Skip to content

Commit

Permalink
chore: log the external command being executed (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 authored Oct 15, 2024
1 parent cab89b4 commit cbe8cce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-brooms-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

chore: log the external command being executed
9 changes: 5 additions & 4 deletions packages/cli/commands/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,15 @@ async function runAdders({
await config.postInstall?.(workspace);

if (config.scripts && config.scripts.length > 0) {
p.log.step(`Running external command ${pc.gray(`(${config.id})`)}`);

for (const script of config.scripts) {
if (script.condition?.(workspace) === false) continue;

const { command, args } = resolveCommand(workspace.packageManager, 'execute', script.args)!;
const adderPrefix = details.length > 1 ? `${config.id}: ` : '';
p.log.step(
`${adderPrefix}Running external command ${pc.gray(`(${command} ${args.join(' ')})`)}`
);

// adding --yes as the first parameter helps avoiding the "Need to install the following packages:" message
if (workspace.packageManager === 'npm') args.unshift('--yes');

Expand All @@ -538,8 +541,6 @@ async function runAdders({
);
}
}

p.log.success(`Finished running ${config.id}`);
}
}

Expand Down

0 comments on commit cbe8cce

Please sign in to comment.