Using Bzlmod:
Add to your MODULE.bazel file:
bazel_dep(name = "aspect_rules_ts", version = "3.7.0")
rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext", dev_dependency = True)
rules_ts_ext.deps(
ts_version_from = "//:package.json",
)
use_repo(rules_ts_ext, "npm_typescript")Using legacy 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 = "6fd16aa24c2e8547b72561ece1c7d307b77a5f98f0402934396f6eefbac59aa2",
strip_prefix = "rules_ts-3.7.0",
url = "https://github.com/aspect-build/rules_ts/releases/download/v3.7.0/rules_ts-v3.7.0.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
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
# 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", "aspect_bazel_lib_dependencies")
aspect_bazel_lib_dependencies()To use rules_ts with bazel-lib 2.x, you must additionally register the coreutils toolchain.
load("@aspect_bazel_lib//lib:repositories.bzl", "register_coreutils_toolchains")
register_coreutils_toolchains()What's Changed
- chore: add bazel8 testing on ci by @jbedard in #794
- ci: enable bazel8 tests, removal bazel6 bcr tests by @jbedard in #830
- Update
examples/isolated_declarations/README.mdby @jthemphill in #833 - chore: adopt bazelrc-preset by @alexeagle in #831
- chore: enable aspect workflows for more Bazel versions by @alexeagle in #832
- docs: remove resolved known issues from README by @michael-pplx in #835
- chore: turn on tools_telemetry by @jbedard in #837
- refactor: remove unused internal attributes by @jbedard in #845
- feat: add --@aspect_rules_ts//ts:validation_typecheck config for type-checking as a validation action by @jbedard in #839
- docs: demonstrate issue with
isolated_typecheckand tsconfig compilerOptions.types by @jbedard in #838 - chore: upgrade aspect_tools_telemetry to 0.2.5 by @jbedard in #840
- chore(deps): Bump tools_telemetry by @arrdem in #847
- fix: transitive bzlmod usage of rules_ts by @jbedard in #844
New Contributors
- @jthemphill made their first contribution in #833
- @michael-pplx made their first contribution in #835
- @arrdem made their first contribution in #847
Full Changelog: v3.6.3...v3.7.0