@sablier/devkit 1.13.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ """Shared helpers for Vercel Just recipes."""
2
+
3
+ import json
4
+ import os
5
+ import subprocess
6
+ import sys
7
+
8
+
9
+ def run(*cmd):
10
+ """Run a command, exiting on failure."""
11
+ result = subprocess.run(cmd)
12
+ if result.returncode != 0:
13
+ sys.exit(result.returncode)
14
+
15
+
16
+ def resolve_vercel_env(app, project_ids_json):
17
+ """Resolve VERCEL_PROJECT_ID and VERCEL_TOKEN, setting them in os.environ.
18
+
19
+ Precedence for project ID:
20
+ 1. VERCEL_PROJECT_ID already set in the environment
21
+ 2. Lookup `app` in the VERCEL_PROJECT_IDS JSON map
22
+
23
+ Returns (project_id, token).
24
+ """
25
+ project_id = os.environ.get("VERCEL_PROJECT_ID", "")
26
+ if not project_id:
27
+ project_ids = json.loads(project_ids_json)
28
+ if app not in project_ids:
29
+ print(
30
+ f"Error: unknown app '{app}'. Known apps: {', '.join(project_ids) or '(none)'}",
31
+ file=sys.stderr,
32
+ )
33
+ sys.exit(1)
34
+ project_id = project_ids[app]
35
+ os.environ["VERCEL_PROJECT_ID"] = project_id
36
+
37
+ token = os.environ.get("VERCEL_TOKEN", "")
38
+ if not token:
39
+ print("Error: VERCEL_TOKEN is not set.", file=sys.stderr)
40
+ sys.exit(1)
41
+
42
+ return project_id, token
package/just/evm.just CHANGED
@@ -19,22 +19,7 @@ nlx := require("nlx")
19
19
  # CONSTANTS #
20
20
  # ---------------------------------------------------------------------------- #
21
21
 
22
- GLOBS_CLEAN := ```
23
- arr=(
24
- "artifacts"
25
- "artifacts-*"
26
- "broadcast"
27
- "cache"
28
- "cache_hardhat-zk"
29
- "coverage"
30
- "docs"
31
- "out"
32
- "out-*"
33
- "typechain-types"
34
- "lcov.info"
35
- )
36
- echo "${arr[*]}"
37
- ```
22
+ GLOBS_CLEAN := "artifacts artifacts-* broadcast cache cache_hardhat-zk coverage docs out out-* typechain-types lcov.info"
38
23
  GLOBS_PRETTIER := "**/*.{md,mdx,yaml,yml}"
39
24
  GLOBS_SOLIDITY := "{scripts,src,tests}/**/*.sol"
40
25
 
@@ -44,11 +29,10 @@ GLOBS_SOLIDITY := "{scripts,src,tests}/**/*.sol"
44
29
 
45
30
  # Clean directories and files
46
31
  clean globs=GLOBS_CLEAN:
47
- nlx del-cli {{ globs }}
32
+ {{ nlx }} del-cli {{ globs }}
48
33
  alias c := clean
49
34
 
50
35
  # Clear node_modules recursively
51
- [confirm("Are you sure you want to delete all node_modules, including in subdirectories? Y/n")]
52
36
  clean-modules:
53
37
  just base::clean-modules
54
38
 
@@ -95,12 +79,12 @@ alias pw := prettier-write
95
79
 
96
80
  # Check code with Solhint
97
81
  solhint-check globs=GLOBS_SOLIDITY:
98
- na solhint --cache "{{ globs }}"
82
+ {{ na }} solhint --cache "{{ globs }}"
99
83
  alias sc := solhint-check
100
84
 
101
85
  # Fix code with Solhint
102
86
  solhint-write globs=GLOBS_SOLIDITY:
103
- na solhint --cache --fix --noPrompt "{{ globs }}"
87
+ {{ na }} solhint --cache --fix --noPrompt "{{ globs }}"
104
88
  alias sw := solhint-write
105
89
 
106
90
  # ---------------------------------------------------------------------------- #
