Skip to content

Commit eceb5cd

Browse files
filipesilvadgp1130
authored andcommitted
build: use rules_nodejs 1.6.0 features
Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
1 parent 63e668f commit eceb5cd

File tree

30 files changed

+92
-29
lines changed

30 files changed

+92
-29
lines changed

‎WORKSPACE

+5-6
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ Try running `yarn bazel` instead.
5252
# - 0.32.1 remove override of @bazel/tsetse & exclude typescript lib declarations in node_module_library transitive_declarations
5353
# - 0.32.2 resolves bug in @bazel/hide-bazel-files postinstall step
5454
# - 0.34.0 introduces protractor rule
55-
check_rules_nodejs_version(minimum_version_string = "0.34.0")
55+
check_rules_nodejs_version(minimum_version_string = "1.5.0")
5656

5757
# Setup the Node.js toolchain
5858
node_repositories(
5959
node_repositories = {
60-
"10.16.0-darwin_amd64": ("node-v10.16.0-darwin-x64.tar.gz", "node-v10.16.0-darwin-x64", "6c009df1b724026d84ae9a838c5b382662e30f6c5563a0995532f2bece39fa9c"),
61-
"10.16.0-linux_amd64": ("node-v10.16.0-linux-x64.tar.xz", "node-v10.16.0-linux-x64", "1827f5b99084740234de0c506f4dd2202a696ed60f76059696747c34339b9d48"),
62-
"10.16.0-windows_amd64": ("node-v10.16.0-win-x64.zip", "node-v10.16.0-win-x64", "aa22cb357f0fb54ccbc06b19b60e37eefea5d7dd9940912675d3ed988bf9a059"),
60+
"12.14.1-darwin_amd64": ("node-v12.14.1-darwin-x64.tar.gz", "node-v12.14.1-darwin-x64", "0be10a28737527a1e5e3784d3ad844d742fe8b0718acd701fd48f718fd3af78f"),
61+
"12.14.1-linux_amd64": ("node-v12.14.1-linux-x64.tar.xz", "node-v12.14.1-linux-x64", "07cfcaa0aa9d0fcb6e99725408d9e0b07be03b844701588e3ab5dbc395b98e1b"),
62+
"12.14.1-windows_amd64": ("node-v12.14.1-win-x64.zip", "node-v12.14.1-win-x64", "1f96ccce3ba045ecea3f458e189500adb90b8bc1a34de5d82fc10a5bf66ce7e3"),
6363
},
64-
node_version = "10.16.0",
64+
node_version = "12.14.1",
6565
package_json = ["//:package.json"],
6666
yarn_repositories = {
6767
"1.22.4": ("yarn-v1.22.4.tar.gz", "yarn-v1.22.4", "bc5316aa110b2f564a71a3d6e235be55b98714660870c5b6b2d2d3f12587fb58"),
@@ -75,7 +75,6 @@ yarn_install(
7575
"//:tools/yarn/check-yarn.js",
7676
],
7777
package_json = "//:package.json",
78-
symlink_node_modules = False,
7978
yarn_lock = "//:yarn.lock",
8079
)
8180

‎etc/api/BUILD renamed to ‎etc/api/BUILD.bazel

+6-4
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ load("@npm_ts_api_guardian//:index.bzl", "ts_api_guardian_test")
3636
),
3737
# We don't want to analyse these exports nor add them to the golden files
3838
# in most cases it's because Ts API Guardian doesn't support Symbol Aliases.
39+
# Note: $ must be escaped to $$ because these patterns will be executed by shell
40+
# and $ has a special meaning there.
3941
strip_export_pattern = [
4042
# @angular-devkit/architect
41-
"^BuilderProgressState$",
43+
"^BuilderProgressState$$",
4244
# @angular-devkit/schematics
43-
"^workflow$",
44-
"^formats$",
45+
"^workflow$$",
46+
"^formats$$",
4547
# @angular-devkit/build-optimizer
46-
"^buildOptimizerLoader$",
48+
"^buildOptimizerLoader$$",
4749
],
4850
# At the moment using this will ignore a big change
4951
use_angular_tag_rules = False,

