Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
620 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | // run an npm command
|
---|
| 2 | const spawn = require('@npmcli/promise-spawn')
|
---|
| 3 | const {dirname} = require('path')
|
---|
| 4 |
|
---|
| 5 | module.exports = (npmBin, npmCommand, cwd, env, extra) => {
|
---|
| 6 | const isJS = npmBin.endsWith('.js')
|
---|
| 7 | const cmd = isJS ? process.execPath : npmBin
|
---|
| 8 | const args = (isJS ? [npmBin] : []).concat(npmCommand)
|
---|
| 9 | // when installing to run the `prepare` script for a git dep, we need
|
---|
| 10 | // to ensure that we don't run into a cycle of checking out packages
|
---|
| 11 | // in temp directories. this lets us link previously-seen repos that
|
---|
| 12 | // are also being prepared.
|
---|
| 13 |
|
---|
| 14 | return spawn(cmd, args, { cwd, stdioString: true, env }, extra)
|
---|
| 15 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.