@airmoney-degn/airmoney-cli 0.19.3 → 0.19.5

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.
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.createCommand = createCommand;
37
37
  const fs = __importStar(require("fs"));
38
38
  const path = __importStar(require("path"));
39
+ const os = __importStar(require("os"));
39
40
  const types_1 = require("../types");
40
41
  const child_process_1 = require("child_process");
41
42
  const LogService_1 = require("../service/log/LogService");
@@ -47,12 +48,26 @@ async function createCommand({ name, template, locationFolder, quiet, }) {
47
48
  const projectPath = path.join(process.cwd(), folderName);
48
49
  if (template) {
49
50
  (0, LogService_1.log)('cloning project').white();
50
- (0, child_process_1.execSync)(`git clone --separate-git-dir=$(mktemp -u) https://github.com/airmoney-degn/airmoney-dapp-quickstart ${folderName}`);
51
- if (fs.lstatSync(path.join(projectPath, '.git')).isDirectory()) {
52
- fs.rmdirSync(path.join(projectPath, '.git'));
51
+ const tempGitDir = path.join(os.tmpdir(), `airmoney-git-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`);
52
+ // Clean up if it already exists (shouldn't happen, but just in case)
53
+ if (fs.existsSync(tempGitDir)) {
54
+ fs.rmSync(tempGitDir, { recursive: true, force: true });
53
55
  }
54
- else {
55
- fs.rmSync(path.join(projectPath, '.git'));
56
+ try {
57
+ (0, child_process_1.execSync)(`git clone --separate-git-dir="${tempGitDir}" https://github.com/airmoney-degn/airmoney-dapp-quickstart ${folderName}`);
58
+ if (fs.existsSync(path.join(projectPath, '.git'))) {
59
+ if (fs.lstatSync(path.join(projectPath, '.git')).isDirectory()) {
60
+ fs.rmdirSync(path.join(projectPath, '.git'));
61
+ }
62
+ else {
63
+ fs.rmSync(path.join(projectPath, '.git'));
64
+ }
65
+ }
66
+ }
67
+ finally {
68
+ if (fs.existsSync(tempGitDir)) {
69
+ fs.rmSync(tempGitDir, { recursive: true, force: true });
70
+ }
56
71
  }
57
72
  }
58
73
  else {
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',
package/dist/cli/demo.js CHANGED
@@ -35,22 +35,35 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.demoCommand = demoCommand;
37
37
  const path = __importStar(require("path"));
38
+ const fs_1 = require("fs");
38
39
  const child_process_1 = require("child_process");
39
40
  const create_1 = require("./create");
40
41
  const serve_1 = require("./serve");
41
42
  const LogService_1 = require("../service/log/LogService");
43
+ function getUniqueFolderName(baseName) {
44
+ let folderName = baseName;
45
+ let counter = 1;
46
+ const basePath = process.cwd();
47
+ while ((0, fs_1.existsSync)(path.join(basePath, folderName))) {
48
+ folderName = `${baseName}-${counter}`;
49
+ counter++;
50
+ }
51
+ return folderName;
52
+ }
42
53
  async function demoCommand({ name = "degn-demo", appPath }) {
43
54
  try {
44
55
  const projectName = name;
45
- const folderName = appPath || projectName;
56
+ const baseFolderName = appPath || projectName;
57
+ const folderName = getUniqueFolderName(baseFolderName);
46
58
  const projectPath = path.join(process.cwd(), folderName);
47
59
  await (0, create_1.createCommand)({
48
60
  name: projectName,
49
61
  template: true,
50
- locationFolder: appPath,
62
+ locationFolder: folderName,
51
63
  quiet: true,
52
64
  // ignoreEnvValidation: true,
53
65
  });
66
+ (0, LogService_1.log)(`Project created successfully in folder: ${folderName}`).green();
54
67
  try {
55
68
  (0, LogService_1.log)('Installing dependencies...').white();
56
69
  (0, child_process_1.execSync)('npm install', { cwd: projectPath, stdio: 'inherit' });
package/dist/config.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.19.3"
2
+ "version": "0.19.5"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airmoney-degn/airmoney-cli",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
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"