From 7f869970b1e9d84de2e8c09b4eb2a6923332169b Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Fri, 12 Oct 2018 17:53:50 -0700 Subject: [PATCH] fix: shrinkwrap https://github.com/oclif/dev-cli/issues/50 --- src/generators/app.ts | 10 +++++++--- templates/circle.yml.ejs | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/generators/app.ts b/src/generators/app.ts index 9f00a99..5f261d3 100644 --- a/src/generators/app.ts +++ b/src/generators/app.ts @@ -307,8 +307,8 @@ class App extends Generator { this.pjson.scripts.prepack = nps.series(`${rmrf} lib`, 'tsc -b') } if (['plugin', 'multi'].includes(this.type)) { - this.pjson.scripts.prepack = nps.series('oclif-dev manifest', 'oclif-dev readme', 'npm shrinkwrap') - this.pjson.scripts.postpack = `${rmf} oclif.manifest.json npm-shrinkwrap.json` + this.pjson.scripts.prepack = nps.series('oclif-dev manifest', 'oclif-dev readme') + this.pjson.scripts.postpack = `${rmf} oclif.manifest.json` this.pjson.scripts.version = nps.series('oclif-dev readme', 'git add README.md') this.pjson.files.push('/oclif.manifest.json') this.pjson.files.push('/npm-shrinkwrap.json') @@ -495,7 +495,11 @@ class App extends Generator { return Promise.all([ install(devDependencies, {...yarnOpts, ...dev, ignoreScripts: true}), install(dependencies, {...yarnOpts, ...save}), - ]) + ]).then(() => { + if (!this.yarn) { + return this.spawnCommand('npm', ['shrinkwrap']) + } + }) } end() { diff --git a/templates/circle.yml.ejs b/templates/circle.yml.ejs index e9313a7..91368dc 100644 --- a/templates/circle.yml.ejs +++ b/templates/circle.yml.ejs @@ -9,7 +9,7 @@ jobs: - checkout - restore_cache: &restore_cache keys: - - v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "<%- yarn ? 'yarn.lock' : 'package-lock.json' %>"}} + - v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "<%- yarn ? 'yarn.lock' : 'npm-shrinkwrap.json' %>"}} - v1-npm-{{checksum ".circleci/config.yml"}} - run: name: Install dependencies @@ -42,7 +42,7 @@ jobs: name: Install dependencies command: yarn - save_cache: - key: v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "<%- yarn ? 'yarn.lock' : 'package-lock.json' %>"}} + key: v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "<%- yarn ? 'yarn.lock' : 'npm-shrinkwrap.json' %>"}} paths: - ~/cli/node_modules <%_ if (yarn) { _%>