Skip to content

Commit

Permalink
use npm if package-lock.json is present
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Aug 19, 2019
1 parent 692eda4 commit 597f760
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/saber/lib/cli-commands/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ module.exports = function(cli) {
)

const { status } = spawnSync('yarnpkg', ['--version']) // test if yarn is present before allowing it to use the same stdio
if (status === 0) {
const hasNpmLock = await fs.pathExists(
path.join(cwd, 'package-lock.json')
)
if (status === 0 && !hasNpmLock) {
await spawn('yarn', ['install'], { stdio: 'inherit' })
} else {
await spawn('npm', ['install'], { stdio: 'inherit' })
Expand Down

0 comments on commit 597f760

Please sign in to comment.