Skip to content

Commit f2b5c1b

Browse files
committed
docs: emphasize use of js_library over npm_package
1 parent f8f6e4f commit f2b5c1b

6 files changed

Lines changed: 14 additions & 12 deletions

File tree

docs/migrate_2.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/npm_link_package.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/npm_translate_lock.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm/private/npm_link_package.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def npm_link_package(
3131
root_package: the root package where the node_modules package store is linked to
3232
link: whether or not to link in this package
3333
If false, only the npm_package_store target will be created _if_ this is called in the `root_package`.
34-
src: the npm_package target to link; may only to be specified when linking in the root package
34+
src: the target to link; may only to be specified when linking in the root package
3535
deps: list of npm_package_store; may only to be specified when linking in the root package
3636
fail_if_no_link: whether or not to fail if this is called in a package that is not the root package and `link` is False
3737
auto_manual: whether or not to automatically add a manual tag to the generated targets

npm/private/npm_package_store.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ def _npm_package_store_impl(ctx):
180180
version = ctx.attr.version
181181

182182
if not package:
183-
fail("No package name specified to link to. Package name must either be specified explicitly via 'package' attribute or come from the 'src' 'NpmPackageInfo', typically a 'npm_package' target")
183+
fail("No package name specified to link to. Package name must either be specified explicitly via 'package' attribute or come from the 'src' 'JsInfo|NpmPackageInfo', typically a 'js_library|npm_package' target")
184184
if not version:
185-
fail("No package version specified to link to. Package version must either be specified explicitly via 'version' attribute or come from the 'src' 'NpmPackageInfo', typically a 'npm_package' target")
185+
fail("No package version specified to link to. Package version must either be specified explicitly via 'version' attribute or come from the 'src' 'JsInfo|NpmPackageInfo', typically a 'js_library|npm_package' target")
186186

187187
package_store_name = utils.package_store_name(package, version)
188188
package_store_directory = None

npm/private/npm_translate_lock.bzl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,18 +445,20 @@ def npm_translate_lock(
445445
446446
Read more: [lifecycles](/docs/pnpm.md#lifecycles)
447447
448-
replace_packages: A dict of package names to npm_package targets to link instead of the sources specified in the pnpm lock file for the corresponding packages.
448+
replace_packages: A dict of package names to targets to link instead of the sources specified in the pnpm lock file for the corresponding packages.
449449
450-
The injected npm_package targets may optionally contribute transitive npm package dependencies on top
450+
Targets must produce `JsInfo` or `NpmPackageInfo` providers such as `js_library` or `npm_package` targets.
451+
452+
The injected package targets may optionally contribute transitive npm package dependencies on top
451453
of the transitive dependencies specified in the pnpm lock file for their respective packages, however, these
452454
transitive dependencies must not collide with pnpm lock specified transitive dependencies.
453455
454-
Any patches specified for the packages will be not applied to the injected npm_package targets. They
456+
Any patches specified for the packages will be not applied to the injected package targets. They
455457
will be applied, however, to the fetches sources for their respecitve packages so they can still be useful
456458
for patching the fetched `package.json` files, which are used to determine the generated bin entries for packages.
457459
458460
NB: lifecycle hooks and custom_postinstall scripts, if implicitly or explicitly enabled, will be run on
459-
the injected npm_package targets. These may be disabled explicitly using the `lifecycle_hooks` attribute.
461+
the injected package targets. These may be disabled explicitly using the `lifecycle_hooks` attribute.
460462
461463
bins: Binary files to create in `node_modules/.bin` for packages in this lock file.
462464
@@ -553,7 +555,7 @@ def npm_translate_lock(
553555
554556
use_pnpm: label of the pnpm entry point to use.
555557
556-
npm_package_target_name: The name of linked `npm_package`, `js_library` or `JsInfo` producing targets.
558+
npm_package_target_name: The name of linked `js_library`, `npm_package` or `JsInfo` producing targets.
557559
558560
When targets are linked as pnpm workspace packages, the name of the target must align with this value.
559561

0 commit comments

Comments
 (0)