‎etc/api/angular_devkit/architect/src/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export interface BuilderContext {
1515
workspaceRoot: string;
1616
addTeardown(teardown: () => (Promise<void> | void)): void;
1717
getBuilderNameForTarget(target: Target): Promise<string>;
18-
getProjectMetadata(target: Target): Promise<json.JsonObject>;
1918
getProjectMetadata(projectName: string): Promise<json.JsonObject>;
19+
getProjectMetadata(target: Target): Promise<json.JsonObject>;
2020
getTargetOptions(target: Target): Promise<json.JsonObject>;
2121
reportProgress(current: number, total?: number, status?: string): void;
2222
reportRunning(): void;

‎packages/angular/cli/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ ts_library(
4545
"**/*.json",
4646
"**/*.md",
4747
]),
48+
devmode_module = "commonjs",
49+
devmode_target = "es2018",
4850
module_name = "@angular/cli",
4951
# strict_checks = False,
5052
deps = [
@@ -232,6 +234,8 @@ ts_library(
232234
"**/*_spec_large.ts",
233235
],
234236
),
237+
devmode_module = "commonjs",
238+
devmode_target = "es2018",
235239
# strict_checks = False,
236240
tsconfig = "//:tsconfig-test.json",
237241
deps = [

‎packages/angular/pwa/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ ts_library(
3636
"pwa/files/**/*",
3737
],
3838
),
39+
devmode_module = "commonjs",
40+
devmode_target = "es2018",
3941
deps = [
4042
"//packages/angular_devkit/core",
4143
"//packages/angular_devkit/schematics",
@@ -60,6 +62,8 @@ ts_library(
6062
"pwa/**/*_spec_large.ts",
6163
],
6264
),
65+
devmode_module = "commonjs",
66+
devmode_target = "es2018",
6367
# strict_checks = False,
6468
tsconfig = "//:tsconfig-test.json",
6569
deps = [

‎packages/angular_devkit/architect/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ ts_library(
5353
],
5454
# strict_checks = False,
5555
data = glob(["**/*.json"]),
56+
devmode_module = "commonjs",
57+
devmode_target = "es2018",
5658
module_name = "@angular-devkit/architect",
5759
module_root = "src/index.d.ts",
5860
deps = [
@@ -72,6 +74,8 @@ ts_library(
7274
"src/**/*_spec_large.ts",
7375
],
7476
),
77+
devmode_module = "commonjs",
78+
devmode_target = "es2018",
7579
# strict_checks = False,
7680
tsconfig = "//:tsconfig-test.json",
7781
deps = [

‎packages/angular_devkit/architect/node/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ ts_library(
1818
"**/*_spec_large.ts",
1919
],
2020
),
21+
devmode_module = "commonjs",
22+
devmode_target = "es2018",
2123
module_name = "@angular-devkit/architect/node",
2224
module_root = "index.d.ts",
2325
# strict_checks = False,

‎packages/angular_devkit/architect/node/node-modules-architect-host.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,7 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
143143
}
144144

145145
async loadBuilder(info: NodeModulesBuilderInfo): Promise<Builder> {
146-
// f1 const is a temporary workaround for a TS bug with UMDs.
147-
// See microsoft/TypeScript#36780. Should be removed when
148-
// https://github.com/bazelbuild/rules_typescript/pull/492 goes in.
149-
const f1 = info.import;
150-
const builder = (await import(f1)).default;
146+
const builder = (await import(info.import)).default;
151147
if (builder[BuilderSymbol]) {
152148
return builder;
153149
}

‎packages/angular_devkit/architect/testing/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ ts_library(
1818
"**/*_spec_large.ts",
1919
],
2020
),
21+
devmode_module = "commonjs",
22+
devmode_target = "es2018",
2123
module_name = "@angular-devkit/architect/testing",
2224
module_root = "index.d.ts",
2325
deps = [

‎packages/angular_devkit/architect/testing/testing-architect-host.ts

+3-12
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ export class TestingArchitectHost implements ArchitectHost {
3636
this._builderMap.set(builderName, { builderName, description, optionSchema });
3737
}
3838
async addBuilderFromPackage(packageName: string) {
39-
// f1 const is a temporary workaround for a TS bug with UMDs.
40-
// See microsoft/TypeScript#36780. Should be removed when
41-
// https://github.com/bazelbuild/rules_typescript/pull/492 goes in.
42-
const f1 = packageName + '/package.json';
43-
const packageJson = await import(f1);
39+
const packageJson = await import(packageName + '/package.json');
4440
if (!('builders' in packageJson)) {
4541
throw new Error('Invalid package.json, builders key not found.');
4642
}
@@ -60,13 +56,8 @@ export class TestingArchitectHost implements ArchitectHost {
6056
const b = builders[builderName];
6157
// TODO: remove this check as v1 is not supported anymore.
6258
if (!b.implementation) { continue; }
63-
// f2 and f3 consts are a temporary workaround for a TS bug with UMDs.
64-
// See microsoft/TypeScript#36780. Should be removed when
65-
// https://github.com/bazelbuild/rules_typescript/pull/492 goes in.
66-
const f2 = builderJsonPath + '/../' + b.implementation;
67-
const handler = (await import(f2)).default;
68-
const f3 = builderJsonPath + '/../' + b.schema;
69-
const optionsSchema = await import(f3);
59+
const handler = (await import(builderJsonPath + '/../' + b.implementation)).default;
60+
const optionsSchema = await import(builderJsonPath + '/../' + b.schema);
7061
this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema);
7162
}
7263
}

