permaweb-deploy 1.1.10 → 2.0.1

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 CHANGED
@@ -28,11 +28,11 @@ To deploy your application, ensure you have a build script and a deployment scri
28
28
  ```json
29
29
  "scripts": {
30
30
  "build": "your-build-command",
31
- "deploy-main": "npm run build && permaweb-deploy --ant-process <ANT_PROCESS>"
31
+ "deploy-main": "npm run build && permaweb-deploy --arns-name <ARNS_NAME>"
32
32
  }
33
33
  ```
34
34
 
35
- Replace `<ANT_PROCESS>` with your actual ANT process.
35
+ Replace `<ARNS_NAME>` with your ArNS name.
36
36
 
37
37
  ### GitHub Actions Workflow
38
38
  To automate the deployment, set up a GitHub Actions workflow as follows:
@@ -61,10 +61,10 @@ jobs:
61
61
  ### To deploy to permaweb manually via cli
62
62
 
63
63
  ```sh
64
- DEPLOY_KEY=$(base64 -i wallet.json) npx permaweb-deploy --ant-process <ANT_PROCESS>
64
+ DEPLOY_KEY=$(base64 -i wallet.json) npx permaweb-deploy --arns-name <ARNS_NAME>
65
65
  ```
66
66
 
67
67
  ### Important Notes
68
68
  - **Security:** Always use a dedicated wallet for deployments to minimize risk.
69
69
  - **Wallet Key:** The wallet must be base64 encoded to be used in the deployment script.
70
- - **ANT Process:** The ANT process must be passed at runtime to associate your deployment with a specific ANT process on AO.
70
+ - **ARNS Name:** The ArNS Name must be passed in so that the ANT Process can be resolved to update the target undername or root record.
package/dist/index.js CHANGED
@@ -21,10 +21,10 @@ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(
21
21
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
22
22
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
23
23
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
24
- var argv = (0, _yargs["default"])((0, _helpers.hideBin)(process.argv)).option('ant-process', {
25
- alias: 'a',
24
+ var argv = (0, _yargs["default"])((0, _helpers.hideBin)(process.argv)).option('arns-name', {
25
+ alias: 'n',
26
26
  type: 'string',
27
- description: 'The ANT process',
27
+ description: 'The ARNS name',
28
28
  demandOption: true
29
29
  }).option('deploy-folder', {
30
30
  alias: 'd',
@@ -38,7 +38,7 @@ var argv = (0, _yargs["default"])((0, _helpers.hideBin)(process.argv)).option('a
38
38
  "default": '@'
39
39
  }).argv;
40
40
  var DEPLOY_KEY = process.env.DEPLOY_KEY;
41
- var ANT_PROCESS = argv.antProcess;
41
+ var ARNS_NAME = argv.arnsName;
42
42
  function getTagValue(list, name) {
43
43
  for (var i = 0; i < list.length; i++) {
44
44
  if (list[i]) {
@@ -50,7 +50,7 @@ function getTagValue(list, name) {
50
50
  return STORAGE.none;
51
51
  }
52
52
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
53
- var jwk, manifestId, signer, ant;
53
+ var jwk, ario, arnsNameRecord, manifestId, signer, ant;
54
54
  return _regeneratorRuntime().wrap(function _callee$(_context) {
55
55
  while (1) switch (_context.prev = _context.next) {
56
56
  case 0:
@@ -58,8 +58,8 @@ _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
58
58
  console.error('DEPLOY_KEY not configured');
59
59
  process.exit(1);
60
60
  }
61
- if (!ANT_PROCESS) {
62
- console.error('ANT_PROCESS not configured');
61
+ if (!ARNS_NAME) {
62
+ console.error('ARNS_NAME not configured');
63
63
  process.exit(1);
64
64
  }
65
65
  if (argv.deployFolder.length == 0) {
@@ -75,17 +75,27 @@ _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
75
75
  process.exit(1);
76
76
  }
77
77
  jwk = JSON.parse(Buffer.from(DEPLOY_KEY, 'base64').toString('utf-8'));
78
- _context.prev = 6;
78
+ ario = _sdk.ARIO.init();
79
79
  _context.next = 9;
80
- return (0, _turbo["default"])(argv, jwk);
80
+ return ario.getArNSRecord({
81
+ name: ARNS_NAME
82
+ })["catch"](function (e) {
83
+ console.error("ARNS name [".concat(ARNS_NAME, "] does not exist"));
84
+ process.exit(1);
85
+ });
81
86
  case 9:
87
+ arnsNameRecord = _context.sent;
88
+ _context.prev = 10;
89
+ _context.next = 13;
90
+ return (0, _turbo["default"])(argv, jwk);
91
+ case 13:
82
92
  manifestId = _context.sent;
83
93
  signer = new _sdk.ArweaveSigner(jwk);
84
94
  ant = _sdk.ANT.init({
85
- processId: ANT_PROCESS,
95
+ processId: arnsNameRecord.processId,
86
96
  signer: signer
87
97
  }); // Update the ANT record (assumes the JWK is a controller or owner)
88
- _context.next = 14;
98
+ _context.next = 18;
89
99
  return ant.setRecord({
90
100
  undername: argv.undername,
91
101
  transactionId: manifestId,
@@ -99,18 +109,18 @@ _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
99
109
  value: process.env.GITHUB_SHA
100
110
  }] : []))
101
111
  });
102
- case 14:
103
- console.log("Deployed TxId [".concat(manifestId, "] to ANT [").concat(ANT_PROCESS, "] using undername [").concat(argv.undername, "]"));
104
- _context.next = 21;
112
+ case 18:
113
+ console.log("Deployed TxId [".concat(manifestId, "] to name [").concat(ARNS_NAME, "] for ANT [").concat(arnsNameRecord.processId, "] using undername [").concat(argv.undername, "]"));
114
+ _context.next = 25;
105
115
  break;
106
- case 17:
107
- _context.prev = 17;
108
- _context.t0 = _context["catch"](6);
116
+ case 21:
117
+ _context.prev = 21;
118
+ _context.t0 = _context["catch"](10);
109
119
  console.error('Deployment failed:', _context.t0);
110
120
  process.exit(1); // Exit with error code
111
- case 21:
121
+ case 25:
112
122
  case "end":
113
123
  return _context.stop();
114
124
  }
115
- }, _callee, null, [[6, 17]]);
125
+ }, _callee, null, [[10, 21]]);
116
126
  }))();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permaweb-deploy",
