refactor(@angular-devkit/schematics-cli): move @schematics/schematics into this package

This change removes the need for the `@schematics/schematics` package and moves it inside `@angular-devkit/schematics-cli`.
This commit is contained in:
Alan Agius 2021-04-01 09:15:35 +02:00
parent 8185558e79
commit f6e1fd84a2
38 changed files with 39 additions and 104 deletions

View File

@ -156,11 +156,6 @@
"name": "Angular Schematics",
"section": "Schematics",
"snapshotRepo": "angular/schematics-angular-builds"
},
"@schematics/schematics": {
"name": "Schematics Schematics",
"section": "Schematics",
"snapshotRepo": "angular/schematics-schematics-builds"
}
}
}

View File

@ -224,7 +224,6 @@ The following is the list of supported scopes:
* **@angular-devkit/schematics-cli**
* **@ngtools/webpack**
* **@schematics/angular**
* **@schematics/schematics**
### Subject

View File

@ -196,7 +196,6 @@ This is a monorepo which contains many tools and packages:
|---|---|---|---|
**Angular PWA Schematics** | [`@angular/pwa`](https://npmjs.com/package/@angular/pwa) | [![latest](https://img.shields.io/npm/v/%40angular%2Fpwa/latest.svg)](https://npmjs.com/package/@angular/pwa) | [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/angular-pwa-builds)
**Angular Schematics** | [`@schematics/angular`](https://npmjs.com/package/@schematics/angular) | [![latest](https://img.shields.io/npm/v/%40schematics%2Fangular/latest.svg)](https://npmjs.com/package/@schematics/angular) | [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/schematics-angular-builds)
**Schematics Schematics** | [`@schematics/schematics`](https://npmjs.com/package/@schematics/schematics) | [![latest](https://img.shields.io/npm/v/%40schematics%2Fschematics/latest.svg)](https://npmjs.com/package/@schematics/schematics) | [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/schematics-schematics-builds)
#### Misc

View File

@ -47,7 +47,6 @@ export const analyticsPackageSafelist = [
/^@angular-devkit\//,
/^@ngtools\//,
'@schematics/angular',
'@schematics/schematics',
];
export function isPackageNameSafeForAnalytics(name: string): boolean {

View File

@ -1,5 +1,6 @@
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
load("//tools:defaults.bzl", "ts_library")
load("//tools:ts_json_schema.bzl", "ts_json_schema")
# Copyright Google Inc. All Rights Reserved.
#
@ -10,24 +11,35 @@ licenses(["notice"])
package(default_visibility = ["//visibility:public"])
# @angular-devkit/schematics-cli
ts_library(
name = "schematics_cli",
srcs = glob(
include = ["bin/**/*.ts"],
exclude = [
"bin/**/*_spec.ts",
"bin/**/*_benchmark.ts",
],
),
# The attribute below is needed in g3 to turn off strict typechecking
# strict_checks = False,
data = glob(
include = ["**/*.json"],
include = ["**/*.ts"],
exclude = [
"**/*_spec.ts",
"schematic/files/**",
"blank/project-files/**",
"blank/schematic-files/**",
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
) + [
# @external_begin
# These files are generated from the JSON schema
"//packages/angular_devkit/schematics_cli:blank/schema.ts",
"//packages/angular_devkit/schematics_cli:schematic/schema.ts",
# @external_end
],
data = glob(
include = [
"collection.json",
"package.json",
"blank/schema.json",
"blank/project-files/**/*",
"blank/schematic-files/**/*",
"schematic/schema.json",
"schematic/files/**/*",
],
),
module_name = "@angular-devkit/schematics-cli",
module_root = "bin/schematics.d.ts",
@ -37,7 +49,6 @@ ts_library(
"//packages/angular_devkit/schematics",
"//packages/angular_devkit/schematics/tasks",
"//packages/angular_devkit/schematics/tools",
"//packages/schematics/schematics",
"@npm//@types/inquirer",
"@npm//@types/minimist",
"@npm//@types/node",
@ -66,3 +77,13 @@ jasmine_node_test(
name = "schematics_cli_test",
srcs = [":schematics_cli_test_lib"],
)
ts_json_schema(
name = "blank_schema",
src = "blank/schema.json",
)
ts_json_schema(
name = "schematic_schema",
src = "schematic/schema.json",
)

View File

@ -26,7 +26,7 @@ import * as minimist from 'minimist';
* and show usage.
*
* In the case where a collection name isn't part of the argument, the default is to use the
* schematics package (@schematics/schematics) as the collection.
* schematics package (@angular-devkit/schematics-cli) as the collection.
*
* This logic is entirely up to the tooling.
*
@ -34,7 +34,7 @@ import * as minimist from 'minimist';
* @return {{collection: string, schematic: (string)}}
*/
function parseSchematicName(str: string | null): { collection: string, schematic: string | null } {
let collection = '@schematics/schematics';
let collection = '@angular-devkit/schematics-cli';
let schematic = str;
if (schematic && schematic.indexOf(':') != -1) {
@ -328,7 +328,7 @@ function getUsage(): string {
--force Force overwriting files that would otherwise be an error.
--list-schematics List all schematics from the collection, by name. A collection name
should be suffixed by a colon. Example: '@schematics/schematics:'.
should be suffixed by a colon. Example: '@angular-devkit/schematics-cli:'.
--no-interactive Disables interactive input prompts.

View File

@ -14,10 +14,10 @@
"code generation",
"schematics"
],
"schematics": "./collection.json",
"dependencies": {
"@angular-devkit/core": "0.0.0",
"@angular-devkit/schematics": "0.0.0",
"@schematics/schematics": "0.0.0",
"ansi-colors": "4.1.1",
"inquirer": "8.0.0",
"minimist": "1.2.5",

View File

@ -1,62 +0,0 @@
# Copyright Google Inc. 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
load("//tools:defaults.bzl", "ts_library")
load("//tools:ts_json_schema.bzl", "ts_json_schema")
licenses(["notice"]) # MIT
package(default_visibility = ["//visibility:public"])
ts_library(
name = "schematics",
srcs = glob(
include = ["**/*.ts"],
exclude = [
"**/*_spec.ts",
"**/*_benchmark.ts",
"schematic/files/**",
"blank/project-files/**",
"blank/schematic-files/**",
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
) + [
# @external_begin
# These files are generated from the JSON schema
"//packages/schematics/schematics:blank/schema.ts",
"//packages/schematics/schematics:schematic/schema.ts",
# @external_end
],
data = glob(
include = [
"collection.json",
"package.json",
"blank/schema.json",
"blank/project-files/**/*",
"blank/schematic-files/**/*",
"schematic/schema.json",
"schematic/files/**/*",
],
),
module_name = "@schematics/schematics",
deps = [
"//packages/angular_devkit/core",
"//packages/angular_devkit/schematics",
"//packages/angular_devkit/schematics/tasks",
"@npm//@types/node",
"@npm//rxjs",
],
)
ts_json_schema(
name = "blank_schema",
src = "blank/schema.json",
)
ts_json_schema(
name = "schematic_schema",
src = "schematic/schema.json",
)

View File

@ -1,17 +0,0 @@
{
"name": "@schematics/schematics",
"version": "0.0.0",
"description": "Schematics specific to Angular",
"experimental": true,
"keywords": [
"blueprints",
"code generation",
"schematics",
"schematic"
],
"schematics": "./collection.json",
"dependencies": {
"@angular-devkit/core": "0.0.0",
"@angular-devkit/schematics": "0.0.0"
}
}

View File

@ -65,8 +65,9 @@
"etc/cli.angular.io/**/*",
"**/node_modules/**/*",
"**/third_party/**/*",
"packages/schematics/*/*/*files/**/*",
"packages/angular_devkit/schematics_cli/*/files/**/*",
"packages/angular_devkit/*/test/**/*",
"packages/schematics/*/*/*files/**/*",
"tests/**/*",
"tools/**/*",
"integration/**/*",