‎packages/angular_devkit/architect_cli/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ ts_library(
1313
srcs = [
1414
"bin/architect.ts",
1515
] + glob(["src/**/*.ts"]),
16+
devmode_module = "commonjs",
17+
devmode_target = "es2018",
1618
module_name = "@angular-devkit/architect-cli",
1719
deps = [
1820
"//packages/angular_devkit/architect",

‎packages/angular_devkit/benchmark/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ ts_library(
2222
"src/**/*_benchmark.ts",
2323
],
2424
),
25+
devmode_module = "commonjs",
26+
devmode_target = "es2018",
2527
module_name = "@angular-devkit/benchmark",
2628
module_root = "src/index.d.ts",
2729
deps = [
@@ -50,6 +52,8 @@ ts_library(
5052
"src/test/watch-test-file.txt",
5153
"src/test/watch-test-script.js",
5254
],
55+
devmode_module = "commonjs",
56+
devmode_target = "es2018",
5357
# @external_begin
5458
tsconfig = "//:tsconfig-test.json",
5559
deps = [

‎packages/angular_devkit/build_optimizer/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ ts_library(
3131
"webpack-loader/package.json",
3232
],
3333
),
34+
devmode_module = "commonjs",
35+
devmode_target = "es2018",
3436
module_name = "@angular-devkit/build-optimizer",
3537
module_root = "src/index.d.ts",
3638
deps = [
@@ -52,6 +54,8 @@ ts_library(
5254
"src/**/*_spec_large.ts",
5355
],
5456
),
57+
devmode_module = "commonjs",
58+
devmode_target = "es2018",
5559
# @external_begin
5660
tsconfig = "//:tsconfig-test.json",
5761
deps = [

‎packages/angular_devkit/core/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ ts_library(
2929
data = glob(["**/*.json"]) + [
3030
"//packages/angular_devkit/core/third_party/github.com/chalk/supports-color",
3131
],
32+
devmode_module = "commonjs",
33+
devmode_target = "es2018",
3234
module_name = "@angular-devkit/core",
3335
module_root = "src/index.d.ts",
3436
# The attribute below is needed in g3 to turn off strict typechecking
@@ -61,6 +63,8 @@ ts_library(
6163
"src/experimental/workspace/test/test-workspace.json",
6264
"src/experimental/workspace/workspace-schema.json",
6365
],
66+
devmode_module = "commonjs",
67+
devmode_target = "es2018",
6468
# The attribute below is needed in g3 to turn off strict typechecking
6569
# strict_checks = False,
6670
# @external_begin

‎packages/angular_devkit/core/node/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ ts_library(
2020
"**/*_benchmark.ts",
2121
],
2222
),
23+
devmode_module = "commonjs",
24+
devmode_target = "es2018",
2325
module_name = "@angular-devkit/core/node",
2426
module_root = "index.d.ts",
2527
# The attribute below is needed in g3 to turn off strict typechecking
@@ -43,6 +45,8 @@ ts_library(
4345
"testing/**/*.ts",
4446
],
4547
),
48+
devmode_module = "commonjs",
49+
devmode_target = "es2018",
4650
# @external_begin
4751
tsconfig = "//:tsconfig-test.json",
4852
# @external_end

‎packages/angular_devkit/core/node/testing/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ ts_library(
1818
"**/*_benchmark.ts",
1919
],
2020
),
21+
devmode_module = "commonjs",
22+
devmode_target = "es2018",
2123
module_name = "@angular-devkit/core/node/testing",
2224
module_root = "index.d.ts",
2325
# The attribute below is needed in g3 to turn off strict typechecking

‎packages/angular_devkit/schematics/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ ts_library(
2929
# The attribute below is needed in g3 to turn off strict typechecking
3030
# strict_checks = False,
3131
data = glob(["**/*.json"]),
32+
devmode_module = "commonjs",
33+
devmode_target = "es2018",
3234
module_name = "@angular-devkit/schematics",
3335
module_root = "src/index.d.ts",
3436
deps = [
@@ -48,6 +50,8 @@ ts_library(
4850
"src/**/*_spec_large.ts",
4951
],
5052
),
53+
devmode_module = "commonjs",
54+
devmode_target = "es2018",
5155
# @external_begin
5256
tsconfig = "//:tsconfig-test.json",
5357
# @external_end

‎packages/angular_devkit/schematics/tasks/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ ts_library(
2020
"tslint-fix/test/**/*",
2121
],
2222
),
23+
devmode_module = "commonjs",
24+
devmode_target = "es2018",
2325
module_name = "@angular-devkit/schematics/tasks",
2426
module_root = "index.d.ts",
2527
# The attribute below is needed in g3 to turn off strict typechecking
@@ -53,6 +55,8 @@ ts_library(
5355
"tslint-fix/test/collection.json",
5456
"tslint-fix/test/rules/customRuleRule.js",
5557
],
58+
devmode_module = "commonjs",
59+
devmode_target = "es2018",
5660
# The attribute below is needed in g3 to turn off strict typechecking
5761
# strict_checks = False,
5862
# @external_begin

‎packages/angular_devkit/schematics/tasks/node/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ ts_library(
1717
"**/*_benchmark.ts",
1818
],
1919
),
20+
devmode_module = "commonjs",
21+
devmode_target = "es2018",
2022
module_name = "@angular-devkit/schematics/tasks/node",
2123
module_root = "index.d.ts",
2224
# The attribute below is needed in g3 to turn off strict typechecking