@@ -110,21 +94,15 @@ alias sw := solhint-write
110
94
  # Build contracts
111
95
  [group("foundry")]
112
96
  build:
113
- forge build
97
+ {{ forge }} build
114
98
  alias b := build
115
99
 
116
- # Build using optimized profile
117
- [group("foundry")]
118
- build-optimized:
119
- FOUNDRY_PROFILE=optimized \
120
- forge build
121
- alias bo := build-optimized
122
-
123
100
  # Build using optimized profile with optional arguments
124
101
  [group("foundry")]
125
102
  build-optimized *args:
126
103
  FOUNDRY_PROFILE=optimized \
127
- forge build --extra-output-files metadata {{ args }}
104
+ {{ forge }} build --extra-output-files metadata {{ args }}
105
+ alias bo := build-optimized
128
106
 
129
107
  # Dump code coverage to an html file
130
108
  [group("foundry"), script("bash")]
@@ -134,30 +112,30 @@ coverage:
134
112
  echo "Install it with Homebrew: https://formulae.brew.sh/formula/lcov"
135
113
  exit 1
136
114
  fi
137
- forge coverage --report lcov
115
+ {{ forge }} coverage --report lcov
138
116
  genhtml --branch-coverage --ignore-errors inconsistent --output-dir coverage lcov.info
139
117
  alias cov := coverage
140
118
 
141
119
  # Check code with Forge formatter
142
120
  [group("foundry")]
143
121
  fmt-check:
144
- forge fmt --check
122
+ {{ forge }} fmt --check
145
123
 
146
124
  # Fix code with Forge formatter
147
125
  [group("foundry")]
148
126
  fmt-write:
149
- forge fmt
127
+ {{ forge }} fmt
150
128
 
151
129
  # Performs a gas report
152
130
  [group("foundry")]
153
131
  gas-report:
154
- forge test --gas-report
132
+ {{ forge }} test --gas-report
155
133
  alias gr := gas-report
156
134
 
157
135
  # Run tests with optional arguments
158
136
  [group("foundry")]
159
137
  test *args:
160
- forge test {{ args }}
138
+ {{ forge }} test {{ args }}
161
139
  alias t := test
162
140
 
163
141
  # Run Bulloak checks
@@ -166,19 +144,14 @@ test-bulloak:
166
144
  bulloak check --skip-modifiers "./tests/**/*.tree"
167
145
  alias tb := test-bulloak
168
146
 
169
- # Run tests using lite profile (skipping fork tests)
147
+ # Run tests using lite profile (skips fork tests by default)
170
148
  [group("foundry")]
171
- test-lite:
172
- FOUNDRY_PROFILE=lite forge test --nmt "testFork"
149
+ test-lite *args="--nmt testFork":
150
+ FOUNDRY_PROFILE=lite {{ forge }} test {{ args }}
173
151
  alias tl := test-lite
174
152
 
175
- # Run tests using lite profile with optional arguments
176
- [group("foundry")]
177
- test-lite *args:
178
- FOUNDRY_PROFILE=lite forge test {{ args }}
179
-
180
153
  # Run tests using optimized profile
181
154
  [group("foundry")]
182
155
  test-optimized: build-optimized
183
- FOUNDRY_PROFILE=test-optimized forge test
156
+ FOUNDRY_PROFILE=test-optimized {{ forge }} test
184
157
  alias to := test-optimized
package/just/vercel.just CHANGED
@@ -13,6 +13,7 @@ na := require("na")
13
13
 
14
14
  # Consumer MUST override with a JSON map of app name → Vercel project ID.
15
15
  # Example: '{"portal": "prj_xxx", "landing": "prj_yyy"}'
16
+ # Note: if VERCEL_PROJECT_ID is already set in the environment, this map is ignored.
16
17
  VERCEL_PROJECT_IDS := '{}'
17
18
 
18
19
  # ---------------------------------------------------------------------------- #
@@ -44,29 +45,15 @@ alias vd := deploy
44
45
  # Core build: vercel pull + vercel build
