Skip to content

Commit 0df2fca

Browse files
author
Jason Bedard
committed
initial project
0 parents  commit 0df2fca

20 files changed

+2551
-0
lines changed

.bazelignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
node_modules/

.bazelrc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Set the tmp directory location to avoid SIGBUS on docker/jdk9
2+
# Bazel issue: https://github.com/bazelbuild/bazel/issues/3236
3+
build --sandbox_tmpfs_path=/tmp
4+
5+
# Make TypeScript and Angular compilation fast, by keeping a few copies of the
6+
# compiler running as daemons, and cache SourceFile AST's to reduce parse time.
7+
build --strategy=TypeScriptCompile=worker
8+
build --strategy=AngularTemplateCompile=worker
9+
10+
# Use the Angular 6 compiler
11+
build --define=compile=legacy
12+
13+
# Don't create bazel-* symlinks in the WORKSPACE directory.
14+
# These require .gitignore and may scare users.
15+
# Also, it's a workaround for https://github.com/bazelbuild/rules_typescript/issues/12
16+
# which affects the common case of having `tsconfig.json` in the WORKSPACE directory.
17+
#
18+
# Instead, you should run `bazel info bazel-bin` to find out where the outputs went.
19+
#build --symlink_prefix=dist/
20+
21+
test --test_output=errors
22+
23+
# Turn off legacy external runfiles
24+
run --nolegacy_external_runfiles
25+
test --nolegacy_external_runfiles
26+
27+
# Turn on --incompatible_strict_action_env which was on by default
28+
# in Bazel 0.21.0 but turned off again in 0.22.0. Follow
29+
# https://github.com/bazelbuild/bazel/issues/7026 for more details.
30+
# This flag is needed to so that the bazel cache is not invalidated
31+
# when running bazel via `yarn bazel`.
32+
# See https://github.com/angular/angular/issues/27514.
33+
build --incompatible_strict_action_env
34+
run --incompatible_strict_action_env
35+
test --incompatible_strict_action_env

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.idea/
2+
.vscode/
3+
*.iml
4+
.project/
5+
.ijwb/
6+
7+
yarn-error.log
8+
9+
bazel-out
10+
bazel-bin
11+
bazel-genfiles
12+
bazel-ng_package-material
13+
bazel-testlogs
14+
15+
dist/
16+
node_modules/
17+
18+
.DS_Store

BUILD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
exports_files([
3+
"tsconfig.json",
4+
])

WORKSPACE

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
workspace(name = "npmscope")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
http_archive(
6+
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",
43+
)
44+
45+
http_archive(
46+
name = "io_bazel_rules_sass",
47+
sha256 = "f42aac17f49b28a1bd12dec0fbc3254ccd7244f3ac9b378d340993bfff1f8301",
48+
strip_prefix = "rules_sass-1.16.1",
49+
url = "https://github.com/bazelbuild/rules_sass/archive/1.16.1.tar.gz",
50+
)
51+
52+
## ====================================================================================================
53+
## TypeScript + Web
54+
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+
67+
load("@io_bazel_rules_sass//:package.bzl", "rules_sass_dependencies")
68+
69+
rules_sass_dependencies()
70+
71+
## ====================================================================================================
72+
## Node / Yarn + Bazel Version
73+
74+
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
75+
76+
node_repositories(
77+
node_urls = ["https://nodejs.org/dist/v{version}/{filename}"],
78+
node_version = "10.13.0",
79+
package_json = ["//:package.json"],
80+
yarn_repositories = {
81+
"1.12.1": ("yarn-v1.12.1.tar.gz", "yarn-v1.12.1", "09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d"),
82+
},
83+
yarn_urls = ["https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}"],
84+
yarn_version = "1.12.1",
85+
)
86+
87+
check_bazel_version("0.22.0")
88+
89+
yarn_install(
90+
name = "npm",
91+
package_json = "//:package.json",
92+
yarn_lock = "//:yarn.lock",
93+
)
94+
95+
## ====================================================================================================
96+
## TypeScript + Web
97+
98+
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
99+
100+
web_test_repositories()
101+
102+
browser_repositories(
103+
chromium = True,
104+
firefox = True,
105+
)
106+
107+
load("@build_bazel_rules_typescript//:defs.bzl", "check_rules_typescript_version", "ts_setup_workspace")
108+
109+
check_rules_typescript_version("0.22.0")
110+
111+
ts_setup_workspace()
112+
113+
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
114+
115+
sass_repositories()
116+
117+
load("@angular//:index.bzl", "ng_setup_workspace")
118+
119+
ng_setup_workspace()
120+
121+
load("@angular_material//:index.bzl", "angular_material_setup_workspace")
122+
123+
angular_material_setup_workspace()

