@ijuantm/simpl-addon 2.4.4 → 2.4.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.
Files changed (2) hide show
  1. package/install.js +37 -25
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -89,14 +89,12 @@ const showHelp = () => {
89
89
  console.log();
90
90
  log(` ${COLORS.bold}Usage:${COLORS.reset}`, 'blue');
91
91
  log(` ${COLORS.dim}npx @ijuantm/simpl-addon${COLORS.reset}`);
92
+ log(` ${COLORS.dim}npx @ijuantm/simpl-addon <add-on>${COLORS.reset}`);
92
93
  log(` ${COLORS.dim}npx @ijuantm/simpl-addon --help${COLORS.reset}`);
93
94
  console.log();
94
95
  log(` ${COLORS.bold}Commands:${COLORS.reset}`, 'blue');
95
96
  log(` ${COLORS.dim}--help, -h${COLORS.reset} Show this help message`);
96
97
  console.log();
97
- log(` ${COLORS.bold}Examples:${COLORS.reset}`, 'blue');
98
- log(` ${COLORS.dim}npx @ijuantm/simpl-addon${COLORS.reset}`);
99
- console.log();
100
98
  log(` ${COLORS.bold}Note:${COLORS.reset}`, 'blue');
101
99
  log(` Run this command from the root of your Simpl project.`);
102
100
  log(` The add-on version will match your Simpl framework version.`);
@@ -393,6 +391,8 @@ const main = async () => {
393
391
  process.exit(0);
394
392
  }
395
393
 
394
+ const directName = firstArg && !firstArg.startsWith('-') ? firstArg : null;
395
+
396
396
  let version;
397
397
 
398
398
  try {
@@ -452,7 +452,7 @@ const main = async () => {
452
452
  process.exit(1);
453
453
  }
454
454
 
455
- log(' 📦 Fetching available add-ons...', 'bold');
455
+ log(' 🧰 Fetching available add-ons...', 'bold');
456
456
 
457
457
  let addons;
458
458
 
@@ -474,34 +474,46 @@ const main = async () => {
474
474
  process.exit(0);
475
475
  }
476
476
 
477
- log(` ${COLORS.bold}Available add-ons:${COLORS.reset}`, 'blue');
478
- addons.forEach((name, index) => log(` ${COLORS.cyan}${index + 1}.${COLORS.reset} ${name}`));
479
- console.log();
480
-
481
477
  let addonName;
482
478
 
483
- while (true) {
484
- const input = await promptUser(` Add-on to install ${COLORS.dim}(name or number)${COLORS.reset}`);
485
-
486
- if (!input) {
487
- log(` ${COLORS.red}✗${COLORS.reset} Selection cannot be empty`, 'red');
479
+ if (directName) {
480
+ if (!addons.includes(directName)) {
481
+ log(` ${COLORS.red}✗${COLORS.reset} Add-on ${COLORS.bold}${directName}${COLORS.reset} not found`, 'red');
482
+ console.log();
483
+ log(` ${COLORS.bold}Available add-ons:${COLORS.reset}`, 'blue');
484
+ addons.forEach((name, index) => log(` ${COLORS.cyan}${index + 1}.${COLORS.reset} ${name}`));
488
485
  console.log();
489
- continue;
486
+ process.exit(1);
490
487
  }
488
+ addonName = directName;
489
+ } else {
490
+ log(` ${COLORS.bold}Available add-ons:${COLORS.reset}`, 'blue');
491
+ addons.forEach((name, index) => log(` ${COLORS.cyan}${index + 1}.${COLORS.reset} ${name}`));
492
+ console.log();
491
493
 
492
- const numInput = parseInt(input, 10);
493
- if (!isNaN(numInput) && numInput >= 1 && numInput <= addons.length) {
494
- addonName = addons[numInput - 1];
495
- break;
496
- }
494
+ while (true) {
495
+ const input = await promptUser(` Add-on to install ${COLORS.dim}(name or number)${COLORS.reset}`);
497
496
 
498
- if (addons.includes(input)) {
499
- addonName = input;
500
- break;
501
- }
497
+ if (!input) {
498
+ log(` ${COLORS.red}✗${COLORS.reset} Selection cannot be empty`, 'red');
499
+ console.log();
500
+ continue;
501
+ }
502
502
 
503
- log(` ${COLORS.red}✗${COLORS.reset} Invalid selection "${input}"`, 'red');
504
- console.log();
503
+ const numInput = parseInt(input, 10);
504
+ if (!isNaN(numInput) && numInput >= 1 && numInput <= addons.length) {
505
+ addonName = addons[numInput - 1];
506
+ break;
507
+ }
508
+
509
+ if (addons.includes(input)) {
510
+ addonName = input;
511
+ break;
512
+ }
513
+
514
+ log(` ${COLORS.red}✗${COLORS.reset} Invalid selection "${input}"`, 'red');
515
+ console.log();
516
+ }
505
517
  }
506
518
 
507
519
  console.log();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ijuantm/simpl-addon",
3
3
  "description": "CLI tool to install Simpl framework add-ons.",
4
- "version": "2.4.4",
4
+ "version": "2.4.5",
5
5
  "scripts": {
6
6
  "link": "npm link",
7
7
  "unlink": "npm unlink -g @ijuantm/simpl-addon"