Skip to content

Commit 7fe780f

Browse files
author
Jason Bedard
committed
upgrade to rules_nodejs 0.18.7, rules_typescript 0.25.1
1 parent 6dbe9da commit 7fe780f

File tree

11 files changed

+1069
-314
lines changed

11 files changed

+1069
-314
lines changed

WORKSPACE

Lines changed: 31 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,11 @@ workspace(name = "npmscope")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5+
# Fetch rules_nodejs so we can install our npm dependencies
56
http_archive(
67
name = "build_bazel_rules_nodejs",
7-
sha256 = "039c6fe27b53e2336ca77209c51e7f8aa64b7baf9f4bd7a383a780dc270237b1",
8-
strip_prefix = "rules_nodejs-0.16.5",
9-
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.16.5.zip"],
10-
)
11-
12-
# Same as package.json version
13-
http_archive(
14-
name = "build_bazel_rules_typescript",
15-
sha256 = "136ba6be39b4ff934cc0f41f043912305e98cb62254d9e6af467e247daafcd34",
16-
strip_prefix = "rules_typescript-0.22.0",
17-
url = "https://github.com/bazelbuild/rules_typescript/archive/0.22.0.zip",
18-
)
19-
20-
# Angular for use of the @angular/bazel rules
21-
# Version should be synchronized with runtime dependencies in package.json
22-
http_archive(
23-
name = "angular",
24-
sha256 = "a5b4a24c7cee3a4ab10f2666c3cfd0213c622da0fc9da042ea07a6a012839ff9",
25-
strip_prefix = "angular-7.2.4",
26-
url = "https://github.com/angular/angular/archive/7.2.4.tar.gz",
27-
)
28-
29-
# Angular material
30-
http_archive(
31-
name = "angular_material",
32-
sha256 = "25e1696c746baad4ee58acb07cd2a2655c489462d358bdb6d6a8ccb6ebca1cff",
33-
strip_prefix = "material2-7.3.1",
34-
url = "https://github.com/angular/material2/archive/7.3.1.tar.gz",
35-
)
36-
37-
# The @rxjs repo contains targets for building rxjs with bazel
38-
http_archive(
39-
name = "rxjs",
40-
sha256 = "52b63515ad38287e9c437df80576ca6b7433358cd8c4095e1b1bece65596cb94",
41-
strip_prefix = "package/src",
42-
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz",
8+
sha256 = "a69c5bd317beef982298ea7b5ed8b5c5275d1b55ee199e98a0ca088f8e0c6cce",
9+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.18.7/rules_nodejs-0.18.7.tar.gz"],
4310
)
4411

