Skip to content

Commit e52cd87

Browse files
committed
feat(npm): publish forge to npmjs.com
1 parent f3b697d commit e52cd87

37 files changed

+1362
-16
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
crates/cheatcodes/assets/*.json linguist-generated
22
testdata/cheats/Vm.sol linguist-generated
3+
bun.lock linguist-generated
34

45
# See <https://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header>
56
*.rs diff=rust

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,60 @@ jobs:
272272
${{ steps.artifacts.outputs.foundry_attestation }}
273273
${{ steps.man.outputs.foundry_man }}
274274
275+
- name: Setup Bun (npm)
276+
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76
277+
env:
278+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
279+
with:
280+
bun-version: "latest"
281+
scope: "@foundry-rs"
282+
registry-url: "https://registry.npmjs.org"
283+
284+
- name: Install dependencies
285+
working-directory: ./npm
286+
run: bun install --frozen-lockfile
287+
288+
- name: Publish @foundry-rs/forge-${{ matrix.platform }}-${{ matrix.arch }} (npm)
289+
shell: bash
290+
working-directory: ./npm
291+
env:
292+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
293+
NPM_REGISTRY_URL: "https://registry.npmjs.org"
294+
ARCH: ${{ matrix.arch }}
295+
TARGET: ${{ matrix.target }}
296+
PLATFORM: ${{ matrix.platform }}
297+
OUT_DIR: target/${{ matrix.target }}/${{ env.PROFILE }}
298+
VERSION_NAME: ${{ (env.IS_NIGHTLY == 'true' && 'nightly') || needs.prepare.outputs.tag_name }}
299+
run: |-
300+
bun ./scripts/prepublish.ts
301+
bun run ./scripts/publish.ts ./@foundry-rs/forge-${{ env.PLATFORM }}-${{ env.ARCH }}
302+
303+
publish-npm:
304+
name: Publish @foundry-rs/forge
305+
runs-on: ubuntu-latest
306+
needs: release
307+
steps:
308+
- uses: actions/checkout@v4
309+
- uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76
310+
with:
311+
bun-version: "latest"
312+
scope: "@foundry-rs"
313+
registry-url: "https://registry.npmjs.org"
314+
315+
- name: Install dependencies
316+
working-directory: ./npm
317+
run: bun install --frozen-lockfile
318+
319+
- name: Publish @foundry-rs/forge
320+
shell: bash
321+
working-directory: ./npm
322+
env:
323+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
324+
NPM_REGISTRY_URL: "https://registry.npmjs.org"
325+
run: |-
326+
bun ./scripts/prepublish.ts
327+
bun run ./scripts/publish.ts ./@foundry-rs/forge
328+
275329
cleanup:
276330
name: Release cleanup
277331
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ CLAUDE.md
1111
node_modules
1212
dist
1313
bin
14-
_
14+
_
15+
*.tgz

dprint.json

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dprint/dprint/refs/heads/main/website/src/assets/schemas/v0.json",
3-
"incremental": true,
43
"indentWidth": 2,
54
"useTabs": false,
6-
"includes": [
7-
"*.md",
8-
"*.{toml}",
9-
"Dockerfile",
10-
"*.{yml,yaml}",
11-
"*.{json,jsonc}",
12-
"*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}"
13-
],
145
"excludes": [
6+
"!npm/**/*.{json,md,toml}",
7+
"!npm/**/*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}",
8+
"**/_",
9+
"dprint.json",
10+
"**/abi",
1511
"**/build",
16-
"**/abi/**",
1712
"**/target",
1813
"**/test/**",
1914
"**/*.min.*",
2015
"**/dist/**",
2116
"testdata/**",
2217
"**/tests/**",
18+
"node_modules",
2319
"changelog.json",
2420
"**/test-data/**",
25-
"**/node_modules",
2621
"**/cheatcodes/**",
22+
"**/node_modules/**",
2723
".github/scripts/**",
2824
".github/ISSUE_TEMPLATE/**"
2925
],
@@ -40,13 +36,15 @@
4036
"textWrap": "maintain"
4137
},
4238
"toml": {
43-
"columnWidth": 100
39+
"lineWidth": 100
4440
},
4541
"json": {
46-
"useTabs": false,
42+
"lineWidth": 1,
4743
"indentWidth": 2,
44+
"useTabs": false,
4845
"trailingCommas": "never",
49-
"array.preferSingleLine": true
46+
"preferSingleLine": false,
47+
"array.preferSingleLine": false
5048
},
5149
"typescript": {
5250
"useTabs": false,
@@ -59,4 +57,4 @@
5957
"exportDeclaration.sortTypeOnlyExports": "none",
6058
"importDeclaration.sortTypeOnlyImports": "none"
6159
}
62-
}
60+
}

