Skip to content

Commit 88a8438

Browse files
committed
Clean up new published markdown docs
1 parent 402b254 commit 88a8438

13 files changed

Lines changed: 131 additions & 46 deletions

File tree

‎packages/jasmine/BUILD.bazel‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ genrule(
3030
cmd = "cp $< $@",
3131
)
3232

33+
# Ugly genrule depending on local linux environment to build the README out of skylark doc generation.
34+
# Only referenced when we do a release.
35+
# TODO: This ought to be possible with stardoc alone. Need to coordinate with Chris Parsons.
36+
genrule(
37+
name = "generate_README",
38+
srcs = [
39+
"//docs",
40+
"//docs:install.md",
41+
],
42+
outs = ["README.md"],
43+
cmd = "unzip -o -d docs $(location //docs:docs) && cat docs/install.md docs/src/*.md | sed 's/^##/\\\n##/' > $@",
44+
)
45+
3346
npm_package(
3447
name = "npm_package",
3548
srcs = [
@@ -41,5 +54,6 @@ npm_package(
4154
],
4255
deps = [
4356
":copy_LICENSE",
57+
":generate_README",
4458
],
4559
)

‎packages/jasmine/WORKSPACE‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,44 @@ yarn_install(
1212
package_json = "//:package.json",
1313
yarn_lock = "//:yarn.lock",
1414
)
15+
16+
# Dependencies for generating documentation
17+
18+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
19+
20+
http_archive(
21+
name = "io_bazel_rules_sass",
22+
sha256 = "894d7928df8da85e263d743c8434d4c10ab0a3f0708fed0d53394e688e3faf70",
23+
strip_prefix = "rules_sass-8ccf4f1c351928b55d5dddf3672e3667f6978d60",
24+
urls = ["https://github.com/bazelbuild/rules_sass/archive/8ccf4f1c351928b55d5dddf3672e3667f6978d60.zip"], # 2018-11-23
25+
)
26+
27+
http_archive(
28+
name = "bazel_skylib",
29+
strip_prefix = "bazel-skylib-d7c5518fa061ae18a20d00b14082705d3d2d885d",
30+
url = "https://github.com/bazelbuild/bazel-skylib/archive/d7c5518fa061ae18a20d00b14082705d3d2d885d.zip",
31+
)
32+
33+
http_archive(
34+
name = "io_bazel_skydoc",
35+
sha256 = "75fd965a71ca1f0d0406d0d0fb0964d24090146a853f58b432761a1a6c6b47b9",
36+
strip_prefix = "skydoc-82fdbfe797c6591d8732df0c0389a2b1c3e50992",
37+
url = "https://github.com/bazelbuild/skydoc/archive/82fdbfe797c6591d8732df0c0389a2b1c3e50992.zip", # 2018-12-12
38+
)
39+
40+
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
41+
42+
sass_repositories()
43+
44+
http_archive(
45+
name = "com_google_protobuf",
46+
sha256 = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2",
47+
strip_prefix = "protobuf-3.6.1.3",
48+
type = "zip",
49+
# v3.6.1.3 as of 2019-01-15
50+
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.6.1.3.zip"],
51+
)
52+
53+
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
54+
55+
skydoc_repositories()

‎packages/jasmine/docs/BUILD.bazel‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("@io_bazel_skydoc//skylark:skylark.bzl", "skylark_doc")
2+
3+
exports_files(["install.md"])
4+
5+
skylark_doc(
6+
name = "docs",
7+
srcs = [
8+
"//:src/jasmine_node_test.bzl",
9+
],
10+
format = "markdown",
11+
visibility = ["//:__subpackages__"],
12+
)

‎packages/jasmine/docs/install.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Jasmine rules for Bazel
2+
3+
**WARNING: this is beta-quality software. Breaking changes are likely. Not recommended for production use without expert support.**
4+
5+
The Jasmine rules run tests under the Jasmine framework with Bazel.
6+
7+
## Installation
8+
9+
Add the `@bazel/jasmine` npm package to your `devDependencies` in `package.json`.
10+
11+
Your `WORKSPACE` should declare a `yarn_install` or `npm_install` rule named `npm`.
12+
It should then install the rules found in the npm packages using the `install_bazel_dependencies' function.
13+
See https://github.com/bazelbuild/rules_nodejs/#quickstart
14+
15+
This causes the `@bazel/jasmine` package to be installed as a Bazel workspace named `npm_bazel_jasmine`.
16+

‎packages/jasmine/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "Run Jasmine tests under Bazel",
44
"license": "Apache 2.0",
55
"version": "0.0.0-PLACEHOLDER",
6+
"homepage": "https://github.com/bazelbuild/rules_nodejs/packages/jasmine",
67
"dependencies": {
78
"jasmine": "~3.3.1"
89
},
@@ -13,7 +14,6 @@
1314
}
1415
},
1516
"scripts": {
16-
"build": "bazel run :package.pack --workspace_status_command=../../tools/current_version.sh",
1717
"test": "bazel test //..."
1818
}
1919
}

‎packages/karma/docs/install.md‎

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,8 @@ The Karma rules run karma tests with Bazel.
99
Add the `@bazel/karma` npm package to your `devDependencies` in `package.json`.
1010

1111
Your `WORKSPACE` should declare a `yarn_install` or `npm_install` rule named `npm`.
12-
It should then install the rules found in the npm packages.
13-
14-
This is copied from the README for rules_nodejs:
15-
16-
```python
17-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
18-
19-
# Fetch rules_nodejs
20-
# (you can check https://github.com/bazelbuild/rules_nodejs/releases for a newer release than this)
21-
http_archive(
22-
name = "build_bazel_rules_nodejs",
23-
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.18.5/rules_nodejs-0.18.5.tar.gz"],
24-
sha256 = "c8cd6a77433f7d3bb1f4ac87f15822aa102989f8e9eb1907ca0cad718573985b",
25-
)
26-
27-
# Setup the NodeJS toolchain
28-
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install")
29-
node_repositories()
30-
31-
yarn_install(
32-
name = "npm",
33-
package_json = "//:package.json",
34-
yarn_lock = "//:yarn.lock",
35-
)
36-
37-
# Install all Bazel dependencies needed for npm packages that supply Bazel rules
38-
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
39-
install_bazel_dependencies()
40-
```
12+
It should then install the rules found in the npm packages using the `install_bazel_dependencies' function.
13+
See https://github.com/bazelbuild/rules_nodejs/#quickstart
4114

4215
This causes the `@bazel/karma` package to be installed as a Bazel workspace named `npm_bazel_karma`.
4316

‎packages/karma/karma_web_test.bzl‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ def _write_karma_config(ctx, files, amd_names_shim):
178178
return configuration
179179

180180
def run_karma_web_test(ctx):
181-
"""Creates an action that can run karma.
181+
"""Internal utility for use by Bazel rule authors.
182182
183+
Creates an action that can run karma.
183184
This is also used by ts_web_test_rule.
184185
185186
Args:
@@ -385,8 +386,12 @@ def karma_web_test_suite(
385386
browser_overrides: Dictionary; optional; default is an empty dictionary. A
386387
dictionary mapping from browser names to browser-specific web_test
387388
attributes, such as shard_count, flakiness, timeout, etc. For example:
388-
{'//browsers:chrome-native': {'shard_count': 3, 'flaky': 1}
389-
'//browsers:firefox-native': {'shard_count': 1, 'timeout': 100}}.
389+
```
390+
{
391+
'//browsers:chrome-native': {'shard_count': 3, 'flaky': 1},
392+
'//browsers:firefox-native': {'shard_count': 1, 'timeout': 100},
393+
}
394+
```
390395
config: Label; optional; Configuration of web test features.
391396
flaky: A boolean specifying that the test is flaky. If set, the test will
392397
be retried up to 3 times (default: 0)

‎packages/karma/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"homepage": "https://github.com/bazelbuild/rules_typescript",
55
"license": "Apache-2.0",
66
"version": "0.0.0-PLACEHOLDER",
7+
"homepage": "https://github.com/bazelbuild/rules_nodejs/packages/karma",
78
"keywords": [
89
"karma",
910
"bazel"

‎packages/typescript/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ genrule(
3636
srcs = [
3737
"//docs",
3838
"//docs:install.md",
39+
"@build_bazel_rules_typescript//internal:common/compilation.bzl",
3940
],
4041
outs = ["README.md"],
4142
cmd = """unzip -o -d docs $(location //docs:docs) \

‎packages/typescript/docs/install.md‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ These are now documented in the README at http://npmjs.com/package/@bazel/karma
99

1010
## Installation
1111

12-
This assumes you have already set up rules_nodejs following its [README](https://github.com/bazelbuild/rules_nodejs/blob/master/README.md)
13-
1412
Add a devDependency on `@bazel/typescript`
1513

1614
```sh
@@ -19,6 +17,18 @@ $ yarn add -D @bazel/typescript
1917
$ npm install --save-dev @bazel/typescript
2018
```
2119

20+
Your `WORKSPACE` should declare a `yarn_install` or `npm_install` rule named `npm`.
21+
It should then install the rules found in the npm packages using the `install_bazel_dependencies` function.
22+
See https://github.com/bazelbuild/rules_nodejs/#quickstart
23+
24+
Add to your `WORKSPACE` file, after `install_bazel_dependencies()`:
25+
26+
```python
27+
# Setup TypeScript toolchain
28+
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
29+
ts_setup_workspace()
30+
```
31+
2232
Create a `BUILD.bazel` file in your workspace root. If your `tsconfig.json` file is in the root, use
2333

2434
```python
@@ -34,14 +44,6 @@ alias(
3444
)
3545
```
3646

37-
Add to your `WORKSPACE` file, after `install_bazel_dependencies()`:
38-
39-
```python
40-
# Setup TypeScript toolchain
41-
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
42-
ts_setup_workspace()
43-
```
44-
4547
# Self-managed npm dependencies
4648

4749
We recommend you use Bazel managed dependencies but if you would like

0 commit comments

Comments
 (0)