@ijuantm/simpl-addon 2.8.6 → 2.8.7

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 +46 -41
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -471,20 +471,48 @@ const mergeFiles = (toMerge) => {
471
471
  return {merged, failed, unchanged};
472
472
  };
473
473
 
474
- const main = async () => {
475
- const parsed = parseArgs(process.argv.slice(2));
474
+ const loadAddons = async (version) => {
475
+ const {versions} = await getVersionsData();
476
+ const versionMeta = versions[version];
476
477
 
477
- if (parsed.help) {
478
- showHelp();
479
- process.exit(0);
478
+ if (!versionMeta) {
479
+ line();
480
+ error(`Version ${styled(version, C.bold)} not found`);
481
+ line();
482
+ process.exit(1);
480
483
  }
481
484
 
482
- if (parsed.list) {
483
- box(`Simpl Add-on Installer ${C.dim}-${C.reset} ${C.blue}Available Add-ons${C.reset}`);
485
+ if (versionMeta['script-compatible'] === false) {
484
486
  line();
485
- out(PAD + styled('Available add-ons:', C.bold), C.blue);
486
- listAddons(addons);
487
+ error(`Version ${styled(version, C.bold)} is not compatible with this installer`);
488
+ line();
489
+ out(PAD + styled('Manual download:', C.bold), C.blue);
490
+ item(`${C.cyan}${CDN_BASE}/${version}/add-ons/`);
491
+ line();
492
+ out(PAD + styled('Available add-ons for this version:', C.bold), C.blue);
493
+ const addons = versionMeta['add-ons'] || [];
494
+ if (!addons.length) info('No add-ons available');
495
+ else for (const name of addons) item(`${name}: ${styled(`${CDN_BASE}/${version}/add-ons/${name}.zip`, C.dim)}`);
496
+ line();
497
+ process.exit(1);
498
+ }
499
+
500
+ try {
501
+ return await getAvailableAddons(version);
502
+ } catch {
503
+ line();
504
+ error('Failed to fetch add-ons');
505
+ info('The CDN server is currently unavailable. Please try again later.');
487
506
  line();
507
+ process.exit(1);
508
+ }
509
+ };
510
+
511
+ const main = async () => {
512
+ const parsed = parseArgs(process.argv.slice(2));
513
+
514
+ if (parsed.help) {
515
+ showHelp();
488
516
  process.exit(0);
489
517
  }
490
518
 
@@ -512,48 +540,25 @@ const main = async () => {
512
540
  process.exit(1);
513
541
  }
514
542
 
515
- box(`Simpl Add-on Installer ${C.dim}(v${version})${C.reset}`);
516
-
517
- const {versions} = await getVersionsData();
518
-
519
- const versionMeta = versions[version];
520
- if (!versionMeta) {
543
+ if (parsed.list) {
544
+ const addons = await loadAddons(version);
545
+ box(`Simpl Add-on Installer ${C.dim}-${C.reset} ${C.blue}Available Add-ons${C.reset}`);
521
546
  line();
522
- error(`Version ${styled(version, C.bold)} not found`);
547
+ out(PAD + styled('Available add-ons:', C.bold), C.blue);
548
+ if (!addons.length) info('No add-ons available for this version');
549
+ else listAddons(addons);
523
550
  line();
524
- process.exit(1);
551
+ process.exit(0);
525
552
  }
526
553
 
527
- if (versionMeta['script-compatible'] === false) {
528
- line();
529
- error(`Version ${styled(version, C.bold)} is not compatible with this installer`);
530
- line();
531
- out(PAD + styled('Manual download:', C.bold), C.blue);
532
- item(`${C.cyan}${CDN_BASE}/${version}/add-ons/`);
533
- line();
534
- out(PAD + styled('Available add-ons for this version:', C.bold), C.blue);
535
- const addons = versionMeta['add-ons'] || [];
536
- if (!addons.length) info('No add-ons available');
537
- else for (const name of addons) item(`${name}: ${styled(`${CDN_BASE}/${version}/add-ons/${name}.zip`, C.dim)}`);
538
- line();
539
- process.exit(1);
540
- }
554
+ box(`Simpl Add-on Installer ${C.dim}(v${version})${C.reset}`);
541
555
 
542
556
  if (!parsed.addon) {
543
557
  line();
544
558
  task('🗄️ Fetching available add-ons...');
545
559
  }
546
560
 
547
- let addons;
548
- try {
549
- addons = await getAvailableAddons(version);
550
- } catch {
551
- line();
552
- error('Failed to fetch add-ons');
553
- info('The CDN server is currently unavailable. Please try again later.');
554
- line();
555
- process.exit(1);
556
- }
561
+ const addons = await loadAddons(version);
557
562
 
558
563
  if (!addons.length) {
559
564
  line();
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.8.6",
4
+ "version": "2.8.7",
5
5
  "scripts": {
6
6
  "link": "npm link",
7
7
  "unlink": "npm unlink -g @ijuantm/simpl-addon"