Reproduction
Steps to reproduce:
ng new tmp and respond to prompts
cd tmp/
ng g app web-app and respond to prompts
- Edit workspace (
angular.json) to change "defaultProject": "tmp" to "defaultProject": "web-app"
ng add @angular/material and respond to prompts
Expected Behavior
The ng add docs state
Adds the npm package for a published library to your workspace, and configures your default app project to use that library,
The default app project is the value of defaultProject in angular.json.
Thus it is expected to add Angular Material to the default project, web-app.
Actual Behavior
Skipping installation: Package already installed
? Choose a prebuilt theme name, or "custom" for a custom theme: Custom
? Set up HammerJS for gesture recognition? Yes
? Set up browser animations for Angular Material? Yes
UPDATE package.json (1473 bytes)
UPDATE src/main.ts (391 bytes)
UPDATE src/app/app.module.ts (423 bytes)
UPDATE src/styles.scss (1418 bytes)
UPDATE src/index.html (484 bytes)
As you can see, it configured the initial app project in the workspace ("tmp") for Angular Material instead of the default project ("web-app").
Environment
Angular CLI: 8.2.1
Node: 10.15.3
OS: darwin x64
Angular: 8.2.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.802.1
@angular-devkit/build-angular 0.802.1
@angular-devkit/build-ng-packagr 0.802.1
@angular-devkit/build-optimizer 0.802.1
@angular-devkit/build-webpack 0.802.1
@angular-devkit/core 8.2.1
@angular-devkit/schematics 8.2.1
@angular/cdk 8.1.2
@angular/material 8.1.2
@ngtools/webpack 8.2.1
@schematics/angular 8.2.1
@schematics/update 0.802.1
ng-packagr 5.4.3
rxjs 6.4.0
typescript 3.5.3
webpack 4.38.0
Ran into this while reviewing PR angular/components#16654.
Reproduction
Steps to reproduce:
ng new tmpand respond to promptscd tmp/ng g app web-appand respond to promptsangular.json) to change"defaultProject": "tmp"to"defaultProject": "web-app"ng add @angular/materialand respond to promptsExpected Behavior
The
ng adddocs stateThus it is expected to add Angular Material to the default project,
web-app.Actual Behavior
As you can see, it configured the initial app project in the workspace (
"tmp") for Angular Material instead of the default project ("web-app").Environment
Ran into this while reviewing PR angular/components#16654.