Skip to content

Commit d75e994

Browse files
committed
feat(schematics): support for ng add
* Introduces support for `ng add @angular/cdk`. Note that this currently just sets up the `package.json` but is necessary because otherwise the CLI will complain about the `ng-add` schematic not being available. * Upgrades Bazel workspace rules in favor of removing Bazel manual-copying workarounds for the schematics. This also allows us to switch over to fine-grained dependencies in a follow-up (making it consistent with angular/angular).
1 parent 74fdedb commit d75e994

27 files changed

+3538
-3422
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050

5151
- run: bazel run @nodejs//:npm install
5252
# TODO(jelbourn): Update this command to run all tests if the Bazel issues have been fixed.
53-
- run: bazel test src/lib/schematics:unit_tests
53+
- run: bazel test src/{cdk,lib}/schematics:unit_tests
5454

5555
- save_cache:
5656
key: *cache_key

BUILD.bazel

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@ package(default_visibility = ["//visibility:public"])
22

33
# TODO(jelbourn): figure out if these workarounds are still needed
44

5-
# This rule belongs in node_modules/BUILD
6-
# It's here as a workaround for
7-
# https://github.com/bazelbuild/bazel/issues/374#issuecomment-296217940
5+
# TODO: Replace with fine-grained node_modules using `npm_install` / `yarn_install`.
6+
# TODO: See https://github.com/bazelbuild/rules_nodejs/wiki#migrating-to-rules_nodejs-013
87
filegroup(
98
name = "node_modules",
10-
# Performance workaround: list individual files
11-
# Reduces the number of files as inputs to nodejs_binary:
12-
# bazel query "deps(:node_modules)" | wc -l
13-
# This won't scale in the general case.
14-
# TODO(alexeagle): figure out what to do
159
srcs = glob(["/".join(["node_modules", pkg, "**", ext]) for pkg in [
1610
"@angular",
1711
"@angular-devkit",
1812
"@schematics",
1913
"@types",
2014
"bytebuffer",
15+
"chalk",
16+
"fs-extra",
17+
"glob",
2118
"hammerjs",
2219
"jasmine",
2320
"minimist",
2421
"moment",
22+
"mock-fs",
2523
"parse5",
2624
"protobufjs",
2725
"protractor",
@@ -30,6 +28,7 @@ filegroup(
3028
"tsickle",
3129
"tslib",
3230
"tslint",
31+
"tsutils",
3332
"typescript",
3433
"zone.js",
3534
] for ext in [
@@ -44,7 +43,6 @@ filegroup(
4443
]),
4544
)
4645

47-
4846
# Glob pattern that matches all Angular testing bundles.
4947
ANGULAR_TESTING = [
5048
"node_modules/@angular/*/bundles/*-testing.umd.js",

WORKSPACE

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
workspace(name = "angular_material")
22

3-
# Add nodejs rules
3+
# Add TypeScript rules
44
http_archive(
5-
name = "build_bazel_rules_nodejs",
6-
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.10.1.zip",
7-
strip_prefix = "rules_nodejs-0.10.1",
8-
sha256 = "634206524d90dc03c52392fa3f19a16637d2bcf154910436fe1d669a0d9d7b9c",
5+
name = "build_bazel_rules_typescript",
6+
url = "https://github.com/bazelbuild/rules_typescript/archive/0.17.0.zip",
7+
strip_prefix = "rules_typescript-0.17.0",
8+
sha256 = "1626ee2cc9770af6950bfc77dffa027f9aedf330fe2ea2ee7e504428927bd95d",
99
)
1010

11-
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
12-
# your npm dependencies. You must still run the package manager.
13-
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
14-
15-
check_bazel_version("0.15.0")
16-
node_repositories(package_json = ["//:package.json"])
11+
# Fetch transient dependencies of the TypeScript bazel rules.
12+
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
13+
rules_typescript_dependencies()
1714

1815
# Add sass rules
1916
http_archive(
@@ -26,19 +23,16 @@ http_archive(
2623
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
2724
sass_repositories()
2825

29-
# Add TypeScript rules
30-
http_archive(
31-
name = "build_bazel_rules_typescript",
32-
url = "https://github.com/bazelbuild/rules_typescript/archive/0.15.1.zip",
33-
strip_prefix = "rules_typescript-0.15.1",
34-
sha256 = "3792cc20ef13bb1d1d8b1760894c3320f02a87843e3a04fed7e8e454a75328b6",
35-
)
26+
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
27+
# your npm dependencies. You must still run the package manager.
28+
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
3629

37-
http_archive(
38-
name = "io_bazel_rules_webtesting",
39-
url = "https://github.com/bazelbuild/rules_webtesting/archive/7ffe970bbf380891754487f66c3d680c087d67f2.zip",
40-
strip_prefix = "rules_webtesting-7ffe970bbf380891754487f66c3d680c087d67f2",
41-
sha256 = "4fb0dca8c9a90547891b7ef486592775a523330fc4555c88cd8f09270055c2ce",
30+
check_bazel_version("0.15.0")
31+
node_repositories(
32+
package_json = ["//:package.json"],
33+
# Disabled until we use fine-grained dependencies. This was previously disabled but is now
34+
# enabled by default.
35+
preserve_symlinks = False,
4236
)
4337

4438
# Setup TypeScript Bazel workspace
@@ -57,7 +51,6 @@ local_repository(
5751
path = "node_modules/rxjs/src",
5852
)
5953

60-
6154
# This commit matches the version of buildifier in angular/ngcontainer
6255
# If you change this, also check if it matches the version in the angular/ngcontainer
6356
# version in /.circleci/config.yml

0 commit comments

Comments
 (0)