45
46
  [private, script("python3")]
46
47
  _vercel-build app env:
47
- import json, os, subprocess, sys
48
-
49
- def run(*cmd):
50
- result = subprocess.run(cmd)
51
- if result.returncode != 0:
52
- sys.exit(result.returncode)
48
+ import sys; sys.path.insert(0, "{{ source_directory() }}")
49
+ import os
50
+ from _vercel_helpers import resolve_vercel_env, run
53
51
 
54
52
  # Workaround for https://github.com/vercel/vercel/issues/14666
55
53
  os.environ["VERCEL_TARGET_ENV"] = "{{ env }}"
56
54
  os.environ["NEXT_PUBLIC_VERCEL_TARGET_ENV"] = "{{ env }}"
57
55
 
58
- # Resolve project ID from app name
59
- project_ids = json.loads('{{ VERCEL_PROJECT_IDS }}')
60
- app = "{{ app }}"
61
- if app not in project_ids:
62
- print(f"Error: unknown app '{app}'. Known apps: {', '.join(project_ids) or '(none)'}", file=sys.stderr)
63
- sys.exit(1)
64
- os.environ["VERCEL_PROJECT_ID"] = project_ids[app]
65
-
66
- token = os.environ.get("VERCEL_TOKEN", "")
67
- if not token:
68
- print("Error: VERCEL_TOKEN is not set.", file=sys.stderr)
69
- sys.exit(1)
56
+ project_id, token = resolve_vercel_env("{{ app }}", '{{ VERCEL_PROJECT_IDS }}')
70
57
 
71
58
  # Pull the environment from the Vercel project
72
59
  run("na", "vercel", "pull", "--environment={{ env }}", f"--token={token}", "--yes")
@@ -77,12 +64,9 @@ _vercel-build app env:
77
64
  # Core deploy: optionally build, then deploy prebuilt artifacts
78
65
  [private, script("python3")]
79
66
  _vercel-deploy app env skip_build="false":
80
- import json, os, subprocess, sys
81
-
82
- def run(*cmd):
83
- result = subprocess.run(cmd)
84
- if result.returncode != 0:
85
- sys.exit(result.returncode)
67
+ import sys; sys.path.insert(0, "{{ source_directory() }}")
68
+ import os
69
+ from _vercel_helpers import resolve_vercel_env, run
86
70
 
87
71
  # Build the project if not skipped (calls the PUBLIC recipe so consumer overrides apply)
88
72
  if "{{ skip_build }}" != "true":
@@ -92,18 +76,7 @@ _vercel-deploy app env skip_build="false":
92
76
  os.environ["VERCEL_TARGET_ENV"] = "{{ env }}"
93
77
  os.environ["NEXT_PUBLIC_VERCEL_TARGET_ENV"] = "{{ env }}"
94
78
 
95
- # Resolve project ID from app name
96
- project_ids = json.loads('{{ VERCEL_PROJECT_IDS }}')
97
- app = "{{ app }}"
98
- if app not in project_ids:
99
- print(f"Error: unknown app '{app}'. Known apps: {', '.join(project_ids) or '(none)'}", file=sys.stderr)
100
- sys.exit(1)
101
- os.environ["VERCEL_PROJECT_ID"] = project_ids[app]
102
-
103
- token = os.environ.get("VERCEL_TOKEN", "")
104
- if not token:
105
- print("Error: VERCEL_TOKEN is not set.", file=sys.stderr)
106
- sys.exit(1)
79
+ project_id, token = resolve_vercel_env("{{ app }}", '{{ VERCEL_PROJECT_IDS }}')
107
80
 
108
81
  # Deploy the project to Vercel
109
82
  run("na", "vercel", "deploy", "--prebuilt", "--target={{ env }}", f"--token={token}")
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Configuration files and reusable scripts for Sablier repositories",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "1.13.1",
6
+ "version": "1.14.0",
7
7
  "author": {
8
8
  "name": "Sablier Labs Ltd",
9
9
  "url": "https://sablier.com"