Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: angular/angular-cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v10.0.0
Choose a base ref
...
head repository: angular/angular-cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.0.1
Choose a head ref
  • 16 commits
  • 35 files changed
  • 3 contributors

Commits on Jun 24, 2020

  1. ci: fix dedupe-duplicate-modules flakes

    Following #17973, which we emitted the stderr when this test failed on CI.
    
    We see that the resolved module order sometimes changes, which is totally fine because of the async nature of the operation.
    
    https://circleci.com/gh/angular/angular-cli/167318#tests/containers/5
    ```
    [DedupeModuleResolvePlugin]: /tmp/angular-cli-e2e-i03vMQ/test-project/node_modules/tslib-1 -> /tmp/angular-cli-e2e-i03vMQ/test-project/node_modules/tslib-1-copy
    ```
    
    With this change we handle both cases which should eliminate the flakes
    
    (cherry picked from commit bf599e4)
    alan-agius4 authored and Keen Yee Liau committed Jun 24, 2020
    Copy the full SHA
    ee8bbe1 View commit details

Commits on Jun 25, 2020

  1. ci: fix saucelabs unsupported OS/browser/version/device combo

    ```
    UnsupportedOperationError: Misconfigured -- Unsupported OS/browser/version/device combo: OS: 'Mac 10.15', Browser: 'safari', Version: '13.0.', Device: 'unspecified'
    ```
    alan-agius4 authored and filipesilva committed Jun 25, 2020
    Copy the full SHA
    2d65a49 View commit details

Commits on Jun 26, 2020

  1. fix(@schematics/angular): don't error out on blank JSON files during …

    …migrations
    
    During the solution-style-tsconfig migration we are unexpectedly erroring out when encounter a blank JSON file. This PR fixes this behaviour and also prints the file path when an error occurs when parsing JSON contents.
    
    Closes: #18012
    alan-agius4 authored and filipesilva committed Jun 26, 2020
    Copy the full SHA
    dc8d8e0 View commit details

Commits on Jun 29, 2020

  1. Copy the full SHA
    52b02c6 View commit details
  2. fix(@angular-devkit/build-angular): don't dedupe modules without a na…

    …me or version
    
    We should not try to dedupe secondary entrypoints, or modules which don't have a name and a version.
    
    Closes #17967
    alan-agius4 authored and filipesilva committed Jun 29, 2020
    Copy the full SHA
    95c08e7 View commit details
  3. Copy the full SHA
    68a3b1e View commit details

Commits on Jun 30, 2020

  1. test: remove eval sourcemap tests

    The eval sourcemap functionality has been removed in v10
    alan-agius4 authored and filipesilva committed Jun 30, 2020
    Copy the full SHA
    d24a239 View commit details
  2. fix(@schematics/schematics): replaced removed runner.runSchematic w…

    …ith `runner.runSchematicAsync`
    
    Deprecated `runSchematic` has been removed in version 10, `runSchematicAsync` should be used instead.
    
    Closes #18062
    alan-agius4 authored and filipesilva committed Jun 30, 2020
    Copy the full SHA
    c402c31 View commit details
  3. fix(@schematics/angular): split browserslist IE entries and provide b…

    …etter comments
    
    Closes #18032
    alan-agius4 authored and filipesilva committed Jun 30, 2020
    Copy the full SHA
    4e99531 View commit details

