Skip to content

Commit 76861c2

Browse files
authored
build: sync formatjs cli versions (#62)
1 parent a69f910 commit 76861c2

6 files changed

Lines changed: 107 additions & 17 deletions

File tree

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bazel_dep(name = "rules_shell", version = "0.3.0", dev_dependency = True)
4444

4545
# FormatJS CLI toolchain
4646
formatjs_cli = use_extension("//formatjs_cli:extensions.bzl", "formatjs_cli")
47-
formatjs_cli.toolchain(version = "1.1.1")
47+
formatjs_cli.toolchain(version = "1.1.4")
4848
use_repo(
4949
formatjs_cli,
5050
"formatjs_cli_toolchains",

MODULE.bazel.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/custom_version/MODULE.bazel

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Example demonstrating custom FormatJS CLI version configuration.
22
3-
This example shows how to use a custom version (0.1.0) that is not in the built-in
3+
This example shows how to use custom FormatJS CLI binary URLs instead of the built-in
44
FORMATJS_CLI_VERSIONS dictionary. This is useful for:
55
- Testing unreleased versions
66
- Using custom builds
@@ -18,8 +18,7 @@ local_path_override(
1818
path = "../..",
1919
)
2020

21-
# Configure custom FormatJS CLI version 0.1.0
22-
# This version was removed from the built-in versions but we can still use it
21+
# Configure custom FormatJS CLI binary URLs for version 0.1.0
2322
formatjs_cli = use_extension("@rules_formatjs//formatjs_cli:extensions.bzl", "formatjs_cli")
2423

2524
# Single toolchain call with custom binaries (similar to rules_nodejs pattern)
@@ -53,7 +52,7 @@ use_repo(
5352
)
5453

5554
# Register the custom version toolchains (0.1.0)
56-
# Note: Standard toolchains (0.1.2) are already registered by rules_formatjs root MODULE.bazel
55+
# Note: Standard toolchains are already registered by rules_formatjs root MODULE.bazel
5756
# Bazel will select the appropriate one based on platform constraints and registration order
5857
register_toolchains(
5958
"@formatjs_v0_1_0_toolchains//:all",

examples/custom_version/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Custom FormatJS CLI Version Example
1+
# Custom FormatJS CLI Binary Example
22

3-
This example demonstrates how to use a custom FormatJS CLI version that is not included in the built-in `FORMATJS_CLI_VERSIONS` dictionary.
3+
This example demonstrates how to use custom FormatJS CLI binary URLs instead of the built-in `FORMATJS_CLI_VERSIONS` dictionary.
44

55
## What This Example Shows
66

7-
- **Custom Version Configuration**: How to use version 0.1.0, which was removed from the built-in versions
7+
- **Custom Binary Configuration**: How to provide explicit URLs and checksums for version 0.1.0
88
- **Simple Ergonomic API**: Just provide version, platform, url, and sha256 - no manual platform constraints needed
99
- **Message Extraction**: A working example of extracting messages using the custom CLI version
1010

@@ -82,7 +82,7 @@ In this example:
8282

8383
- On macOS ARM64: The custom 0.1.0 darwin-arm64 toolchain is available
8484
- On Linux x64: The custom 0.1.0 linux-x64 toolchain is available
85-
- The standard 0.1.2 toolchains (from rules_formatjs root MODULE.bazel) are also available
85+
- The standard toolchains from the rules_formatjs root MODULE.bazel are also available
8686
- Bazel will select the best match based on platform constraints
8787

8888
## Running the Example
@@ -162,7 +162,7 @@ When you build the `:messages` target, it will create a `messages.json` file con
162162

163163
## Comparison with Standard Toolchains
164164

165-
This example does NOT call `formatjs_cli.toolchain()` because we're only using custom binaries. However, the root MODULE.bazel of `rules_formatjs` does call it, so standard toolchains (0.1.2) are also available.
165+
This example does NOT call `formatjs_cli.toolchain()` without custom repositories because we're only using custom binaries. However, the root MODULE.bazel of `rules_formatjs` does call it, so standard toolchains are also available.
166166

167167
If you want to completely override and use only custom versions, you can still do so - Bazel will prefer the custom toolchains if they match the platform constraints.
168168

formatjs_cli/extensions.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ formatjs_cli = module_extension(
255255
## Advanced: Custom Platform Binaries
256256
257257
If you need to use a custom binary for a specific platform (e.g., unreleased version,
258-
custom build, or older version not in the built-in list), configure custom platforms
258+
custom build, or platform not in the built-in list), configure custom platforms
259259
in a single toolchain call:
260260
261261
```starlark
@@ -295,7 +295,8 @@ formatjs_cli = module_extension(
295295
296296
## Version History
297297
298-
- **0.1.2**: Latest version with native key sorting
298+
- **1.1.4**: Latest built-in version
299+
- **0.1.2**: Added native key sorting
299300
- **0.1.1**: Added key sorting support
300301
- **0.1.0**: Initial release
301302

formatjs_cli/repositories.bzl

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
"""Repository rules for FormatJS CLI toolchains."""
22

3-
DEFAULT_VERSION = "1.1.1"
3+
DEFAULT_VERSION = "1.1.4"
44

55
FORMATJS_CLI_VERSIONS = {
6+
"1.1.4": {
7+
"darwin-arm64": {
8+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.4/formatjs_cli-darwin-arm64",
9+
"sha256": "dd3bd223f0c1dddfa136d4ce4299fa3e43ce36e7d3b4b9a8c7ac6131f888f810",
10+
},
11+
"linux-x64": {
12+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.4/formatjs_cli-linux-x64",
13+
"sha256": "2d8a02030d7a83279dbd2cc02837e5d8cd3081bcadace4314e5d14d973ea36b9",
14+
},
15+
},
16+
"1.1.3": {
17+
"darwin-arm64": {
18+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.3/formatjs_cli-darwin-arm64",
19+
"sha256": "dd3bd223f0c1dddfa136d4ce4299fa3e43ce36e7d3b4b9a8c7ac6131f888f810",
20+
},
21+
"linux-x64": {
22+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.3/formatjs_cli-linux-x64",
23+
"sha256": "1664d61b08d466c7a278e51ddce1cd6905a0ac1d81e70f941fceaaeaba60b136",
24+
},
25+
},
26+
"1.1.2": {
27+
"darwin-arm64": {
28+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.2/formatjs_cli-darwin-arm64",
29+
"sha256": "faccf69c391b16cf5c08ce05bd2c5cdf8868f30f365940a7496e13abd4b3ed6e",
30+
},
31+
"linux-x64": {
32+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.2/formatjs_cli-linux-x64",
33+
"sha256": "f5dc23f43e261114dafe403f01609cf789d426e480c72b8bf0be8b20160a3b5d",
34+
},
35+
},
636
"1.1.1": {
737
"darwin-arm64": {
838
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.1/formatjs_cli-darwin-arm64",
@@ -33,6 +63,36 @@ FORMATJS_CLI_VERSIONS = {
3363
"sha256": "d692809446523d613b2e2f6a49d225f8f8296afd3412c5cc2d136660ab51faa1",
3464
},
3565
},
66+
"0.1.14": {
67+
"darwin-arm64": {
68+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.14/formatjs_cli-darwin-arm64",
69+
"sha256": "e4c032973f299f6f7c6f73c5556d75219b99fd337f286c5931cd21a1c0d499a8",
70+
},
71+
"linux-x64": {
72+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.14/formatjs_cli-linux-x64",
73+
"sha256": "f880c7986b6994c8f5e9d5fa59842c036e6badd838d5862ac8e2ea7226d1c53c",
74+
},
75+
},
76+
"0.1.13": {
77+
"darwin-arm64": {
78+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.13/formatjs_cli-darwin-arm64",
79+
"sha256": "4a19a68fcaa4280e93c6abb00ad4c32e34442f6e62bd947c73c037a85bb69fc3",
80+
},
81+
"linux-x64": {
82+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.13/formatjs_cli-linux-x64",
83+
"sha256": "25f948156faf66ba3e0febafa191d258d17689b9de5d13c23b2d0f305d84b829",
84+
},
85+
},
86+
"0.1.12": {
87+
"darwin-arm64": {
88+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.12/formatjs_cli-darwin-arm64",
89+
"sha256": "14810ea377a3f0bc0f527fdd3675b3aff7d23b9fcb541f9d79488a27baad36d8",
90+
},
91+
"linux-x64": {
92+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.12/formatjs_cli-linux-x64",
93+
"sha256": "a6779e36c17ed36401d4598dca2e1affcb23c45676887414241ae65d02f32067",
94+
},
95+
},
3696
"0.1.11": {
3797
"darwin-arm64": {
3898
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.11/formatjs_cli-darwin-arm64",
@@ -43,6 +103,16 @@ FORMATJS_CLI_VERSIONS = {
43103
"sha256": "9361021a9f23a810737d41f809de7379f350c98411b4337ad562a17a3f3533bb",
44104
},
45105
},
106+
"0.1.10": {
107+
"darwin-arm64": {
108+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.10/formatjs_cli-darwin-arm64",
109+
"sha256": "107de7ab0b51de1de4c1b52d25c1dd6330d9689a544e832cf7e371b169bdf7eb",
110+
},
111+
"linux-x64": {
112+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.10/formatjs_cli-linux-x64",
113+
"sha256": "bbfbf1f718e3094353a5dec2767a1aa6200bf2031e7561643de14684a1a8e360",
114+
},
115+
},
46116
"0.1.9": {
47117
"darwin-arm64": {
48118
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.9/formatjs_cli-darwin-arm64",
@@ -63,6 +133,16 @@ FORMATJS_CLI_VERSIONS = {
63133
"sha256": "6d57d42a83d90f9bf311c23e3754a214a855e965a538de1fe68b54553320a587",
64134
},
65135
},
136+
"0.1.7": {
137+
"darwin-arm64": {
138+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.7/formatjs_cli-darwin-arm64",
139+
"sha256": "2500c526bd4f355d8803be85a435bc0fb68d71c9e2528444c95c02ec22f81da1",
140+
},
141+
"linux-x64": {
142+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.7/formatjs_cli-linux-x64",
143+
"sha256": "017728adc9a0f376f738a101af0627f7e9bf8e6eb76455599aa4b7836009ffa3",
144+
},
145+
},
66146
"0.1.6": {
67147
"darwin-arm64": {
68148
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.6/formatjs_cli-darwin-arm64",
@@ -123,6 +203,16 @@ FORMATJS_CLI_VERSIONS = {
123203
"sha256": "7bfbce944b780c0b12ec4d8362ae5e0e9ab8b745573f8a367228b14f64c7175b",
124204
},
125205
},
206+
"0.1.0": {
207+
"darwin-arm64": {
208+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.0/formatjs_cli-darwin-arm64",
209+
"sha256": "9b2c736b48cc65e763cf19ac7c190e527f9a8d4aa0798185e602f58becb99feb",
210+
},
211+
"linux-x64": {
212+
"url": "https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v0.1.0/formatjs_cli-linux-x64",
213+
"sha256": "884b9a41b9f6be649ea72277ebf22af0146043466d2ab94b28a57f95ffb7da1a",
214+
},
215+
},
126216
}
127217

128218
def _formatjs_cli_repo_impl(rctx):

0 commit comments

Comments
 (0)