npm/.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
NODE_ENV="development"
2+
3+
NPM_TOKEN=""
4+
NPM_REGISTRY_URL=""
5+
NPM_USERNAME="foundry-rs"
6+
7+
PLATFORM_NAME=""
8+
ARCH=""

npm/.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# dependencies (bun install)
2+
node_modules
3+
4+
# output
5+
out
6+
dist
7+
*.tgz
8+
9+
# code coverage
10+
coverage
11+
*.lcov
12+
13+
# logs
14+
logs
15+
_.log
16+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
17+
18+
# dotenv environment variable files
19+
.env
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
.env.local
24+
25+
# caches
26+
.eslintcache
27+
.cache
28+
*.tsbuildinfo
29+
30+
# IntelliJ based IDEs
31+
.idea
32+
33+
# Finder (MacOS) folder config
34+
.DS_Store
35+
36+
forge/*/bin/forge
37+
@foundry-rs/*/bin/
38+
test/workspace/bun.lock
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# forge
2+
3+
This is the macOS ARM 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
4+
See <https://getfoundry.sh/forge/overview> for details.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@foundry-rs/forge-darwin-arm64",
3+
"version": "1.2.3",
4+
"type": "module",
5+
"homepage": "https://getfoundry.sh",
6+
"description": "Fast and flexible Ethereum testing framework (macOS arm64)",
7+
"bin": {
8+
"forge": "./bin/forge"
9+
},
10+
"os": [
11+
"darwin"
12+
],
13+
"cpu": [
14+
"arm64"
15+
],
16+
"files": [
17+
"bin"
18+
],
19+
"engines": {
20+
"node": ">=20"
21+
},
22+
"license": "MIT OR Apache-2.0",
23+
"repository": {
24+
"directory": "npm",
25+
"url": "https://github.com/foundry-rs/foundry"
26+
},
27+
"keywords": [
28+
"foundry",
29+
"testing",
30+
"ethereum",
31+
"solidity",
32+
"blockchain",
33+
"smart-contracts"
34+
]
35+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# forge
2+
3+
This is the macOS 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
4+
See <https://getfoundry.sh/forge/overview> for details.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@foundry-rs/forge-darwin-x64",
3+
"version": "1.2.3",
4+
"type": "module",
5+
"homepage": "https://getfoundry.sh",
6+
"description": "Fast and flexible Ethereum testing framework (macOS x64)",
7+
"bin": {
8+
"forge": "./bin/forge"
9+
},
10+
"os": [
11+
"darwin"
12+
],
13+
"cpu": [
14+
"x64"
15+
],
16+
"files": [
17+
"bin"
18+
],
19+
"engines": {
20+
"node": ">=20"
21+
},
22+
"license": "MIT OR Apache-2.0",
23+
"repository": {
24+
"directory": "npm",
25+
"url": "https://github.com/foundry-rs/foundry"
26+
},
27+
"keywords": [
28+
"foundry",
29+
"testing",
30+
"ethereum",
31+
"solidity",
32+
"blockchain",
33+
"smart-contracts"
34+
]
35+
}

0 commit comments

Comments
 (0)