Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f655ba0

Browse files
committedJun 16, 2020
fix(@schematics/angular): only generate package.json under app in strict applications
(cherry picked from commit 1559ad6)
1 parent 117d142 commit f655ba0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
 

‎packages/schematics/angular/application/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,9 @@ export default function (options: ApplicationOptions): Rule {
399399
}),
400400
mergeWith(
401401
apply(url('./other-files'), [
402+
options.strict
403+
? noop()
404+
: filter(path => path !== '/package.json.template'),
402405
componentOptions.inlineTemplate
403406
? filter(path => !path.endsWith('.html.template'))
404407
: noop(),

‎packages/schematics/angular/application/index_spec.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,12 @@ describe('Application Schematic', () => {
310310
expect(content.sideEffects).toBe(false);
311311
});
312312

313-
it('sideEffects property should be false when not in strict mode', async () => {
313+
it('sideEffects package.json should not exist when not in strict mode', async () => {
314314
const options = { ...defaultOptions, projectRoot: '', strict: false };
315315

316316
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
317317
.toPromise();
318-
const content = JSON.parse(tree.readContent('/src/app/package.json'));
319-
expect(content.sideEffects).toBe(true);
318+
expect(tree.exists('/src/app/package.json')).toBeFalse();
320319
});
321320

322321
describe('custom projectRoot', () => {

0 commit comments

Comments
 (0)
Please sign in to comment.