Skip to content

Commit bbdcced

Browse files
feat(qwik-nx): ensure tsconfig.base.json exists in a package-based repo (#92)
1 parent ca6b313 commit bbdcced

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

packages/qwik-nx/src/generators/application/generator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { NormalizedSchema, QwikAppGeneratorSchema } from './schema';
2020
import { getQwikApplicationProjectTargets } from './utils/get-qwik-application-project-params';
2121
import { normalizeOptions } from './utils/normalize-options';
2222
import { addE2eProject } from '../e2e-project/generator';
23+
import { ensureTsConfigBaseExists } from '../../utils/ensure-tsconfig-base-exists';
2324

2425
function addFiles(tree: Tree, options: NormalizedSchema) {
2526
const templateOptions = {
@@ -49,6 +50,8 @@ export async function appGenerator(
4950
delete targets['test'];
5051
}
5152

53+
ensureTsConfigBaseExists(tree);
54+
5255
addProjectConfiguration(tree, normalizedOptions.projectName, {
5356
root: normalizedOptions.projectRoot,
5457
name: normalizedOptions.projectName,

packages/qwik-nx/src/generators/library/generator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { configureEslint } from '../../utils/configure-eslint';
2020
import { initGenerator } from '@nrwl/vite';
2121
import { addCommonQwikDependencies } from '../../utils/add-common-qwik-dependencies';
2222
import { getQwikLibProjectTargets } from './utils/get-qwik-lib-project-params';
23+
import { ensureTsConfigBaseExists } from '../../utils/ensure-tsconfig-base-exists';
2324

2425
interface NormalizedSchema extends LibraryGeneratorSchema {
2526
projectName: string;
@@ -62,6 +63,8 @@ export async function libraryGenerator(
6263
const options = normalizeOptions(tree, schema);
6364
const tasks: GeneratorCallback[] = [];
6465

66+
ensureTsConfigBaseExists(tree);
67+
6568
tasks.push(await addLibrary(tree, options));
6669

6770
tasks.push(await configureVite(tree, options));
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Tree } from '@nrwl/devkit';
2+
3+
export function ensureTsConfigBaseExists(tree: Tree) {
4+
if (!tree.exists('tsconfig.base.json')) {
5+
tree.write('tsconfig.base.json', getBasicTsConfig());
6+
}
7+
}
8+
9+
function getBasicTsConfig(): string {
10+
return JSON.stringify({
11+
compileOnSave: false,
12+
compilerOptions: {
13+
rootDir: '.',
14+
sourceMap: true,
15+
declaration: false,
16+
moduleResolution: 'node',
17+
emitDecoratorMetadata: true,
18+
experimentalDecorators: true,
19+
importHelpers: true,
20+
target: 'es2015',
21+
module: 'esnext',
22+
lib: ['es2017', 'dom'],
23+
skipLibCheck: true,
24+
skipDefaultLibCheck: true,
25+
baseUrl: '.',
26+
paths: {},
27+
},
28+
exclude: ['node_modules', 'tmp'],
29+
});
30+
}

0 commit comments

Comments
 (0)