build(docs-infra): align config with what cli generates for new apps (#32923)
This is mainly to avoid some warning when building the app, such as: ``` WARNING in .../angular/aio/src/environments/environment.archive.ts is part of the TypeScript compilation but it's unused. Add only entry points to the 'files' or 'include' properties in your tsconfig. ``` (Not turning on `fullTemplateTypeCheck` due to lots of errors.) PR Close #32923
This commit is contained in:
parent
ea9245446f
commit
32b16de8ea
|
@ -7,7 +7,7 @@ const {join, resolve} = require('path');
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const ROOT_DIR = resolve(__dirname, '..');
|
const ROOT_DIR = resolve(__dirname, '..');
|
||||||
const NG_JSON = join(ROOT_DIR, 'angular.json');
|
const TS_CONFIG_PATH = join(ROOT_DIR, 'tsconfig.json');
|
||||||
const NG_COMPILER_OPTS = {
|
const NG_COMPILER_OPTS = {
|
||||||
angularCompilerOptions: {
|
angularCompilerOptions: {
|
||||||
enableIvy: false,
|
enableIvy: false,
|
||||||
|
@ -19,21 +19,17 @@ _main(process.argv.slice(2));
|
||||||
|
|
||||||
// Functions - Definitions
|
// Functions - Definitions
|
||||||
function _main() {
|
function _main() {
|
||||||
// Detect path to `tsconfig.app.json`.
|
|
||||||
const ngConfig = parse(readFileSync(NG_JSON, 'utf8'));
|
|
||||||
const tsConfigPath = join(ROOT_DIR, ngConfig.projects.site.architect.build.options.tsConfig);
|
|
||||||
|
|
||||||
// Enable ViewIngine/Disable Ivy in TS config.
|
// Enable ViewIngine/Disable Ivy in TS config.
|
||||||
console.log(`\nModifying \`${tsConfigPath}\`...`);
|
console.log(`\nModifying \`${TS_CONFIG_PATH}\`...`);
|
||||||
const oldTsConfigStr = readFileSync(tsConfigPath, 'utf8');
|
const oldTsConfigStr = readFileSync(TS_CONFIG_PATH, 'utf8');
|
||||||
const oldTsConfigObj = parse(oldTsConfigStr);
|
const oldTsConfigObj = parse(oldTsConfigStr);
|
||||||
const newTsConfigObj = extend(true, oldTsConfigObj, NG_COMPILER_OPTS);
|
const newTsConfigObj = extend(true, oldTsConfigObj, NG_COMPILER_OPTS);
|
||||||
const newTsConfigStr = `${JSON.stringify(newTsConfigObj, null, 2)}\n`;
|
const newTsConfigStr = `${JSON.stringify(newTsConfigObj, null, 2)}\n`;
|
||||||
console.log(`\nNew config: ${newTsConfigStr}`);
|
console.log(`\nNew config: ${newTsConfigStr}`);
|
||||||
writeFileSync(tsConfigPath, newTsConfigStr);
|
writeFileSync(TS_CONFIG_PATH, newTsConfigStr);
|
||||||
|
|
||||||
// Done.
|
// Done.
|
||||||
console.log('\nReady to build with ViewEngine!');
|
console.log('\nReady to build with ViewEngine!');
|
||||||
console.log('(To switch back to Ivy (with packages from npm), undo the changes in ' +
|
console.log('(To switch back to Ivy (with packages from npm), undo the changes in ' +
|
||||||
`\`${tsConfigPath}\` and run \`yarn aio-use-npm && yarn example-use-npm\`.)`);
|
`\`${TS_CONFIG_PATH}\` and run \`yarn aio-use-npm && yarn example-use-npm\`.)`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,11 @@
|
||||||
"outDir": "./out-tsc/app",
|
"outDir": "./out-tsc/app",
|
||||||
"types": []
|
"types": []
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"src/main.ts",
|
||||||
|
"src/polyfills.ts"
|
||||||
|
],
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts"
|
"src/**/*.d.ts"
|
||||||
],
|
]
|
||||||
"exclude": [
|
|
||||||
"src/test.ts",
|
|
||||||
"src/testing/**/*",
|
|
||||||
"src/**/*.spec.ts",
|
|
||||||
"src/**/*.worker.ts"
|
|
||||||
],
|
|
||||||
"angularCompilerOptions": {
|
|
||||||
"disableTypeScriptVersionCheck": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"emitDecoratorMetadata": true,
|
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"target": "es2015",
|
"target": "es2015",
|
||||||
|
@ -33,4 +32,10 @@
|
||||||
"scripts",
|
"scripts",
|
||||||
"tools"
|
"tools"
|
||||||
],
|
],
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"disableTypeScriptVersionCheck": true,
|
||||||
|
// TODO: Fix template type errors and enable.
|
||||||
|
// "fullTemplateTypeCheck": true,
|
||||||
|
"strictInjectionParameters": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue