Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit b6bb414

Browse files
gregmagolanalexeagle
authored andcommitted
Remove dependency on local node_modules for @rxjs repository (#217)
1 parent d9861c3 commit b6bb414

File tree

3 files changed

+30
-34
lines changed

3 files changed

+30
-34
lines changed

.circleci/config.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
steps:
3939
- checkout:
4040
<<: *post_checkout
41+
4142
# Enforce that BUILD files are formatted. Note that this uses the version of buildifier
4243
# from the docker image above - take care that you use the same version when you run
4344
# buildifier locally on your change.
@@ -50,26 +51,15 @@ jobs:
5051
- checkout:
5152
<<: *post_checkout
5253

53-
- restore_cache:
54-
key: *cache_key
55-
5654
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
5755

5856
# Helpful for debugging, so you can check you have the same bazel version when you need
5957
# to reproduce a failure.
6058
- run: bazel info release
6159

62-
# Install the dependencies from NPM
63-
# TODO(gmagolan): Use `bazel run :install` once bootstrap issue resolved.
64-
# See https://github.com/bazelbuild/rules_nodejs/issues/275.
65-
- run: yarn
66-
6760
# Build and Test
6861
- run: bazel test //...
6962

70-
# Run the benchmark
71-
- run: node_modules/.bin/ibazel-benchmark-runner //src:devserver src/hello-world/hello-world.component.ts --url=http://localhost:5432
72-
7363
- store_artifacts:
7464
path: dist/bin/src/bundle.min.js
7565
destination: bundle.min.js
@@ -78,6 +68,19 @@ jobs:
7868
path: dist/bin/src/bundle.cs.min
7969
destination: bundle.cs.min
8070

71+
benchmark:
72+
<<: *job_defaults
73+
steps:
74+
- checkout:
75+
<<: *post_checkout
76+
77+
- restore_cache:
78+
key: *cache_key
79+
80+
# Run the benchmark
81+
- run: yarn
82+
- run: node_modules/.bin/ibazel-benchmark-runner //src:devserver src/hello-world/hello-world.component.ts --url=http://localhost:5432
83+
8184
# If we get this far, save the node_modules directory for use next time.
8285
- save_cache:
8386
key: *cache_key
@@ -90,3 +93,4 @@ workflows:
9093
jobs:
9194
- lint
9295
- build
96+
- benchmark

README.md

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,6 @@ or
4141
npm install -g @bazel/ibazel
4242
```
4343

44-
## Setup
45-
46-
Before building the app, we install packages, just as with any npm-based development workflow.
47-
48-
```bash
49-
$ yarn install
50-
```
51-
52-
or
53-
54-
```bash
55-
$ npm install
56-
```
57-
58-
For the time being, you need to run your locally installed `yarn` or `npm` to install dependencies
59-
as shown above. This is because we pull down the `@bazel/typescript` bazel dependency from npm and
60-
that dependency needs to be in place before we can build the project. We're working to
61-
resolve this bootstrapping issue. Soon you will be able to skip this step and just do your first
62-
Bazel build without needing any install step first.
63-
6444
## Development
6545

6646
Next we'll run the development server:
@@ -129,3 +109,14 @@ the entry points and modules is how routes are loaded, with production
129109
lazy loading routes and development using a custom `NgModuleFactoryLoader`
130110
loader to disable lazy loading. `enableProdMode()` is
131111
also called in the production entry point.
112+
113+
## Npm dependencies
114+
115+
Having a local `node_modules` folder setup by `yarn` or `npm` is not
116+
necessary when building this example with Bazel. This example makes use
117+
of Bazel managed npm dependencies (https://github.com/bazelbuild/rules_nodejs#using-bazel-managed-dependencies)
118+
which means Bazel will setup the npm dependencies in your `package.json` for you
119+
outside of your local workspace for use in the build.
120+
121+
However, you may still want to run `yarn` or `npm` to manually
122+
setup a local `node_modules` folder for editor and tooling support.

WORKSPACE

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ http_archive(
2929
)
3030

3131
# The @rxjs repo contains targets for building rxjs with bazel
32-
local_repository(
32+
http_archive(
3333
name = "rxjs",
34-
path = "node_modules/rxjs/src",
34+
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz",
35+
strip_prefix = "package/src",
36+
sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403",
3537
)
3638

3739
####################################
@@ -44,7 +46,6 @@ rules_angular_dependencies()
4446
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install")
4547

4648
node_repositories(
47-
preserve_symlinks = True,
4849
node_version = "10.9.0",
4950
yarn_version = "1.9.2",
5051
)

0 commit comments

Comments
 (0)