@airmoney-degn/airmoney-cli 0.19.2 → 0.19.4

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/dist/cli/dapp.js CHANGED
@@ -19,6 +19,23 @@ async function dappStatusCommand() {
19
19
  return;
20
20
  }
21
21
  (0, LogService_1.log)(`Found ${dapps.length} dapp(s)`).green();
22
+ // Define column widths (Status needs to be wider to accommodate "Waiting", "Pending", etc.)
23
+ const widths = [5, 20, 10, 15, 20, 15, 16, 15];
24
+ const headers = [
25
+ 'No',
26
+ 'Name',
27
+ 'Version',
28
+ 'Author',
29
+ 'Identifier',
30
+ 'Maintainer',
31
+ 'Digest',
32
+ 'Status',
33
+ ];
34
+ // Print table header once
35
+ (0, format_1.printTableRow)(headers, widths, true);
36
+ (0, format_1.printSeparator)(widths);
37
+ // Track row number across all dapps
38
+ let rowNumber = 0;
22
39
  // Fetch details for each dapp
23
40
  for (let i = 0; i < dapps.length; i++) {
24
41
  const dappName = dapps[i];
@@ -33,23 +50,9 @@ async function dappStatusCommand() {
33
50
  (0, LogService_1.log)(' No builds found for this dapp').italic().white();
34
51
  continue;
35
52
  }
36
- // Define column widths (Status needs to be wider to accommodate "Waiting", "Pending", etc.)
37
- const widths = [20, 10, 15, 20, 15, 16, 15];
38
- const headers = [
39
- 'Name',
40
- 'Version',
41
- 'Author',
42
- 'Identifier',
43
- 'Maintainer',
44
- 'Digest',
45
- 'Status',
46
- ];
47
- // Print table header
48
- // log('').white();
49
- (0, format_1.printTableRow)(headers, widths, true);
50
- (0, format_1.printSeparator)(widths);
51
53
  // Print table rows
52
54
  buildsWithMeta.forEach(build => {
55
+ rowNumber++;
53
56
  const digest = build.package_digest || 'N/A';
54
57
  const shortenedDigest = (0, format_1.shortenString)(digest);
55
58
  // Color code status
@@ -74,6 +77,7 @@ async function dappStatusCommand() {
74
77
  statusReset = '\x1b[0m';
75
78
  }
76
79
  const row = [
80
+ rowNumber.toString(),
77
81
  build.name || 'N/A',
78
82
  build.version || 'N/A',
79
83
  build.author || 'N/A',
@@ -39,86 +39,136 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.uploadCommand = uploadCommand;
40
40
  const fs = __importStar(require("fs"));
41
41
  const node_fetch_1 = __importDefault(require("node-fetch"));
42
- const md5_1 = __importDefault(require("md5")); // default import fixes TS call
42
+ const md5_1 = __importDefault(require("md5"));
43
+ const path_1 = __importDefault(require("path"));
43
44
  const metadata_1 = require("../util/metadata");
44
45
  const tarball_1 = require("../util/tarball");
45
46
  const network_1 = require("../util/network");
46
47
  const env_1 = require("../util/env");
47
48
  const LogService_1 = require("../service/log/LogService");
48
- const path_1 = __importDefault(require("path"));
49
- async function uploadCommand({ network, locationFolder, buttonImages, }) {
49
+ /**
50
+ * Gets the project path based on location folder
51
+ */
52
+ function getProjectPath(locationFolder) {
53
+ if (!locationFolder) {
54
+ return process.cwd();
55
+ }
56
+ return path_1.default.join(process.cwd(), locationFolder);
57
+ }
58
+ /**
59
+ * Loads and validates metadata
60
+ */
61
+ async function loadAndValidateMetadata(locationFolder) {
62
+ (0, LogService_1.log)('Loading metadata...').white();
63
+ const meta = await (0, metadata_1.loadMetadata)(locationFolder);
64
+ if (!meta) {
65
+ throw new Error('No metadata.json found. Aborting.');
66
+ }
67
+ return meta;
68
+ }
69
+ /**
70
+ * Prepares the package by packing and reading it
71
+ */
72
+ async function preparePackage(meta, projectPath) {
73
+ const pkgName = (0, metadata_1.getPackageName)(meta);
74
+ (0, LogService_1.log)(`Packing ${pkgName}...`).white();
75
+ await (0, tarball_1.packProject)(meta, projectPath);
76
+ const pkgPath = path_1.default.join(process.cwd(), pkgName);
77
+ if (!fs.existsSync(pkgPath)) {
78
+ throw new Error(`Package file not found at ${pkgPath}`);
79
+ }
80
+ const fileBuffer = fs.readFileSync(pkgPath);
81
+ const fileHash = (0, md5_1.default)(fileBuffer);
82
+ (0, LogService_1.log)(`Package Hash: ${fileHash}`).white();
83
+ return { fileBuffer, fileHash, pkgPath };
84
+ }
85
+ /**
86
+ * Creates the JSON-RPC request body for upload
87
+ */
88
+ function createUploadRequestBody(userId, apiKey, meta, encodedFile) {
89
+ const metaJson = JSON.stringify(meta);
90
+ return JSON.stringify({
91
+ jsonrpc: '2.0',
92
+ id: 1,
93
+ method: 'uploadPackage',
94
+ params: [userId, apiKey, metaJson, encodedFile],
95
+ });
96
+ }
97
+ /**
98
+ * Handles the upload response
99
+ */
100
+ function handleUploadResponse(json) {
101
+ if (json.result === true) {
102
+ (0, LogService_1.log)('Package uploaded successfully').green();
103
+ (0, LogService_1.log)('Open : https://dash-devnet.degn.com/').white();
104
+ return;
105
+ }
106
+ (0, LogService_1.log)('Error uploding package').red();
107
+ if (json.error?.code === -32602) {
108
+ (0, LogService_1.log)('invalid api key, please visit https://dash-devnet.degn.com/ and setup env with the new key').red();
109
+ return;
110
+ }
111
+ (0, LogService_1.log)('unknow error, please contact support').red();
112
+ (0, LogService_1.log)(JSON.stringify(json.error)).red();
113
+ }
114
+ /**
115
+ * Uploads the package to the server
116
+ */
117
+ async function uploadPackageToServer(network, body) {
118
+ const rpcUrl = (0, network_1.networkToRpcUrl)(network);
119
+ const res = await (0, node_fetch_1.default)(rpcUrl, {
120
+ method: 'POST',
121
+ body,
122
+ headers: {
123
+ 'Content-Type': 'application/json',
124
+ },
125
+ });
126
+ if (!res.ok) {
127
+ const errorText = await res.text();
128
+ (0, LogService_1.log)(`Error uploading package: ${errorText}`).red();
129
+ throw new Error(`Upload failed: ${errorText}`);
130
+ }
131
+ const json = await res.json();
132
+ handleUploadResponse(json);
133
+ }
134
+ /**
135
+ * Cleans up the package file
136
+ */
137
+ function cleanupPackageFile(pkgPath) {
138
+ if (fs.existsSync(pkgPath)) {
139
+ fs.rmSync(pkgPath);
140
+ (0, LogService_1.log)('Cleaned up package file').white();
141
+ }
142
+ }
143
+ /**
144
+ * Main upload command
145
+ */
146
+ async function uploadCommand({ network, locationFolder, }) {
147
+ let packageData = null;
50
148
  try {
51
- if ((0, network_1.validateNetwork)(network)) {
52
- (0, LogService_1.log)('Loading metadata...').white();
53
- const credentials = (0, env_1.validateCredential)();
54
- const { userId, apiKey } = credentials;
55
- (0, LogService_1.log)(`User ID: ${userId}`).white();
56
- let projectPath = process.cwd();
57
- if (locationFolder != undefined) {
58
- projectPath = path_1.default.join(projectPath, locationFolder);
59
- }
60
- if (buttonImages === undefined) {
61
- buttonImages = 'assets';
62
- }
63
- (0, LogService_1.log)(buttonImages).white();
64
- const meta = await (0, metadata_1.loadMetadata)();
65
- if (!meta) {
66
- (0, LogService_1.log)('No metadata.json found. Aborting.').red();
67
- return;
68
- }
69
- const pkgName = (0, metadata_1.getPackageName)(meta);
70
- (0, LogService_1.log)(`Packing ${pkgName}...`).white();
71
- await (0, tarball_1.packProject)(meta, projectPath, buttonImages);
72
- const pkgPath = path_1.default.join(process.cwd(), pkgName);
73
- // read tar
74
- const fileBuffer = fs.readFileSync(pkgPath);
75
- const fileHash = (0, md5_1.default)(fileBuffer);
76
- (0, LogService_1.log)(`Package Hash: ${fileHash}`).white();
77
- (0, LogService_1.log)('Publishing package to DEGN Dapp Store...').white();
78
- // encode base64
79
- const encoded = Buffer.from(fileBuffer).toString('base64');
80
- // In Rust, we do a JSON-RPC call. Let's replicate:
81
- const metaJson = JSON.stringify(meta);
82
- const body = JSON.stringify({
83
- jsonrpc: '2.0',
84
- id: 1,
85
- method: 'uploadPackage',
86
- params: [userId, apiKey, metaJson, encoded],
87
- });
88
- try {
89
- const rpcUrl = (0, network_1.networkToRpcUrl)(network);
90
- const res = await (0, node_fetch_1.default)(rpcUrl, {
91
- method: 'POST',
92
- body,
93
- headers: {
94
- 'Content-Type': 'application/json',
95
- },
96
- });
97
- if (!res.ok) {
98
- (0, LogService_1.log)(`Error uploading package: ${await res.text()}`).red();
99
- return;
100
- }
101
- const json = await res.json();
102
- if (json.result === true) {
103
- (0, LogService_1.log)('Package uploaded successfully').green();
104
- (0, LogService_1.log)('Open : https://dash-devnet.air.fun/').white();
105
- }
106
- else {
107
- (0, LogService_1.log)('Error uploding package').red();
108
- if (json.error.code == -32602) {
109
- (0, LogService_1.log)('invalid api key, please visit https://dash-devnet.air.fun/ and setup env with the new key').red();
110
- return;
111
- }
112
- (0, LogService_1.log)('unknow error, please contact support').red();
113
- (0, LogService_1.log)(JSON.stringify(json.error)).red();
114
- }
115
- }
116
- catch (err) {
117
- (0, LogService_1.log)(`Error: ${err}`).red();
118
- }
119
- }
149
+ (0, network_1.validateNetwork)(network);
150
+ const effectiveNetwork = (network || 'devnet');
151
+ (0, LogService_1.log)(`Using network: ${effectiveNetwork}`).white();
152
+ const credentials = (0, env_1.validateCredential)();
153
+ const { userId, apiKey } = credentials;
154
+ (0, LogService_1.log)(`User ID: ${userId}`).white();
155
+ const projectPath = getProjectPath(locationFolder);
156
+ const meta = await loadAndValidateMetadata(locationFolder);
157
+ packageData = await preparePackage(meta, projectPath);
158
+ (0, LogService_1.log)('Publishing package to DEGN Dapp Store...').white();
159
+ const encoded = Buffer.from(packageData.fileBuffer).toString('base64');
160
+ const body = createUploadRequestBody(userId, apiKey, meta, encoded);
161
+ await uploadPackageToServer(effectiveNetwork, body);
120
162
  }
121
163
  catch (err) {
122
- (0, LogService_1.log)(`${err instanceof Error ? err.message : String(err)}`).red();
164
+ const errorMessage = err instanceof Error ? err.message : String(err);
165
+ (0, LogService_1.log)(`Upload failed: ${errorMessage}`).red();
166
+ throw err;
167
+ }
168
+ finally {
169
+ // Clean up package file if it was created
170
+ if (packageData) {
171
+ cleanupPackageFile(packageData.pkgPath);
172
+ }
123
173
  }
124
174
  }
package/dist/config.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.19.2"
2
+ "version": "0.19.4"
3
3
  }
package/dist/index.js CHANGED
@@ -25,9 +25,14 @@ program
25
25
  .requiredOption('-u, --user <string>', 'developer user')
26
26
  .requiredOption('-k, --key <string>', 'API key')
27
27
  .option('-n, --network <string>', 'network devnet|mainnet')
28
- .action(opts => {
29
- const { user, key, network } = opts;
30
- (0, setup_1.setupCommand)({ network, userId: user, apiKey: key });
28
+ .action(async (opts) => {
29
+ try {
30
+ const { user, key, network } = opts;
31
+ await (0, setup_1.setupCommand)({ network, userId: user, apiKey: key });
32
+ }
33
+ catch (err) {
34
+ process.exit(1);
35
+ }
31
36
  });
32
37
  program
33
38
  .command('create')
@@ -35,9 +40,14 @@ program
35
40
  .requiredOption('-N, --name <string>', 'Project name')
36
41
  .option('-f, --app-path <string>', 'path where project will be created')
37
42
  .option('--template', 'initialize project based on git quickstart')
38
- .action(opts => {
39
- const { name, appPath, template } = opts;
40
- (0, create_1.createCommand)({ name, template, locationFolder: appPath });
43
+ .action(async (opts) => {
44
+ try {
45
+ const { name, appPath, template } = opts;
46
+ await (0, create_1.createCommand)({ name, template, locationFolder: appPath });
47
+ }
48
+ catch (err) {
49
+ process.exit(1);
50
+ }
41
51
  });
42
52
  program
43
53
  .command('serve')
@@ -45,20 +55,25 @@ program
45
55
  .option('-f, --index-app-path <string>', 'path for the index.html', './')
46
56
  .option('--no-browser', 'stop browser from being open')
47
57
  .option('-u, --app-url <string>', 'url where the app is running')
48
- .action(opts => {
49
- let { indexAppPath, browser, appUrl } = opts;
50
- if (indexAppPath == './') {
51
- indexAppPath = undefined;
58
+ .action(async (opts) => {
59
+ try {
60
+ let { indexAppPath, browser, appUrl } = opts;
61
+ if (indexAppPath == './') {
62
+ indexAppPath = undefined;
63
+ }
64
+ if (indexAppPath && appUrl) {
65
+ (0, LogService_1.log)('both --index-app-path and --app-url must not be used simuntaniusly').red();
66
+ return;
67
+ }
68
+ await (0, serve_1.serveCommand)({
69
+ noBrowser: !browser,
70
+ locationFolder: indexAppPath,
71
+ appUrl,
72
+ });
52
73
  }
53
- if (indexAppPath && appUrl) {
54
- (0, LogService_1.log)('both --index-app-path and --app-url must not be used simuntaniusly').red();
55
- return;
74
+ catch (err) {
75
+ process.exit(1);
56
76
  }
57
- (0, serve_1.serveCommand)({
58
- noBrowser: !browser,
59
- locationFolder: indexAppPath,
60
- appUrl,
61
- });
62
77
  });
63
78
  program
64
79
  .command('wallet')
@@ -72,27 +87,32 @@ program
72
87
  .option('-gd, --get-default', 'get default wallet')
73
88
  .option('-c, --chain [evm | svm | btc]', 'chain name ', 'evm')
74
89
  .action(async (opts) => {
75
- const { list, delete: del, import: importWallet, export: exportWallet, generate, setDefault, getDefault, chain, } = opts;
76
- if (list) {
77
- await (0, wallet_1.listWallet)(chain);
78
- }
79
- else if (del) {
80
- await (0, wallet_1.deleteWallet)(del, chain);
81
- }
82
- else if (importWallet) {
83
- await (0, wallet_1.importWalletSk)(importWallet, chain);
90
+ try {
91
+ const { list, delete: del, import: importWallet, export: exportWallet, generate, setDefault, getDefault, chain, } = opts;
92
+ if (list) {
93
+ await (0, wallet_1.listWallet)(chain);
94
+ }
95
+ else if (del) {
96
+ await (0, wallet_1.deleteWallet)(del, chain);
97
+ }
98
+ else if (importWallet) {
99
+ await (0, wallet_1.importWalletSk)(importWallet, chain);
100
+ }
101
+ else if (exportWallet) {
102
+ await (0, wallet_1.exportWalletSk)(exportWallet, chain);
103
+ }
104
+ else if (generate) {
105
+ await (0, wallet_1.generateWallet)(chain);
106
+ }
107
+ else if (setDefault) {
108
+ await (0, wallet_1.setDefaultWallet)(setDefault, chain);
109
+ }
110
+ else if (getDefault) {
111
+ await (0, wallet_1.getDefaultWallet)(chain);
112
+ }
84
113
  }
85
- else if (exportWallet) {
86
- await (0, wallet_1.exportWalletSk)(exportWallet, chain);
87
- }
88
- else if (generate) {
89
- await (0, wallet_1.generateWallet)(chain);
90
- }
91
- else if (setDefault) {
92
- await (0, wallet_1.setDefaultWallet)(setDefault, chain);
93
- }
94
- else if (getDefault) {
95
- await (0, wallet_1.getDefaultWallet)(chain);
114
+ catch (err) {
115
+ process.exit(1);
96
116
  }
97
117
  });
98
118
  program
@@ -100,24 +120,32 @@ program
100
120
  .description('Publish the app to the DEGN Dapp Store')
101
121
  .option('-n, --network <string>', 'network devnet|mainnet')
102
122
  .option('-f, --index-app-path <string>', 'path for the index.html', './')
103
- .option('-i, --button-image <string>', 'path for the button images', 'assets')
104
- .action(opts => {
105
- let { network, indexAppPath, buttonImage } = opts;
123
+ .action(async (opts) => {
124
+ let { network, indexAppPath } = opts;
106
125
  if (indexAppPath == './') {
107
126
  indexAppPath = undefined;
108
127
  }
109
- (0, upload_1.uploadCommand)({
110
- network,
111
- locationFolder: indexAppPath,
112
- buttonImages: buttonImage,
113
- });
128
+ try {
129
+ await (0, upload_1.uploadCommand)({
130
+ network,
131
+ locationFolder: indexAppPath,
132
+ });
133
+ }
134
+ catch (err) {
135
+ process.exit(1);
136
+ }
114
137
  });
115
138
  program
116
139
  .command('dapp')
117
140
  .description('Manage dapps')
118
141
  .option('-s, --status', 'show all dapps list')
119
- .action(() => {
120
- (0, dapp_1.dappStatusCommand)();
142
+ .action(async () => {
143
+ try {
144
+ await (0, dapp_1.dappStatusCommand)();
145
+ }
146
+ catch (err) {
147
+ process.exit(1);
148
+ }
121
149
  });
122
150
  program
123
151
  .command('demo')
@@ -125,8 +153,13 @@ program
125
153
  .option('-f, --app-path <string>', 'path where project will be created')
126
154
  .description('serve the built-in demo app')
127
155
  .action(async (opts) => {
128
- const { name = 'degn-demo', appPath } = opts;
129
- await (0, demo_1.demoCommand)({ name, appPath });
156
+ try {
157
+ const { name = 'degn-demo', appPath } = opts;
158
+ await (0, demo_1.demoCommand)({ name, appPath });
159
+ }
160
+ catch (err) {
161
+ process.exit(1);
162
+ }
130
163
  });
131
- program.addHelpText('after', 'for more help access https://dash-devnet.air.fun/');
164
+ program.addHelpText('after', 'for more help access https://dash-devnet.degn.com/');
132
165
  program.parse(process.argv);
@@ -40,64 +40,109 @@ exports.packProject = packProject;
40
40
  const fs = __importStar(require("fs"));
41
41
  const path = __importStar(require("path"));
42
42
  const tar = __importStar(require("tar"));
43
- const md5_1 = __importDefault(require("md5")); // default import
43
+ const md5_1 = __importDefault(require("md5"));
44
44
  const metadata_1 = require("./metadata");
45
45
  const LogService_1 = require("../service/log/LogService");
46
+ const REQUIRED_FILES = ['metadata.json', 'dapp-logo.png', 'index.html'];
46
47
  /**
47
- * Reproduces the `pack()` logic, creating a tar.gz from the project's assets
48
+ * Validates that the project path exists
48
49
  */
49
- async function packProject(pkg, projectPath, assetsPath) {
50
- const outputFilename = (0, metadata_1.getPackageName)(pkg);
51
- const absOutputPath = path.join(process.cwd(), outputFilename);
52
- try {
53
- let files = ['metadata.json', 'dapp-logo.png', '@projectFiles.tar.gz'];
54
- let projectFiles = ['index.html'];
55
- if (fs.existsSync(assetsPath)) {
56
- const assetFiles = fs.readdirSync(assetsPath);
57
- await tar.create({
58
- file: 'assets.tar.gz',
59
- gzip: false,
60
- cwd: assetsPath,
61
- prefix: 'assets',
62
- portable: true,
63
- }, assetFiles);
64
- files.push('@assets.tar.gz');
50
+ function validateProjectPath(projectPath) {
51
+ if (!fs.existsSync(projectPath)) {
52
+ throw new Error(`Project path does not exist: ${projectPath}`);
53
+ }
54
+ }
55
+ /**
56
+ * Validates that all required files exist at the root of the project
57
+ */
58
+ function validateRequiredFiles(projectPath) {
59
+ const missingFiles = [];
60
+ REQUIRED_FILES.forEach(file => {
61
+ const filePath = path.join(projectPath, file);
62
+ if (!fs.existsSync(filePath)) {
63
+ missingFiles.push(file);
64
+ }
65
+ });
66
+ if (missingFiles.length > 0) {
67
+ throw new Error(`Missing required files at root: ${missingFiles.join(', ')}`);
68
+ }
69
+ }
70
+ /**
71
+ * Recursively gets all files from a directory
72
+ */
73
+ function getAllFiles(dir, baseDir, fileList = []) {
74
+ const items = fs.readdirSync(dir);
75
+ items.forEach(item => {
76
+ const fullPath = path.join(dir, item);
77
+ const stat = fs.statSync(fullPath);
78
+ if (stat.isDirectory()) {
79
+ getAllFiles(fullPath, baseDir, fileList);
65
80
  }
66
81
  else {
67
- (0, LogService_1.log)('No assets directory found.').white();
82
+ const relativePath = path.relative(baseDir, fullPath);
83
+ fileList.push(relativePath);
68
84
  }
69
- // this is bad, but couldn't figure out how to get files from different folders without the absolute path messing with the tar file structure
70
- await tar.create({
71
- file: 'projectFiles.tar.gz',
72
- gzip: false,
73
- cwd: projectPath,
74
- prefix: '',
75
- portable: true,
76
- }, projectFiles);
77
- await tar.create({
78
- file: absOutputPath,
79
- gzip: true,
80
- cwd: process.cwd(),
81
- prefix: '',
82
- portable: true,
83
- }, files);
84
- // read it in memory for MD5
85
- const buffer = fs.readFileSync(absOutputPath);
86
- const digest = (0, md5_1.default)(buffer);
87
- (0, LogService_1.log)(`MD5: ${digest}`).white();
85
+ });
86
+ return fileList;
87
+ }
88
+ /**
89
+ * Collects all files from the project directory
90
+ */
91
+ function collectProjectFiles(projectPath) {
92
+ const allFiles = getAllFiles(projectPath, projectPath);
93
+ if (allFiles.length === 0) {
94
+ throw new Error(`No files found in ${projectPath}`);
95
+ }
96
+ return allFiles;
97
+ }
98
+ /**
99
+ * Creates the tarball file
100
+ */
101
+ async function createTarball(outputPath, projectPath, files) {
102
+ // Clean up any existing output file
103
+ if (fs.existsSync(outputPath)) {
104
+ fs.rmSync(outputPath);
105
+ }
106
+ await tar.create({
107
+ file: outputPath,
108
+ gzip: true,
109
+ cwd: projectPath,
110
+ prefix: '',
111
+ portable: true,
112
+ }, files);
113
+ if (!fs.existsSync(outputPath)) {
114
+ throw new Error('Tarball was not created successfully');
115
+ }
116
+ }
117
+ /**
118
+ * Calculates and logs the MD5 hash of the tarball
119
+ */
120
+ function logTarballHash(outputPath) {
121
+ const buffer = fs.readFileSync(outputPath);
122
+ const digest = (0, md5_1.default)(buffer);
123
+ (0, LogService_1.log)(`MD5: ${digest}`).white();
124
+ }
125
+ /**
126
+ * Main function to pack a project into a tarball
127
+ */
128
+ async function packProject(pkg, projectPath) {
129
+ const outputFilename = (0, metadata_1.getPackageName)(pkg);
130
+ const absOutputPath = path.join(process.cwd(), outputFilename);
131
+ try {
132
+ validateProjectPath(projectPath);
133
+ validateRequiredFiles(projectPath);
134
+ const allFiles = collectProjectFiles(projectPath);
135
+ (0, LogService_1.log)(`Found ${allFiles.length} files to pack`).white();
136
+ (0, LogService_1.log)('Creating tarball...').white();
137
+ await createTarball(absOutputPath, projectPath, allFiles);
138
+ logTarballHash(absOutputPath);
88
139
  (0, LogService_1.log)(`Tarball created at ${absOutputPath}`).white();
89
- (0, LogService_1.log)('cleaning up...').white();
90
- fs.rmSync('projectFiles.tar.gz');
91
- fs.rmSync('assets.tar.gz');
92
140
  }
93
141
  catch (err) {
94
142
  (0, LogService_1.log)(`Failed to create tarball: ${err.message}`).red();
95
- if (fs.existsSync('projectFiles.tar.gz'))
96
- fs.rmSync('projectFiles.tar.gz');
97
- if (fs.existsSync('assets.tar.gz'))
98
- fs.rmSync('assets.tar.gz');
99
- if (fs.existsSync(absOutputPath))
143
+ if (fs.existsSync(absOutputPath)) {
100
144
  fs.rmSync(absOutputPath);
101
- process.exit(1);
145
+ }
146
+ throw err;
102
147
  }
103
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airmoney-degn/airmoney-cli",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
4
4
  "description": "airmoney-cli is a command-line interface tool designed to facilitate the development and management of decentralized applications (DApps) for Airmoney.",
5
5
  "publishConfig": {
6
6
  "access": "public"