Skip to content

Commit

Permalink
feat: support rules_js 1.6.4 with improved version mirroring (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored Nov 3, 2022
1 parent 6fc3fc4 commit 9139435
Show file tree
Hide file tree
Showing 14 changed files with 2,330 additions and 10,452 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs/*.md linguist-generated=true
pnpm-lock.yaml linguist-generated=true
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/pnpm-lock.yaml
docs/*.md
11 changes: 6 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ nodejs_register_toolchains(

load("//jest:repositories.bzl", "jest_repositories")

jest_repositories(
name = "jest",
jest_version = "v28.1.0",
)
jest_repositories(name = "jest")

load("@jest//:npm_repositories.bzl", jest_npm_repositories = "npm_repositories")

jest_npm_repositories()

# For running our own unit tests
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
Expand All @@ -42,6 +43,6 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe

go_rules_dependencies()

go_register_toolchains(version = "1.19.1")
go_register_toolchains(version = "1.19.3")

gazelle_dependencies()
4 changes: 2 additions & 2 deletions e2e/workspace/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@jest//jest:defs.bzl", "jest_test")
load("@jest//:defs.bzl", "jest_test")

jest_test(
name = "test",
data = ["index.test.js"],
config = "jest.config.js",
data = ["index.test.js"],
)
11 changes: 6 additions & 5 deletions e2e/workspace/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ load("@aspect_rules_jest//jest:dependencies.bzl", "rules_jest_dependencies")
rules_jest_dependencies()

# Fetches the npm packages for jest-cli.
load("@aspect_rules_jest//jest:repositories.bzl", "LATEST_VERSION", "jest_repositories")
load("@aspect_rules_jest//jest:repositories.bzl", "jest_repositories")

jest_repositories(
name = "jest",
jest_version = LATEST_VERSION,
)
jest_repositories(name = "jest")

load("@jest//:npm_repositories.bzl", jest_npm_repositories = "npm_repositories")

jest_npm_repositories()

# Register a nodejs toolchain, if you haven't already done so.
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
Expand Down
38 changes: 11 additions & 27 deletions internal_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,35 @@ Users should *not* need to install these. If users see a load()
statement from these, that's a bug in our distribution.
"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
# buildifier: disable=bzl-visibility
load("//jest/private:maybe.bzl", http_archive = "maybe_http_archive")

def rules_jest_internal_deps():
"Fetch deps needed for local development"
maybe(
http_archive,
http_archive(
name = "io_bazel_rules_go",
sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
],
urls = ["https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip"],
)

maybe(
http_archive,
http_archive(
name = "bazel_gazelle",
sha256 = "efbbba6ac1a4fd342d5122cbdfdb82aeb2cf2862e35022c752eaddffada7c3f3",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.27.0/bazel-gazelle-v0.27.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.27.0/bazel-gazelle-v0.27.0.tar.gz",
],
sha256 = "448e37e0dbf61d6fa8f00aaa12d191745e14f07c31cabfa731f0c8e8a4f41b97",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.28.0/bazel-gazelle-v0.28.0.tar.gz"],
)

# Override bazel_skylib distribution to fetch sources instead
# so that the gazelle extension is included
# see https://github.com/bazelbuild/bazel-skylib/issues/250
maybe(
http_archive,
http_archive(
name = "bazel_skylib",
sha256 = "3b620033ca48fcd6f5ef2ac85e0f6ec5639605fa2f627968490e52fc91a9932f",
strip_prefix = "bazel-skylib-1.3.0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/archive/1.3.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/archive/refs/tags/1.3.0.tar.gz",
],
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/refs/tags/1.3.0.tar.gz"],
)

maybe(
http_archive,
http_archive(
name = "io_bazel_stardoc",
sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
"https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
],
urls = ["https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz"],
)
31 changes: 13 additions & 18 deletions jest/dependencies.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"Runtime starlark dependencies"

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//jest/private:maybe.bzl", http_archive = "maybe_http_archive")

# WARNING: any changes in this function may be BREAKING CHANGES for users
# because we'll fetch a dependency which may be different from one that
Expand All @@ -11,32 +10,28 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
# and released only in semver majors.
def rules_jest_dependencies():
# The minimal version of bazel_skylib we require
maybe(
http_archive,
http_archive(
name = "bazel_skylib",
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz"],
)

maybe(
http_archive,
http_archive(
name = "aspect_bazel_lib",
sha256 = "79381b0975ba7d2d5653239e5bab12cf54d89b10217fe771b8edd95047a2e44b",
strip_prefix = "bazel-lib-1.12.1",
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.12.1.tar.gz",
sha256 = "eae670935704ce5f9d050b2c23d426b4ae453458830eebdaac1f11a6a9da150b",
strip_prefix = "bazel-lib-1.15.0",
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.15.0.tar.gz",
)

maybe(
http_archive,
http_archive(
name = "aspect_rules_js",
sha256 = "9d80f28eb59df0486cc1e8e82868e97d8167429ea309a7ae96dfac64ff73275b",
strip_prefix = "rules_js-1.4.0",
url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.4.0.tar.gz",
sha256 = "a6c97d32e82f890bd3e62ab2bd1ab2610baf80c4ab9eaa9586685c5e0c7c5858",
strip_prefix = "rules_js-1.6.5",
url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.6.5.tar.gz",
)

maybe(
http_archive,
http_archive(
name = "rules_nodejs",
sha256 = "bce105e7a3d2a3c5eb90dcd6436544bf11f82e97073fb29e4090321ba2b84d8f",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.6.0/rules_nodejs-core-5.6.0.tar.gz"],
sha256 = "50adf0b0ff6fc77d6909a790df02eefbbb3bc2b154ece3406361dda49607a7bd",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.7.1/rules_nodejs-core-5.7.1.tar.gz"],
)
7 changes: 7 additions & 0 deletions jest/private/maybe.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"maybe utilities"

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

def maybe_http_archive(**kwargs):
maybe(_http_archive, **kwargs)
Loading

0 comments on commit 9139435

Please sign in to comment.