Skip to content

Commit

Permalink
feat: upgrade to rules_js 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Apr 21, 2024
1 parent ee39d23 commit be120ff
Show file tree
Hide file tree
Showing 23 changed files with 94 additions and 182 deletions.
7 changes: 0 additions & 7 deletions .aspect/bazelrc/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# We recommend enforcing a policy that keeps your CI from being slowed down
# by individual test targets that should be optimized
# or split up into multiple test targets with sharding or manually.
# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI.
# Docs: https://bazel.build/docs/user-manual#test-timeout-filters
test --test_timeout_filters=-eternal

# Set this flag to enable re-tries of failed tests on CI.
# When any test target fails, try one or more times. This applies regardless of whether the "flaky"
# tag appears on the target definition.
Expand Down
2 changes: 1 addition & 1 deletion .bazeliskrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BAZELISK_BASE_URL=https://github.com/aspect-build/aspect-cli/releases/download
USE_BAZEL_VERSION=aspect/5.8.19
USE_BAZEL_VERSION=aspect/5.9.25
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
7.0.2
7.1.1
# The first line of this file is used by Bazelisk and Bazel to be sure
# the right version of Bazel is used to build and test this repo.
# This also defines which version is used on CI.
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@ bazel-*
.bazelrc.user
node_modules
.DS_Store

# Don't commit lockfile for now as it is unstable. Do allow for it to be
# created, however, since it gives a performance boost for local development.
# https://github.com/bazelbuild/bazel/issues/19026
# https://github.com/bazelbuild/bazel/issues/19621
# https://github.com/bazelbuild/bazel/issues/19971
# https://github.com/bazelbuild/bazel/issues/20272
# https://github.com/bazelbuild/bazel/issues/20369
MODULE.bazel.lock
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: buildifier-lint
# Enforce that commit messages allow for later changelog generation
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.13.0
rev: v3.24.0
hooks:
# Requires that commitizen is already installed
- id: commitizen
Expand Down
3 changes: 2 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

#gazelle:exclude internal_deps.bzl
buildifier(
name = "buildifier",
exclude_patterns = ["./.git/*"],
Expand All @@ -16,3 +15,5 @@ buildifier(
mode = "diff",
tags = ["manual"], # tag as manual so windows ci does not build it by default
)

# gazelle:exclude internal_deps.bzl
13 changes: 8 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.40.0")
bazel_dep(name = "aspect_rules_js", version = "1.35.0")
# Lower-bounds (minimum) versions for direct runtime dependencies
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "aspect_rules_js", version = "2.0.0-alpha.2")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_nodejs", version = "5.8.3")
bazel_dep(name = "rules_nodejs", version = "6.1.0")

esbuild = use_extension("@aspect_rules_esbuild//esbuild:extensions.bzl", "esbuild")
esbuild.toolchain(
Expand All @@ -19,7 +20,9 @@ esbuild.toolchain(
)
use_repo(esbuild, "esbuild_toolchains")

register_toolchains("@esbuild_toolchains//:all")

####### Dev dependencies ########

bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")

register_toolchains("@esbuild_toolchains//:all")
22 changes: 4 additions & 18 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Declare the local Bazel workspace.
workspace(
# see https://docs.bazel.build/versions/main/skylark/deploying.html#workspace
name = "aspect_rules_esbuild",
)
workspace(name = "aspect_rules_esbuild")

load(":internal_deps.bzl", "rules_esbuild_internal_deps")

Expand All @@ -14,19 +10,9 @@ load("//esbuild:dependencies.bzl", "rules_esbuild_dependencies")
# Fetch dependencies which users need as well
rules_esbuild_dependencies()

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()

load("@aspect_bazel_lib//lib:repositories.bzl", "DEFAULT_YQ_VERSION", "aspect_bazel_lib_dependencies", "register_coreutils_toolchains", "register_yq_toolchains")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

aspect_bazel_lib_dependencies()

register_coreutils_toolchains()

register_yq_toolchains(
version = DEFAULT_YQ_VERSION,
)
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)

load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")

Expand All @@ -48,7 +34,7 @@ esbuild_register_toolchains(
)

# Install additional packages to test esbuild plugins
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")