bazelproject

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
directories:
2+
.
3+
-node_modules
4+
-dist
5+
6+
targets:
7+
//...
8+
9+
java_language_level: 9
10+
11+
workspace_type: java
12+
13+
additional_languages:
14+
javascript
15+
typescript
16+
17+
ts_config_rules:
18+
//:tsconfig.json

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ngpackagr-material",
3+
"version": "0.0.1",
4+
"license": "UNLICENSED",
5+
"private": true,
6+
"dependencies": {
7+
"tslib": "1.9.3"
8+
},
9+
"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",
17+
"typescript": ">=3.1.1 <3.3",
18+
"@types/node": "^11.9.5"
19+
},
20+
"engines": {
21+
"node": ">=10.13.0",
22+
"yarn": ">=1.12.1"
23+
}
24+
}

tsconfig.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"moduleResolution": "node",
5+
"lib": ["dom", "es2015", "es2016.array.include"],
6+
// Override the default use of node_modules/@types and specify dependencies via bazel
7+
"types": [],
8+
"strict": true,
9+
"noUnusedLocals": true,
10+
"stripInternal": true,
11+
"removeComments": false,
12+
"sourceMap": true,
13+
"allowSyntheticDefaultImports": true,
14+
"forceConsistentCasingInFileNames": true,
15+
"experimentalDecorators": true,
16+
"emitDecoratorMetadata": true,
17+
"declaration": false,
18+
"importHelpers": true,
19+
"noEmitHelpers": true,
20+
"skipLibCheck": true
21+
},
22+
"exclude": ["node_modules", "dist"],
23+
"angularCompilerOptions": {
24+
"annotateForClosureCompiler": true,
25+
"skipTemplateCodegen": true,
26+
"strictMetadataEmit": true,
27+
"fullTemplateTypeCheck": true,
28+
"strictInjectionParameters": true,
29+
"enableResourceInlining": true
30+
}
31+
}

ui/BUILD

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
# Packaging modeled after @angular/cdk+material style
4+
# https://github.com/angular/material2/blob/7.3.3/src/cdk/BUILD.bazel
5+
6+
load("@angular//packages/bazel:index.bzl", "ng_module", "ng_package")
7+
8+
UI_COMPONENTS = [
9+
"banner",
10+
]
11+
12+
UI_COMPONENT_PACKAGES = ["//ui/%s" % p for p in UI_COMPONENTS]
13+
14+
ng_module(
15+
name = "ui",
16+
srcs = glob(["*.ts"]),
17+
module_name = "@npmscope/ui",
18+
deps = ["@npm//@types", "@npm//@angular/core"] + UI_COMPONENT_PACKAGES,
19+
)
20+
21+
# BROKEN!!
22+
ng_package(
23+
name = "npm",
24+
srcs = ["package.json"],
25+
entry_point = "ui/index.js",
26+
deps = [":ui"] + UI_COMPONENT_PACKAGES,
27+
)

ui/banner/BUILD

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("@angular//packages/bazel:index.bzl", "ng_module")
4+
5+
ng_module(
6+
name = "banner",
7+
srcs = glob(["*.ts"]),
8+
assets = [
9+
":banner.html",
10+
":banner.css",
11+
],
12+
module_name = "@npmscope/ui/banner",
13+
deps = [
14+
"@npm//@types",
15+
"@angular//packages/common",
16+
"@angular//packages/core",
17+
"@angular_material//src/lib/button",
18+
"@angular_material//src/lib/icon",
19+
],
20+
)

0 commit comments

Comments
 (0)