Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/schematics): remove usages of deprecated defaultProject option #24641

Merged
merged 1 commit into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions integration/harness-e2e-cli/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,5 @@
}
}
}
},
"defaultProject": "harness-e2e-cli"
}
}
3 changes: 1 addition & 2 deletions integration/ng-add/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,5 @@
}
}
}
},
"defaultProject": "ng-add"
}
}
3 changes: 1 addition & 2 deletions integration/ng-update-v13/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,5 @@
}
}
}
},
"defaultProject": "ng-update"
}
}
2 changes: 0 additions & 2 deletions src/cdk/schematics/ng-generate/drag-drop/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ describe('CDK drag-drop schematic', () => {
'angular.json',
JSON.stringify({
version: 1,
defaultProject: 'material',
projects: {
material: {
projectType: 'application',
Expand Down Expand Up @@ -173,7 +172,6 @@ describe('CDK drag-drop schematic', () => {
'angular.json',
JSON.stringify({
version: 1,
defaultProject: 'material',
projects: {
material: {
projectType: 'application',
Expand Down
8 changes: 7 additions & 1 deletion src/cdk/schematics/utils/get-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ import {SchematicsException} from '@angular-devkit/schematics';
*/
export function getProjectFromWorkspace(
workspace: WorkspaceDefinition,
projectName = workspace.extensions.defaultProject as string,
projectName: string | undefined,
): ProjectDefinition {
if (!projectName) {
// TODO(crisbeto): some schematics APIs have the project name as optional so for now it's
// simpler to allow undefined and checking it at runtime. Eventually we should clean this up.
throw new SchematicsException('Project name is required.');
}

const project = workspace.projects.get(projectName);

if (!project) {
Expand Down
Loading