diff --git a/docs/npm_install/npm_install.html b/docs/npm_install/npm_install.html index 2ec5c4bccf..5f9951cfa2 100644 --- a/docs/npm_install/npm_install.html +++ b/docs/npm_install/npm_install.html @@ -132,7 +132,7 @@
npm_install(name, data, exclude_packages, included_files, manual_build_file_contents, package_json, package_lock_json, prod_only, quiet, symlink_node_modules, timeout)+
npm_install(name, data, always_hide_bazel_files, exclude_packages, included_files, manual_build_file_contents, package_json, package_lock_json, prod_only, quiet, symlink_node_modules, timeout)
Runs npm install during workspace setup.
@@ -159,6 +159,41 @@Data files required by this rule.
If symlink_node_modules is True, this attribute is ignored since
the dependency manager will run in the package.json location.
+
+
+
+ always_hide_bazel_files
Boolean; Optional; Default is False
If True then Bazel build files such as BUILD
and BUILD.bazelwill always be hidden by prefixing them with
_`.
Defaults to False, in which case Bazel files are _not_ hidden when `symlink_node_modules`
+ is True. In this case, the rule will report an error when there are Bazel files detected
+ in npm packages.
+
+ Reporting the error is desirable as relying on this repository rule to hide
+ these files does not work in the case where a user deletes their node_modules folder
+ and manually re-creates it with yarn or npm outside of Bazel which would restore them.
+ On a subsequent Bazel build, this repository rule does not re-run and the presence
+ of the Bazel files leads to a build failure that looks like the following:
+
+ ```
+ ERROR: /private/var/tmp/_bazel_greg/37b273501bbecefcf5ce4f3afcd7c47a/external/npm/BUILD.bazel:9:1:
+ Label '@npm//:node_modules/rxjs/src/AsyncSubject.ts' crosses boundary of subpackage '@npm//node_modules/rxjs/src'
+ (perhaps you meant to put the colon here: '@npm//node_modules/rxjs/src:AsyncSubject.ts'?)
+ ```
+
+ See https://github.com/bazelbuild/rules_nodejs/issues/802 for more details.
+
+ The recommended solution is to use the @bazel/hide-bazel-files utility to hide these files.
+ See https://github.com/bazelbuild/rules_nodejs/blob/master/packages/hide-bazel-files/README.md
+ for installation instructions.
+
+ The alternate solution is to set `always_hide_bazel_files` to True which tell
+ this rule to hide Bazel files even when `symlink_node_modules` is True. This means
+ you won't need to use `@bazel/hide-bazel-files` utility but if you manually recreate
+ your `node_modules` folder via yarn or npm outside of Bazel you may run into the above
+ error.
yarn_install(name, data, exclude_packages, included_files, manual_build_file_contents, network_timeout, package_json, prod_only, quiet, symlink_node_modules, timeout, use_global_yarn_cache, yarn_lock)+
yarn_install(name, data, always_hide_bazel_files, exclude_packages, included_files, manual_build_file_contents, network_timeout, package_json, prod_only, quiet, symlink_node_modules, timeout, use_global_yarn_cache, yarn_lock)
Runs yarn install during workspace setup.
@@ -293,6 +328,41 @@Data files required by this rule.
If symlink_node_modules is True, this attribute is ignored since
the dependency manager will run in the package.json location.
+
+
+
+ always_hide_bazel_files
Boolean; Optional; Default is False
If True then Bazel build files such as BUILD
and BUILD.bazelwill always be hidden by prefixing them with
_`.
Defaults to False, in which case Bazel files are _not_ hidden when `symlink_node_modules`
+ is True. In this case, the rule will report an error when there are Bazel files detected
+ in npm packages.
+
+ Reporting the error is desirable as relying on this repository rule to hide
+ these files does not work in the case where a user deletes their node_modules folder
+ and manually re-creates it with yarn or npm outside of Bazel which would restore them.
+ On a subsequent Bazel build, this repository rule does not re-run and the presence
+ of the Bazel files leads to a build failure that looks like the following:
+
+ ```
+ ERROR: /private/var/tmp/_bazel_greg/37b273501bbecefcf5ce4f3afcd7c47a/external/npm/BUILD.bazel:9:1:
+ Label '@npm//:node_modules/rxjs/src/AsyncSubject.ts' crosses boundary of subpackage '@npm//node_modules/rxjs/src'
+ (perhaps you meant to put the colon here: '@npm//node_modules/rxjs/src:AsyncSubject.ts'?)
+ ```
+
+ See https://github.com/bazelbuild/rules_nodejs/issues/802 for more details.
+
+ The recommended solution is to use the @bazel/hide-bazel-files utility to hide these files.
+ See https://github.com/bazelbuild/rules_nodejs/blob/master/packages/hide-bazel-files/README.md
+ for installation instructions.
+
+ The alternate solution is to set `always_hide_bazel_files` to True which tell
+ this rule to hide Bazel files even when `symlink_node_modules` is True. This means
+ you won't need to use `@bazel/hide-bazel-files` utility but if you manually recreate
+ your `node_modules` folder via yarn or npm outside of Bazel you may run into the above
+ error.
npm_package(name, deps, srcs, packages, replace_with_version, replacements, vendor_external)+
npm_package(name, deps, srcs, packages, rename_build_files, replace_with_version, replacements, vendor_external)
The npm_package rule creates a directory containing a publishable npm artifact.
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package")
@@ -259,6 +259,15 @@ Attributes
Other npm_package rules whose content is copied into this package.
+
+ rename_build_files
+
+ Boolean; Optional; Default is True
+ If set BUILD and BUILD.bazel files are prefixed with _
in the npm package.
+ The default is True since npm packages that contain BUILD files don't work with
+ yarn_install
and npm_install
without a post-install step that deletes or renames them.
+
+
replace_with_version