‎packages/angular_devkit/schematics/testing/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ ts_library(
1313
srcs = glob(
1414
include = ["**/*.ts"],
1515
),
16+
devmode_module = "commonjs",
17+
devmode_target = "es2018",
1618
module_name = "@angular-devkit/schematics/testing",
1719
module_root = "index.d.ts",
1820
deps = [

‎packages/angular_devkit/schematics/tools/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ ts_library(
1919
"test/**/*.ts",
2020
],
2121
),
22+
devmode_module = "commonjs",
23+
devmode_target = "es2018",
2224
module_name = "@angular-devkit/schematics/tools",
2325
module_root = "index.d.ts",
2426
# The attribute below is needed in g3 to turn off strict typechecking
@@ -44,6 +46,8 @@ ts_library(
4446
"test/**/*.ts",
4547
],
4648
),
49+
devmode_module = "commonjs",
50+
devmode_target = "es2018",
4751
# @external_begin
4852
tsconfig = "//:tsconfig-test.json",
4953
# @external_end

‎packages/angular_devkit/schematics_cli/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ ts_library(
2424
# The attribute below is needed in g3 to turn off strict typechecking
2525
# strict_checks = False,
2626
data = glob(["**/*.json"]),
27+
devmode_module = "commonjs",
28+
devmode_target = "es2018",
2729
module_name = "@angular-devkit/schematics-cli",
2830
module_root = "bin/schematics.d.ts",
2931
deps = [
@@ -51,6 +53,8 @@ ts_library(
5153
"bin/**/*_spec.ts",
5254
],
5355
),
56+
devmode_module = "commonjs",
57+
devmode_target = "es2018",
5458
# strict_checks = False,
5559
tsconfig = "//:tsconfig-test.json",
5660
deps = [

‎packages/ngtools/webpack/BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ ts_library(
2929
"package.json",
3030
],
3131
),
32+
devmode_module = "commonjs",
33+
devmode_target = "es2018",
3234
module_name = "@ngtools/webpack",
3335
module_root = "src/index.d.ts",
3436
deps = [
@@ -55,6 +57,8 @@ ts_library(
5557
"src/**/*_spec_helpers.ts",
5658
],
5759
),
60+
devmode_module = "commonjs",
61+
devmode_target = "es2018",
5862
tsconfig = "//:tsconfig-test.json",
5963
deps = [
6064
":webpack",

‎packages/schematics/angular/BUILD.bazel

+4-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ ts_library(
5858
"*/other-files/**/*",
5959
],
6060
),
61+
devmode_module = "commonjs",
62+
devmode_target = "es2018",
6163
module_name = "@schematics/angular",
6264
deps = [
6365
"//packages/angular_devkit/core",
@@ -87,10 +89,11 @@ ts_library(
8789
srcs = glob(
8890
include = [
8991
"**/*_spec.ts",
90-
"**/*_spec_large.ts",
9192
"utility/test/**/*.ts",
9293
],
9394
),
95+
devmode_module = "commonjs",
96+
devmode_target = "es2018",
9497
# @external_begin
9598
tsconfig = "//:tsconfig-test.json",
9699
deps = [

0 commit comments

Comments
 (0)