From ba4fdb83a05b1e7cb0af7f92dbd2229f5eda2586 Mon Sep 17 00:00:00 2001 From: Matt Mackay Date: Mon, 31 Aug 2020 11:00:10 -0400 Subject: [PATCH] docs: replace references to //packages/ with the @npm//@bazel/ equivalent (#2154) --- docs/Jasmine.html | 4 ++-- docs/Jasmine.md | 4 ++-- docs/Protractor.html | 2 +- docs/Protractor.md | 2 +- docs/Rollup.html | 4 ++-- docs/Rollup.md | 4 ++-- docs/Terser.html | 4 ++-- docs/Terser.md | 4 ++-- docs/TypeScript.html | 8 ++++---- docs/TypeScript.md | 8 ++++---- tools/stardoc/post-process-docs.js | 8 ++++++++ 11 files changed, 30 insertions(+), 22 deletions(-) diff --git a/docs/Jasmine.html b/docs/Jasmine.html index 57ad56faa0..43f4b70309 100755 --- a/docs/Jasmine.html +++ b/docs/Jasmine.html @@ -274,7 +274,7 @@

jasmine_node_test

A label providing the @bazel/jasmine npm dependency. - "//packages/jasmine" + "@npm//@bazel/jasmine" @@ -283,7 +283,7 @@

jasmine_node_test

