diff --git a/src/update-last-successful-build/index.js b/src/update-last-successful-build/index.js index 744d6daec..6ef7f2200 100644 --- a/src/update-last-successful-build/index.js +++ b/src/update-last-successful-build/index.js @@ -39,12 +39,25 @@ async function updateLastSuccessfulBuild (opts) { console.info('Creating temp branch') // eslint-disable-line no-console await exec('git', ['checkout', '-b', tempBranch]) - console.info('Creating yarn.lock') // eslint-disable-line no-console - await exec('yarn') + console.info('Removing dependencies') // eslint-disable-line no-console + await exec('rm', ['-rf', 'node_modules', 'package-lock.json', 'yarn.lock', 'npm-shrinkwrap.json']) + + console.info('Installing dependencies') // eslint-disable-line no-console + await exec('npm', ['install', '--production']) + + console.info('Removing package-lock.json') // eslint-disable-line no-console + await exec('rm', ['-rf', 'package-lock.json']) // removing package-lock after install prevents dev deps being added to the shrinkwrap file console.info('Creating npm-shrinkwrap.json') // eslint-disable-line no-console await exec('npm', ['shrinkwrap']) + console.info('Creating yarn.lock') // eslint-disable-line no-console + await exec('yarn', [], { + env: { + NODE_ENV: 'production' + } + }) + try { console.info('Committing') // eslint-disable-line no-console await exec('git', ['add', '-f', 'npm-shrinkwrap.json', 'yarn.lock']) diff --git a/src/update-release-branch-lockfiles/index.js b/src/update-release-branch-lockfiles/index.js index 06e28bb68..9973198df 100644 --- a/src/update-release-branch-lockfiles/index.js +++ b/src/update-release-branch-lockfiles/index.js @@ -27,15 +27,22 @@ async function updateReleaseBranchLockfiles (opts) { console.info('Removing dependencies') // eslint-disable-line no-console await exec('rm', ['-rf', 'node_modules', 'package-lock.json', 'yarn.lock', 'npm-shrinkwrap.json']) - console.info('Creating yarn.lock') // eslint-disable-line no-console - await exec('yarn') - console.info('Installing dependencies') // eslint-disable-line no-console - await exec('npm', ['install']) + await exec('npm', ['install', '--production']) + + console.info('Removing package-lock.json') // eslint-disable-line no-console + await exec('rm', ['-rf', 'package-lock.json']) // removing package-lock after install prevents dev deps being added to the shrinkwrap file console.info('Creating npm-shrinkwrap.json') // eslint-disable-line no-console await exec('npm', ['shrinkwrap']) + console.info('Creating yarn.lock') // eslint-disable-line no-console + await exec('yarn', [], { + env: { + NODE_ENV: 'production' + } + }) + try { console.info('Committing') // eslint-disable-line no-console await exec('git', ['add', '-f', 'npm-shrinkwrap.json', 'yarn.lock'])