@loadnetwork/permaweb-deploy 2.5.1-loadnetwork.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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +581 -0
  3. package/bin/dev.js +5 -0
  4. package/bin/run.js +5 -0
  5. package/dist/commands/deploy.js +384 -0
  6. package/dist/commands/deploy.js.map +1 -0
  7. package/dist/constants/flags.js +195 -0
  8. package/dist/constants/flags.js.map +1 -0
  9. package/dist/index.js +2 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/prompts/arns.js +89 -0
  12. package/dist/prompts/arns.js.map +1 -0
  13. package/dist/prompts/deployment.js +27 -0
  14. package/dist/prompts/deployment.js.map +1 -0
  15. package/dist/prompts/wallet.js +51 -0
  16. package/dist/prompts/wallet.js.map +1 -0
  17. package/dist/src/commands/deploy.d.ts +9 -0
  18. package/dist/src/commands/deploy.d.ts.map +1 -0
  19. package/dist/src/constants/flags.d.ts +96 -0
  20. package/dist/src/constants/flags.d.ts.map +1 -0
  21. package/dist/src/index.d.ts +2 -0
  22. package/dist/src/index.d.ts.map +1 -0
  23. package/dist/src/prompts/arns.d.ts +13 -0
  24. package/dist/src/prompts/arns.d.ts.map +1 -0
  25. package/dist/src/prompts/deployment.d.ts +6 -0
  26. package/dist/src/prompts/deployment.d.ts.map +1 -0
  27. package/dist/src/prompts/wallet.d.ts +11 -0
  28. package/dist/src/prompts/wallet.d.ts.map +1 -0
  29. package/dist/src/types/index.d.ts +31 -0
  30. package/dist/src/types/index.d.ts.map +1 -0
  31. package/dist/src/utils/__tests__/constants.test.d.ts +2 -0
  32. package/dist/src/utils/__tests__/constants.test.d.ts.map +1 -0
  33. package/dist/src/utils/config-resolver.d.ts +72 -0
  34. package/dist/src/utils/config-resolver.d.ts.map +1 -0
  35. package/dist/src/utils/constants.d.ts +4 -0
  36. package/dist/src/utils/constants.d.ts.map +1 -0
  37. package/dist/src/utils/path.d.ts +5 -0
  38. package/dist/src/utils/path.d.ts.map +1 -0
  39. package/dist/src/utils/signer.d.ts +17 -0
  40. package/dist/src/utils/signer.d.ts.map +1 -0
  41. package/dist/src/utils/uploader.d.ts +8 -0
  42. package/dist/src/utils/uploader.d.ts.map +1 -0
  43. package/dist/src/utils/validators.d.ts +29 -0
  44. package/dist/src/utils/validators.d.ts.map +1 -0
  45. package/dist/tests/constants.d.ts +11 -0
  46. package/dist/tests/constants.d.ts.map +1 -0
  47. package/dist/tests/e2e/deploy-command.test.d.ts +2 -0
  48. package/dist/tests/e2e/deploy-command.test.d.ts.map +1 -0
  49. package/dist/tests/global-setup.d.ts +6 -0
  50. package/dist/tests/global-setup.d.ts.map +1 -0
  51. package/dist/tests/mocks/turbo-handlers.d.ts +105 -0
  52. package/dist/tests/mocks/turbo-handlers.d.ts.map +1 -0
  53. package/dist/tests/setup.d.ts +11 -0
  54. package/dist/tests/setup.d.ts.map +1 -0
  55. package/dist/tests/types/payment-service.d.ts +218 -0
  56. package/dist/tests/types/payment-service.d.ts.map +1 -0
  57. package/dist/tests/types/upload-service.d.ts +168 -0
  58. package/dist/tests/types/upload-service.d.ts.map +1 -0
  59. package/dist/tests/unit/validators.test.d.ts +2 -0
  60. package/dist/tests/unit/validators.test.d.ts.map +1 -0
  61. package/dist/types/index.js +2 -0
  62. package/dist/types/index.js.map +1 -0
  63. package/dist/utils/config-resolver.js +39 -0
  64. package/dist/utils/config-resolver.js.map +1 -0
  65. package/dist/utils/constants.js +6 -0
  66. package/dist/utils/constants.js.map +1 -0
  67. package/dist/utils/path.js +15 -0
  68. package/dist/utils/path.js.map +1 -0
  69. package/dist/utils/signer.js +40 -0
  70. package/dist/utils/signer.js.map +1 -0
  71. package/dist/utils/uploader.js +86 -0
  72. package/dist/utils/uploader.js.map +1 -0
  73. package/dist/utils/validators.js +62 -0
  74. package/dist/utils/validators.js.map +1 -0
  75. package/package.json +110 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Forward Research
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,581 @@
1
+ # Permaweb Deploy
2
+
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 uploads your build folder or a single file, creates Arweave manifests, and updates ArNS (Arweave Name Service) records via ANT (Arweave Name Token) with the transaction ID.
4
+
5
+ ## Load S3 Preview integration
6
+ To use locally the load s3 `--preview` deployment integration:
7
+
8
+ #### setup
9
+
10
+ ```bash
11
+ pnpm install
12
+ pnpm build
13
+
14
+ pnpm link --global
15
+ ```
16
+
17
+ #### deploy
18
+
19
+ from your ui folder:
20
+
21
+ ```bash
22
+ permaweb-deploy deploy --preview --deploy-folder ./dist --wallet ./wallet.json
23
+ ```
24
+ if you want to avoid linking, run it directly from the repo:
25
+
26
+ ```bash
27
+ node ./bin/run.js deploy --preview --deploy-folder /path-to-dist/dist --wallet /path-to-wallet/wallet.json
28
+ ```
29
+ ### anchor
30
+
31
+ to anchor load s3 preview deployment to Arweave while maintaining determinism and provenance:
32
+
33
+ ```bash
34
+ permaweb-deploy deploy --anchor --preview-id <manifest-id> --wallet ./wallet.json
35
+ ```
36
+
37
+ ### Resolving Arweave Manifests (Staging/Prod)
38
+
39
+ For web apps deployed as offchain LS3 dataitems (arweave/paths manifest), the LS3 gateway can properly resolve the manifests under the `/resolve/preview/{manifest_dataitem_id}` endpoint; example:
40
+
41
+ * preview: https://gateway.s3-node-1.load.network/resolve/preview/n8nMf7oSQgBZDEw1mCsGslsp_zAZwmCf4AgTFHSC0C0
42
+
43
+ * manifest json file: https://gateway.s3-node-1.load.network/resolve/n8nMf7oSQgBZDEw1mCsGslsp_zAZwmCf4AgTFHSC0C0
44
+
45
+ to resolve prod (Arweave settled) manifests, use the `/resolve/prod/{manifest_dataitem_id}` endpoint - this endpoint resolve anchored LS3 manifests as well as Arweave-first manifests:
46
+
47
+ * https://gateway.s3-node-1.load.network/resolve/prod/rquIQPiahInYInWyMACxEK4EU27VAt3FZXFPdPYI6vo
48
+
49
+ * Source code: https://github.com/loadnetwork/load_hb/tree/s3-node-1/native/s3_nif/src/sidecar
50
+
51
+
52
+ ## Features
53
+
54
+ - **Turbo SDK Integration:** Uses Turbo SDK for fast, reliable file uploads to Arweave
55
+ - **On-Demand Payment:** Pay with ARIO or Base-ETH tokens on-demand during upload
56
+ - **Arweave Manifest v0.2.0:** Creates manifests with fallback support for SPAs
57
+ - **ArNS Updates:** Updates ArNS records via ANT with new transaction IDs and metadata
58
+ - **Automated Workflow:** Integrates with GitHub Actions for continuous deployment
59
+ - **Git Hash Tagging:** Automatically tags deployments with Git commit hashes
60
+ - **404 Fallback Detection:** Automatically detects and sets 404.html as fallback
61
+ - **Network Support:** Supports mainnet, testnet, and custom ARIO process IDs
62
+ - **Flexible Deployment:** Supports deploying a folder or a single file
63
+ - **Modern CLI:** Built with oclif for a robust command-line experience
64
+ - **TypeScript:** Fully typed for better developer experience
65
+
66
+ ## Installation
67
+
68
+ Install the package using pnpm (recommended):
69
+
70
+ ```bash
71
+ pnpm add -D permaweb-deploy
72
+ ```
73
+
74
+ Or with npm:
75
+
76
+ ```bash
77
+ npm install --save-dev permaweb-deploy
78
+ ```
79
+
80
+ Or with yarn:
81
+
82
+ ```bash
83
+ yarn add --dev permaweb-deploy
84
+ ```
85
+
86
+ ## Prerequisites
87
+
88
+ 1. **For Arweave signer (default):** Encode your Arweave wallet key in base64 format and set it as a GitHub secret:
89
+
90
+ ```bash
91
+ base64 -i wallet.json | pbcopy
92
+ ```
93
+
94
+ 2. **For Ethereum/Polygon/KYVE signers:** Use your raw private key (no encoding needed) as the `DEPLOY_KEY`.
95
+ 3. Ensure that the secret name for the encoded wallet or private key is `DEPLOY_KEY`.
96
+
97
+ ⚠️ **Important:** Use a dedicated wallet for deployments to minimize security risks. Ensure your wallet has sufficient Turbo Credits for uploads.
98
+
99
+ ## Usage
100
+
101
+ ### Interactive Mode (Easiest)
102
+
103
+ **Command Menu:**
104
+
105
+ Simply run the CLI for an interactive command selector:
106
+
107
+ ```bash
108
+ permaweb-deploy
109
+ # or explicitly
110
+ permaweb-deploy interactive
111
+ ```
112
+
113
+ This shows a menu with options:
114
+
115
+ - **Deploy to Permaweb** - Start the deployment wizard
116
+ - **Show Help** - Display help information
117
+ - **Exit** - Exit the CLI
118
+
119
+ **Interactive Deploy (Guided):**
120
+
121
+ Run the deploy command without arguments to be guided through all deployment options:
122
+
123
+ ```bash
124
+ permaweb-deploy deploy
125
+ ```
126
+
127
+ This will prompt you for:
128
+
129
+ - ArNS name
130
+ - Wallet method (file, string, or environment variable)
131
+ - Signer type (Arweave, Ethereum, Polygon, KYVE)
132
+ - What to deploy (folder or file)
133
+ - Advanced options (optional: undername, TTL, network)
134
+
135
+ ### Direct Commands
136
+
137
+ Use flags for faster, scriptable deployments:
138
+
139
+ ```bash
140
+ # Basic deployment with wallet file
141
+ permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json
142
+ ```
143
+
144
+ Deploy using private key directly:
145
+
146
+ ```bash
147
+ permaweb-deploy deploy --arns-name my-app --private-key "$(cat wallet.json)"
148
+ ```
149
+
150
+ Deploy using environment variable:
151
+
152
+ ```bash
153
+ DEPLOY_KEY=$(base64 -i wallet.json) permaweb-deploy deploy --arns-name my-app
154
+ ```
155
+
156
+ Deploy a specific folder:
157
+
158
+ ```bash
159
+ permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --deploy-folder ./build
160
+ ```
161
+
162
+ Deploy a single file:
163
+
164
+ ```bash
165
+ permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --deploy-file ./path/to/file.txt
166
+ ```
167
+
168
+ ### Advanced Usage
169
+
170
+ Deploy to an undername (subdomain):
171
+
172
+ ```bash
173
+ permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --undername staging
174
+ ```
175
+
176
+ Deploy with a custom TTL:
177
+
178
+ ```bash
179
+ permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --ttl-seconds 7200
180
+ ```
181
+
182
+ Deploy using Ethereum wallet (file):
183
+
184
+ ```bash
185
+ permaweb-deploy deploy --arns-name my-app --sig-type ethereum --wallet ./private-key.txt
186
+ ```
187
+
188
+ Deploy using Ethereum wallet (direct key):
189
+
190
+ ```bash
191
+ permaweb-deploy deploy --arns-name my-app --sig-type ethereum --private-key "0x1234..."
192
+ ```
193
+
194
+ ### On-Demand Payment
195
+
196
+ Use on-demand payment to automatically fund uploads with ARIO or Base-ETH tokens when your Turbo balance is insufficient:
197
+
198
+ Deploy with ARIO on-demand payment:
199
+
200
+ ```bash
201
+ permaweb-deploy deploy --arns-name my-app --wallet ./wallet.json --on-demand ario --max-token-amount 1.5
202
+ ```
203
+
204
+ Deploy with Base-ETH on-demand payment (using Ethereum signer):
205
+
206
+ ```bash
207
+ permaweb-deploy deploy --arns-name my-app --sig-type ethereum --private-key "0x..." --on-demand base-eth --max-token-amount 0.1
208
+ ```
209
+
210
+ **On-Demand Payment Options:**
211
+
212
+ - `--on-demand`: Token to use for on-demand payment (`ario` or `base-eth`)
213
+ - `--max-token-amount`: Maximum token amount to spend (in native token units, e.g., `1.5` for 1.5 ARIO or `0.1` for 0.1 ETH)
214
+
215
+ **How it works:**
216
+
217
+ 1. Checks your Turbo balance before upload
218
+ 2. If balance is insufficient, converts tokens to Turbo credits on-demand
219
+ 3. Automatically adds a 10% buffer (`topUpBufferMultiplier: 1.1`) for reliability
220
+ 4. Proceeds with upload once funded
221
+
222
+ **Token compatibility:**
223
+
224
+ - **ARIO**: Works with Arweave signer
225
+ - **Base-ETH**: Works with Ethereum signer (Base Network)
226
+
227
+ ### Command Options
228
+
229
+ - `--arns-name, -n` (required): The ArNS name to update
230
+ - `--ario-process, -p`: ARIO process to use (`mainnet`, `testnet`, or a custom process ID). Default: `mainnet`
231
+ - `--deploy-folder, -d`: Folder to deploy. Default: `./dist`
232
+ - `--deploy-file, -f`: Deploy a single file instead of a folder
233
+ - `--undername, -u`: ANT undername to update. Default: `@`
234
+ - `--ttl-seconds, -t`: TTL in seconds for the ANT record (60-86400). Default: `60`
235
+ - `--sig-type, -s`: Signer type for deployment. Choices: `arweave`, `ethereum`, `polygon`, `kyve`. Default: `arweave`
236
+ - `--wallet, -w`: Path to wallet file (JWK for Arweave, private key for Ethereum/Polygon/KYVE)
237
+ - `--private-key, -k`: Private key or JWK JSON string (alternative to `--wallet`)
238
+ - `--on-demand`: Enable on-demand payment with specified token. Choices: `ario`, `base-eth`
239
+ - `--max-token-amount`: Maximum token amount for on-demand payment (used with `--on-demand`)
240
+
241
+ ### Package.json Scripts
242
+
243
+ Add deployment scripts to your `package.json`:
244
+
245
+ ```json
246
+ {
247
+ "scripts": {
248
+ "build": "vite build",
249
+ "deploy": "pnpm build && permaweb-deploy deploy --arns-name <ARNS_NAME>",
250
+ "deploy:staging": "pnpm build && permaweb-deploy deploy --arns-name <ARNS_NAME> --undername staging",
251
+ "deploy:testnet": "pnpm build && permaweb-deploy deploy --arns-name <ARNS_NAME> --ario-process testnet",
252
+ "deploy:on-demand": "pnpm build && permaweb-deploy deploy --arns-name <ARNS_NAME> --on-demand ario --max-token-amount 1.5"
253
+ }
254
+ }
255
+ ```
256
+
257
+ Then deploy with:
258
+
259
+ ```bash
260
+ DEPLOY_KEY=$(base64 -i wallet.json) pnpm deploy
261
+ ```
262
+
263
+ Or with on-demand payment:
264
+
265
+ ```bash
266
+ DEPLOY_KEY=$(base64 -i wallet.json) pnpm deploy:on-demand
267
+ ```
268
+
269
+ ## GitHub Action
270
+
271
+ The easiest way to integrate permaweb-deploy into your CI/CD pipeline is using our official GitHub Action.
272
+
273
+ ### Basic Usage
274
+
275
+ ```yaml
276
+ - uses: permaweb/permaweb-deploy@v1
277
+ with:
278
+ deploy-key: ${{ secrets.DEPLOY_KEY }}
279
+ arns-name: myapp
280
+ deploy-folder: ./dist
281
+ ```
282
+
283
+ ### PR Preview Deployments
284
+
285
+ Automatically deploy preview builds for each pull request. The `preview` mode auto-generates an undername from the PR number and posts a comment with the preview URL:
286
+
287
+ ```yaml
288
+ name: Deploy PR Preview
289
+
290
+ on:
291
+ pull_request:
292
+ types: [opened, synchronize]
293
+
294
+ jobs:
295
+ deploy-preview:
296
+ runs-on: ubuntu-latest
297
+ steps:
298
+ - uses: actions/checkout@v4
299
+
300
+ - name: Setup Node.js
301
+ uses: actions/setup-node@v4
302
+ with:
303
+ node-version: '20'
304
+
305
+ - name: Install dependencies
306
+ run: npm ci
307
+
308
+ - name: Build
309
+ run: npm run build
310
+
311
+ - name: Deploy Preview
312
+ uses: permaweb/permaweb-deploy@v1
313
+ with:
314
+ deploy-key: ${{ secrets.DEPLOY_KEY }}
315
+ arns-name: myapp
316
+ preview: 'true'
317
+ github-token: ${{ secrets.GITHUB_TOKEN }}
318
+ deploy-folder: ./dist
319
+ ```
320
+
321
+ When `preview` is enabled, the action will:
322
+
323
+ - Auto-generate an undername like `pr-123` from the PR number
324
+ - Post a comment on the PR with the preview URL
325
+ - Update the comment on subsequent pushes instead of creating new ones
326
+
327
+ ### Production Deployment
328
+
329
+ Deploy to your base ArNS name when pushing to main:
330
+
331
+ ```yaml
332
+ name: Deploy to Production
333
+
334
+ on:
335
+ push:
336
+ branches: [main]
337
+
338
+ jobs:
339
+ deploy:
340
+ runs-on: ubuntu-latest
341
+ steps:
342
+ - uses: actions/checkout@v4
343
+
344
+ - name: Setup Node.js
345
+ uses: actions/setup-node@v4
346
+ with:
347
+ node-version: '20'
348
+
349
+ - name: Install dependencies
350
+ run: npm ci
351
+
352
+ - name: Build
353
+ run: npm run build
354
+
355
+ - name: Deploy to Permaweb
356
+ uses: permaweb/permaweb-deploy@v1
357
+ with:
358
+ deploy-key: ${{ secrets.DEPLOY_KEY }}
359
+ arns-name: myapp
360
+ deploy-folder: ./dist
361
+ ```
362
+
363
+ ### With On-Demand Payment
364
+
365
+ ```yaml
366
+ - name: Deploy with ARIO on-demand
367
+ uses: permaweb/permaweb-deploy@v1
368
+ with:
369
+ deploy-key: ${{ secrets.DEPLOY_KEY }}
370
+ arns-name: myapp
371
+ deploy-folder: ./dist
372
+ on-demand: ario
373
+ max-token-amount: '2.0'
374
+ ```
375
+
376
+ ---
377
+
378
+ ## CLI in GitHub Actions
379
+
380
+ You can also use the CLI directly in your workflows:
381
+
382
+ **Basic Workflow:**
383
+
384
+ ```yaml
385
+ name: Deploy to Permaweb
386
+
387
+ on:
388
+ push:
389
+ branches:
390
+ - main
391
+
392
+ jobs:
393
+ publish:
394
+ runs-on: ubuntu-latest
395
+ steps:
396
+ - uses: actions/checkout@v4
397
+
398
+ - uses: pnpm/action-setup@v3
399
+ with:
400
+ version: 9
401
+
402
+ - uses: actions/setup-node@v4
403
+ with:
404
+ node-version: 20
405
+ cache: 'pnpm'
406
+
407
+ - run: pnpm install
408
+
409
+ - run: pnpm deploy
410
+ env:
411
+ DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
412
+ ```
413
+
414
+ **With On-Demand Payment:**
415
+
416
+ ```yaml
417
+ name: Deploy to Permaweb with On-Demand Payment
418
+
419
+ on:
420
+ push:
421
+ branches:
422
+ - main
423
+
424
+ jobs:
425
+ publish:
426
+ runs-on: ubuntu-latest
427
+ steps:
428
+ - uses: actions/checkout@v4
429
+
430
+ - uses: pnpm/action-setup@v3
431
+ with:
432
+ version: 9
433
+
434
+ - uses: actions/setup-node@v4
435
+ with:
436
+ node-version: 20
437
+ cache: 'pnpm'
438
+
439
+ - run: pnpm install
440
+ - run: pnpm build
441
+
442
+ - name: Deploy with ARIO on-demand
443
+ run: permaweb-deploy deploy --arns-name my-app --on-demand ario --max-token-amount 2.0
444
+ env:
445
+ DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
446
+
447
+ # Or deploy with Ethereum and Base-ETH:
448
+ # - name: Deploy with Base-ETH on-demand
449
+ # run: |
450
+ # permaweb-deploy deploy \
451
+ # --arns-name my-app \
452
+ # --sig-type ethereum \
453
+ # --on-demand base-eth \
454
+ # --max-token-amount 0.2
455
+ # env:
456
+ # DEPLOY_KEY: ${{ secrets.ETH_PRIVATE_KEY }}
457
+ ```
458
+
459
+ ## Development
460
+
461
+ ### Setup
462
+
463
+ ```bash
464
+ # Install dependencies
465
+ pnpm install
466
+
467
+ # Build the project
468
+ pnpm build
469
+
470
+ # Run in development mode
471
+ pnpm dev
472
+
473
+ # Run tests
474
+ pnpm test
475
+
476
+ # Run linter
477
+ pnpm lint
478
+
479
+ # Format code
480
+ pnpm format
481
+ ```
482
+
483
+ ### Project Structure
484
+
485
+ ```
486
+ permaweb-deploy/
487
+ ├── src/
488
+ │ ├── commands/ # oclif commands
489
+ │ │ └── deploy.ts
490
+ │ ├── types/ # TypeScript type definitions
491
+ │ │ └── index.ts
492
+ │ ├── utils/ # Utility functions
493
+ │ │ ├── constants.ts
494
+ │ │ ├── signer.ts
495
+ │ │ ├── uploader.ts
496
+ │ │ └── __tests__/ # Unit tests
497
+ │ └── index.ts # Main entry point
498
+ ├── bin/ # Executable scripts
499
+ │ ├── run.js
500
+ │ └── dev.js
501
+ ├── .changeset/ # Changesets configuration
502
+ ├── .husky/ # Git hooks
503
+ └── dist/ # Build output
504
+ ```
505
+
506
+ ## Security & Best Practices
507
+
508
+ - **Dedicated Wallet:** Always use a dedicated wallet for deployments to minimize security risks
509
+ - **Wallet Encoding:** Arweave wallets must be base64 encoded to be used in the deployment script
510
+ - **ArNS Name:** The ArNS Name must be passed so that the ANT Process can be resolved to update the target undername or root record
511
+ - **Turbo Credits:** Ensure your wallet has sufficient Turbo Credits, or use on-demand payment for automatic funding
512
+ - **On-Demand Limits:** Set reasonable `--max-token-amount` limits to prevent unexpected costs
513
+ - **Secret Management:** Keep your `DEPLOY_KEY` secret secure and never commit it to your repository
514
+ - **Build Security:** Always check your build for exposed environmental secrets before deployment, as data on Arweave is permanent
515
+
516
+ ## Troubleshooting
517
+
518
+ - **Error: "DEPLOY_KEY environment variable not set":** Verify your base64 encoded wallet is set as the `DEPLOY_KEY` environment variable
519
+ - **Error: "deploy-folder does not exist":** Check that your build folder exists and the path is correct
520
+ - **Error: "deploy-file does not exist":** Check that your build file exists and the path is correct
521
+ - **Error: "ArNS name does not exist":** Verify the ArNS name is correct and exists in the specified network
522
+ - **Upload timeouts:** Files have a timeout for upload. Large files may fail and require optimization
523
+ - **Insufficient Turbo Credits:** Use `--on-demand` with `--max-token-amount` to automatically fund uploads when balance is low
524
+ - **On-demand payment fails:** Ensure your wallet has sufficient tokens (ARIO or Base-ETH) and the token type matches your signer (`ario` with Arweave, `base-eth` with Ethereum)
525
+
526
+ ## Contributing
527
+
528
+ Contributions are welcome! Please follow these guidelines:
529
+
530
+ 1. Fork the repository
531
+ 2. Create a feature branch
532
+ 3. Make your changes
533
+ 4. Run tests and linter: `pnpm test && pnpm lint`
534
+ 5. Create a changeset: `pnpm changeset`
535
+ 6. Commit your changes using conventional commits
536
+ 7. Push and create a pull request
537
+
538
+ ### Conventional Commits
539
+
540
+ This project uses [Conventional Commits](https://www.conventionalcommits.org/). Commit messages should follow this format:
541
+
542
+ ```
543
+ type(scope): subject
544
+
545
+ body (optional)
546
+ ```
547
+
548
+ Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
549
+
550
+ ### Changesets
551
+
552
+ We use [changesets](https://github.com/changesets/changesets) for version management. When making changes:
553
+
554
+ ```bash
555
+ pnpm changeset
556
+ ```
557
+
558
+ Follow the prompts to describe your changes.
559
+
560
+ ## Dependencies
561
+
562
+ - **@ar.io/sdk** - For ANT operations and ArNS management
563
+ - **@ardrive/turbo-sdk** - For fast file uploads to Arweave
564
+ - **@permaweb/aoconnect** - For AO network connectivity
565
+ - **@oclif/core** - CLI framework
566
+ - **mime-types** - MIME type detection
567
+
568
+ ## License
569
+
570
+ ISC
571
+
572
+ ## Author
573
+
574
+ NickJ202
575
+
576
+ ## Links
577
+
578
+ - [GitHub Repository](https://github.com/permaweb/permaweb-deploy)
579
+ - [Issues](https://github.com/permaweb/permaweb-deploy/issues)
580
+ - [Arweave Documentation](https://docs.arweave.org/)
581
+ - [AR.IO Documentation](https://docs.ar.io/)
package/bin/dev.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env tsx
2
+
3
+ import { execute } from '@oclif/core'
4
+
5
+ await execute({ development: true, dir: import.meta.url })
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execute } from '@oclif/core'
4
+
5
+ await execute({ development: false, dir: import.meta.url })