From 686f7c5a40d496d422d6e795d6f2e07c4817a010 Mon Sep 17 00:00:00 2001 From: Doug Parker Date: Sat, 18 Feb 2023 23:23:58 -0800 Subject: [PATCH] Adds load visibility to publish tools and refactors it to match new conventions. Refs #67. --- BUILD.bazel | 2 +- packages/declarative_shadow_dom/BUILD.bazel | 2 +- tools/publish/BUILD.bazel | 6 ++++++ tools/publish/defs.bzl | 5 +++++ tools/publish/npm_publish.bzl | 2 ++ 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tools/publish/defs.bzl diff --git a/BUILD.bazel b/BUILD.bazel index 75e27405..42564e09 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,7 +4,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//lib:dicts.bzl", "dicts") load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@rules_prerender_npm//:defs.bzl", "npm_link_all_packages") -load("//tools/publish:npm_publish.bzl", "npm_publish") +load("//tools/publish:defs.bzl", "npm_publish") load("//tools/stamping:stamp_package.bzl", "stamp_package") load("//tools/typescript:defs.bzl", "types_only") load("//:index.bzl", "link_prerender_component", "prerender_component") diff --git a/packages/declarative_shadow_dom/BUILD.bazel b/packages/declarative_shadow_dom/BUILD.bazel index d887a994..eb286275 100644 --- a/packages/declarative_shadow_dom/BUILD.bazel +++ b/packages/declarative_shadow_dom/BUILD.bazel @@ -9,7 +9,7 @@ load( ) load("//tools/jasmine:defs.bzl", "jasmine_node_test") load("//tools/typescript:defs.bzl", "ts_project") -load("//tools/publish:npm_publish.bzl", "npm_publish") +load("//tools/publish:defs.bzl", "npm_publish") load("//tools/stamping:stamp_package.bzl", "stamp_package") prerender_component_publish_files( diff --git a/tools/publish/BUILD.bazel b/tools/publish/BUILD.bazel index 253d6228..0e8229c4 100644 --- a/tools/publish/BUILD.bazel +++ b/tools/publish/BUILD.bazel @@ -2,6 +2,12 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") exports_files(["npm_publish.sh"], visibility = ["//visibility:public"]) +bzl_library( + name = "defs", + srcs = ["defs.bzl"], + deps = [":npm_publish"], +) + bzl_library( name = "npm_publish", srcs = ["npm_publish.bzl"], diff --git a/tools/publish/defs.bzl b/tools/publish/defs.bzl new file mode 100644 index 00000000..86585c41 --- /dev/null +++ b/tools/publish/defs.bzl @@ -0,0 +1,5 @@ +load(":npm_publish.bzl", _npm_publish = "npm_publish") + +visibility("public") + +npm_publish = _npm_publish diff --git a/tools/publish/npm_publish.bzl b/tools/publish/npm_publish.bzl index 7907f6ba..106aabad 100644 --- a/tools/publish/npm_publish.bzl +++ b/tools/publish/npm_publish.bzl @@ -3,6 +3,8 @@ load("@aspect_rules_js//npm:providers.bzl", "NpmPackageInfo") load("@bazel_skylib//rules:build_test.bzl", "build_test") load("//common:label.bzl", "absolute", "file_path_of") +visibility("private") + def npm_publish(name, package, npmrc, testonly = None, visibility = None): """Publishes the given `npm_package()` to NPM.