@ijuantm/simpl-addon 2.4.0 → 2.4.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.
Files changed (2) hide show
  1. package/install.js +8 -12
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -84,7 +84,7 @@ const getSimplVersion = () => {
84
84
  const showHelp = () => {
85
85
  console.log();
86
86
  log(` ╭${'─'.repeat(62)}╮`);
87
- log(` │ ${COLORS.bold}Simpl Add-on Installer${COLORS.reset}${' '.repeat(36)}│`);
87
+ log(` │ ${COLORS.bold}Simpl Add-on Installer${COLORS.reset}${' '.repeat(38)}│`);
88
88
  log(` ╰${'─'.repeat(62)}╯`);
89
89
  console.log();
90
90
  log(` ${COLORS.bold}Usage:${COLORS.reset}`, 'blue');
@@ -128,8 +128,7 @@ const getAvailableAddons = async (version) => {
128
128
  .map(entry => entry.name.replace('.zip', ''))
129
129
  .sort();
130
130
 
131
- const versionsData = await getVersionsData();
132
- const versionMeta = versionsData.versions[version];
131
+ const versionMeta = (await getVersionsData()).versions[version];
133
132
  return (versionMeta?.['add-ons'] || []).sort();
134
133
  };
135
134
 
@@ -156,7 +155,6 @@ const collectContentBetweenMarkers = (lines, startIndex) => {
156
155
 
157
156
  for (let i = startIndex + 1; i < lines.length; i++) {
158
157
  if (lines[i].trim().includes('@addon-end')) break;
159
-
160
158
  content.push(lines[i]);
161
159
  }
162
160
 
@@ -190,9 +188,7 @@ const findInsertIndex = (lines, searchText, type) => {
190
188
 
191
189
  const findMarkerLine = (lines, markerName) => {
192
190
  const markerPattern = new RegExp(`@addon-marker\\s*\\(\\s*["']${markerName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}["']\\s*\\)`);
193
-
194
191
  for (let i = 0; i < lines.length; i++) if (markerPattern.test(lines[i])) return i;
195
-
196
192
  return -1;
197
193
  };
198
194
 
@@ -277,10 +273,10 @@ const printMergeResults = (relativePath, isEnv, result) => {
277
273
  if (op.type === 'prepend') log(`${indent}${COLORS.green}✓${COLORS.reset} Prepended ${COLORS.bold}${op.lines}${COLORS.reset} ${varText}${op.lines !== 1 ? 's' : ''} to file start`);
278
274
  else if (op.type === 'append') log(`${indent}${COLORS.green}✓${COLORS.reset} Appended ${COLORS.bold}${op.lines}${COLORS.reset} ${varText}${op.lines !== 1 ? 's' : ''} to file end`);
279
275
  else if (op.type === 'replace') log(`${indent}${COLORS.green}✓${COLORS.reset} Replaced marker ${COLORS.cyan}${op.markerName}${COLORS.reset} with ${COLORS.bold}${op.lines}${COLORS.reset} ${varText}${op.lines !== 1 ? 's' : ''}`);
280
- else if (op.type === 'after') log(`${indent}${COLORS.green}✓${COLORS.reset} Inserted ${COLORS.bold}${op.lines}${COLORS.reset} ${varText}${op.lines !== 1 ? 's' : ''} ${COLORS.cyan}after${COLORS.reset} "${COLORS.dim}${op.searchText}${COLORS.reset}"`);
281
- else if (op.type === 'before') log(`${indent}${COLORS.green}✓${COLORS.reset} Inserted ${COLORS.bold}${op.lines}${COLORS.reset} ${varText}${op.lines !== 1 ? 's' : ''} ${COLORS.cyan}before${COLORS.reset} "${COLORS.dim}${op.searchText}${COLORS.reset}"`);
276
+ else if (op.type === 'after') log(`${indent}${COLORS.green}✓${COLORS.reset} Inserted ${COLORS.bold}${op.lines}${COLORS.reset} ${varText}${op.lines !== 1 ? 's' : ''} ${COLORS.cyan}after${COLORS.reset} ${COLORS.dim}${op.searchText}${COLORS.reset}`);
277
+ else if (op.type === 'before') log(`${indent}${COLORS.green}✓${COLORS.reset} Inserted ${COLORS.bold}${op.lines}${COLORS.reset} ${varText}${op.lines !== 1 ? 's' : ''} ${COLORS.cyan}before${COLORS.reset} ${COLORS.dim}${op.searchText}${COLORS.reset}`);
282
278
  } else if (op.type === 'notfound') {
283
- const target = op.markerName ? `marker "${COLORS.dim}${op.markerName}${COLORS.reset}"` : `"${COLORS.dim}${op.searchText}${COLORS.reset}"`;
279
+ const target = op.markerName ? `marker ${COLORS.dim}${op.markerName}${COLORS.reset}` : `${COLORS.dim}${op.searchText}${COLORS.reset}`;
284
280
  log(`${indent}${COLORS.yellow}⚠${COLORS.reset} ${COLORS.yellow}Could not find target:${COLORS.reset} ${target}`);
285
281
  } else log(`${indent}${COLORS.gray}○${COLORS.reset} ${COLORS.dim}Content already exists (${op.type})${COLORS.reset}`);
286
282
  });
@@ -410,7 +406,7 @@ const main = async () => {
410
406
 
411
407
  console.log();
412
408
  log(` ╭${'─'.repeat(62)}╮`);
413
- log(` │ ${COLORS.bold}Simpl Add-on Installer${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(36 - version.length)}│`);
409
+ log(` │ ${COLORS.bold}Simpl Add-on Installer${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(35 - version.length)}│`);
414
410
  log(` ╰${'─'.repeat(62)}╯`);
415
411
  console.log();
416
412
 
@@ -485,7 +481,7 @@ const main = async () => {
485
481
  let addonName;
486
482
 
487
483
  while (true) {
488
- const input = await promptUser(' Add-on to install (name or number)');
484
+ const input = await promptUser(` Add-on to install ${COLORS.dim}(name or number)${COLORS.reset}`);
489
485
 
490
486
  if (!input) {
491
487
  log(` ${COLORS.red}✗${COLORS.reset} Selection cannot be empty`, 'red');
@@ -510,7 +506,7 @@ const main = async () => {
510
506
 
511
507
  console.log();
512
508
  log(` ╭${'─'.repeat(62)}╮`);
513
- log(` │ ${COLORS.bold}Installing: ${COLORS.cyan}${addonName}${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(45 - addonName.length - version.length)}│`);
509
+ log(` │ ${COLORS.bold}Installing: ${COLORS.cyan}${addonName}${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(43 - addonName.length - version.length)}│`);
514
510
  log(` ╰${'─'.repeat(62)}╯`);
515
511
  console.log();
516
512
  log(' 📦 Downloading add-on...', 'bold');
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.0",
4
+ "version": "2.4.2",
5
5
  "scripts": {
6
6
  "link": "npm link",
7
7
  "unlink": "npm unlink -g @ijuantm/simpl-addon"