mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 18:43:42 +08:00
refactor(@angular/cli): inline @schematics/update:update schematic
This change removes the need for the `@schematics/update` package within the Angular tooling and removes the dependency from the `@angular/cli` package. Only the `update` schematic from the `@schematics/update` package was used and this schematic's logic will eventually be folded into the update command logic directly.
This commit is contained in:
parent
51cb3181ea
commit
2dd0cbd2e9
@ -48,6 +48,7 @@ ts_library(
|
|||||||
"//packages/angular/cli:commands/version.ts",
|
"//packages/angular/cli:commands/version.ts",
|
||||||
"//packages/angular/cli:commands/run.ts",
|
"//packages/angular/cli:commands/run.ts",
|
||||||
"//packages/angular/cli:commands/extract-i18n.ts",
|
"//packages/angular/cli:commands/extract-i18n.ts",
|
||||||
|
"//packages/angular/cli:src/commands/update/schematic/schema.ts",
|
||||||
# @external_end
|
# @external_end
|
||||||
],
|
],
|
||||||
data = glob(
|
data = glob(
|
||||||
@ -72,11 +73,13 @@ ts_library(
|
|||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
"//packages/angular_devkit/core/node",
|
"//packages/angular_devkit/core/node",
|
||||||
"//packages/angular_devkit/schematics",
|
"//packages/angular_devkit/schematics",
|
||||||
|
"//packages/angular_devkit/schematics/tasks",
|
||||||
"//packages/angular_devkit/schematics/tools",
|
"//packages/angular_devkit/schematics/tools",
|
||||||
"@npm//@angular/core",
|
"@npm//@angular/core",
|
||||||
"@npm//@types/debug",
|
"@npm//@types/debug",
|
||||||
"@npm//@types/inquirer",
|
"@npm//@types/inquirer",
|
||||||
"@npm//@types/node",
|
"@npm//@types/node",
|
||||||
|
"@npm//@types/npm-package-arg",
|
||||||
"@npm//@types/resolve",
|
"@npm//@types/resolve",
|
||||||
"@npm//@types/rimraf",
|
"@npm//@types/rimraf",
|
||||||
"@npm//@types/semver",
|
"@npm//@types/semver",
|
||||||
@ -274,6 +277,11 @@ ts_json_schema(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ts_json_schema(
|
||||||
|
name = "update_schematic_schema",
|
||||||
|
src = "src/commands/update/schematic/schema.json",
|
||||||
|
)
|
||||||
|
|
||||||
ts_library(
|
ts_library(
|
||||||
name = "angular-cli_test_lib",
|
name = "angular-cli_test_lib",
|
||||||
testonly = True,
|
testonly = True,
|
||||||
@ -288,6 +296,10 @@ ts_library(
|
|||||||
deps = [
|
deps = [
|
||||||
":angular-cli",
|
":angular-cli",
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
|
"//packages/angular_devkit/schematics",
|
||||||
|
"//packages/angular_devkit/schematics/testing",
|
||||||
|
"@npm//@types/semver",
|
||||||
|
"@npm//rxjs",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,6 +47,11 @@ const NG_VERSION_9_POST_MSG = colors.cyan(
|
|||||||
'For more info, please see: https://v9.angular.io/guide/updating-to-version-9',
|
'For more info, please see: https://v9.angular.io/guide/updating-to-version-9',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const UPDATE_SCHEMATIC_COLLECTION = path.join(
|
||||||
|
__dirname,
|
||||||
|
'../src/commands/update/schematic/collection.json',
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable CLI version mismatch checks and forces usage of the invoked CLI
|
* Disable CLI version mismatch checks and forces usage of the invoked CLI
|
||||||
* instead of invoking the local installed version.
|
* instead of invoking the local installed version.
|
||||||
@ -384,7 +389,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
|
|||||||
|
|
||||||
if (packages.length === 0) {
|
if (packages.length === 0) {
|
||||||
// Show status
|
// Show status
|
||||||
const { success } = await this.executeSchematic('@schematics/update', 'update', {
|
const { success } = await this.executeSchematic(UPDATE_SCHEMATIC_COLLECTION, 'update', {
|
||||||
force: options.force || false,
|
force: options.force || false,
|
||||||
next: options.next || false,
|
next: options.next || false,
|
||||||
verbose: options.verbose || false,
|
verbose: options.verbose || false,
|
||||||
@ -630,7 +635,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { success } = await this.executeSchematic('@schematics/update', 'update', {
|
const { success } = await this.executeSchematic(UPDATE_SCHEMATIC_COLLECTION, 'update', {
|
||||||
verbose: options.verbose || false,
|
verbose: options.verbose || false,
|
||||||
force: options.force || false,
|
force: options.force || false,
|
||||||
next: !!options.next,
|
next: !!options.next,
|
||||||
|
@ -48,7 +48,6 @@ export const analyticsPackageSafelist = [
|
|||||||
/^@ngtools\//,
|
/^@ngtools\//,
|
||||||
'@schematics/angular',
|
'@schematics/angular',
|
||||||
'@schematics/schematics',
|
'@schematics/schematics',
|
||||||
'@schematics/update',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export function isPackageNameSafeForAnalytics(name: string): boolean {
|
export function isPackageNameSafeForAnalytics(name: string): boolean {
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
"@angular-devkit/core": "0.0.0",
|
"@angular-devkit/core": "0.0.0",
|
||||||
"@angular-devkit/schematics": "0.0.0",
|
"@angular-devkit/schematics": "0.0.0",
|
||||||
"@schematics/angular": "0.0.0",
|
"@schematics/angular": "0.0.0",
|
||||||
"@schematics/update": "0.0.0",
|
|
||||||
"@yarnpkg/lockfile": "1.1.0",
|
"@yarnpkg/lockfile": "1.1.0",
|
||||||
"ansi-colors": "4.1.1",
|
"ansi-colors": "4.1.1",
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"schematics": {
|
||||||
|
"update": {
|
||||||
|
"factory": "./index",
|
||||||
|
"schema": "./schema.json",
|
||||||
|
"description": "Update one or multiple packages to versions, updating peer dependencies along the way."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"schematics": {
|
|
||||||
"update": {
|
|
||||||
"factory": "./update",
|
|
||||||
"schema": "./update/schema.json",
|
|
||||||
"description": "Update one or multiple packages to versions, updating peer dependencies along the way."
|
|
||||||
},
|
|
||||||
"migrate": {
|
|
||||||
"factory": "./migrate",
|
|
||||||
"schema": "./migrate/schema.json",
|
|
||||||
"description": "Schematic that calls the migrations of an installed package. Can be used separately",
|
|
||||||
"hidden": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user