@ijuantm/simpl-addon 2.4.3 → 2.4.4

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 -15
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -136,13 +136,13 @@ const extractMarkers = (content) => {
136
136
  const markers = [];
137
137
 
138
138
  content.split('\n').forEach((line, i) => {
139
- const afterMatch = line.match(/@addon-insert:after\s*\(\s*["'](.+?)["']\s*\)/);
140
- const beforeMatch = line.match(/@addon-insert:before\s*\(\s*["'](.+?)["']\s*\)/);
141
- const replaceMatch = line.match(/@addon-insert:replace\s*\(\s*["'](.+?)["']\s*\)/);
139
+ const afterMatch = line.match(/@addon-insert:after\s*\(\s*(["'])(.+?)\1\s*\)/);
140
+ const beforeMatch = line.match(/@addon-insert:before\s*\(\s*(["'])(.+?)\1\s*\)/);
141
+ const replaceMatch = line.match(/@addon-insert:replace\s*\(\s*(["'])(.+?)\1\s*\)/);
142
142
 
143
- if (afterMatch) markers.push({type: 'after', lineIndex: i, searchText: afterMatch[1]});
144
- else if (beforeMatch) markers.push({type: 'before', lineIndex: i, searchText: beforeMatch[1]});
145
- else if (replaceMatch) markers.push({type: 'replace', lineIndex: i, markerName: replaceMatch[1]});
143
+ if (afterMatch) markers.push({type: 'after', lineIndex: i, searchText: afterMatch[2]});
144
+ else if (beforeMatch) markers.push({type: 'before', lineIndex: i, searchText: beforeMatch[2]});
145
+ else if (replaceMatch) markers.push({type: 'replace', lineIndex: i, markerName: replaceMatch[2]});
146
146
  else if (line.includes('@addon-insert:prepend')) markers.push({type: 'prepend', lineIndex: i});
147
147
  else if (line.includes('@addon-insert:append')) markers.push({type: 'append', lineIndex: i});
148
148
  });
@@ -262,11 +262,6 @@ 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
-
270
265
  const printMergeResults = (relativePath, isEnv, result) => {
271
266
  const indent = ' ';
272
267
  const varText = isEnv ? 'environment variable' : 'line';
@@ -278,10 +273,10 @@ const printMergeResults = (relativePath, isEnv, result) => {
278
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`);
279
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`);
280
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' : ''}`);
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}`);
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}`);
283
278
  } else if (op.type === 'notfound') {
284
- const target = op.markerName ? `marker ${COLORS.dim}${op.markerName}${COLORS.reset}` : `${COLORS.dim}${truncateText(op.searchText)}${COLORS.reset}`;
279
+ const target = op.markerName ? `marker ${COLORS.dim}${op.markerName}${COLORS.reset}` : `${COLORS.dim}${op.searchText}${COLORS.reset}`;
285
280
  log(`${indent}${COLORS.yellow}⚠${COLORS.reset} ${COLORS.yellow}Could not find target:${COLORS.reset} ${target}`);
286
281
  } else log(`${indent}${COLORS.gray}○${COLORS.reset} ${COLORS.dim}Content already exists (${op.type})${COLORS.reset}`);
287
282
  });
@@ -514,7 +509,7 @@ const main = async () => {
514
509
  log(` │ ${COLORS.bold}Installing: ${COLORS.cyan}${addonName}${COLORS.reset} ${COLORS.dim}(v${version})${COLORS.reset}${' '.repeat(44 - addonName.length - version.length)}│`);
515
510
  log(` ╰${'─'.repeat(62)}╯`);
516
511
  console.log();
517
- log(' 📦 Downloading add-on...', 'bold');
512
+ log(` 📦 Downloading ${COLORS.cyan}${addonName}${COLORS.reset} add-on...`, 'bold');
518
513
 
519
514
  let copied, skipped, toMerge;
520
515
 
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.3",
4
+ "version": "2.4.4",
5
5
  "scripts": {
6
6
  "link": "npm link",
7
7
  "unlink": "npm unlink -g @ijuantm/simpl-addon"