@foundry-rs/anvil 1.4.4 → 1.5.0-nightly.20251116.cd86772
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.
- package/README.md +49 -1
- package/bin.mjs +34 -1
- package/package.json +14 -6
package/README.md
CHANGED
|
@@ -1,4 +1,52 @@
|
|
|
1
|
-
# Anvil
|
|
1
|
+
# [Anvil](https://getfoundry.sh/anvil)
|
|
2
2
|
|
|
3
3
|
Anvil is a fast local Ethereum development node.
|
|
4
4
|
The anvil binary can be used both within and outside of a Foundry project.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
### One-off commands
|
|
9
|
+
|
|
10
|
+
Example
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx --yes @foundry-rs/anvil@nightly
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
More generally
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx --yes @foundry-rs/anvil@<version|nightly> [args...]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Install then use
|
|
23
|
+
|
|
24
|
+
locally to your project
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm add @foundry-rs/anvil@nightly
|
|
28
|
+
npx anvil [args...]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
globally
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm add --global @foundry-rs/anvil@nightly
|
|
35
|
+
anvil [args...]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
Also works with `deno`, `bun`, and `pnpm`:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
deno run --quiet --allow-all npm:@foundry-rs/anvil@nightly [args...]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
bun x @foundry-rs/anvil@nightly [args...]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
pnpm dlx --silent @foundry-rs/anvil@nightly [args...]
|
|
52
|
+
```
|
package/bin.mjs
CHANGED
|
@@ -28,7 +28,22 @@ if (!platformPackage) {
|
|
|
28
28
|
process.exit(1)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
NodeChildProcess.spawn(
|
|
31
|
+
const child = NodeChildProcess.spawn(
|
|
32
|
+
selectBinaryPath(),
|
|
33
|
+
process.argv.slice(2),
|
|
34
|
+
{ stdio: 'inherit' }
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @type {Record<'SIGINT' | 'SIGTERM', () => void>}
|
|
39
|
+
*/
|
|
40
|
+
const signalHandlers = {
|
|
41
|
+
SIGINT: () => forwardSignal('SIGINT'),
|
|
42
|
+
SIGTERM: () => forwardSignal('SIGTERM')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (const [signal, handler] of Object.entries(signalHandlers))
|
|
46
|
+
process.on(signal, handler)
|
|
32
47
|
|
|
33
48
|
/**
|
|
34
49
|
* Determines which tool wrapper is executing.
|
|
@@ -117,3 +132,21 @@ function selectBinaryPath() {
|
|
|
117
132
|
|
|
118
133
|
return NodePath.join(__dirname, '..', 'dist', binaryName)
|
|
119
134
|
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Forwards a received signal to the child process, then re-emits it locally to
|
|
138
|
+
* preserve Node.js default exit semantics.
|
|
139
|
+
* @param {'SIGINT' | 'SIGTERM'} signal
|
|
140
|
+
*/
|
|
141
|
+
function forwardSignal(signal) {
|
|
142
|
+
try {
|
|
143
|
+
if (!child.killed)
|
|
144
|
+
child.kill(signal)
|
|
145
|
+
} catch (error) {
|
|
146
|
+
if (!error || (typeof error === 'object' && 'code' in error && error.code !== 'ESRCH'))
|
|
147
|
+
throw error
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
process.off(signal, signalHandlers[signal])
|
|
151
|
+
process.kill(process.pid, signal)
|
|
152
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foundry-rs/anvil",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-nightly.20251116.cd86772",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://getfoundry.sh/anvil",
|
|
6
6
|
"description": "Anvil is a fast local Ethereum development node",
|
|
@@ -16,17 +16,25 @@
|
|
|
16
16
|
"postinstall": "TARGET_TOOL=anvil node ./postinstall.mjs"
|
|
17
17
|
},
|
|
18
18
|
"optionalDependencies": {
|
|
19
|
-
"@foundry-rs/anvil-darwin-arm64": "1.
|
|
20
|
-
"@foundry-rs/anvil-darwin-amd64": "1.
|
|
21
|
-
"@foundry-rs/anvil-linux-arm64": "1.
|
|
22
|
-
"@foundry-rs/anvil-linux-amd64": "1.
|
|
23
|
-
"@foundry-rs/anvil-win32-amd64": "1.
|
|
19
|
+
"@foundry-rs/anvil-darwin-arm64": "1.5.0-nightly.20251116.cd86772",
|
|
20
|
+
"@foundry-rs/anvil-darwin-amd64": "1.5.0-nightly.20251116.cd86772",
|
|
21
|
+
"@foundry-rs/anvil-linux-arm64": "1.5.0-nightly.20251116.cd86772",
|
|
22
|
+
"@foundry-rs/anvil-linux-amd64": "1.5.0-nightly.20251116.cd86772",
|
|
23
|
+
"@foundry-rs/anvil-win32-amd64": "1.5.0-nightly.20251116.cd86772"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public",
|
|
27
27
|
"provenance": true,
|
|
28
28
|
"registry": "https://registry.npmjs.org"
|
|
29
29
|
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"foundry",
|
|
32
|
+
"testing",
|
|
33
|
+
"ethereum",
|
|
34
|
+
"solidity",
|
|
35
|
+
"blockchain",
|
|
36
|
+
"smart-contracts"
|
|
37
|
+
],
|
|
30
38
|
"license": "MIT OR Apache-2.0",
|
|
31
39
|
"repository": {
|
|
32
40
|
"directory": "npm",
|