4512
http_archive(
@@ -52,18 +19,6 @@ http_archive(
5219
## ====================================================================================================
5320
## TypeScript + Web
5421

55-
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
56-
57-
rules_typescript_dependencies()
58-
59-
load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies")
60-
61-
rules_nodejs_dependencies()
62-
63-
load("@angular//packages/bazel:package.bzl", "rules_angular_dependencies")
64-
65-
rules_angular_dependencies()
66-
6722
load("@io_bazel_rules_sass//:package.bzl", "rules_sass_dependencies")
6823

6924
rules_sass_dependencies()
@@ -88,36 +43,51 @@ check_bazel_version("0.22.0")
8843

8944
yarn_install(
9045
name = "npm",
46+
data = [
47+
# Needed because this tsconfig file is used in the "postinstall" script.
48+
"//:angular-metadata.tsconfig.json",
49+
],
9150
package_json = "//:package.json",
9251
yarn_lock = "//:yarn.lock",
9352
)
9453

9554
## ====================================================================================================
9655
## TypeScript + Web
9756

98-
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
57+
# Install all bazel dependencies of our npm packages
58+
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
59+
60+
install_bazel_dependencies()
61+
62+
# Load karma dependencies
63+
load("@npm_bazel_karma//:package.bzl", "rules_karma_dependencies")
64+
65+
rules_karma_dependencies()
66+
67+
# Setup the rules_webtesting toolchain
68+
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
9969

10070
web_test_repositories()
10171

102-
browser_repositories(
103-
chromium = True,
104-
firefox = True,
105-
)
72+
# Temporary work-around for https://github.com/angular/angular/issues/28681
73+
# TODO(gregmagolan): go back to @io_bazel_rules_webtesting browser_repositories
74+
load("@npm_bazel_karma//:browser_repositories.bzl", "browser_repositories")
10675

107-
load("@build_bazel_rules_typescript//:defs.bzl", "check_rules_typescript_version", "ts_setup_workspace")
76+
browser_repositories()
10877

109-
check_rules_typescript_version("0.22.0")
78+
# Setup the rules_typescript tooolchain
79+
load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace")
11080

11181
ts_setup_workspace()
11282

11383
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
11484

11585
sass_repositories()
11686

117-
load("@angular//:index.bzl", "ng_setup_workspace")
118-
119-
ng_setup_workspace()
120-
121-
load("@angular_material//:index.bzl", "angular_material_setup_workspace")
87+
# Setup the angular toolchain. This integration test no longer builds Angular from source,
88+
# but we still need to set up the "angular" workspace since some Bazel rules depend on
89+
# the "ngdeps" repository. This can be fixed if we switched the Angular repository to the
90+
# "npm" repository for the bazel managed dependencies.
91+
load("@npm_angular_bazel//:index.bzl", "ng_setup_workspace")
12292

123-
angular_material_setup_workspace()
93+
ng_setup_workspace()

angular-metadata.tsconfig.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Workaround for https://github.com/angular/angular/issues/18810
2+
// This file is required because when using the Angular NPM packages and building
3+
// with AOT compilation, NGC needs the "ngsummary.json" files.
4+
{
5+
"compilerOptions": {
6+
"lib": [
7+
"dom",
8+
"es2015"
9+
],
10+
"experimentalDecorators": true,
11+
"types": []
12+
},
13+
"include": [
14+
"node_modules/@angular/**/*"
15+
],
16+
"exclude": [
17+
"node_modules/@angular/bazel/**",
18+
"node_modules/@angular/compiler-cli/**",
19+
"node_modules/@angular/**/testing/**"
20+
]
21+
}

package.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@
44
"license": "UNLICENSED",
55
"private": true,
66
"dependencies": {
7+
"@angular/animations": "7.2.7",
8+
"@angular/cdk": "^7.3.3",
9+
"@angular/common": "7.2.7",
10+
"@angular/core": "7.2.7",
11+
"@angular/material": "^7.3.3",
712
"tslib": "1.9.3"
813
},
914
"devDependencies": {
10-
"@angular/bazel": "7.2.4",
11-
"@angular/core": "7.2.4",
12-
"@angular/compiler": "7.2.4",
13-
"@angular/compiler-cli": "7.2.4",
14-
"@bazel/typescript": "^0.22.1",
15-
"rxjs": "^6.0.0",
16-
"zone.js": "~0.8.26",
15+
"@angular/bazel": "7.2.7",
16+
"@angular/compiler": "7.2.7",
17+
"@angular/compiler-cli": "7.2.7",
18+
"@bazel/karma": "^0.25.1",
19+
"@bazel/typescript": "^0.25.1",
20+
"@types/node": "^11.9.5",
21+
"rxjs": "^6.4.0",
1722
"typescript": ">=3.1.1 <3.3",
18-
"@types/node": "^11.9.5"
23+
"zone.js": "~0.8.26"
1924
},
2025
"engines": {
2126
"node": ">=10.13.0",

ui/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"])
33
# Packaging modeled after @angular/cdk+material style
44
# https://github.com/angular/material2/blob/7.3.3/src/cdk/BUILD.bazel
55

6-
load("@angular//packages/bazel:index.bzl", "ng_module", "ng_package")
6+
load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package")
77

88
UI_COMPONENTS = [
99
"banner",

ui/banner/BUILD

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("@angular//packages/bazel:index.bzl", "ng_module")
3+
load("@npm_angular_bazel//:index.bzl", "ng_module")
44

55
ng_module(
66
name = "banner",
@@ -12,9 +12,8 @@ ng_module(
1212
module_name = "@npmscope/ui/banner",
1313
deps = [
1414
"@npm//@types",
15-
"@angular//packages/common",
16-
"@angular//packages/core",
17-
"@angular_material//src/lib/button",
18-
"@angular_material//src/lib/icon",
15+
"@npm//@angular/common",
16+
"@npm//@angular/core",
17+
"@npm//@angular/material",
1918
],
2019
)

ui/injected/BUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("@angular//packages/bazel:index.bzl", "ng_module")
3+
load("@npm_angular_bazel//:index.bzl", "ng_module")
44

55
ng_module(
66
name = "injected",
77
srcs = glob(["*.ts"]),
88
module_name = "@npmscope/ui/injected",
99
deps = [
1010
"@npm//@types",
11-
"@angular//packages/core",
12-
"@angular_material//src/cdk/overlay",
11+
"@npm//@angular/core",
12+
"@npm//@angular/cdk",
1313
],
1414
)

ui/simple-injected/BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("@npm_angular_bazel//:index.bzl", "ng_module")
4+
5+
ng_module(
6+
name = "simple-injected",
7+
srcs = glob(["*.ts"]),
8+
module_name = "@npmscope/ui/simple-injected",
9+
deps = [
10+
"@npm//@types",
11+
"@npm//@angular/common",
12+
"@npm//@angular/core",
13+
],
14+
)

ui/simple-injected/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './public_api';

ui/simple-injected/module.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {NgModule} from '@angular/core';
2+
import {CommonModule} from '@angular/common';
3+
4+
@NgModule({
5+
imports: [CommonModule],
6+
})
7+
export class SimpleModule {}

ui/simple-injected/public_api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './module';

0 commit comments

Comments
 (0)