-
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.
feat(@angular/cli): remove deprecated
defaultProject
from workspace…
… configuration The deprecated 'defaultProject' workspace option has been removed BREAKING CHANGE: The deprecated `defaultProject` workspace option has been removed. The project to use will be determined from the current working directory.
- Loading branch information
1 parent
ada4d69
commit d58428d
Showing
17 changed files
with
87 additions
and
68 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
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 |
---|---|---|
|
@@ -133,6 +133,5 @@ | |
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "my-app" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -136,6 +136,5 @@ | |
"new": { | ||
"root": "src" | ||
} | ||
}, | ||
"defaultProject": "my-app" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -136,6 +136,5 @@ | |
"1": { | ||
"root": "src" | ||
} | ||
}, | ||
"defaultProject": "my-app" | ||
} | ||
} |
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 |
---|---|---|
|
@@ -136,6 +136,5 @@ | |
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "my-app" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -127,6 +127,5 @@ | |
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "my-app" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -133,6 +133,5 @@ | |
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "my-app" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -134,6 +134,5 @@ | |
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "my-app" | ||
} | ||
} | ||
} |
6 changes: 5 additions & 1 deletion
6
packages/schematics/angular/migrations/migration-collection.json
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
{ | ||
"schematics": { | ||
|
||
"remove-default-project-option": { | ||
"version": "16.0.0", | ||
"factory": "./update-16/remove-default-project-option", | ||
"description": "Remove 'defaultProject' option from workspace configuration. The project to use will be determined from the current working directory." | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/schematics/angular/migrations/update-16/remove-default-project-option.ts
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,17 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import { Rule } from '@angular-devkit/schematics'; | ||
import { updateWorkspace } from '../../utility/workspace'; | ||
|
||
/** Migration to remove 'defaultProject' option from angular.json. */ | ||
export default function (): Rule { | ||
return updateWorkspace((workspace) => { | ||
delete workspace.extensions['defaultProject']; | ||
}); | ||
} |
50 changes: 50 additions & 0 deletions
50
packages/schematics/angular/migrations/update-16/remove-default-project-option_spec.ts
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,50 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import { EmptyTree } from '@angular-devkit/schematics'; | ||
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; | ||
|
||
describe(`Migration to remove 'defaultProject' option.`, () => { | ||
const schematicName = 'remove-default-project-option'; | ||
const schematicRunner = new SchematicTestRunner( | ||
'migrations', | ||
require.resolve('../migration-collection.json'), | ||
); | ||
|
||
let tree: UnitTestTree; | ||
beforeEach(() => { | ||
tree = new UnitTestTree(new EmptyTree()); | ||
}); | ||
|
||
it(`should remove 'defaultProject'`, async () => { | ||
const angularConfig = { | ||
version: 1, | ||
projects: {}, | ||
defaultProject: 'foo', | ||
}; | ||
|
||
tree.create('/angular.json', JSON.stringify(angularConfig, undefined, 2)); | ||
const newTree = await schematicRunner.runSchematic(schematicName, {}, tree); | ||
const { defaultProject } = JSON.parse(newTree.readContent('/angular.json')); | ||
|
||
expect(defaultProject).toBeUndefined(); | ||
}); | ||
|
||
it(`should not error when 'defaultProject' is not defined`, async () => { | ||
const angularConfig = { | ||
version: 1, | ||
projects: {}, | ||
}; | ||
|
||
tree.create('/angular.json', JSON.stringify(angularConfig, undefined, 2)); | ||
const newTree = await schematicRunner.runSchematic(schematicName, {}, tree); | ||
const { defaultProject } = JSON.parse(newTree.readContent('/angular.json')); | ||
|
||
expect(defaultProject).toBeUndefined(); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -113,6 +113,4 @@ | |
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "thirteen-project" | ||
} | ||
}} |