Skip to content

Commit

Permalink
wip: start some run-script changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Apr 7, 2024
1 parent 561e0de commit f97b196
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
15 changes: 5 additions & 10 deletions lib/commands/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,13 @@ class RunScript extends BaseCommand {
}
}

const opts = {
path,
args,
scriptShell,
stdio: 'inherit',
pkg,
banner: !this.npm.silent,
}

for (const [ev, evArgs] of events) {
await runScript({
...opts,
path,
scriptShell,
stdio: 'inherit',
pkg,
banner: !this.npm.silent,
event: ev,
args: evArgs,
})
Expand Down
19 changes: 9 additions & 10 deletions workspaces/libnpmexec/lib/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ const run = async ({

// do the fakey runScript dance
// still should work if no package.json in cwd
const realPkg = await readPackageJson(`${path}/package.json`)
.catch(() => ({}))
const realPkg = await readPackageJson(`${path}/package.json`).catch(() => ({}))
const pkg = {
...realPkg,
scripts: {
Expand All @@ -36,18 +35,18 @@ const run = async ({
return log.warn('exec', 'Interactive mode disabled in CI environment')
}

locationMsg = locationMsg || ` at location:\n${flatOptions.chalk.dim(runPath)}`
const { chalk } = flatOptions

output(`${
flatOptions.chalk.reset('\nEntering npm script environment')
}${
flatOptions.chalk.reset(locationMsg)
}${
flatOptions.chalk.bold('\nType \'exit\' or ^D when finished\n')
}`)
chalk.reset('\nEntering npm script environment')
}${
chalk.reset(locationMsg || ` at location:\n${chalk.dim(runPath)}`)
}${
chalk.bold('\nType \'exit\' or ^D when finished\n')
}`)
}
}
return await runScript({
return runScript({
...flatOptions,
pkg,
banner: false,
Expand Down

0 comments on commit f97b196

Please sign in to comment.