Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builtin): rename @nodejs//:npm and @nodejs//:yarn to @nodejs//:[yarn/npm]_node_repositories #1369

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tasks:
name: ubuntu1604
platform: ubuntu1604
run_targets:
- "@nodejs//:yarn"
- "@nodejs//:yarn_node_repositories"
- "//internal/node/test:no_deps"
- "//internal/node/test:has_deps_legacy"
- "//internal/node/test:has_deps"
Expand Down Expand Up @@ -79,7 +79,7 @@ tasks:
name: ubuntu1804
platform: ubuntu1804
run_targets:
- "@nodejs//:yarn"
- "@nodejs//:yarn_node_repositories"
- "//internal/node/test:no_deps"
- "//internal/node/test:has_deps_legacy"
- "//internal/node/test:has_deps"
Expand Down Expand Up @@ -194,7 +194,7 @@ tasks:
name: macos
platform: macos
run_targets:
- "@nodejs//:yarn"
- "@nodejs//:yarn_node_repositories"
- "//internal/node/test:no_deps"
- "//internal/node/test:has_deps_legacy"
- "//internal/node/test:has_deps"
Expand Down Expand Up @@ -291,7 +291,7 @@ tasks:
name: windows
platform: windows
run_targets:
- "@nodejs//:yarn"
- "@nodejs//:yarn_node_repositories"
- "//internal/node/test:no_deps"
- "//internal/node/test:has_deps_legacy"
- "//internal/node/test:has_deps"
Expand Down
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ jobs:
- *yarn_install
- *init_bazel

# Run yarn on all node_repositories
- run: bazel run @nodejs//:bin/yarn
# Run yarn
- run: bazel run @nodejs//:yarn

# Save all node_modules to the cache
- save_cache:
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
# We should also be able to test targets in a different workspace
# TODO(gmagolan): move these tests into `build` job once
# https://github.com/bazelbuild/bazel/issues/6481 is resolved
- run: 'cd examples/user_managed_deps && bazel run @nodejs//:yarn'
- run: 'cd examples/user_managed_deps && bazel run @nodejs//:yarn_node_repositories'
- run: bazel test @examples_user_managed_deps//...
- run: bazel test @e2e_packages//...

Expand Down
10 changes: 5 additions & 5 deletions docs/Built-ins.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ to point to those before calling node_repositories.
This rule exposes the `@nodejs` workspace containing some rules the user can call later:

- Run node: `bazel run @nodejs//:node path/to/program.js`
- Install dependencies using npm: `bazel run @nodejs//:npm install`
- Install dependencies using yarn: `bazel run @nodejs//:yarn`
- Install dependencies using npm: `bazel run @nodejs//:npm_node_repositories install`
- Install dependencies using yarn: `bazel run @nodejs//:yarn_node_repositories`

Note that the dependency installation scripts will run in each subpackage indicated by the `package_json` attribute.

Expand All @@ -50,7 +50,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
node_repositories(package_json = ["//:package.json", "//subpkg:package.json"])
```

Running `bazel run @nodejs//:yarn` in this repo would create `/node_modules` and `/subpkg/node_modules`.
Running `bazel run @nodejs//:yarn_node_repositories` in this repo would create `/node_modules` and `/subpkg/node_modules`.



Expand Down Expand Up @@ -114,7 +114,7 @@ and expect that file to have sha256sum `00b7a8426e076e9bf9d12ba2d571312e833fe962
#### `package_json`
(*[labels]*): a list of labels, which indicate the package.json files that will be installed
when you manually run the package manager, e.g. with
`bazel run @nodejs//:yarn` or `bazel run @nodejs//:npm install`.
`bazel run @nodejs//:yarn_node_repositories` or `bazel run @nodejs//:npm_node_repositories install`.
If you use bazel-managed dependencies, you can omit this attribute.


Expand Down Expand Up @@ -777,7 +777,7 @@ Actually publish the package with `npm publish` (also builds first):

```sh
# Check login credentials
$ bazel run @nodejs//:npm who
$ bazel run @nodejs//:npm_node_repositories who
# Publishes the package
$ bazel run :my_package.publish
```
Expand Down
2 changes: 1 addition & 1 deletion docs/TypeScript.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ node_repositories(package_json = ["//:package.json"])
You can then run `yarn` in your workspace with:

```sh
$ bazel run @nodejs//:yarn
$ bazel run @nodejs//:yarn_node_repositories
```

To use your workspace `node_modules` folder as a dependency in `ts_library` and
Expand Down
14 changes: 6 additions & 8 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,16 @@ To use the Yarn package manager, which we recommend for its built-in
verification command, you can run:

