Skip to content

Commit

Permalink
fix(core): add back target defaults for all new workspaces (nrwl#11936)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored Sep 8, 2022
1 parent ae58c1d commit caec117
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions e2e/nx-run/src/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ describe('cache', () => {

// touch package.json
// --------------------------------------------
updateFile(`package.json`, (c) => {
updateFile(`nx.json`, (c) => {
const r = JSON.parse(c);
r.description = 'different';
r.affected.defaultBase = 'different';
return JSON.stringify(r);
});
const outputWithNoBuildCached = runCLI(`affected:build ${files}`);
Expand Down
5 changes: 5 additions & 0 deletions packages/workspace/src/generators/workspace/workspace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ describe('@nrwl/workspace:workspace', () => {
},
},
},
targetDefaults: {
build: {
dependsOn: ['^build'],
},
},
});
const validateNxJson = ajv.compile(nxSchema);
expect(validateNxJson(nxJson)).toEqual(true);
Expand Down
13 changes: 7 additions & 6 deletions packages/workspace/src/generators/workspace/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ function createNxJson(
},
};

nxJson.targetDefaults = {
build: {
dependsOn: ['^build'],
},
};

if (
preset !== Preset.Core &&
preset !== Preset.NPM &&
Expand All @@ -90,12 +96,7 @@ function createNxJson(
production: ['default'],
sharedGlobals: [],
};
nxJson.targetDefaults = {
build: {
dependsOn: ['^build'],
inputs: ['production', '^production'],
},
};
nxJson.targetDefaults.build.inputs = ['production', '^production'];
}

if (packageManager && cli === 'angular') {
Expand Down

0 comments on commit caec117

Please sign in to comment.