mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 10:11:50 +08:00
refactor: rename tsconfig.json to tsconfig.base.json
This commit is contained in:
parent
9423a9e5e1
commit
93e253bc93
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/e2e",
|
||||
"module": "commonjs",
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": []
|
||||
|
25
integration/angular_cli/tsconfig.base.json
Normal file
25
integration/angular_cli/tsconfig.base.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es2015",
|
||||
"module": "es2020",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": true,
|
||||
"disableTypeScriptVersionCheck": true
|
||||
}
|
||||
}
|
@ -1,23 +1,13 @@
|
||||
// This tsConfig file is used by editors and TypeScript’s language server to improve development experience.
|
||||
// Note: This should not be used to perform a compilation.
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "es2020",
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2015",
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true
|
||||
}
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
|
@ -194,7 +194,7 @@ export class VersionCommand extends Command<VersionCommandSchema> {
|
||||
|
||||
private getIvyWorkspace(): string {
|
||||
try {
|
||||
const content = fs.readFileSync(path.resolve(this.workspace.root, 'tsconfig.json'), 'utf-8');
|
||||
const content = fs.readFileSync(path.resolve(this.workspace.root, 'tsconfig.base.json'), 'utf-8');
|
||||
const tsConfig = parseJson(content, JsonParseMode.Loose);
|
||||
if (!isJsonObject(tsConfig)) {
|
||||
return '<error>';
|
||||
|
@ -29,7 +29,7 @@ describe('Browser Builder allow js', () => {
|
||||
});
|
||||
|
||||
host.replaceInFile(
|
||||
'tsconfig.json',
|
||||
'tsconfig.base.json',
|
||||
'"target": "es2015"',
|
||||
'"target": "es5", "allowJs": true',
|
||||
);
|
||||
@ -54,7 +54,7 @@ describe('Browser Builder allow js', () => {
|
||||
});
|
||||
|
||||
host.replaceInFile(
|
||||
'tsconfig.json',
|
||||
'tsconfig.base.json',
|
||||
'"target": "es2015"',
|
||||
'"target": "es5", "allowJs": true',
|
||||
);
|
||||
@ -81,7 +81,7 @@ describe('Browser Builder allow js', () => {
|
||||
});
|
||||
|
||||
host.replaceInFile(
|
||||
'tsconfig.json',
|
||||
'tsconfig.base.json',
|
||||
'"target": "es2015"',
|
||||
'"target": "es5", "allowJs": true',
|
||||
);
|
||||
|
@ -64,7 +64,7 @@ describe('Browser Builder with differential loading', () => {
|
||||
|
||||
it('emits all the neccessary files for target of ES2016', async () => {
|
||||
host.replaceInFile(
|
||||
'tsconfig.json',
|
||||
'tsconfig.base.json',
|
||||
'"target": "es2015",',
|
||||
`"target": "es2016",`,
|
||||
);
|
||||
@ -106,7 +106,7 @@ describe('Browser Builder with differential loading', () => {
|
||||
|
||||
it('emits all the neccessary files for target of ESNext', async () => {
|
||||
host.replaceInFile(
|
||||
'tsconfig.json',
|
||||
'tsconfig.base.json',
|
||||
'"target": "es2015",',
|
||||
`"target": "esnext",`,
|
||||
);
|
||||
|
@ -27,7 +27,7 @@ describe('Browser Builder optimization level', () => {
|
||||
});
|
||||
|
||||
it('tsconfig target changes optimizations to use ES2015', async () => {
|
||||
host.replaceInFile('tsconfig.json', '"target": "es5"', '"target": "es2015"');
|
||||
host.replaceInFile('tsconfig.base.json', '"target": "es5"', '"target": "es2015"');
|
||||
|
||||
const overrides = { optimization: true };
|
||||
const { files } = await browserBuild(architect, host, target, overrides);
|
||||
|
@ -29,7 +29,7 @@ describe('Browser Builder resolve json module', () => {
|
||||
});
|
||||
|
||||
host.replaceInFile(
|
||||
'tsconfig.json',
|
||||
'tsconfig.base.json',
|
||||
'"target": "es2015"',
|
||||
'"target": "es5", "resolveJsonModule": true',
|
||||
);
|
||||
|
@ -22,7 +22,7 @@ describe('Browser Builder tsconfig paths', () => {
|
||||
|
||||
it('works', async () => {
|
||||
host.replaceInFile('src/app/app.module.ts', './app.component', '@root/app/app.component');
|
||||
host.replaceInFile('tsconfig.json', /"baseUrl": ".\/",/, `
|
||||
host.replaceInFile('tsconfig.base.json', /"baseUrl": ".\/",/, `
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@root/*": [
|
||||
@ -40,7 +40,7 @@ describe('Browser Builder tsconfig paths', () => {
|
||||
'src/app/shared/meaning.ts': 'export var meaning = 42;',
|
||||
'src/app/shared/index.ts': `export * from './meaning'`,
|
||||
});
|
||||
host.replaceInFile('tsconfig.json', /"baseUrl": ".\/",/, `
|
||||
host.replaceInFile('tsconfig.base.json', /"baseUrl": ".\/",/, `
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@shared": [
|
||||
|
@ -57,7 +57,7 @@ describe('Browser Builder Web Worker support', () => {
|
||||
// tests, and integration with other build targets.
|
||||
'./src/tsconfig.worker.json': `
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/worker",
|
||||
"lib": [
|
||||
@ -73,7 +73,7 @@ describe('Browser Builder Web Worker support', () => {
|
||||
// Alter the app tsconfig to not include *.worker.ts files.
|
||||
'./src/tsconfig.app.json': `
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/worker",
|
||||
"types": []
|
||||
|
@ -87,7 +87,7 @@ describe('Karma Builder code coverage', () => {
|
||||
|
||||
host.writeMultipleFiles(files);
|
||||
|
||||
host.replaceInFile('tsconfig.json', /"baseUrl": ".\/",/, `
|
||||
host.replaceInFile('tsconfig.base.json', /"baseUrl": ".\/",/, `
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"my-lib": [
|
||||
|
@ -41,7 +41,7 @@ describe('Karma Builder', () => {
|
||||
});
|
||||
|
||||
it('supports ES2015 target', async () => {
|
||||
host.replaceInFile('tsconfig.json', '"target": "es5"', '"target": "es2015"');
|
||||
host.replaceInFile('tsconfig.base.json', '"target": "es5"', '"target": "es2015"');
|
||||
|
||||
const run = await architect.scheduleTarget(karmaTargetSpec);
|
||||
|
||||
|
@ -55,7 +55,7 @@ export async function createArchitect(workspaceRoot: Path) {
|
||||
|
||||
// Set AOT compilation to use VE if needed.
|
||||
if (veEnabled) {
|
||||
host.replaceInFile('tsconfig.json', `"enableIvy": true,`, `"enableIvy": false,`);
|
||||
host.replaceInFile('tsconfig.base.json', `"enableIvy": true,`, `"enableIvy": false,`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/e2e",
|
||||
"module": "commonjs",
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"types": []
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"types": [
|
||||
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es2015",
|
||||
"module": "es2020",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": true,
|
||||
"disableTypeScriptVersionCheck": true
|
||||
}
|
||||
}
|
@ -1,26 +1,19 @@
|
||||
// This tsConfig file is used by editors and TypeScript’s language server to improve development experience.
|
||||
// Note: This should not be used to perform a compilation.
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"preserveSymlinks": true,
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es2015",
|
||||
"module": "es2020",
|
||||
"typeRoots": [
|
||||
"../node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": true,
|
||||
"disableTypeScriptVersionCheck": true
|
||||
}
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./src/tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"path": "./src/tsconfig.spec.json"
|
||||
},
|
||||
{
|
||||
"path": "./src/tsconfig.server.json"
|
||||
},
|
||||
{
|
||||
"path": "./e2e/tsconfig.e2e.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ describe('NgPackagr Builder', () => {
|
||||
|
||||
// Set AOT compilation to use VE if needed.
|
||||
if (veEnabled) {
|
||||
host.replaceInFile('tsconfig.json', `"enableIvy": true,`, `"enableIvy": false,`);
|
||||
host.replaceInFile('tsconfig.base.json', `"enableIvy": true,`, `"enableIvy": false,`);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "es2015",
|
||||
"declaration": true,
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/spec",
|
||||
"types": [
|
||||
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"target": "es2015",
|
||||
"module": "es2020",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": true,
|
||||
"disableTypeScriptVersionCheck": true
|
||||
}
|
||||
}
|
@ -1,24 +1,13 @@
|
||||
// This tsConfig file is used by editors and TypeScript’s language server to improve development experience.
|
||||
// Note: This should not be used to perform a compilation.
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"target": "es2015",
|
||||
"module": "es2020",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": true,
|
||||
"disableTypeScriptVersionCheck": true
|
||||
}
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./projects/lib/tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "./projects/lib/tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"target": "es2015",
|
||||
"module": "esnext",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"disableTypeScriptVersionCheck": true
|
||||
}
|
||||
}
|
@ -38,6 +38,7 @@ import { findPropertyInAstObject, insertPropertyInAstObjectInOrder } from '../ut
|
||||
import { latestVersions } from '../utility/latest-versions';
|
||||
import { applyLintFix } from '../utility/lint-fix';
|
||||
import { relativePathToWorkspaceRoot } from '../utility/paths';
|
||||
import { addTsConfigProjectReferences, verifyBaseTsConfigExists } from '../utility/tsconfig';
|
||||
import { validateProjectName } from '../utility/validation';
|
||||
import { getWorkspace, updateWorkspace } from '../utility/workspace';
|
||||
import { Builders, ProjectType } from '../utility/workspace-models';
|
||||
@ -311,7 +312,6 @@ function addAppToWorkspaceFile(options: ApplicationOptions, appDir: string): Rul
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function minimalPathFilter(path: string): boolean {
|
||||
const toRemoveList = /(test.ts|tsconfig.spec.json|karma.conf.js|tslint.json).template$/;
|
||||
|
||||
@ -319,11 +319,14 @@ function minimalPathFilter(path: string): boolean {
|
||||
}
|
||||
|
||||
export default function (options: ApplicationOptions): Rule {
|
||||
return async (host: Tree, context: SchematicContext) => {
|
||||
return async (host: Tree) => {
|
||||
if (!options.name) {
|
||||
throw new SchematicsException(`Invalid options, "name" is required.`);
|
||||
}
|
||||
|
||||
validateProjectName(options.name);
|
||||
verifyBaseTsConfigExists(host);
|
||||
|
||||
const appRootSelector = `${options.prefix}-root`;
|
||||
const componentOptions: Partial<ComponentOptions> = !options.minimal ?
|
||||
{
|
||||
@ -344,7 +347,7 @@ export default function (options: ApplicationOptions): Rule {
|
||||
const newProjectRoot = workspace.extensions.newProjectRoot as (string | undefined) || '';
|
||||
const isRootApp = options.projectRoot !== undefined;
|
||||
const appDir = isRootApp
|
||||
? options.projectRoot as string
|
||||
? normalize(options.projectRoot || '')
|
||||
: join(normalize(newProjectRoot), options.name);
|
||||
const sourceDir = `${appDir}/src/app`;
|
||||
|
||||
@ -402,6 +405,10 @@ export default function (options: ApplicationOptions): Rule {
|
||||
}),
|
||||
move(sourceDir),
|
||||
]), MergeStrategy.Overwrite),
|
||||
addTsConfigProjectReferences([
|
||||
join(appDir, 'tsconfig.app.json'),
|
||||
join(appDir, 'tsconfig.spec.json'),
|
||||
]),
|
||||
options.minimal ? noop() : schematic('e2e', e2eOptions),
|
||||
options.skipPackageJson ? noop() : addDependenciesToPackageJson(options),
|
||||
options.lintFix ? applyLintFix(appDir) : noop(),
|
||||
|
@ -6,6 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
// tslint:disable:no-big-function
|
||||
import { JsonParseMode, parseJson } from '@angular-devkit/core';
|
||||
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
||||
import { latestVersions } from '../utility/latest-versions';
|
||||
import { getFileContent } from '../utility/test';
|
||||
@ -74,6 +75,19 @@ describe('Application Schematic', () => {
|
||||
expect(workspace.defaultProject).toBe('foo');
|
||||
});
|
||||
|
||||
it('should add references in solution style tsconfig', async () => {
|
||||
const tree = await schematicRunner.runSchematicAsync('application', defaultOptions, workspaceTree)
|
||||
.toPromise();
|
||||
|
||||
// tslint:disable-next-line:no-any
|
||||
const { references } = parseJson(tree.readContent('/tsconfig.json').toString(), JsonParseMode.Loose) as any;
|
||||
expect(references).toEqual([
|
||||
{ path: './projects/foo/tsconfig.app.json' },
|
||||
{ path: './projects/foo/tsconfig.spec.json' },
|
||||
{ path: './projects/foo/e2e/tsconfig.json' },
|
||||
]);
|
||||
});
|
||||
|
||||
it('should set the prefix to app if none is set', async () => {
|
||||
const options = { ...defaultOptions };
|
||||
|
||||
@ -138,10 +152,10 @@ describe('Application Schematic', () => {
|
||||
.toPromise();
|
||||
let path = '/projects/foo/tsconfig.app.json';
|
||||
let content = tree.readContent(path);
|
||||
expect(content).toMatch('../../tsconfig.json');
|
||||
expect(content).toMatch('../../tsconfig.base.json');
|
||||
path = '/projects/foo/tsconfig.spec.json';
|
||||
content = tree.readContent(path);
|
||||
expect(content).toMatch('../../tsconfig.json');
|
||||
expect(content).toMatch('../../tsconfig.base.json');
|
||||
const specTsConfig = JSON.parse(content);
|
||||
expect(specTsConfig.files).toEqual(['src/test.ts', 'src/polyfills.ts']);
|
||||
});
|
||||
@ -371,9 +385,9 @@ describe('Application Schematic', () => {
|
||||
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
|
||||
.toPromise();
|
||||
const appTsConfig = JSON.parse(tree.readContent('/tsconfig.app.json'));
|
||||
expect(appTsConfig.extends).toEqual('./tsconfig.json');
|
||||
expect(appTsConfig.extends).toEqual('./tsconfig.base.json');
|
||||
const specTsConfig = JSON.parse(tree.readContent('/tsconfig.spec.json'));
|
||||
expect(specTsConfig.extends).toEqual('./tsconfig.json');
|
||||
expect(specTsConfig.extends).toEqual('./tsconfig.base.json');
|
||||
expect(specTsConfig.files).toEqual(['src/test.ts', 'src/polyfills.ts']);
|
||||
});
|
||||
|
||||
@ -414,9 +428,9 @@ describe('Application Schematic', () => {
|
||||
expect(buildOpt.tsConfig).toEqual('foo/tsconfig.app.json');
|
||||
|
||||
const appTsConfig = JSON.parse(tree.readContent('/foo/tsconfig.app.json'));
|
||||
expect(appTsConfig.extends).toEqual('../tsconfig.json');
|
||||
expect(appTsConfig.extends).toEqual('../tsconfig.base.json');
|
||||
const specTsConfig = JSON.parse(tree.readContent('/foo/tsconfig.spec.json'));
|
||||
expect(specTsConfig.extends).toEqual('../tsconfig.json');
|
||||
expect(specTsConfig.extends).toEqual('../tsconfig.base.json');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "./<%= tsConfigExtends %>",
|
||||
"compilerOptions": {
|
||||
"outDir": "<%= outDir %>-server",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/<%= stripTsExtension(main) %>.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"entryModule": "./<%= rootInSrc ? '' : 'src/' %><%= appDir %>/<%= stripTsExtension(rootModuleFileName) %>#<%= rootModuleClassName %>"
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ export default async function() {
|
||||
await ng('e2e', '--prod');
|
||||
|
||||
// View Engine (NGC) compilation should work after running NGCC from Webpack
|
||||
await updateJsonFile('tsconfig.json', config => {
|
||||
await updateJsonFile('tsconfig.base.json', config => {
|
||||
const { angularCompilerOptions = {} } = config;
|
||||
angularCompilerOptions.enableIvy = false;
|
||||
config.angularCompilerOptions = angularCompilerOptions;
|
||||
|
@ -20,7 +20,7 @@ export async function executeTest() {
|
||||
'IE 9-11',
|
||||
);
|
||||
|
||||
await updateJsonFile('tsconfig.json', config => {
|
||||
await updateJsonFile('tsconfig.base.json', config => {
|
||||
config.compilerOptions.target = 'es2015';
|
||||
if (!config.angularCompilerOptions) {
|
||||
config.angularCompilerOptions = {};
|
||||
|
@ -10,7 +10,7 @@ export default async function() {
|
||||
|
||||
// Ensure a ES2015 build is used.
|
||||
await writeFile('.browserslistrc', 'Chrome 65');
|
||||
await updateJsonFile('tsconfig.json', config => {
|
||||
await updateJsonFile('tsconfig.base.json', config => {
|
||||
config.compilerOptions.target = 'es2015';
|
||||
if (!config.angularCompilerOptions) {
|
||||
config.angularCompilerOptions = {};
|
||||
|
@ -9,7 +9,7 @@ export default async function() {
|
||||
await setupI18nConfig();
|
||||
|
||||
// Ensure a es5 build is used.
|
||||
await updateJsonFile('tsconfig.json', config => {
|
||||
await updateJsonFile('tsconfig.base.json', config => {
|
||||
config.compilerOptions.target = 'es5';
|
||||
if (!config.angularCompilerOptions) {
|
||||
config.angularCompilerOptions = {};
|
||||
|
@ -32,7 +32,7 @@ export default async function() {
|
||||
}
|
||||
await npm('install', `${serviceWorkerVersion}`);
|
||||
|
||||
await updateJsonFile('tsconfig.json', config => {
|
||||
await updateJsonFile('tsconfig.base.json', config => {
|
||||
config.compilerOptions.target = 'es2015';
|
||||
if (!config.angularCompilerOptions) {
|
||||
config.angularCompilerOptions = {};
|
||||
|
@ -23,7 +23,7 @@ export default async function() {
|
||||
|
||||
// Ensure a ES2015 build is used.
|
||||
await writeFile('.browserslistrc', 'Chrome 65');
|
||||
await updateJsonFile('tsconfig.json', config => {
|
||||
await updateJsonFile('tsconfig.base.json', config => {
|
||||
config.compilerOptions.target = 'es2015';
|
||||
if (!config.angularCompilerOptions) {
|
||||
config.angularCompilerOptions = {};
|
||||
|
@ -4,7 +4,7 @@ import { ng } from '../../utils/process';
|
||||
import { updateJsonFile } from '../../utils/project';
|
||||
|
||||
export default async function () {
|
||||
await updateJsonFile('tsconfig.json', configJson => {
|
||||
await updateJsonFile('tsconfig.base.json', configJson => {
|
||||
const compilerOptions = configJson['compilerOptions'];
|
||||
compilerOptions['target'] = 'es5';
|
||||
});
|
||||
|
@ -5,7 +5,7 @@ import { expectToFail } from '../../utils/utils';
|
||||
|
||||
|
||||
export default async function () {
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.paths = {
|
||||
'*': ['./node_modules/*'],
|
||||
};
|
||||
@ -20,14 +20,14 @@ export default async function () {
|
||||
|
||||
await expectToFail(() => ng('build'));
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.paths = {
|
||||
'@angular/common': [ './xyz/common' ],
|
||||
};
|
||||
});
|
||||
await ng('build');
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.paths = {
|
||||
'*': ['./node_modules/*'],
|
||||
'@angular/common': [ './xyz/common' ],
|
||||
@ -35,7 +35,7 @@ export default async function () {
|
||||
});
|
||||
await ng('build');
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.paths = {
|
||||
'@angular/common': [ './xyz/common' ],
|
||||
'*': ['./node_modules/*'],
|
||||
@ -43,7 +43,7 @@ export default async function () {
|
||||
});
|
||||
await ng('build');
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
delete tsconfig.compilerOptions.paths;
|
||||
});
|
||||
|
||||
@ -58,12 +58,12 @@ export default async function () {
|
||||
await ng('build', '--aot');
|
||||
await ng('test', '--watch=false');
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.paths = {};
|
||||
});
|
||||
await ng('build');
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.paths = {
|
||||
'@app/*': ['*'],
|
||||
'@lib/*/test': ['*/test'],
|
||||
@ -71,14 +71,14 @@ export default async function () {
|
||||
});
|
||||
await ng('build');
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.paths = {
|
||||
'@firebase/polyfill': ['./node_modules/@firebase/polyfill/index.ts'],
|
||||
};
|
||||
});
|
||||
await expectToFail(() => ng('build'));
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.paths = {
|
||||
'@firebase/polyfill*': ['./node_modules/@firebase/polyfill/index.ts'],
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ import { ng } from '../../utils/process';
|
||||
import { updateJsonFile } from '../../utils/project';
|
||||
|
||||
export default async function () {
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.traceResolution = true;
|
||||
});
|
||||
|
||||
@ -11,7 +11,7 @@ export default async function () {
|
||||
throw new Error(`Modules resolutions must be printed when 'traceResolution' is enabled.`);
|
||||
}
|
||||
|
||||
await updateJsonFile('tsconfig.json', tsconfig => {
|
||||
await updateJsonFile('tsconfig.base.json', tsconfig => {
|
||||
tsconfig.compilerOptions.traceResolution = false;
|
||||
});
|
||||
|
||||
|
@ -28,7 +28,7 @@ export default async function() {
|
||||
await writeMultipleFiles({
|
||||
'./tsconfig.server.json': `
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../dist-server",
|
||||
"baseUrl": "./",
|
||||
|
@ -6,7 +6,7 @@ export default function () {
|
||||
// TypeError: Assignment to constant variable.
|
||||
return;
|
||||
|
||||
return updateJsonFile('tsconfig.json', configJson => {
|
||||
return updateJsonFile('tsconfig.base.json', configJson => {
|
||||
const compilerOptions = configJson['compilerOptions'];
|
||||
compilerOptions['target'] = 'es2015';
|
||||
})
|
||||
|
@ -28,8 +28,7 @@ export default async function() {
|
||||
'src/app/app-routing.module.ts',
|
||||
`loadChildren: () => import('./lazy/lazy.module').then(m => m.LazyModule)`,
|
||||
);
|
||||
// Should update tsconfig and src/browserslist via differential-loading.
|
||||
await expectFileToMatch('tsconfig.json', `"target": "es2015",`);
|
||||
|
||||
await expectToFail(() => expectFileToExist('e2e/browserlist'));
|
||||
// Should rename codelyzer rules.
|
||||
await expectFileToMatch('tslint.json', `use-lifecycle-interface`);
|
||||
|
@ -39,10 +39,10 @@ export async function createProject(name: string, ...args: string[]) {
|
||||
await ng('new', name, '--skip-install', ...extraArgs, ...args);
|
||||
process.chdir(name);
|
||||
|
||||
if (fs.existsSync('tsconfig.json')) {
|
||||
if (fs.existsSync('tsconfig.base.json')) {
|
||||
// Disable the TS version check to make TS updates easier.
|
||||
// Only VE does it, but on Ivy the i18n extraction uses VE.
|
||||
await updateJsonFile('tsconfig.json', config => {
|
||||
await updateJsonFile('tsconfig.base.json', config => {
|
||||
if (!config.angularCompilerOptions) {
|
||||
config.angularCompilerOptions = {};
|
||||
}
|
||||
@ -101,7 +101,7 @@ export async function prepareProjectForE2e(name) {
|
||||
);
|
||||
// Force sourcemaps to be from the root of the filesystem.
|
||||
await updateJsonFile(
|
||||
'tsconfig.json',
|
||||
'tsconfig.base.json',
|
||||
json => {
|
||||
json[
|
||||
'compilerOptions'
|
||||
|
Loading…
x
Reference in New Issue
Block a user