Skip to content

v2.0.0-beta0

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 10 Aug 23:27
· 262 commits to main since this release

This is the beginning of our 2.0.0 major release cycle, containing any breaking changes we've been saving up since 1.0. More breaking changes are possible before 2.0.0-rc0, at which point there will be only bugfixes before 2.0.0 final.

Note: we are looking for a corporate sponsor for this release! Your company will get prominent placement in any release announcements, on the release page itself, and on the project README. If you're looking to hire any DevInfra people, this is a great way to broadcast your company's position on supporting open source! If we don't find a sponsor, we may change to a more restrictive license for the 2.0 release, with the intent to restore it to Apache-2.0 for the 2.1 release.

Breaking Changes

  • We now require Bazel 6.0 or greater, since we rely on validation actions
  • We require that you select a value for the skipLibCheck flag, as there is no good default - you can either be fast or correct. Instructions are printed to the terminal on the first build.
  • We require that you select a value for the transpiler attribute. Again, there is no good default since the choices are to be fast or compatible. Documentation is at https://github.com/aspect-build/rules_ts/blob/2.x/docs/transpiler.md
  • "Persistent Worker" mode is no longer enabled by default. It requires a custom tsc compiler program, and we don't have the resources or funding to deal with the bugs this brings. We think that choosing a faster transpiler is a better solution. If your organization would like support for worker mode, you can fund the maintenance work. Or, if you'd like to take over the persistent worker Node.js program, we are open to relocating the code to a separate repository.
  • The supports_workers attribute on ts_project is now a tri-state [-1, 0, 1] rather than a boolean.
  • --define=VERBOSE_LOGS no longer has an effect, use the --@aspect_rules_ts//ts:verbose=true flag instead
  • Replace usage of load("@aspect_rules_ts//ts:repositories.bzl", "LATEST_VERSION") with LATEST_TYPESCRIPT_VERSION
  • The ts_project macro now produces a ts_project rule. Any bazel query expressions, aspect implementations, or other "leaky abstractions" that keyed on the kind of the underlying rule being "ts_project_rule" will need to be updated to the new name "ts_project".
  • json inputs that are not sources and do not have an input / output collision are now declared

Using Bzlmod with Bazel 6:

Add to your MODULE.bazel file:

bazel_dep(name = "aspect_rules_ts", version = "2.0.0-beta0")

rules_ts_ext = use_extension(
    "@aspect_rules_ts//ts:extensions.bzl",
    "ext",
    dev_dependency = True,
)

rules_ts_ext.deps()

use_repo(rules_ts_ext, "npm_typescript")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "aspect_rules_ts",
    sha256 = "71fff38c05c2b866dbada246f12f57db9c793e5fad36765223563e7f6a940bb0",
    strip_prefix = "rules_ts-2.0.0-beta0",
    url = "https://github.com/aspect-build/rules_ts/releases/download/v2.0.0-beta0/rules_ts-v2.0.0-beta0.tar.gz",
)

##################
# rules_ts setup #
##################
# Fetches the rules_ts dependencies.
# If you want to have a different version of some dependency,
# you should fetch it *before* calling this.
# Alternatively, you can skip calling this function, so long as you've
# already fetched all the dependencies.
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")

rules_ts_dependencies(
    # This keeps the TypeScript version in-sync with the editor, which is typically best.
    ts_version_from = "//:package.json",

    # Alternatively, you could pick a specific version, or use
    # load("@aspect_rules_ts//ts:repositories.bzl", "LATEST_TYPESCRIPT_VERSION")
    # ts_version = LATEST_TYPESCRIPT_VERSION
)

# Fetch and register node, if you haven't already
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

nodejs_register_toolchains(
    name = "node",
    node_version = DEFAULT_NODE_VERSION,
)

# Register aspect_bazel_lib toolchains;
# If you use npm_translate_lock or npm_import from aspect_rules_js you can omit this block.
load("@aspect_bazel_lib//lib:repositories.bzl", "register_copy_directory_toolchains", "register_copy_to_directory_toolchains")

register_copy_directory_toolchains()

register_copy_to_directory_toolchains()

What's Changed

New Contributors

Full Changelog: v1.3.3...v2.0.0-beta0