Commits on Jul 1, 2020

  1. fix(@angular-devkit/build-angular): update copy-webpack-plugin to 6.0.3

    Prior versions of copy-webpack-plugin 6.x contained a memory usage regression that could cause gigabytes of memory to be used during a build.  Version 6.0.3 contains a fix that prevents this issue.
    Referenced Issue: webpack-contrib/copy-webpack-plugin#505
    
    (cherry picked from commit 23ae457)
    clydin authored and filipesilva committed Jul 1, 2020
    Copy the full SHA
    766cb06 View commit details
  2. fix(@angular-devkit/build-angular): use copy-on-write asset processin…

    …g for non-watch builds
    
    Optimized asset processing was only being performed when differential loading was enabled.  This change ensures that the optimized approach is used for non-watch builds.  This does not affect `ng serve` usage since it currently requires all application files to be in memory.
    
    (cherry picked from commit 3c734a8)
    clydin authored and filipesilva committed Jul 1, 2020
    Copy the full SHA
    f22efa1 View commit details
  3. fix(@angular-devkit/build-angular): match allowed dependencies agains…

    …t the package name
    
    With this change we add the functionality to also match an allowed dependency against a package name. The package name is retrieved from the rawRequest.
    
    Previously, users needed to add the request path which in some case might be a deep import. Ex: `zone.js/dist/zone-error`. With this change adding the package name example `zone.js` will suffice.
    
    Closes: #18058
    alan-agius4 authored and filipesilva committed Jul 1, 2020
    Copy the full SHA
    d74b7c9 View commit details
  4. fix(@angular-devkit/build-angular): show warning when using non globa…

    …l locale data
    
    When using the `localize` option directly importing locale data from `@angular/common` is not needed because the Angular CLI  will automatically include locale data. When not using the `localize` option, most likely users meant to import the global variant of the local data.
    
    See: https://angular.io/guide/i18n#import-global-variants-of-the-locale-data
    alan-agius4 authored and filipesilva committed Jul 1, 2020
    Copy the full SHA
    68ed9ab View commit details
  5. Copy the full SHA
    c9f5304 View commit details
  6. fix(@angular/cli): resolve external schematics from workspace root

    Resolve schematics collections from the workspace root, as otherwise it will be resolved from the temporary installed CLI version
    
    Closes #18083
    alan-agius4 authored and mgechev committed Jul 1, 2020
    Copy the full SHA
    f51cde7 View commit details
  7. release: v10.0.1

    mgechev committed Jul 1, 2020
    Copy the full SHA
    e98cacc View commit details
