Skip to content
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

feat(gatsby-cli): Remove one of package-lock.json and yarn.lock on gatsby new #13225

Merged
Prev Previous commit
Next Next commit
👌 Take care of @sidharthachatterjee review
  • Loading branch information
frinyvonnick authored and sidharthachatterjee committed Apr 9, 2019
commit ea3513e9d23d4f6894b51cf70e6a3bc3743994ea
1 change: 1 addition & 0 deletions packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@babel/runtime": "^7.0.0",
"bluebird": "^3.5.0",
"common-tags": "^1.4.0",
"configstore": "^4.0.0",
"convert-hrtime": "^2.0.0",
"core-js": "^2.5.0",
"envinfo": "^5.8.1",
Expand Down
7 changes: 6 additions & 1 deletion packages/gatsby-cli/src/init-starter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* @flow */
const { execSync } = require(`child_process`)
const Configstore = require(`configstore`)
const execa = require(`execa`)
const hostedGitInfo = require(`hosted-git-info`)
const fs = require(`fs-extra`)
Expand All @@ -14,6 +15,9 @@ const spawn = (cmd: string, options: any) => {
return execa(file, args, { stdio: `inherit`, ...options })
}

const pkg = require(`../package.json`)
const conf = new Configstore(pkg.name, {})
frinyvonnick marked this conversation as resolved.
Show resolved Hide resolved

// Checks the existence of yarn package
// We use yarnpkg instead of yarn to avoid conflict with Hadoop yarn
// Refer to https://github.com/yarnpkg/yarn/issues/673
Expand Down Expand Up @@ -80,11 +84,12 @@ const install = async rootPath => {
{ title: `yarn`, value: `yarnpkg` },
{ title: `npm`, value: npmCmd },
],
max: 1,
initial: 0,
},
])
response = promptsAnswer.package_manager
frinyvonnick marked this conversation as resolved.
Show resolved Hide resolved
}
conf.set(`package_manager`, response)
if (response.includes(`yarn`)) {
await spawn(`rm package-lock.json`)
frinyvonnick marked this conversation as resolved.
Show resolved Hide resolved
} else {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6305,7 +6305,7 @@ config-chain@^1.1.11:
ini "^1.3.4"
proto-list "~1.2.1"

configstore@4.0.0:
configstore@4.0.0, configstore@^4.0.0:
frinyvonnick marked this conversation as resolved.
Show resolved Hide resolved
version "4.0.0"
resolved "https://registry.yarnpkg.com/configstore/-/configstore-4.0.0.tgz#5933311e95d3687efb592c528b922d9262d227e7"
integrity sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ==
Expand Down