3
- "version": "1.1.10",
3
+ "version": "2.0.1",
4
4
  "description": "Permaweb app deployment package",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,7 +10,7 @@
10
10
  "permaweb-deploy": "./dist/index.js"
11
11
  },
12
12
  "dependencies": {
13
- "@ar.io/sdk": "^2.2.5",
13
+ "@ar.io/sdk": "^3.10.1",
14
14
  "@ardrive/turbo-sdk": "^1.17.0",
15
15
  "mime-types": "^2.1.35",
16
16
  "yargs": "17.7.2"
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { ANT, ArweaveSigner } from '@ar.io/sdk';
3
+ import { ANT, ARIO, ArweaveSigner } from '@ar.io/sdk';
4
4
  import fs from 'fs';
5
5
  import yargs from 'yargs';
6
6
  import { hideBin } from 'yargs/helpers';
@@ -8,10 +8,10 @@ import { hideBin } from 'yargs/helpers';
8
8
  import TurboDeploy from './turbo';
9
9
 
10
10
  const argv = yargs(hideBin(process.argv))
11
- .option('ant-process', {
12
- alias: 'a',
11
+ .option('arns-name', {
12
+ alias: 'n',
13
13
  type: 'string',
14
- description: 'The ANT process',
14
+ description: 'The ARNS name',
15
15
  demandOption: true,
16
16
  })
17
17
  .option('deploy-folder', {
@@ -28,7 +28,7 @@ const argv = yargs(hideBin(process.argv))
28
28
  }).argv;
29
29
 
30
30
  const DEPLOY_KEY = process.env.DEPLOY_KEY;
31
- const ANT_PROCESS = argv.antProcess;
31
+ const ARNS_NAME = argv.arnsName;
32
32
 
33
33
  export function getTagValue(list, name) {
34
34
  for (let i = 0; i < list.length; i++) {
@@ -47,11 +47,12 @@ export function getTagValue(list, name) {
47
47
  process.exit(1);
48
48
  }
49
49
 
50
- if (!ANT_PROCESS) {
51
- console.error('ANT_PROCESS not configured');
50
+ if (!ARNS_NAME) {
51
+ console.error('ARNS_NAME not configured');
52
52
  process.exit(1);
53
53
  }
54
54
 
55
+
55
56
  if (argv.deployFolder.length == 0) {
56
57
  console.error('deploy folder must not be empty');
57
58
  process.exit(1);
@@ -67,11 +68,18 @@ export function getTagValue(list, name) {
67
68
  process.exit(1);
68
69
  }
69
70
 
70
- let jwk = JSON.parse(Buffer.from(DEPLOY_KEY, 'base64').toString('utf-8'));
71
+ const jwk = JSON.parse(Buffer.from(DEPLOY_KEY, 'base64').toString('utf-8'));
72
+ const ario = ARIO.init()
73
+ const arnsNameRecord = await ario.getArNSRecord({name: ARNS_NAME}).catch((e) => {
74
+ console.error(`ARNS name [${ARNS_NAME}] does not exist`);
75
+ process.exit(1);
76
+ });
77
+
78
+
71
79
  try {
72
80
  const manifestId = await TurboDeploy(argv, jwk);
73
81
  const signer = new ArweaveSigner(jwk);
74
- const ant = ANT.init({ processId: ANT_PROCESS, signer });
82
+ const ant = ANT.init({ processId: arnsNameRecord.processId, signer });
75
83
 
76
84
  // Update the ANT record (assumes the JWK is a controller or owner)
77
85
  await ant.setRecord(
@@ -93,7 +101,7 @@ export function getTagValue(list, name) {
93
101
  }
94
102
  );
95
103
 
96
- console.log(`Deployed TxId [${manifestId}] to ANT [${ANT_PROCESS}] using undername [${argv.undername}]`);
104
+ console.log(`Deployed TxId [${manifestId}] to name [${ARNS_NAME}] for ANT [${arnsNameRecord.processId}] using undername [${argv.undername}]`);
97
105
  } catch (e) {
98
106
  console.error('Deployment failed:', e);
99
107
  process.exit(1); // Exit with error code