Skip to content

Commit 6b6cf45

Browse files
devversionmmalerba
authored andcommitted
refactor(schematics): foundation for cdk schematics (#13213)
* Moves the utility functions which will be needed for building CDK schematics to the CDK (`cdk/schematics`). * Updates package tools to properly build schematics for CDK and Material (shared logic for building schematics; Material schematics depend on CDK schematics) * Update to `ng-add`: The Angular CLI only installs `@angular/material` if someone runs `ng add @angular/material`. But since we need access to the utility functions from the CDK, we need to install the dependencies first, and then setup the project.
1 parent 800e366 commit 6b6cf45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+423
-173
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/src/lib/progress-bar/** @jelbourn @crisbeto @josephperrott
2424
/src/lib/progress-spinner/** @jelbourn @crisbeto @josephperrott
2525
/src/lib/radio/** @jelbourn @devversion
26-
/src/lib/schematics/** @amcdnl
26+
/src/lib/schematics/** @devversion @amcdnl
2727
/src/lib/select/** @crisbeto
2828
/src/lib/sidenav/** @mmalerba
2929
/src/lib/slide-toggle/** @devversion
@@ -71,6 +71,7 @@
7171
/src/cdk/overlay/** @jelbourn @crisbeto
7272
/src/cdk/platform/** @jelbourn @devversion
7373
/src/cdk/portal/** @jelbourn
74+
/src/cdk/schematics/** @devversion @jelbourn
7475
/src/cdk/scrolling/** @andrewseguin @crisbeto
7576
/src/cdk/stepper/** @mmalerba
7677
/src/cdk/table/** @andrewseguin

src/cdk/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@
2929
"dependencies": {
3030
"tslib": "^1.7.1"
3131
},
32+
"optionalDependencies": {
33+
"parse5": "^5.0.0"
34+
},
35+
"schematics": "./schematics/collection.json",
3236
"ng-update": {
37+
"migrations": "./schematics/migration.json",
3338
"packageGroup": [
3439
"@angular/material",
3540
"@angular/cdk",

src/cdk/schematics/BUILD.bazel

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
4+
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package", "jasmine_node_test")
5+
load("//:packages.bzl", "VERSION_PLACEHOLDER_REPLACEMENTS")
6+
7+
filegroup(
8+
name = "schematics_assets",
9+
srcs = ["README.md"],
10+
)
11+
12+
ts_library(
13+
name = "schematics",
14+
module_name = "@angular/cdk/schematics",
15+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
16+
tsconfig = ":tsconfig.json",
17+
)
18+
19+
# This package is intended to be combined into the main @angular/cdk package as a dep.
20+
npm_package(
21+
name = "npm_package",
22+
srcs = [":schematics_assets"],
23+
deps = [":schematics"],
24+
replacements = VERSION_PLACEHOLDER_REPLACEMENTS,
25+
)
26+
27+
### Testing rules
28+
29+
jasmine_node_test(
30+
name = "unit_tests",
31+
srcs = [":schematics_test_sources"],
32+
data = [":schematics_assets"]
33+
)
34+
35+
ts_library(
36+
name = "schematics_test_sources",
37+
srcs = glob(["**/*.spec.ts"]),
38+
deps = [":schematics"],
39+
tsconfig = ":tsconfig.json",
40+
testonly = True,
41+
)

src/cdk/schematics/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Cdk schematics

src/cdk/schematics/collection.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json",
3+
"schematics": {}
4+
}

src/cdk/schematics/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export * from './utils';

src/cdk/schematics/migration.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json",
3+
"schematics": {}
4+
}

src/cdk/schematics/tsconfig.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["es2017"],
4+
"module": "commonjs",
5+
"moduleResolution": "node",
6+
"outDir": "../../../dist/packages/cdk/schematics",
7+
"noEmitOnError": false,
8+
"strictNullChecks": true,
9+
"skipDefaultLibCheck": true,
10+
"skipLibCheck": true,
11+
"sourceMap": true,
12+
"target": "es2015",
13+
"types": [
14+
"jasmine",
15+
"node"
16+
]
17+
},
18+
"exclude": [
19+
"**/*.spec.ts"
20+
],
21+
"bazelOptions": {
22+
"suppressTsconfigOverrideWarnings": true
23+
}
24+
}
File renamed without changes.

0 commit comments

Comments
 (0)