Skip to content

2.1.0

Compare
Choose a tag to compare
@alexeagle alexeagle released this 07 Sep 01:38
· 1712 commits to stable since this release

Upgrade with:

http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "b16a03bf63952ae436185c74a5c63bec03c010ed422e230db526af55441a02dd",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.1.0/rules_nodejs-2.1.0.tar.gz"],
)

and update your @bazel-scoped npm packages!

New features

Brand-new docsite

Thanks to our core maintainer @mattem for finding time to rewrite the templates and generation process for our documentation site, bazelbuild.github.io/rules_nodejs

It's now got

  • a search feature, hooray
  • a right-nav to find your way through the table-of-contents of long pages
  • a more broken-down introductory section with things like debugging and stamping in their own page
  • it's much nicer on your eyes, by borrowing from the Bazel website
  • many pages (those not generated from stardoc) have an "edit this page" link to quickly suggest your fixes in the GitHub editor

Since this is freshly redone, there may be a bunch of formatting issues. And since the site is nice, we're also more keen on improving the text for clarity, correctness, and comprehension. Please file issues on the docs if you see problems.

tsconfig.json generation in ts_project rule

One problem we've heard from users migrating from ts_library to ts_project is that the latter requires adding a bunch of tsconfig.json files in their repository. If you have hundreds of ts_library rules this is a big obstacle to migration and to keeping your repo maintainable.

You can now pass a dictionary to the tsconfig attribute of ts_project

    ts_project(
        tsconfig = {
            "compilerOptions": {
                "declaration": True,
            },
        },
    )

it works for generated .ts source files, the TypeScript extends feature, and React-style projects that use emitDeclarationOnly.
Also you can mix-and-match properties in the tsconfig dictionary with attributes on the ts_project rule. Check out the tests folder for more examples of how this is used.

Consistent stamping with arbitrary variables

The documentation for stamping is updated with better handling of status variables. Now instead of hardcoding the BUILD_SCM_VERSION variable, you can use any status variable you like. This is important because variables starting with STABLE_ are special to Bazel, and guarantee a re-build will pick up changed values. You no longer need to perform a clean build to reliably get stamped artifacts!

Thanks to @thesayyn the pkg_web rule now does stamping as well, using the same substitutions dictionary as pkg_npm.

Bug Fixes

  • use golden_file_test instead (1ef6704)
  • typescript: add the tsBuildInfoFile option to ts_project (#2138) (16def64), closes #2137

Features

  • builtin: accept any stamp vars in pkg_npm (01bfe4d), closes #1694
  • builtin: support for substitutions (8a3f9b0)
  • typescript: generate tsconfig.json for ts_project (#2130) (09ec233), closes #2058