Skip to content

Commit

Permalink
Adds @aspect_rules_js to WORKSPACE.
Browse files Browse the repository at this point in the history
Refs #48.

This does not replace the `@npm` workspace, but instead adds a new `@npm_rules_js` so the two can co-exist.
  • Loading branch information
dgp1130 committed Jul 20, 2022
1 parent f752496 commit 8ad1c8c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@npm_rules_js//:defs.bzl", "npm_link_all_packages")
load("//tools:publish.bzl", "publish_files")
load("//:index.bzl", "prerender_component", "prerender_component_publish_files")

Expand All @@ -15,6 +16,8 @@ ts_config(
deps = ["tsconfig.json"],
)

npm_link_all_packages(name = "node_modules")

bzl_library(
name = "rules_prerender",
srcs = [
Expand Down
26 changes: 24 additions & 2 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@ http_archive(
sha256 = "2b2004784358655f334925e7eadc7ba80f701144363df949b3293e1ae7a2fb7b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.0/rules_nodejs-5.4.0.tar.gz"],
)

# Load `rules_nodejs` dependencies.
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
build_bazel_rules_nodejs_dependencies()

# Load `@aspect_rules_js`.
http_archive(
name = "aspect_rules_js",
sha256 = "80e168f9cd62f3640de429b70b34ff817d0d94ada2abaf2cffeef46e35434e1d",
strip_prefix = "rules_js-1.0.0-rc.1",
url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.0.0-rc.1.tar.gz",
)

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

# Set the NodeJS version.
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
nodejs_register_toolchains(
Expand All @@ -44,6 +53,19 @@ npm_install(
exports_directories_only = False,
)

# Load the `@aspect_rules_js` version of the `@npm` workspace. Named `@npm_rules_js` to avoid
# conflicting with the existing workspace from `@build_bazel_rules_nodejs`.
# TODO(#48): Rename to `@npm` once migrated off `@build_bazel_rules_nodejs`.
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm_rules_js",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)

load("@npm_rules_js//:repositories.bzl", "npm_repositories")
npm_repositories()

# Load bazel_skylib.
http_archive(
name = "bazel_skylib",
Expand Down

0 comments on commit 8ad1c8c

Please sign in to comment.