Skip to content

Commit

Permalink
docs: replace references to //packages/ with the @npm//@bazel/ equiva…
Browse files Browse the repository at this point in the history
…lent (#2154)
  • Loading branch information
mattem authored Aug 31, 2020
1 parent 09ec233 commit ba4fdb8
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 22 deletions.
4 changes: 2 additions & 2 deletions docs/Jasmine.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ <h2 id="jasmine_node_test">jasmine_node_test</h2>
A label providing the <code>@bazel/jasmine</code> npm dependency.
</td>
<td>
"//packages/jasmine"
"@npm//@bazel/jasmine"
</td>
</tr>
<tr id="jasmine_node_test-jasmine_entry_point">
Expand All @@ -283,7 +283,7 @@ <h2 id="jasmine_node_test">jasmine_node_test</h2>
A label providing the <code>@bazel/jasmine</code> entry point.
</td>
<td>
"//packages/jasmine:jasmine_runner.js"
"@npm//@bazel/jasmine:jasmine_runner.js"
</td>
</tr>
<tr id="jasmine_node_test-kwargs">
Expand Down
4 changes: 2 additions & 2 deletions docs/Jasmine.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jasmine_node_test(<a href="#jasmine_node_test-name">name</a>, <a href="#jasmine_
A label providing the <code>@bazel/jasmine</code> npm dependency.
</td>
<td>
"//packages/jasmine"
"@npm//@bazel/jasmine"
</td>
</tr>
<tr id="jasmine_node_test-jasmine_entry_point">
Expand All @@ -132,7 +132,7 @@ jasmine_node_test(<a href="#jasmine_node_test-name">name</a>, <a href="#jasmine_
A label providing the <code>@bazel/jasmine</code> entry point.
</td>
<td>
"//packages/jasmine:jasmine_runner.js"
"@npm//@bazel/jasmine:jasmine_runner.js"
</td>
</tr>
<tr id="jasmine_node_test-kwargs">
Expand Down
2 changes: 1 addition & 1 deletion docs/Protractor.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ <h2 id="protractor_web_test">protractor_web_test</h2>
List of peer npm deps required by protractor_web_test
</td>
<td>
["@build_bazel_rules_nodejs//packages/protractor", "@npm//protractor"]
["@npm//@bazel/protractor", "@npm//protractor"]
</td>
</tr>
<tr id="protractor_web_test-protractor_entry_point">
Expand Down
2 changes: 1 addition & 1 deletion docs/Protractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protractor_web_test(<a href="#protractor_web_test-name">name</a>, <a href="#prot
List of peer npm deps required by protractor_web_test
</td>
<td>
["@build_bazel_rules_nodejs//packages/protractor", "@npm//protractor"]
["@npm//@bazel/protractor", "@npm//protractor"]
</td>
</tr>
<tr id="protractor_web_test-protractor_entry_point">
Expand Down
4 changes: 2 additions & 2 deletions docs/Rollup.html
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ <h2 id="rollup_bundle">rollup_bundle</h2>
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/rollup:rollup.config.js
@npm//@bazel/rollup:rollup.config.js
</td>
</tr>
<tr id="rollup_bundle-deps">
Expand Down Expand Up @@ -445,7 +445,7 @@ <h2 id="rollup_bundle">rollup_bundle</h2>
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/rollup/bin:rollup-worker
@npm//@bazel/bin:rollup-worker
</td>
</tr>
<tr id="rollup_bundle-silent">
Expand Down
4 changes: 2 additions & 2 deletions docs/Rollup.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ If not set, a default basic Rollup config is used.
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/rollup:rollup.config.js
@npm//@bazel/rollup:rollup.config.js
</td>
</tr>
<tr id="rollup_bundle-deps">
Expand Down Expand Up @@ -303,7 +303,7 @@ Otherwise, the outputs are assumed to be a single file.
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/rollup/bin:rollup-worker
@npm//@bazel/bin:rollup-worker
</td>
</tr>
<tr id="rollup_bundle-silent">
Expand Down
4 changes: 2 additions & 2 deletions docs/Terser.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ <h2 id="terser_minified">terser_minified</h2>
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/terser:terser_config.default.json
@npm//@bazel/terser:terser_config.default.json
</td>
</tr>
<tr id="terser_minified-debug">
Expand Down Expand Up @@ -334,7 +334,7 @@ <h2 id="terser_minified">terser_minified</h2>
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/terser/bin:terser
@npm//@bazel/bin:terser
</td>
</tr>
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions docs/Terser.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ If <code>config_file</code> isn't supplied, Bazel will use a default config file
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/terser:terser_config.default.json
@npm//@bazel/terser:terser_config.default.json
</td>
</tr>
<tr id="terser_minified-debug">
Expand Down Expand Up @@ -188,7 +188,7 @@ If you want to do this, you can pass a filegroup here.
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/terser/bin:terser
@npm//@bazel/bin:terser
</td>
</tr>
</tbody>
Expand Down
8 changes: 4 additions & 4 deletions docs/TypeScript.html
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ <h3 id="compiling-typescript-ts_library">Compiling TypeScript: <code>ts_library<
<p>Create a <code>BUILD</code> file next to your sources:</p>

<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">package</span><span class="p">(</span><span class="n">default_visibility</span><span class="o">=</span><span class="p">[</span><span class="s">"//visibility:public"</span><span class="p">])</span>
<span class="n">load</span><span class="p">(</span><span class="s">"//packages/typescript:index.bzl"</span><span class="p">,</span> <span class="s">"ts_library"</span><span class="p">)</span>
<span class="n">load</span><span class="p">(</span><span class="s">"@npm//@bazel/typescript:index.bzl"</span><span class="p">,</span> <span class="s">"ts_library"</span><span class="p">)</span>

<span class="n">ts_library</span><span class="p">(</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">"my_code"</span><span class="p">,</span>
Expand Down Expand Up @@ -420,7 +420,7 @@ <h2 id="serving-typescript-for-development">Serving TypeScript for development</
<p>To use <code>ts_devserver</code>, you simply <code>load</code> the rule, and call it with <code>deps</code> that
point to your <code>ts_library</code> target(s):</p>

<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">load</span><span class="p">(</span><span class="s">"//packages/typescript:index.bzl"</span><span class="p">,</span> <span class="s">"ts_devserver"</span><span class="p">,</span> <span class="s">"ts_library"</span><span class="p">)</span>
<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="n">load</span><span class="p">(</span><span class="s">"@npm//@bazel/typescript:index.bzl"</span><span class="p">,</span> <span class="s">"ts_devserver"</span><span class="p">,</span> <span class="s">"ts_library"</span><span class="p">)</span>

<span class="n">ts_library</span><span class="p">(</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">"app"</span><span class="p">,</span>
Expand Down Expand Up @@ -633,7 +633,7 @@ <h2 id="ts_devserver">ts_devserver</h2>
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/typescript/devserver:devserver
@npm//@bazel/devserver:devserver
</td>
</tr>
<tr id="ts_devserver-devserver_host">
Expand All @@ -645,7 +645,7 @@ <h2 id="ts_devserver">ts_devserver</h2>
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/typescript/devserver:devserver_darwin_amd64
@npm//@bazel/devserver:devserver_darwin_amd64
</td>
</tr>
<tr id="ts_devserver-entry_module">
Expand Down
8 changes: 4 additions & 4 deletions docs/TypeScript.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Create a <code>BUILD</code> 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",
Expand Down Expand Up @@ -289,7 +289,7 @@ To use <code>ts_devserver</code>, you simply <code>load</code> the rule, and cal
point to your <code>ts_library</code> 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",
Expand Down Expand Up @@ -521,7 +521,7 @@ ts_devserver(<a href="#ts_devserver-name">name</a>, <a href="#ts_devserver-addit
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/typescript/devserver:devserver
@npm//@bazel/devserver:devserver
</td>
</tr>
<tr id="ts_devserver-devserver_host">
Expand All @@ -533,7 +533,7 @@ ts_devserver(<a href="#ts_devserver-name">name</a>, <a href="#ts_devserver-addit
<td><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></td>
<td>optional</td>
<td>
//packages/typescript/devserver:devserver_darwin_amd64
@npm//@bazel/devserver:devserver_darwin_amd64
</td>
</tr>
<tr id="ts_devserver-entry_module">
Expand Down
8 changes: 8 additions & 0 deletions tools/stardoc/post-process-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba4fdb8

Please sign in to comment.