From 8a3ed72bb5e328449a9325de945b51b1882476c3 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 26 Apr 2022 18:03:41 -0700 Subject: [PATCH] fix: @swc_cli repository is referenced at runtime, so users have to create it too (#29) --- .github/workflows/workspace_snippet.sh | 6 ++++++ WORKSPACE | 10 ---------- swc/repositories.bzl | 10 +++++++++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/workspace_snippet.sh b/.github/workflows/workspace_snippet.sh index 37e7e11..81b87a4 100755 --- a/.github/workflows/workspace_snippet.sh +++ b/.github/workflows/workspace_snippet.sh @@ -44,5 +44,11 @@ nodejs_register_toolchains( name = "node16", node_version = "16.9.0", ) +load("@aspect_bazel_lib//lib:repositories.bzl", "DEFAULT_YQ_VERSION", "register_yq_toolchains") + +register_yq_toolchains( + version = DEFAULT_YQ_VERSION, +) + \`\`\` EOF diff --git a/WORKSPACE b/WORKSPACE index 2db5d67..276def3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -32,16 +32,6 @@ nodejs_register_toolchains( node_version = "16.9.0", ) -load("@aspect_rules_js//js:npm_import.bzl", "translate_pnpm_lock") - -# This is used to generate code in this repo, but otherwise unused -# at runtime or by users directly. -translate_pnpm_lock( - name = "swc_cli", - node_repository = "node16", - pnpm_lock = "@aspect_rules_swc//swc:pnpm-lock.yaml", -) - load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() diff --git a/swc/repositories.bzl b/swc/repositories.bzl index f34139c..7645632 100644 --- a/swc/repositories.bzl +++ b/swc/repositories.bzl @@ -4,7 +4,7 @@ These are needed for local dev, and users must install them as well. See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies """ -load("@aspect_rules_js//js:npm_import.bzl", "npm_import") +load("@aspect_rules_js//js:npm_import.bzl", "npm_import", "translate_pnpm_lock") load("//swc/private:toolchains_repo.bzl", "PLATFORMS", "toolchains_repo") load("//swc/private:versions.bzl", "TOOL_VERSIONS") load("//swc:cli_repositories.bzl", _cli_repositories = "npm_repositories") @@ -95,4 +95,12 @@ def swc_register_toolchains(name, register = True, **kwargs): version = "1.1.0", ) + translate_pnpm_lock( + name = "swc_cli", + node_repository = "node16", + pnpm_lock = "@aspect_rules_swc//swc:pnpm-lock.yaml", + ) + + # We ALSO re-declare the results of the previous translate_pnpm_lock + # so that users don't have to make an extra load/execution in their WORKSPACE _cli_repositories()