Skip to content

Commit

Permalink
chore: cleanup WORKSPACE and MODULE.bazel files
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Apr 22, 2024
1 parent 91037dd commit 15b1947
Show file tree
Hide file tree
Showing 47 changed files with 357 additions and 309 deletions.
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.9.24
USE_BAZEL_VERSION=aspect/5.9.25
20 changes: 20 additions & 0 deletions .github/workflows/buildifier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Buildifier

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: buildifier
run: bazel run --enable_bzlmod //:buildifier.check
2 changes: 1 addition & 1 deletion .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bazel_dep(name = "aspect_rules_js", version = "${TAG:1}")
# 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 = "6.1.0")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)
node.toolchain(node_version = "16.14.2")
#################################
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ node_modules/
.DS_Store
.bazelrc.user

# Disable lockfile for now. It is unstable.
# 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
MODULE.bazel.lock
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ default_stages: [commit]
repos:
# Check formatting and lint for starlark code
- repo: https://github.com/keith/pre-commit-buildifier
rev: 6.1.0.1
rev: 6.4.0
hooks:
- id: buildifier
- id: buildifier-lint
# Enforce that commit messages allow for later changelog generation
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.18.0
rev: v3.24.0
hooks:
# Requires that commitizen is already installed
- id: commitizen
stages: [commit-msg]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v2.4.0'
rev: v3.1.0
hooks:
- id: prettier
- repo: https://github.com/koalaman/shellcheck-precommit
Expand Down
4 changes: 3 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@npm//:defs.bzl", "npm_link_all_packages", "npm_link_targets")
load("@pnpm__links//:defs.bzl", npm_link_pnpm = "npm_link_imported_package")
load("//npm:defs.bzl", "npm_link_package")
load("//js:defs.bzl", "js_library")
load("//npm:defs.bzl", "npm_link_package")

# Link all packages from the /WORKSPACE npm_translate_lock(name = "npm") and also packages from
# manual /WORKSPACE npm_import rules to bazel-bin/node_modules as well as the package store
Expand Down Expand Up @@ -99,6 +99,7 @@ buildifier(
lint_mode = "fix",
lint_warnings = ["-out-of-order-load"], # TODO: enable out-of-order-load
mode = "fix",
tags = ["manual"], # tag as manual so windows ci does not build it by default
)

