| # Copyright 2017 The Bazel Authors. All rights reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| load("@bazel_skylib//rules:diff_test.bzl", "diff_test") |
| load("@bazel_skylib//rules:write_file.bzl", "write_file") |
| load("//tools/stardoc:index.bzl", "stardoc") |
| |
| stardoc( |
| name = "core", |
| out = "core.md_", |
| input = "//nodejs:index.for_docs.bzl", |
| deps = ["//nodejs:bzl"], |
| ) |
| |
| stardoc( |
| name = "builtins", |
| out = "builtins.md_", |
| input = "//:index.for_docs.bzl", |
| tags = ["fix-windows"], |
| deps = [ |
| "//:bzl", |
| "//internal/node:bzl", |
| "@bazel_skylib//lib:types", |
| "@rules_nodejs//nodejs:bzl", |
| ], |
| ) |
| |
| stardoc( |
| name = "providers", |
| out = "providers.md_", |
| input = "//:providers.bzl", |
| symbol_names = [ |
| "ExternalNpmPackageInfo", |
| "js_ecma_script_module_info", |
| "js_named_module_info", |
| "JSEcmaScriptModuleInfo", |
| "JSNamedModuleInfo", |
| "node_modules_aspect", |
| "NodeRuntimeDepsInfo", |
| "run_node", |
| "NpmPackageInfo", |
| ], |
| tags = ["fix-windows"], |
| deps = [ |
| "//:bzl", |
| "@bazel_skylib//lib:types", |
| "@rules_nodejs//nodejs:bzl", |
| ], |
| ) |
| |
| _READMES = { |
| "Built-ins": "//docs:builtins.md_", |
| "Core": "//docs:core.md_", |
| "Cypress": "//packages/cypress:README.md", |
| "Jasmine": "//packages/jasmine:README.md", |
| "Providers": "//docs:providers.md_", |
| "Rollup": "//packages/rollup:README.md", |
| "Terser": "//packages/terser:README.md", |
| "Toolchains": "//toolchains:README.md", |
| "TypeScript": "//packages/typescript:README.md", |
| } |
| |
| [ |
| diff_test( |
| name = "check_" + k.lower(), |
| failure_message = "Please run: bazel run //docs:update", |
| file1 = k + ".md", |
| file2 = v, |
| tags = [ |
| # no need to run on more than one platform |
| "no-bazelci-windows", |
| # diff_test has line endings issues on Windows |
| "fix-windows", |
| ], |
| ) |
| for [ |
| k, |
| v, |
| ] in _READMES.items() |
| ] |
| |
| write_file( |
| name = "gen_update", |
| out = "update.sh", |
| content = [ |
| "#!/usr/bin/env bash", |
| "cd $BUILD_WORKSPACE_DIRECTORY", |
| ] + [ |
| "cp -fv dist/bin/{1} docs/{0}.md".format( |
| k, |
| v.replace(":", "/"), |
| ) |
| for [ |
| k, |
| v, |
| ] in _READMES.items() |
| ], |
| ) |
| |
| sh_binary( |
| name = "update", |
| srcs = ["update.sh"], |
| data = _READMES.values(), |
| ) |