npm_translate_lock(
name = "esbuild_plugins",
Expand Down
2 changes: 1 addition & 1 deletion docs/esbuild.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions e2e/bundle/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"Bazel dependencies"

bazel_dep(name = "aspect_rules_esbuild", version = "0.0.0", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.2.0", dev_dependency = True)

local_path_override(
module_name = "aspect_rules_esbuild",
path = "../..",
)

bazel_dep(name = "aspect_bazel_lib", version = "2.7.1", dev_dependency = True)
16 changes: 2 additions & 14 deletions e2e/bundle/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,9 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc

rules_esbuild_dependencies()

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

rules_js_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

# If you didn't already register a toolchain providing nodejs, do that:
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

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

# Register a toolchain containing esbuild npm package and native bindings
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")
Expand Down
14 changes: 4 additions & 10 deletions e2e/npm-links/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
"Bazel dependencies"

bazel_dep(name = "aspect_rules_esbuild", version = "0.0.0", dev_dependency = True)
bazel_dep(name = "aspect_rules_js", version = "1.34.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

local_path_override(
module_name = "aspect_rules_esbuild",
path = "../..",
)

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)
bazel_dep(name = "aspect_rules_js", version = "2.0.0-alpha.2", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
Expand Down
17 changes: 3 additions & 14 deletions e2e/npm-links/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,11 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc

rules_esbuild_dependencies()

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

rules_js_dependencies()
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

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

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")

npm_translate_lock(
name = "npm",
Expand Down
6 changes: 2 additions & 4 deletions e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"Bazel dependencies"

bazel_dep(name = "aspect_rules_esbuild", version = "0.0.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

local_path_override(
module_name = "aspect_rules_esbuild",
path = "../..",
)

bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)
16 changes: 2 additions & 14 deletions e2e/smoke/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,9 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc

rules_esbuild_dependencies()

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

rules_js_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

# If you didn't already register a toolchain providing nodejs, do that:
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

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

# Register a toolchain containing esbuild npm package and native bindings
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")
Expand Down
6 changes: 2 additions & 4 deletions e2e/sourcemaps/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"Bazel dependencies"

bazel_dep(name = "aspect_rules_esbuild", version = "0.0.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

local_path_override(
module_name = "aspect_rules_esbuild",
path = "../..",
)

bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)
18 changes: 2 additions & 16 deletions e2e/sourcemaps/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,9 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc

rules_esbuild_dependencies()

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

rules_js_dependencies()

# For convenience, npm_translate_lock does this call automatically.
# You can omit this if you have any npm_translate_lock calls.
load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

# If you didn't already register a toolchain providing nodejs, do that:
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

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

# Register a toolchain containing esbuild npm package and native bindings
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")
Expand Down
6 changes: 2 additions & 4 deletions e2e/tsconfig/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"Bazel dependencies"

bazel_dep(name = "aspect_rules_esbuild", version = "0.0.0", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.2.0", dev_dependency = True)

local_path_override(
module_name = "aspect_rules_esbuild",
path = "../..",
)

bazel_dep(name = "aspect_bazel_lib", version = "2.7.1", dev_dependency = True)
15 changes: 2 additions & 13 deletions e2e/tsconfig/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,9 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc

rules_esbuild_dependencies()

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

rules_js_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

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

load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")

Expand Down
17 changes: 9 additions & 8 deletions esbuild/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@ def rules_esbuild_dependencies():

http_archive(
name = "aspect_bazel_lib",
sha256 = "f6ef68871d206cf8f5f4eea83d26a366563a631b020afe1da2f838a9bff035c0",
strip_prefix = "bazel-lib-1.40.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.40.0/bazel-lib-v1.40.0.tar.gz",
sha256 = "b554eb7942a5ab44c90077df6a0c76fc67c5874c9446a007e9ba68be82bd4796",
strip_prefix = "bazel-lib-2.7.1",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.1/bazel-lib-v2.7.1.tar.gz",
)

http_archive(
name = "aspect_rules_js",
sha256 = "76a04ef2120ee00231d85d1ff012ede23963733339ad8db81f590791a031f643",
strip_prefix = "rules_js-1.34.1",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.34.1/rules_js-v1.34.1.tar.gz",
sha256 = "b627acf34f928507dfabae69d3fd8702ce3d45bed568ad4c44b243cb789f08c6",
strip_prefix = "rules_js-2.0.0-alpha.2",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.0.0-alpha.2/rules_js-v2.0.0-alpha.2.tar.gz",
)

http_archive(
name = "rules_nodejs",
sha256 = "8fc8e300cb67b89ceebd5b8ba6896ff273c84f6099fc88d23f24e7102319d8fd",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.4/rules_nodejs-core-5.8.4.tar.gz"],
sha256 = "dddd60acc3f2f30359bef502c9d788f67e33814b0ddd99aa27c5a15eb7a41b8c",
strip_prefix = "rules_nodejs-6.1.0",
url = "https://github.com/bazelbuild/rules_nodejs/releases/download/v6.1.0/rules_nodejs-v6.1.0.tar.gz",
)
Loading

0 comments on commit be120ff

Please sign in to comment.