buildifier(
Expand All @@ -107,6 +108,7 @@ buildifier(
lint_mode = "warn",
lint_warnings = ["-out-of-order-load"], # TODO: enable out-of-order-load
mode = "diff",
tags = ["manual"], # tag as manual so windows ci does not build it by default
)

alias(
Expand Down
8 changes: 4 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ module(
# Lower-bounds (minimum) versions for direct runtime dependencies.
# Do not bump these unless rules_js requires a newer version to function.
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "aspect_rules_lint", version = "0.12.0")
bazel_dep(name = "bazel_features", version = "1.9.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_nodejs", version = "6.1.0")
bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "rules_nodejs", version = "6.1.0")

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
use_repo(node, "nodejs_darwin_amd64")
Expand Down Expand Up @@ -46,9 +45,10 @@ use_repo(bazel_lib_toolchains, "bsd_tar_toolchains")

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

bazel_dep(name = "gazelle", version = "0.35.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "0.12.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.36.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "rules_go", version = "0.46.0", dev_dependency = True)

host = use_extension(
Expand Down
27 changes: 23 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
workspace(
# see https://docs.bazel.build/versions/main/skylark/deploying.html#workspace
name = "aspect_rules_js",
)
workspace(name = "aspect_rules_js")

# buildifier: disable=bzl-visibility
load("//js/private:dev_deps.bzl", "rules_js_dev_dependencies")
Expand Down Expand Up @@ -186,6 +183,28 @@ npm_import(
version = "8.4.0",
)

############################################
# Stardoc
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")

stardoc_repositories()

load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

rules_jvm_external_setup()

load("@io_bazel_stardoc//:deps.bzl", "stardoc_external_deps")

stardoc_external_deps()

load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install")

stardoc_pinned_maven_install()

# Buildifier
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")

Expand Down
14 changes: 4 additions & 10 deletions e2e/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
module(
name = "e2e_bzlmod",
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "bazel_skylib", version = "1.5.0")

bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
path = "../..",
)

bazel_dep(name = "aspect_bazel_lib", version = "2.7.1", 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",
Expand Down
7 changes: 1 addition & 6 deletions e2e/git_dep_metadata/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
module(
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
path = "../..",
Expand Down
14 changes: 9 additions & 5 deletions e2e/gyp_no_install_script/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "platforms", version = "0.0.8")

bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
path = "../..",
)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1", dev_dependency = True)
bazel_dep(name = "platforms", version = "0.0.9", dev_dependency = True)

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)
npm.npm_translate_lock(
name = "npm",
data = ["//:package.json"],
Expand Down
5 changes: 2 additions & 3 deletions e2e/js_image_docker/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ load("@npm//:repositories.bzl", "npm_repositories")

npm_repositories()

# TODO: remove when rules_? upgrades to modern version supporting
http_archive(
name = "bazel_gazelle",
sha256 = "32938bda16e6700063035479063d9d24c60eda8d79fd4739563f50d331cb3209",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz"],
integrity = "sha256-dd8ojEsxyB61D1Hi4U9HY8t1SNquEmgXJHBkY3/Z6mI=",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz"],
)

###
Expand Down
2 changes: 0 additions & 2 deletions e2e/js_image_oci/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
workspace(name = "js_image_oci")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

###
Expand Down
34 changes: 20 additions & 14 deletions e2e/js_run_devserver/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
module(
name = "e2e_js_run_devserver",
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_go", version = "0.46.0")

bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
path = "../..",
)

pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "rules_go", version = "0.46.0", dev_dependency = True)

pnpm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"pnpm",
dev_dependency = True,
)
use_repo(pnpm, "pnpm")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)
npm.npm_translate_lock(
name = "npm",
bins = {
Expand All @@ -32,7 +34,11 @@ npm.npm_translate_lock(
)
use_repo(npm, "npm")

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk = use_extension(
"@rules_go//go:extensions.bzl",
"go_sdk",
dev_dependency = True,
)
go_sdk.download(
name = "go_sdk",
version = "1.20.3",
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_link_package-esm/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ local_repository(

load("@rules_foo//foo:repositories.bzl", "foo_repositories")

foo_repositories(name = "foo")
foo_repositories()

load("@foo//:npm_repositories.bzl", foo_npm_repositories = "npm_repositories")

Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_link_package/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local_repository(

load("@rules_foo//foo:repositories.bzl", "foo_repositories")

foo_repositories(name = "foo")
foo_repositories()

load("@foo//:npm_repositories.bzl", foo_npm_repositories = "npm_repositories")

Expand Down
22 changes: 10 additions & 12 deletions e2e/npm_translate_lock/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
module(
name = "e2e_npm_translate_lock",
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "platforms", version = "0.0.8")

bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
path = "../..",
)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "platforms", version = "0.0.9", dev_dependency = True)

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)
npm.npm_translate_lock(
name = "npm",
data = ["//:package.json"],
Expand Down
17 changes: 8 additions & 9 deletions e2e/npm_translate_lock_auth/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
module(
name = "e2e_npm_translate_lock_auth",
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
path = "../..",
)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
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",
data = ["//:package.json"],
Expand Down
22 changes: 10 additions & 12 deletions e2e/npm_translate_lock_empty/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
module(
name = "e2e_npm_translate_lock",
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "platforms", version = "0.0.8")

bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
path = "../..",
)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "platforms", version = "0.0.9", dev_dependency = True)

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)
npm.npm_translate_lock(
name = "npm",
data = ["//:package.json"],
Expand Down
Loading

0 comments on commit 15b1947

Please sign in to comment.