@ijuantm/simpl-addon 2.4.2 → 2.4.3

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 +10 -5
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -262,6 +262,11 @@ const mergeFile = (targetPath, addonContent, markers, isEnv = false) => {
262
262
  return {modified: newContent !== targetContent, operations};
263
263
  };
264
264
 
265
+ const truncateText = (text, maxLength = 80) => {
266
+ if (text.length <= maxLength) return text;
267
+ return text.substring(0, maxLength - 3) + '...';
268
+ };
269
+
265
270
  const printMergeResults = (relativePath, isEnv, result) => {
266
271
  const indent = ' ';
267
272
  const varText = isEnv ? 'environment variable' : 'line';
@@ -273,10 +278,10 @@ const printMergeResults = (relativePath, isEnv, result) => {
273
278
  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`);
274
279
  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`);
275
280
  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' : ''}`);
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}`);
281
+ 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}${truncateText(op.searchText)}${COLORS.reset}`);
282
+ 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}${truncateText(op.searchText)}${COLORS.reset}`);
278
283
  } else if (op.type === 'notfound') {
279
- const target = op.markerName ? `marker ${COLORS.dim}${op.markerName}${COLORS.reset}` : `${COLORS.dim}${op.searchText}${COLORS.reset}`;
284
+ const target = op.markerName ? `marker ${COLORS.dim}${op.markerName}${COLORS.reset}` : `${COLORS.dim}${truncateText(op.searchText)}${COLORS.reset}`;
280
285
  log(`${indent}${COLORS.yellow}⚠${COLORS.reset} ${COLORS.yellow}Could not find target:${COLORS.reset} ${target}`);
281
286
  } else log(`${indent}${COLORS.gray}○${COLORS.reset} ${COLORS.dim}Content already exists (${op.type})${COLORS.reset}`);
282
287
  });
@@ -406,7 +411,7 @@ const main = async () => {
406
411
 
407
412
  console.log();
408
413
  log(` ╭${'─'.repeat(62)}╮`);
409
- log(` │ ${COLORS.bold}Simpl Add-on Installer${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(35 - version.length)}│`);
414
+ log(` │ ${COLORS.bold}Simpl Add-on Installer${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(34 - version.length)}│`);
410
415
  log(` ╰${'─'.repeat(62)}╯`);
411
416
  console.log();
412
417
 
@@ -506,7 +511,7 @@ const main = async () => {
506
511
 
507
512
  console.log();
508
513
  log(` ╭${'─'.repeat(62)}╮`);
509
- log(` │ ${COLORS.bold}Installing: ${COLORS.cyan}${addonName}${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(43 - addonName.length - version.length)}│`);
514
+ log(` │ ${COLORS.bold}Installing: ${COLORS.cyan}${addonName}${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(44 - addonName.length - version.length)}│`);
510
515
  log(` ╰${'─'.repeat(62)}╯`);
511
516
  console.log();
512
517
  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.2",
4
+ "version": "2.4.3",
5
5
  "scripts": {
6
6
  "link": "npm link",
7
7
  "unlink": "npm unlink -g @ijuantm/simpl-addon"