A label providing the @bazel/jasmine entry point. - "//packages/jasmine:jasmine_runner.js" + "@npm//@bazel/jasmine:jasmine_runner.js" diff --git a/docs/Jasmine.md b/docs/Jasmine.md index 553ce7ad06..d7e9259171 100755 --- a/docs/Jasmine.md +++ b/docs/Jasmine.md @@ -123,7 +123,7 @@ jasmine_node_test(name, @@ -132,7 +132,7 @@ jasmine_node_test(name, diff --git a/docs/Protractor.html b/docs/Protractor.html index 8fdb505fdf..45a57278c7 100755 --- a/docs/Protractor.html +++ b/docs/Protractor.html @@ -272,7 +272,7 @@

protractor_web_test

List of peer npm deps required by protractor_web_test - ["@build_bazel_rules_nodejs//packages/protractor", "@npm//protractor"] + ["@npm//@bazel/protractor", "@npm//protractor"] diff --git a/docs/Protractor.md b/docs/Protractor.md index 2eca7aac8d..dbd61e808b 100755 --- a/docs/Protractor.md +++ b/docs/Protractor.md @@ -121,7 +121,7 @@ protractor_web_test(
name, diff --git a/docs/Rollup.html b/docs/Rollup.html index 5d2eeac1b5..60a0386905 100755 --- a/docs/Rollup.html +++ b/docs/Rollup.html @@ -295,7 +295,7 @@

rollup_bundle

Label optional - //packages/rollup:rollup.config.js + @npm//@bazel/rollup:rollup.config.js @@ -445,7 +445,7 @@

rollup_bundle

Label optional - //packages/rollup/bin:rollup-worker + @npm//@bazel/bin:rollup-worker diff --git a/docs/Rollup.md b/docs/Rollup.md index 0a341f72f6..3cf0df6db1 100755 --- a/docs/Rollup.md +++ b/docs/Rollup.md @@ -153,7 +153,7 @@ If not set, a default basic Rollup config is used. Label optional - //packages/rollup:rollup.config.js + @npm//@bazel/rollup:rollup.config.js @@ -303,7 +303,7 @@ Otherwise, the outputs are assumed to be a single file. Label optional - //packages/rollup/bin:rollup-worker + @npm//@bazel/bin:rollup-worker diff --git a/docs/Terser.html b/docs/Terser.html index 21010f327d..f36489f087 100755 --- a/docs/Terser.html +++ b/docs/Terser.html @@ -281,7 +281,7 @@

terser_minified

Label optional - //packages/terser:terser_config.default.json + @npm//@bazel/terser:terser_config.default.json @@ -334,7 +334,7 @@

terser_minified

Label optional - //packages/terser/bin:terser + @npm//@bazel/bin:terser diff --git a/docs/Terser.md b/docs/Terser.md index f8c4a5f20f..808421a07b 100755 --- a/docs/Terser.md +++ b/docs/Terser.md @@ -135,7 +135,7 @@ If config_file isn't supplied, Bazel will use a default config file Label optional - //packages/terser:terser_config.default.json + @npm//@bazel/terser:terser_config.default.json @@ -188,7 +188,7 @@ If you want to do this, you can pass a filegroup here. Label optional - //packages/terser/bin:terser + @npm//@bazel/bin:terser diff --git a/docs/TypeScript.html b/docs/TypeScript.html index bb251d3a3b..9a2f467ecc 100755 --- a/docs/TypeScript.html +++ b/docs/TypeScript.html @@ -311,7 +311,7 @@

Compiling TypeScript: ts_library<

Create a BUILD file next to your sources:

package(default_visibility=["//visibility:public"])
-load("//packages/typescript:index.bzl", "ts_library")
+load("@npm//@bazel/typescript:index.bzl", "ts_library")
 
 ts_library(
     name = "my_code",
@@ -420,7 +420,7 @@ 

Serving TypeScript for developmentTo use ts_devserver, you simply load the rule, and call it with deps that point to your ts_library target(s):

-
load("//packages/typescript:index.bzl", "ts_devserver", "ts_library")
+
load("@npm//@bazel/typescript:index.bzl", "ts_devserver", "ts_library")
 
 ts_library(
     name = "app",
@@ -633,7 +633,7 @@ 

ts_devserver

Label optional - //packages/typescript/devserver:devserver + @npm//@bazel/devserver:devserver @@ -645,7 +645,7 @@

ts_devserver

Label optional - //packages/typescript/devserver:devserver_darwin_amd64 + @npm//@bazel/devserver:devserver_darwin_amd64 diff --git a/docs/TypeScript.md b/docs/TypeScript.md index 821d3073fe..fde6651fee 100755 --- a/docs/TypeScript.md +++ b/docs/TypeScript.md @@ -174,7 +174,7 @@ Create a BUILD file next to your sources: {% highlight python %} package(default_visibility=["//visibility:public"]) -load("//packages/typescript:index.bzl", "ts_library") +load("@npm//@bazel/typescript:index.bzl", "ts_library") ts_library( name = "my_code", @@ -289,7 +289,7 @@ To use ts_devserver, you simply load the rule, and cal point to your ts_library target(s): {% highlight python %} -load("//packages/typescript:index.bzl", "ts_devserver", "ts_library") +load("@npm//@bazel/typescript:index.bzl", "ts_devserver", "ts_library") ts_library( name = "app", @@ -521,7 +521,7 @@ ts_devserver(name, Label optional - //packages/typescript/devserver:devserver + @npm//@bazel/devserver:devserver @@ -533,7 +533,7 @@ ts_devserver(name, Label optional - //packages/typescript/devserver:devserver_darwin_amd64 + @npm//@bazel/devserver:devserver_darwin_amd64 diff --git a/tools/stardoc/post-process-docs.js b/tools/stardoc/post-process-docs.js index a6bcaeebb4..c6433f6a24 100644 --- a/tools/stardoc/post-process-docs.js +++ b/tools/stardoc/post-process-docs.js @@ -11,6 +11,14 @@ const out = content .replace(/```(\w*?)\n((?:(?!```)[\s\S])+)```/g, (str, lang, block) => { // if no lang is defined, assume Python, it's likely right and the param is required return `{% highlight ${lang ? lang.trim() : 'python'} %}\n${block}{% endhighlight %}`; + }) + // replace the //packages/foo from the docs with references to @npm//@bazel/foo + // @npm is not the required name, but it seems to be the common case + // this reflects the similar transformation made when publishing the packages to npm + // via pkg_npm defined in //tools:defaults.bzl + .replace(/(?:@.*)*?\/\/packages\/([^:"\s]*)/g, (str, pkg) => { + const parts = pkg.split('/'); + return `@npm//@bazel/${parts[parts.length - 1]}`; }); // stamp the frontmatter into the post processed stardoc HTML