-
-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use $ npm ci
if there is a lockfile
#310
Conversation
$ npm ci
if there is lockfile
index.js
Outdated
@@ -46,6 +47,7 @@ module.exports = async (input = 'patch', options) => { | |||
const pkg = util.readPkg(); | |||
const pkgManager = options.yarn === true ? 'yarn' : 'npm'; | |||
const pkgManagerName = options.yarn === true ? 'Yarn' : 'npm'; | |||
const hasLockFile = fs.existsSync('package-lock.json') || fs.existsSync('npm-shrinkwrap.json'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized, you have to make the paths here relative to the package root, as it should be possible to run np
in a sub-folder.
You can get the root path with https://github.com/sindresorhus/pkg-dir
$ npm ci
if there is lockfile$ npm ci
if there is a lockfile
index.js
Outdated
@@ -65,6 +70,7 @@ module.exports = async (input = 'patch', options) => { | |||
tasks.add([ | |||
{ | |||
title: 'Cleanup', | |||
skip: hasLockFile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a function.
index.js
Outdated
task: () => exec('npm', ['install', '--no-package-lock', '--no-production']) | ||
task: () => { | ||
const args = hasLockFile ? ['ci'] : ['install', '--no-package-lock', '--no-production']; | ||
exec('npm', args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to return this, so the task would wait for it.
Fixes #285