Skip to content

Commit

Permalink
Merge branch 'master' into ci-codeship
Browse files Browse the repository at this point in the history
  • Loading branch information
selbyk authored Oct 11, 2017
2 parents 323f885 + 507c25c commit dc8e09b
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions update.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ const info = require('./ci-services')()
const pkg = relative('./package.json')

module.exports = function update () {
try {
var shrinkwrap = fs.readFileSync('./npm-shrinkwrap.json')
} catch (e) {}
try {
var packageLock = fs.readFileSync('./package-lock.json')
} catch (e) {}
try {
var yarnLock = fs.readFileSync('./yarn.lock')
} catch (e) {}

if (!(shrinkwrap || packageLock || yarnLock)) {
const shrinkwrapExists = fs.existsSync('./npm-shrinkwrap.json')
const packageLockExists = fs.existsSync('./package-lock.json')
const yarnLockExists = fs.existsSync('./yarn.lock')

if (!(shrinkwrapExists || packageLockExists || yarnLockExists)) {
return console.error(
'Without either an "npm-shrinkwrap.json", "package-lock.json" or "yarn.lock" file present there is no need to run this script'
)
Expand Down Expand Up @@ -58,8 +52,8 @@ module.exports = function update () {
}

updateLockfile(dependency, {
yarn: !!yarnLock,
npm: !!packageLock
yarn: yarnLockExists,
npm: packageLockExists
})

console.log('Lockfile updated')
Expand Down

0 comments on commit dc8e09b

Please sign in to comment.