```sh
$ bazel run @nodejs//:yarn
$ bazel run @nodejs//:yarn_node_repositories
```

If you use npm instead, run:

```sh
$ bazel run @nodejs//:npm install
$ bazel run @nodejs//:npm_node_repositories install
```

The `@nodejs//:yarn` and `@nodejs//:npm` targets will run yarn/npm on all of the
The `@nodejs//:yarn_node_repositories` and `@nodejs//:npm_node_repositories` targets will run yarn/npm on all of the
package.json contexts listed `package_json` attribute of the `node_repositories`
repository rule in your WORKSPACE file (`node_repositories(package_json = [...])`).

Expand All @@ -403,22 +403,20 @@ run the bazel managed yarn or npm on a single context this can be done
using the following targets:

```sh
$ bazel run @nodejs//:bin/yarn -- <arguments passed to yarn>
$ bazel run @nodejs//:yarn -- <arguments passed to yarn>
```

If you use npm instead, run:

```sh
$ bazel run @nodejs//:bin/npm -- <arguments passed to npm>
$ bazel run @nodejs//:npm -- <arguments passed to npm>
```

Note: on **Windows** the targets are `@nodejs//:bin/yarn.cmd` and `@nodejs//:bin/npm.cmd`.

This will run yarn/npm in the current working directory. To add a package with the `yarn add` command,
for example, you would use:

```sh
$ bazel run @nodejs//:bin/yarn -- add <package>
$ bazel run @nodejs//:yarn -- add <package>
```

Note: the arguments passed to `bazel run` after `--` are forwarded to the executable being run.
Expand Down
4 changes: 2 additions & 2 deletions e2e/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ e2e_integration_test(
e2e_integration_test(
name = "e2e_ts_auto_deps",
bazel_commands = [
"run @nodejs//:yarn",
"run @nodejs//:bin/yarn -- generate_build_file",
"run @nodejs//:yarn_node_repositories",
"run @nodejs//:yarn -- generate_build_file",
"build //simple:simple",
],
npm_packages = {
Expand Down
2 changes: 1 addition & 1 deletion e2e/ts_auto_deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"typescript": "2.9.2"
},
"scripts": {
"pretest": "bazel run @nodejs//:yarn",
"pretest": "bazel run @nodejs//:yarn_node_repositories",
"generate_build_file": "cd simple && ts_auto_deps",
"test": "yarn generate_build_file && bazel build simple"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ example_integration_test(

example_integration_test(
name = "examples_user_managed_deps",
# This test requires calling `bazel run @nodejs//:yarn` before `bazel test ...`
# This test requires calling `bazel run @nodejs//:yarn_node_repositories` before `bazel test ...`
bazel_commands = [
"run @nodejs//:yarn",
"run @nodejs//:yarn_node_repositories",
"test ...",
],
# replace the following repositories with the generated archives
Expand Down
8 changes: 4 additions & 4 deletions examples/user_managed_deps/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
# - NodeJS:
# @nodejs//:node
# - NPM:
# @nodejs//:npm
# @nodejs//:npm_node_repositories
# - The yarn package manager:
# @nodejs//:yarn
# @nodejs//:yarn_node_repositories
#
# To install the node_modules of all the listed package_json files run:
# bazel run @nodejs//:yarn
# bazel run @nodejs//:yarn_node_repositories
# or
# bazel run @nodejs//:npm
# bazel run @nodejs//:npm_node_repositories
node_repositories(
package_json = ["//:package.json"],
)
Expand Down
2 changes: 1 addition & 1 deletion examples/user_managed_deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"v8-coverage": "1.0.9"
},
"scripts": {
"pretest": "bazel run @nodejs//:yarn",
"pretest": "bazel run @nodejs//:yarn_node_repositories",
"test": "bazel test ..."
}
}
2 changes: 0 additions & 2 deletions internal/node/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ exports_files([
"node_repositories.bzl", # Exported to be consumed for generating skydoc.
"node_launcher.sh",
"node_loader.js",
"BUILD.nodejs_host_os_alias.tpl",
])

filegroup(
Expand All @@ -42,7 +41,6 @@ filegroup(
"*.sh",
]) + [
"BUILD.bazel",
"BUILD.nodejs_host_os_alias.tpl",
],
visibility = ["//:__pkg__"],
)
27 changes: 0 additions & 27 deletions internal/node/BUILD.nodejs_host_os_alias.tpl

This file was deleted.

Loading