permaweb-deploy 2.2.0 → 2.3.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.
- package/README.md +22 -6
- package/dist/index.js +19 -1
- package/package.json +1 -1
- package/src/index.js +22 -1
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Inspired by the [cookbook github action deployment guide](https://cookbook.arweave.dev/guides/deployment/github-action.html), `permaweb-deploy` is a Node.js command-line tool designed to streamline the deployment of web applications to the permaweb using Arweave. It simplifies the process by uploading your build folder, creating Arweave manifests, and updating ArNS (Arweave Name Service) records via ANT (Arweave Name Token) with the transaction ID.
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
|
+
|
|
6
7
|
- **Turbo SDK Integration:** Uses Turbo SDK for fast, reliable file uploads to Arweave
|
|
7
8
|
- **Arweave Manifest v0.2.0:** Creates manifests with fallback support for SPAs
|
|
8
9
|
- **ArNS Updates:** Updates ArNS records via ANT with new transaction IDs and metadata
|
|
@@ -20,11 +21,13 @@ npm install permaweb-deploy
|
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
For development use:
|
|
24
|
+
|
|
23
25
|
```bash
|
|
24
26
|
npm install permaweb-deploy --save-dev
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
For Yarn users:
|
|
30
|
+
|
|
28
31
|
```bash
|
|
29
32
|
yarn add permaweb-deploy --dev --ignore-engines
|
|
30
33
|
```
|
|
@@ -32,6 +35,7 @@ yarn add permaweb-deploy --dev --ignore-engines
|
|
|
32
35
|
### Prerequisites
|
|
33
36
|
|
|
34
37
|
Before using `permaweb-deploy`, you must:
|
|
38
|
+
|
|
35
39
|
1. **Arweave Wallet:** Have an Arweave wallet with Turbo Credits for uploading
|
|
36
40
|
2. **ArNS Name:** Own or control an ArNS name (which has an associated ANT process)
|
|
37
41
|
3. **Wallet Encoding:** Encode your Arweave wallet key in base64 format:
|
|
@@ -43,16 +47,19 @@ Before using `permaweb-deploy`, you must:
|
|
|
43
47
|
⚠️ **Important:** Use a dedicated wallet for deployments to minimize security risks. Ensure your wallet has sufficient Turbo Credits for uploads.
|
|
44
48
|
|
|
45
49
|
### CLI Options
|
|
50
|
+
|
|
46
51
|
```bash
|
|
47
52
|
permaweb-deploy [options]
|
|
48
53
|
```
|
|
49
54
|
|
|
50
|
-
| Option
|
|
51
|
-
|
|
52
|
-
| `--arns-name`
|
|
53
|
-
| `--ario-process`
|
|
54
|
-
| `--deploy-folder` | `-d`
|
|
55
|
-
| `--
|
|
55
|
+
| Option | Alias | Description | Default | Required |
|
|
56
|
+
| ----------------- | ----- | -------------------------------------- | --------- | -------- |
|
|
57
|
+
| `--arns-name` | `-n` | ArNS name for deployment | - | ✅ |
|
|
58
|
+
| `--ario-process` | `-p` | ARIO process ID or "mainnet"/"testnet" | `mainnet` | ❌ |
|
|
59
|
+
| `--deploy-folder` | `-d` | Folder to deploy | `./dist` | ❌ |
|
|
60
|
+
| `--deploy-file` | `-f` | File to deploy | `./dist` | ❌ |
|
|
61
|
+
| `--undername` | `-u` | ANT undername to update | `@` | ❌ |
|
|
62
|
+
| `--ttl-seconds` | `-t` | ArNS TTL Seconds | `3600` | ❌ |
|
|
56
63
|
|
|
57
64
|
### Usage
|
|
58
65
|
|
|
@@ -66,6 +73,7 @@ To deploy your application, ensure you have a build script and a deployment scri
|
|
|
66
73
|
```
|
|
67
74
|
|
|
68
75
|
**Example with custom options:**
|
|
76
|
+
|
|
69
77
|
```bash
|
|
70
78
|
permaweb-deploy --arns-name "your-arns-name" --deploy-folder "./build" --undername "app"
|
|
71
79
|
```
|
|
@@ -73,6 +81,7 @@ permaweb-deploy --arns-name "your-arns-name" --deploy-folder "./build" --underna
|
|
|
73
81
|
Replace `<ARNS_NAME>` with your ArNS name. You can also specify testnet, mainnet, and custom process IDs for the ARIO process to use.
|
|
74
82
|
|
|
75
83
|
**Mainnet (default) config:**
|
|
84
|
+
|
|
76
85
|
```json
|
|
77
86
|
"scripts": {
|
|
78
87
|
"build": "your-build-command",
|
|
@@ -81,6 +90,7 @@ Replace `<ARNS_NAME>` with your ArNS name. You can also specify testnet, mainnet
|
|
|
81
90
|
```
|
|
82
91
|
|
|
83
92
|
**Testnet config:**
|
|
93
|
+
|
|
84
94
|
```json
|
|
85
95
|
"scripts": {
|
|
86
96
|
"build": "your-build-command",
|
|
@@ -89,6 +99,7 @@ Replace `<ARNS_NAME>` with your ArNS name. You can also specify testnet, mainnet
|
|
|
89
99
|
```
|
|
90
100
|
|
|
91
101
|
**Custom process ID config:**
|
|
102
|
+
|
|
92
103
|
```json
|
|
93
104
|
"scripts": {
|
|
94
105
|
"build": "your-build-command",
|
|
@@ -97,11 +108,13 @@ Replace `<ARNS_NAME>` with your ArNS name. You can also specify testnet, mainnet
|
|
|
97
108
|
```
|
|
98
109
|
|
|
99
110
|
### Manual CLI Deployment
|
|
111
|
+
|
|
100
112
|
```bash
|
|
101
113
|
DEPLOY_KEY=$(base64 -i wallet.json) npx permaweb-deploy --arns-name <ARNS_NAME>
|
|
102
114
|
```
|
|
103
115
|
|
|
104
116
|
### Technical Details
|
|
117
|
+
|
|
105
118
|
- **Upload Service:** Uses Turbo SDK for fast, reliable file uploads to Arweave
|
|
106
119
|
- **Manifest Format:** Creates Arweave manifests using version 0.2.0 specification
|
|
107
120
|
- **Fallback Support:** Automatically detects `404.html` and sets it as fallback, otherwise uses `index.html`
|
|
@@ -137,6 +150,7 @@ jobs:
|
|
|
137
150
|
```
|
|
138
151
|
|
|
139
152
|
### Security & Best Practices
|
|
153
|
+
|
|
140
154
|
- **Dedicated Wallet:** Always use a dedicated wallet for deployments to minimize security risks
|
|
141
155
|
- **Wallet Encoding:** The wallet must be base64 encoded to be used in the deployment script
|
|
142
156
|
- **ArNS Name:** The ArNS Name must be passed so that the ANT Process can be resolved to update the target undername or root record
|
|
@@ -145,6 +159,7 @@ jobs:
|
|
|
145
159
|
- **Build Security:** Always check your build for exposed environmental secrets before deployment, as data on Arweave is permanent
|
|
146
160
|
|
|
147
161
|
### Troubleshooting
|
|
162
|
+
|
|
148
163
|
- **Error: "ARNS_NAME not configured":** Ensure you're passing the `--arns-name` flag with a valid ArNS name
|
|
149
164
|
- **Error: "DEPLOY_KEY not configured":** Verify your base64 encoded wallet is set as the `DEPLOY_KEY` environment variable
|
|
150
165
|
- **Error: "deploy-folder does not exist":** Check that your build folder exists and the path is correct
|
|
@@ -154,6 +169,7 @@ jobs:
|
|
|
154
169
|
- **Insufficient Turbo Credits:** Ensure your wallet has enough Turbo Credits for the deployment
|
|
155
170
|
|
|
156
171
|
### Dependencies
|
|
172
|
+
|
|
157
173
|
- **@ar.io/sdk:** - For ANT operations and ArNS management
|
|
158
174
|
- **@ardrive/turbo-sdk:** - For fast file uploads to Arweave
|
|
159
175
|
- **@permaweb/aoconnect:** - For AO network connectivity
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,11 @@ var argv = (0, _yargs["default"])((0, _helpers.hideBin)(process.argv)).option('a
|
|
|
40
40
|
alias: 'f',
|
|
41
41
|
type: 'string',
|
|
42
42
|
description: 'File to deploy.'
|
|
43
|
+
}).option('ttl-seconds', {
|
|
44
|
+
alias: 't',
|
|
45
|
+
type: 'number',
|
|
46
|
+
description: 'ArNS TTL Seconds',
|
|
47
|
+
"default": 3600
|
|
43
48
|
}).option('undername', {
|
|
44
49
|
alias: 'u',
|
|
45
50
|
type: 'string',
|
|
@@ -48,6 +53,7 @@ var argv = (0, _yargs["default"])((0, _helpers.hideBin)(process.argv)).option('a
|
|
|
48
53
|
}).argv;
|
|
49
54
|
var DEPLOY_KEY = process.env.DEPLOY_KEY;
|
|
50
55
|
var ARNS_NAME = argv.arnsName;
|
|
56
|
+
var TTL_SECONDS = argv.ttlSeconds;
|
|
51
57
|
var ARIO_PROCESS = argv.arioProcess;
|
|
52
58
|
if (ARIO_PROCESS === 'mainnet') {
|
|
53
59
|
ARIO_PROCESS = _sdk.ARIO_MAINNET_PROCESS_ID;
|
|
@@ -71,6 +77,10 @@ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
|
71
77
|
console.error('ARNS_NAME not configured');
|
|
72
78
|
process.exit(1);
|
|
73
79
|
}
|
|
80
|
+
if (!Number.isFinite(TTL_SECONDS) || TTL_SECONDS < 60 || TTL_SECONDS > 86400) {
|
|
81
|
+
console.error('TTL_SECONDS must be a number between 60 and 86400 seconds');
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
74
84
|
if (argv.deployFile && !_fs["default"].existsSync(argv.deployFile)) {
|
|
75
85
|
console.error("deploy-file [".concat(argv.deployFolder, "] does not exist"));
|
|
76
86
|
process.exit(1);
|
|
@@ -123,6 +133,14 @@ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
|
123
133
|
case 5:
|
|
124
134
|
txId = _context.v;
|
|
125
135
|
case 6:
|
|
136
|
+
console.log('-------------------- DEPLOY DETAILS --------------------');
|
|
137
|
+
console.log("Tx ID: ".concat(txId));
|
|
138
|
+
console.log("ArNS Name: ".concat(ARNS_NAME));
|
|
139
|
+
console.log("Undername: ".concat(argv.undername));
|
|
140
|
+
console.log("ANT: ".concat(arnsNameRecord.processId));
|
|
141
|
+
console.log("AR IO Process: ".concat(ARIO_PROCESS));
|
|
142
|
+
console.log("TTL Seconds: ".concat(TTL_SECONDS));
|
|
143
|
+
console.log('--------------------------------------------------------');
|
|
126
144
|
signer = new _sdk.ArweaveSigner(jwk);
|
|
127
145
|
ant = _sdk.ANT.init({
|
|
128
146
|
processId: arnsNameRecord.processId,
|
|
@@ -132,7 +150,7 @@ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
|
132
150
|
return ant.setRecord({
|
|
133
151
|
undername: argv.undername,
|
|
134
152
|
transactionId: txId,
|
|
135
|
-
ttlSeconds:
|
|
153
|
+
ttlSeconds: TTL_SECONDS
|
|
136
154
|
}, {
|
|
137
155
|
tags: [{
|
|
138
156
|
name: 'App-Name',
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -37,6 +37,12 @@ const argv = yargs(hideBin(process.argv))
|
|
|
37
37
|
type: 'string',
|
|
38
38
|
description: 'File to deploy.'
|
|
39
39
|
})
|
|
40
|
+
.option('ttl-seconds', {
|
|
41
|
+
alias: 't',
|
|
42
|
+
type: 'number',
|
|
43
|
+
description: 'ArNS TTL Seconds',
|
|
44
|
+
default: 3600
|
|
45
|
+
})
|
|
40
46
|
.option('undername', {
|
|
41
47
|
alias: 'u',
|
|
42
48
|
type: 'string',
|
|
@@ -46,6 +52,7 @@ const argv = yargs(hideBin(process.argv))
|
|
|
46
52
|
|
|
47
53
|
const DEPLOY_KEY = process.env.DEPLOY_KEY;
|
|
48
54
|
const ARNS_NAME = argv.arnsName;
|
|
55
|
+
const TTL_SECONDS = argv.ttlSeconds;
|
|
49
56
|
let ARIO_PROCESS = argv.arioProcess;
|
|
50
57
|
if (ARIO_PROCESS === 'mainnet') {
|
|
51
58
|
ARIO_PROCESS = ARIO_MAINNET_PROCESS_ID;
|
|
@@ -69,6 +76,11 @@ if (ARIO_PROCESS === 'mainnet') {
|
|
|
69
76
|
process.exit(1);
|
|
70
77
|
}
|
|
71
78
|
|
|
79
|
+
if (!Number.isFinite(TTL_SECONDS) || TTL_SECONDS < 60 || TTL_SECONDS > 86400) {
|
|
80
|
+
console.error('TTL_SECONDS must be a number between 60 and 86400 seconds');
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
72
84
|
if (argv.deployFile && !fs.existsSync(argv.deployFile)) {
|
|
73
85
|
console.error(`deploy-file [${argv.deployFolder}] does not exist`);
|
|
74
86
|
process.exit(1);
|
|
@@ -111,6 +123,15 @@ if (ARIO_PROCESS === 'mainnet') {
|
|
|
111
123
|
txId = await uploadDirectory(argv, jwk);
|
|
112
124
|
}
|
|
113
125
|
|
|
126
|
+
console.log('-------------------- DEPLOY DETAILS --------------------');
|
|
127
|
+
console.log(`Tx ID: ${txId}`);
|
|
128
|
+
console.log(`ArNS Name: ${ARNS_NAME}`);
|
|
129
|
+
console.log(`Undername: ${argv.undername}`);
|
|
130
|
+
console.log(`ANT: ${arnsNameRecord.processId}`);
|
|
131
|
+
console.log(`AR IO Process: ${ARIO_PROCESS}`);
|
|
132
|
+
console.log(`TTL Seconds: ${TTL_SECONDS}`);
|
|
133
|
+
console.log('--------------------------------------------------------');
|
|
134
|
+
|
|
114
135
|
const signer = new ArweaveSigner(jwk);
|
|
115
136
|
const ant = ANT.init({ processId: arnsNameRecord.processId, signer });
|
|
116
137
|
|
|
@@ -119,7 +140,7 @@ if (ARIO_PROCESS === 'mainnet') {
|
|
|
119
140
|
{
|
|
120
141
|
undername: argv.undername,
|
|
121
142
|
transactionId: txId,
|
|
122
|
-
ttlSeconds:
|
|
143
|
+
ttlSeconds: TTL_SECONDS,
|
|
123
144
|
},
|
|
124
145
|
{
|
|
125
146
|
tags: [
|