-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular/cli): infer schematic defaults correctly when using `--p…
…roject` Previously, the `--project` flag was ignored when gathering and merging the schematics defaults from the angular workspace configuration file. Closes #20666 (cherry picked from commit 586226a)
- Loading branch information
1 parent
95cb13e
commit bc01593
Showing
3 changed files
with
57 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ng } from '../../utils/process'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
export default async function () { | ||
await updateJsonFile('angular.json', (config) => { | ||
config.projects['test-project'].schematics = { | ||
'@schematics/angular:component': { | ||
style: 'scss', | ||
}, | ||
}; | ||
}); | ||
|
||
// Generate component in application to verify that it's minimal | ||
const { stdout } = await ng('generate', 'component', 'foo'); | ||
if (!stdout.includes('foo.component.scss')) { | ||
console.log(stdout); | ||
throw new Error('Expected "foo.component.scss" to exist.'); | ||
} | ||
|
||
// Generate another project with different settings | ||
await ng('generate', 'application', 'test-project-two', '--no-minimal'); | ||
|
||
await updateJsonFile('angular.json', (config) => { | ||
config.projects['test-project-two'].schematics = { | ||
'@schematics/angular:component': { | ||
style: 'less', | ||
}, | ||
}; | ||
}); | ||
|
||
const { stdout: stdout2 } = await ng( | ||
'generate', | ||
'component', | ||
'foo', | ||
'--project', | ||
'test-project-two', | ||
); | ||
if (!stdout2.includes('foo.component.less')) { | ||
console.log(stdout2); | ||
throw new Error('Expected "foo.component.less" to exist.'); | ||
} | ||
} |