@airmoney-degn/airmoney-cli 0.25.0 → 0.25.2
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/build.js +2 -2
- package/dist/cli/upload.js +18 -11
- package/dist/config.json +1 -1
- package/dist/util/metadata.js +0 -10
- package/package.json +1 -1
package/dist/cli/build.js
CHANGED
|
@@ -72,8 +72,8 @@ async function buildCommand({ locationFolder, publicDir }) {
|
|
|
72
72
|
cwd: projectPath,
|
|
73
73
|
stdio: 'inherit',
|
|
74
74
|
});
|
|
75
|
-
// 2. Find the binary
|
|
76
|
-
const binName =
|
|
75
|
+
// 2. Find the binary
|
|
76
|
+
const binName = 'user_app';
|
|
77
77
|
const binPath = path.join(projectPath, 'target', 'aarch64-unknown-linux-gnu', 'release', binName);
|
|
78
78
|
if (!fs.existsSync(binPath)) {
|
|
79
79
|
(0, LogService_1.log)(`Binary not found at expected path: ${binPath}`).white();
|
package/dist/cli/upload.js
CHANGED
|
@@ -60,12 +60,20 @@ function getProjectPath(locationFolder) {
|
|
|
60
60
|
return path_1.default.join(process.cwd(), locationFolder);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Prompts user for confirmation when uploading from current directory
|
|
63
|
+
* Prompts user for confirmation when uploading from current directory.
|
|
64
|
+
* Web: warns that all files from the directory will be packed/uploaded.
|
|
65
|
+
* Native: only mentions building and uploading the package (binary + metadata + logo).
|
|
64
66
|
*/
|
|
65
|
-
async function confirmUploadFromCurrentDirectory(projectPath) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
async function confirmUploadFromCurrentDirectory(projectPath, appType) {
|
|
68
|
+
if (appType === 'Native') {
|
|
69
|
+
(0, LogService_1.log)(`Upload folder: ${path_1.default.resolve(projectPath)}`).white();
|
|
70
|
+
(0, LogService_1.log)('A package (binary + metadata + logo) will be built and uploaded.').white();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
(0, LogService_1.log)('⚠️ WARNING: You are about to upload all files from the current directory!').red();
|
|
74
|
+
(0, LogService_1.log)(`Upload folder: ${path_1.default.resolve(projectPath)}`).white();
|
|
75
|
+
(0, LogService_1.log)('To upload a specific folder, use: airmoney-cli upload -f <folder-path>').white();
|
|
76
|
+
}
|
|
69
77
|
const answer = await inquirer_1.default.prompt([
|
|
70
78
|
{
|
|
71
79
|
type: 'confirm',
|
|
@@ -123,7 +131,7 @@ async function preparePackage(meta, projectPath, publicDir) {
|
|
|
123
131
|
const pkgName = (0, metadata_1.getPackageName)(meta);
|
|
124
132
|
if (meta.type === 'Native') {
|
|
125
133
|
(0, LogService_1.log)(`Preparing Native package for ${meta.displayName}...`).white();
|
|
126
|
-
const binName =
|
|
134
|
+
const binName = 'user_app';
|
|
127
135
|
const binInTarget = path_1.default.join(projectPath, 'target', 'aarch64-unknown-linux-gnu', 'release', binName);
|
|
128
136
|
const binAtRoot = path_1.default.join(projectPath, binName);
|
|
129
137
|
const metadataAtRoot = path_1.default.join(projectPath, 'metadata.json');
|
|
@@ -156,7 +164,7 @@ async function preparePackage(meta, projectPath, publicDir) {
|
|
|
156
164
|
}
|
|
157
165
|
}
|
|
158
166
|
else {
|
|
159
|
-
throw new Error(
|
|
167
|
+
throw new Error('Native binary not found. Either run "airmoney-cli build" first, or point -f to a folder that already contains user_app, metadata.json, and dapp-logo.png at root (e.g. dist/).');
|
|
160
168
|
}
|
|
161
169
|
}
|
|
162
170
|
else {
|
|
@@ -247,9 +255,7 @@ async function uploadCommand({ network, locationFolder, publicDir, packagePath:
|
|
|
247
255
|
throw new Error(`No metadata.json found next to the package. Put metadata.json in the same directory as ${path_1.default.basename(zipPath)}.`);
|
|
248
256
|
}
|
|
249
257
|
(0, LogService_1.log)('Verifying zip package...').white();
|
|
250
|
-
const verifyOptions = meta.type === 'Native'
|
|
251
|
-
? { binaryName: (0, metadata_1.readPackageNameFromCargoToml)(projectPath) ?? 'user_app' }
|
|
252
|
-
: undefined;
|
|
258
|
+
const verifyOptions = meta.type === 'Native' ? { binaryName: 'user_app' } : undefined;
|
|
253
259
|
await (0, tarball_1.verifyZipPackage)(zipPath, meta.type, verifyOptions);
|
|
254
260
|
(0, LogService_1.log)('Zip package verified.').green();
|
|
255
261
|
const dappService = new DappService_1.DappService(userId, apiKey, network);
|
|
@@ -273,7 +279,8 @@ async function uploadCommand({ network, locationFolder, publicDir, packagePath:
|
|
|
273
279
|
const projectPath = getProjectPath(locationFolder);
|
|
274
280
|
// Prompt for confirmation if uploading from current directory
|
|
275
281
|
if (!locationFolder) {
|
|
276
|
-
const
|
|
282
|
+
const metaForConfirm = await (0, metadata_1.loadMetadata)(projectPath);
|
|
283
|
+
const confirmed = await confirmUploadFromCurrentDirectory(projectPath, metaForConfirm?.type);
|
|
277
284
|
if (!confirmed) {
|
|
278
285
|
(0, LogService_1.log)('Upload cancelled by user').yellow();
|
|
279
286
|
return;
|
package/dist/config.json
CHANGED
package/dist/util/metadata.js
CHANGED
|
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.loadMetadata = loadMetadata;
|
|
40
40
|
exports.saveMetadata = saveMetadata;
|
|
41
41
|
exports.getPackageName = getPackageName;
|
|
42
|
-
exports.readPackageNameFromCargoToml = readPackageNameFromCargoToml;
|
|
43
42
|
exports.readVersionFromCargoToml = readVersionFromCargoToml;
|
|
44
43
|
exports.applyVersionFromCargoToml = applyVersionFromCargoToml;
|
|
45
44
|
exports.populateBuildMetadata = populateBuildMetadata;
|
|
@@ -107,15 +106,6 @@ function parseCargoToml(projectPath) {
|
|
|
107
106
|
return null;
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Reads the package name from Cargo.toml [package] section (used as binary name).
|
|
112
|
-
* Returns null if file is missing or name is not found.
|
|
113
|
-
*/
|
|
114
|
-
function readPackageNameFromCargoToml(projectPath) {
|
|
115
|
-
const parsed = parseCargoToml(projectPath);
|
|
116
|
-
const name = parsed?.package?.name;
|
|
117
|
-
return typeof name === 'string' ? name : null;
|
|
118
|
-
}
|
|
119
109
|
/**
|
|
120
110
|
* Reads the package version from Cargo.toml [package] section.
|
|
121
111
|
* Returns null if file is missing or version is not found.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airmoney-degn/airmoney-cli",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.2",
|
|
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"
|