From 9354a749a36489b415fa0983d273729b936f57ef Mon Sep 17 00:00:00 2001 From: Takeo Sawada Date: Thu, 31 Oct 2024 23:13:57 +0800 Subject: [PATCH] Migrate everything to bzlmod --- MODULE.bazel | 39 ++++++++++++++++++++++++++++++++++ WORKSPACE | 59 ---------------------------------------------------- 2 files changed, 39 insertions(+), 59 deletions(-) delete mode 100644 WORKSPACE diff --git a/MODULE.bazel b/MODULE.bazel index 1b837d5..07de1ce 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,3 +8,42 @@ bazel_dep( version = "7.3.1", dev_dependency = True, ) + +bazel_dep(name = "aspect_bazel_lib", version = "2.9.3") + +bazel_dep(name = "aspect_rules_js", version = "1.42.3") + +####### Node.js version ######### +# By default you get the node version from DEFAULT_NODE_VERSION in @rules_nodejs//nodejs:repositories.bzl +# Optionally you can pin a different node version: +bazel_dep(name = "rules_nodejs", version = "5.8.3") +node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node") +node.toolchain(node_version = "16.14.2") +################################# + +npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True) + +npm.npm_translate_lock( + name = "npm", + pnpm_lock = "//:pnpm-lock.yaml", + verify_node_modules_ignored = "//:.bazelignore", +) + +use_repo(npm, "npm") + +pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm") + +# Allows developers to use the matching pnpm version, for example: +# bazel run -- @pnpm --dir /home/runner/work/rules_js/rules_js install +use_repo(pnpm, "pnpm") + + +bazel_dep(name = "aspect_rules_ts", version = "2.4.2") + +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") +bazel_dep(name = "aspect_rules_esbuild", version = "0.20.1") + diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index 31732e3..0000000 --- a/WORKSPACE +++ /dev/null @@ -1,59 +0,0 @@ -workspace(name = "com_github_tsawada_bazel_github_actions_cache") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "aspect_rules_ts", - sha256 = "97a8246bf6d1c7077b296e90a6e307bf8eabed02c5bca84d46db81efbf6ead41", - strip_prefix = "rules_ts-2.4.0", - url = "https://github.com/aspect-build/rules_ts/releases/download/v2.4.0/rules_ts-v2.4.0.tar.gz", -) - -load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies") - -rules_ts_dependencies(ts_version_from = "//:package.json") - -load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") - -rules_js_dependencies() - -load("@bazel_features//:deps.bzl", "bazel_features_deps") - -bazel_features_deps() - -load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") - -nodejs_register_toolchains( - name = "node16", - node_version = "16.16.0", -) - -load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock") - -npm_translate_lock( - name = "npm", - pnpm_lock = "//:pnpm-lock.yaml", - verify_node_modules_ignored = "//:.bazelignore", -) - -load("@npm//:repositories.bzl", "npm_repositories") - -npm_repositories() - -http_archive( - name = "aspect_rules_esbuild", - sha256 = "1e365451341ffb2490193292dfd9953f2ca009586c2381cb4dc08d01e48866b7", - strip_prefix = "rules_esbuild-0.12.0", - url = "https://github.com/aspect-build/rules_esbuild/archive/refs/tags/v0.12.0.tar.gz", -) - -load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependencies") - -rules_esbuild_dependencies() - -load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_VERSION", "esbuild_register_toolchains") - -esbuild_register_toolchains( - name = "esbuild", - esbuild_version = LATEST_VERSION, -)