Skip to content

Commit

Permalink
fix(@schematics/angular): only generate package.json under app in…
Browse files Browse the repository at this point in the history
… strict applications

(cherry picked from commit 1559ad6)
  • Loading branch information
alan-agius4 committed Jun 16, 2020
1 parent 117d142 commit f655ba0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ export default function (options: ApplicationOptions): Rule {
}),
mergeWith(
apply(url('./other-files'), [
options.strict
? noop()
: filter(path => path !== '/package.json.template'),
componentOptions.inlineTemplate
? filter(path => !path.endsWith('.html.template'))
: noop(),
Expand Down
5 changes: 2 additions & 3 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,12 @@ describe('Application Schematic', () => {
expect(content.sideEffects).toBe(false);
});

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

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

describe('custom projectRoot', () => {
Expand Down

0 comments on commit f655ba0

Please sign in to comment.