Showing with 331 additions and 153 deletions.
  1. +1 −1 package.json
  2. +3 −1 packages/angular/cli/commands/update-impl.ts
  3. +1 −1 packages/angular_devkit/build_angular/package.json
  4. +1 −1 packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts
  5. +26 −10 packages/angular_devkit/build_angular/src/angular-cli-files/plugins/common-js-usage-warn-plugin.ts
  6. +15 −2 packages/angular_devkit/build_angular/src/angular-cli-files/plugins/dedupe-module-resolve-plugin.ts
  7. +41 −22 packages/angular_devkit/build_angular/src/browser/index.ts
  8. +29 −4 packages/angular_devkit/build_angular/src/browser/specs/common-js-warning_spec.ts
  9. +4 −2 packages/schematics/angular/application/files/.browserslistrc.template
  10. +7 −3 packages/schematics/angular/application/index_spec.ts
  11. +5 −5 packages/schematics/angular/migrations/migration-collection.json
  12. +10 −3 packages/schematics/angular/migrations/update-10/solution-style-tsconfig.ts
  13. +6 −0 packages/schematics/angular/migrations/update-10/solution-style-tsconfig_spec.ts
  14. +1 −1 packages/schematics/angular/migrations/update-10/update-module-and-target-compiler-options.ts
  15. +5 −5 packages/schematics/angular/migrations/update-10/update-module-and-target-compiler-options_spec.ts
  16. +4 −4 packages/schematics/angular/utility/latest-versions.ts
  17. +2 −2 packages/schematics/schematics/blank/schematic-files/src/__name@dasherize__/index_spec.ts.template
  18. +3 −3 packages/schematics/schematics/schematic/files/src/my-full-schematic/index_spec.ts
  19. +2 −2 packages/schematics/schematics/schematic/files/src/my-other-schematic/index_spec.ts
  20. +2 −2 packages/schematics/schematics/schematic/files/src/my-schematic/index_spec.ts
  21. +1 −1 tests/legacy-cli/e2e/assets/protractor-saucelabs.conf.js
  22. +2 −2 tests/legacy-cli/e2e/tests/build/differential-cache.ts
  23. +2 −2 tests/legacy-cli/e2e/tests/build/differential-loading.ts
  24. +0 −21 tests/legacy-cli/e2e/tests/build/eval-sourcemap.ts
  25. +2 −2 tests/legacy-cli/e2e/tests/build/polyfills.ts
  26. +2 −2 tests/legacy-cli/e2e/tests/build/prod-build.ts
  27. +2 −2 tests/legacy-cli/e2e/tests/build/sourcemap.ts
  28. +2 −2 tests/legacy-cli/e2e/tests/build/worker.ts
  29. +2 −2 tests/legacy-cli/e2e/tests/i18n/ivy-localize-dl-xliff2.ts
  30. +2 −2 tests/legacy-cli/e2e/tests/misc/browsers.ts
  31. +24 −18 tests/legacy-cli/e2e/tests/misc/dedupe-duplicate-modules.ts
  32. +17 −11 tests/legacy-cli/e2e/tests/schematics_cli/basic.ts
  33. +37 −0 tests/legacy-cli/e2e/tests/schematics_cli/blank-test.ts
  34. +37 −0 tests/legacy-cli/e2e/tests/schematics_cli/schematic-test.ts
  35. +31 −12 yarn.lock
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@
"common-tags": "^1.8.0",
"conventional-changelog": "^3.0.0",
"conventional-commits-parser": "^3.0.0",
"copy-webpack-plugin": "6.0.2",
"copy-webpack-plugin": "6.0.3",
"core-js": "3.6.4",
"css-loader": "3.5.2",
"cssnano": "4.1.10",
4 changes: 3 additions & 1 deletion packages/angular/cli/commands/update-impl.ts
Original file line number Diff line number Diff line change
@@ -667,7 +667,9 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
for (const migration of migrations) {
const result = await this.executeMigrations(
migration.package,
migration.collection,
// Resolve the collection from the workspace root, as otherwise it will be resolved from the temp
// installed CLI version.
require.resolve(migration.collection, { paths: [this.workspace.root] }),
new semver.Range('>' + migration.from + ' <=' + migration.to),
options.createCommits,
);
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
"cacache": "15.0.3",
"caniuse-lite": "^1.0.30001032",
"circular-dependency-plugin": "5.2.0",
"copy-webpack-plugin": "6.0.2",
"copy-webpack-plugin": "6.0.3",
"core-js": "3.6.4",
"css-loader": "3.5.3",
"cssnano": "4.1.10",
Original file line number Diff line number Diff line change
@@ -308,7 +308,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
new (class {
apply(compiler: Compiler) {
compiler.hooks.emit.tap('angular-cli-stats', compilation => {
const data = JSON.stringify(compilation.getStats().toJson('verbose'));
const data = JSON.stringify(compilation.getStats().toJson('verbose'), undefined, 2);
compilation.assets['stats.json'] = new RawSource(data);
});
}
Original file line number Diff line number Diff line change
@@ -34,14 +34,10 @@ export class CommonJsUsageWarnPlugin {
// Allow the below depedency for HMR
// tslint:disable-next-line: max-line-length
// https://github.com/angular/angular-cli/blob/1e258317b1f6ec1e957ee3559cc3b28ba602f3ba/packages/angular_devkit/build_angular/src/dev-server/index.ts#L605-L638
private allowedDepedencies = [
'webpack/hot/dev-server',
];
private allowedDepedencies = new Set<string>(['webpack/hot/dev-server']);

constructor(private options: CommonJsUsageWarnPluginOptions = {}) {
if (this.options.allowedDepedencies) {
this.allowedDepedencies.push(...this.options.allowedDepedencies);
}
this.options.allowedDepedencies?.forEach(d => this.allowedDepedencies.add(d));
}

apply(compiler: Compiler) {
@@ -57,7 +53,10 @@ export class CommonJsUsageWarnPlugin {
continue;
}

if (this.allowedDepedencies?.includes(rawRequest)) {
if (
this.allowedDepedencies.has(rawRequest) ||
this.allowedDepedencies.has(this.rawRequestToPackageName(rawRequest))
) {
// Skip as this module is allowed even if it's a CommonJS.
continue;
}
@@ -67,7 +66,8 @@ export class CommonJsUsageWarnPlugin {

// Check if it's parent issuer is also a CommonJS dependency.
// In case it is skip as an warning will be show for the parent CommonJS dependency.
if (this.hasCommonJsDependencies(issuer?.issuer?.dependencies ?? [])) {
const parentDependencies = issuer?.issuer?.dependencies;
if (parentDependencies && this.hasCommonJsDependencies(parentDependencies)) {
continue;
}

@@ -81,8 +81,16 @@ export class CommonJsUsageWarnPlugin {
// And if the issuer request is not from 'webpack-dev-server', as 'webpack-dev-server'
// will require CommonJS libraries for live reloading such as 'sockjs-node'.
if (mainIssuer?.name === 'main' && !issuer?.userRequest?.includes('webpack-dev-server')) {
const warning = `${issuer?.userRequest} depends on ${rawRequest}. CommonJS or AMD dependencies can cause optimization bailouts.\n` +
'For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies';
let warning = `${issuer?.userRequest} depends on '${rawRequest}'.`;

if (rawRequest.startsWith('@angular/common/locales')) {
warning += `\nWhen using the 'localize' option this import is not needed. ` +
`Did you mean to import '${rawRequest.replace(/locales(\/extra)?\//, 'locales/global/')}'?\n` +
'For more info see: https://angular.io/guide/i18n#import-global-variants-of-the-locale-data';
} else {
warning += ' CommonJS or AMD dependencies can cause optimization bailouts.\n' +
'For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies';
}

// Avoid showing the same warning multiple times when in 'watch' mode.
if (!this.shownWarnings.has(warning)) {
@@ -100,4 +108,12 @@ export class CommonJsUsageWarnPlugin {
return dependencies.some(d => d instanceof CommonJsRequireDependency || d instanceof AMDDefineDependency);
}

private rawRequestToPackageName(rawRequest: string): string {
return rawRequest.startsWith('@')
// Scoped request ex: @angular/common/locale/en -> @angular/common
? rawRequest.split('/', 2).join('/')
// Non-scoped request ex: lodash/isEmpty -> lodash
: rawRequest.split('/', 1)[0];
}

}
Original file line number Diff line number Diff line change
@@ -14,11 +14,13 @@ interface NormalModuleFactoryRequest {
relativePath: string;
path: string;
descriptionFileData: {
name: string;
version: string;
name?: string;
version?: string;
};
descriptionFileRoot: string;
descriptionFilePath: string;
directory?: boolean;
file?: boolean;
}

export interface DedupeModuleResolvePluginOptions {
@@ -45,6 +47,17 @@ export class DedupeModuleResolvePlugin {
return;
}

// When either of these properties is undefined. It typically means it's a link.
// In which case we shouldn't try to dedupe it.
if (request.file === undefined || request.directory === undefined) {
return;
}

// Empty name or versions are no valid primary entrypoints of a library
if (!request.descriptionFileData.name || !request.descriptionFileData.version) {
return;
}

const moduleId = request.descriptionFileData.name + '@' + request.descriptionFileData.version;
const prevResolvedModule = this.modules.get(moduleId);

63 changes: 41 additions & 22 deletions packages/angular_devkit/build_angular/src/browser/index.ts
Original file line number Diff line number Diff line change
@@ -201,12 +201,31 @@ async function initialize(
i18n: I18nOptions;
}> {
const originalOutputPath = options.outputPath;

// Assets are processed directly by the builder except when watching
const adjustedOptions = options.watch ? options : { ...options, assets: [] };

const {
config,
projectRoot,
projectSourceRoot,
i18n,
} = await buildBrowserWebpackConfigFromContext(options, context, host, true);
} = await buildBrowserWebpackConfigFromContext(adjustedOptions, context, host, true);

// Validate asset option values if processed directly
if (options.assets?.length && !adjustedOptions.assets?.length) {
normalizeAssetPatterns(
options.assets,
new virtualFs.SyncDelegateHost(host),
normalize(context.workspaceRoot),
normalize(projectRoot),
projectSourceRoot === undefined ? undefined : normalize(projectSourceRoot),
).forEach(({ output }) => {
if (output.startsWith('..')) {
throw new Error('An asset cannot be written to a location outside of the output path.');
}
});
}

let transformedConfig;
if (webpackConfigurationTransform) {
@@ -573,27 +592,6 @@ export function buildWebpackBrowser(
executor.stop();
}

// Copy assets
if (options.assets) {
try {
await copyAssets(
normalizeAssetPatterns(
options.assets,
new virtualFs.SyncDelegateHost(host),
root,
normalize(projectRoot),
projectSourceRoot === undefined ? undefined : normalize(projectSourceRoot),
),
Array.from(outputPaths.values()),
context.workspaceRoot,
);
} catch (err) {
context.logger.error('Unable to copy assets: ' + err.message);

return { success: false };
}
}

type ArrayElement<A> = A extends ReadonlyArray<infer T> ? T : never;
function generateBundleInfoStats(
id: string | number,
@@ -698,6 +696,27 @@ export function buildWebpackBrowser(
}
}

// Copy assets
if (!options.watch && options.assets) {
try {
await copyAssets(
normalizeAssetPatterns(
options.assets,
new virtualFs.SyncDelegateHost(host),
root,
normalize(projectRoot),
projectSourceRoot === undefined ? undefined : normalize(projectSourceRoot),
),
Array.from(outputPaths.values()),
context.workspaceRoot,
);
} catch (err) {
context.logger.error('Unable to copy assets: ' + err.message);

return { success: false };
}
}

if (options.index) {
for (const [locale, outputPath] of outputPaths.entries()) {
let localeBaseHref;
Original file line number Diff line number Diff line change
@@ -20,9 +20,6 @@ describe('Browser Builder commonjs warning', () => {
await host.initialize().toPromise();
architect = (await createArchitect(host.root())).architect;

// Add a Common JS dependency
host.appendToFile('src/app/app.component.ts', `import 'bootstrap';`);

// Create logger
logger = new logging.Logger('');
logs = [];
@@ -32,19 +29,31 @@ describe('Browser Builder commonjs warning', () => {
afterEach(async () => host.restore().toPromise());

it('should show warning when depending on a Common JS bundle', async () => {
// Add a Common JS dependency
host.appendToFile('src/app/app.component.ts', `
import 'bootstrap';
`);

const run = await architect.scheduleTarget(targetSpec, undefined, { logger });
const output = await run.result;
expect(output.success).toBe(true);
const logMsg = logs.join();
expect(logMsg).toMatch(/WARNING in.+app\.component\.ts depends on bootstrap\. CommonJS or AMD dependencies/);
expect(logMsg).toMatch(/WARNING in.+app\.component\.ts depends on 'bootstrap'\. CommonJS or AMD dependencies/);
expect(logMsg).not.toContain('jquery', 'Should not warn on transitive CommonJS packages which parent is also CommonJS.');
await run.stop();
});

it('should not show warning when depending on a Common JS bundle which is allowed', async () => {
// Add a Common JS dependency
host.appendToFile('src/app/app.component.ts', `
import 'bootstrap';
import 'zone.js/dist/zone-error';
`);

const overrides = {
allowedCommonJsDependencies: [
'bootstrap',
'zone.js',
],
};

@@ -54,4 +63,20 @@ describe('Browser Builder commonjs warning', () => {
expect(logs.join()).not.toContain('WARNING');
await run.stop();
});

it(`should show warning when importing non global '@angular/common/locale' data`, async () => {
// Add a Common JS dependency
host.appendToFile('src/app/app.component.ts', `
import '@angular/common/locales/fr';
`);

const run = await architect.scheduleTarget(targetSpec, undefined, { logger });
const output = await run.result;
expect(output.success).toBe(true);

const logMsg = logs.join();
expect(logMsg).toMatch(/WARNING in.+app\.component\.ts depends on '@angular\/common\/locales\/fr'/);
expect(logMsg).toContain(`Did you mean to import '@angular/common/locales/global/fr'`);
await run.stop();
});
});
Original file line number Diff line number Diff line change
@@ -14,5 +14,7 @@ last 2 Edge major versions
last 2 Safari major version
last 2 iOS major versions
Firefox ESR<% if (legacyBrowsers) { %>
IE 9-11<% } else { %>
not IE 9-11 # For IE 9-11 support, remove 'not'.<% } %>
IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11.
IE 11<% } else { %>
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.<% } %>
10 changes: 7 additions & 3 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
@@ -445,15 +445,19 @@ describe('Application Schematic', () => {
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
.toPromise();
const content = tree.readContent('/projects/foo/.browserslistrc');
expect(content).not.toContain(`not IE 9-11 # For IE 9-11 support, remove 'not'.`);
expect(content).toContain('IE 9-11');
expect(content).not.toContain('not IE 11');
expect(content).toContain('IE 11');

expect(content).not.toContain('not IE 9-10');
expect(content).toContain('IE 9-10');
});

it(`should not add support for IE 9-11 in '.browserslistrc' when 'legacyBrowsers' is false`, async () => {
const options: ApplicationOptions = { ...defaultOptions, legacyBrowsers: false };
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
.toPromise();
const content = tree.readContent('/projects/foo/.browserslistrc');
expect(content).toContain(`not IE 9-11 # For IE 9-11 support, remove 'not'.`);
expect(content).toContain('not IE 11');
expect(content).toContain('not IE 9-10');
});
});
10 changes: 5 additions & 5 deletions packages/schematics/angular/migrations/migration-collection.json
Original file line number Diff line number Diff line change
@@ -95,15 +95,15 @@
"factory": "./update-10/solution-style-tsconfig",
"description": "Add \"Solution Style\" TypeScript configuration file support. This improves developer experience using editors powered by TypeScript’s language server. Read more about this here: https://v10.angular.io/guide/migration-solution-style-tsconfig"
},
"update-module-and-target-compiler-options": {
"version": "10.0.0-rc.1",
"factory": "./update-10/update-module-and-target-compiler-options",
"description": "Update 'module' and 'target' TypeScript compiler options. Read more about this here: https://v10.angular.io/guide/migration-update-module-and-target-compiler-options"
},
"update-workspace-dependencies": {
"version": "10.0.0-rc.2",
"factory": "./update-10/update-dependencies",
"description": "Update workspace dependencies to match a new v10 project."
},
"update-module-and-target-compiler-options": {
"version": "10.0.1",
"factory": "./update-10/update-module-and-target-compiler-options",
"description": "Update 'module' and 'target' TypeScript compiler options. Read more about this here: https://v10.angular.io/guide/migration-update-module-and-target-compiler-options"
}
}
}
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { JsonAstString, JsonParseMode, dirname, join, normalize, parseJsonAst, resolve } from '@angular-devkit/core';
import { JsonAstNode, JsonAstString, JsonParseMode, dirname, join, normalize, parseJsonAst, resolve } from '@angular-devkit/core';
import { DirEntry, Rule, chain } from '@angular-devkit/schematics';
import { findPropertyInAstObject } from '../../utility/json-utils';
import { getWorkspace } from '../../utility/workspace';
@@ -25,11 +25,18 @@ function* visitExtendedJsonFiles(directory: DirEntry): IterableIterator<[string,
}

const entry = directory.file(path);
if (!entry) {
const content = entry?.content.toString();
if (!content) {
continue;
}

const jsonAst = parseJsonAst(entry.content.toString(), JsonParseMode.Loose);
let jsonAst: JsonAstNode;
try {
jsonAst = parseJsonAst(content, JsonParseMode.Loose);
} catch {
throw new Error(`Invalid JSON AST Object (${path})`);
}

if (jsonAst.kind !== 'object') {
continue;
}
Original file line number Diff line number Diff line change
@@ -114,4 +114,10 @@ describe('Migration to create "Solution Style" tsconfig', () => {
],
});
});

it('should not error out when a JSON file is a blank', async () => {
tree.create('blank.json', '');
const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise();
expect(readJsonFile(newTree, 'src/tsconfig.json').extends).toEqual('./../tsconfig.base.json');
});
});
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ interface ModuleAndTargetReplamenent {
export default function (): Rule {
return async host => {
// Workspace level tsconfig
updateModuleAndTarget(host, 'tsconfig.json', {
updateModuleAndTarget(host, 'tsconfig.base.json', {
oldModule: 'esnext',
newModule: 'es2020',
});
Loading