From f6417dd58360bd3e243a955c413dd46138608af6 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Tue, 24 Nov 2020 18:52:05 +0000 Subject: [PATCH] fix: Fix starter publish and scripts (#28260) * Fix starter publish script * Don't use yarn import because @arcanis says it's a bad idea https://github.com/gatsbyjs/gatsby/issues/28238#issuecomment-732506607 --- packages/create-gatsby/src/init-starter.ts | 8 +------- packages/gatsby-cli/src/init-starter.ts | 7 +------ scripts/publish-starters.sh | 2 +- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/create-gatsby/src/init-starter.ts b/packages/create-gatsby/src/init-starter.ts index 25a23f49ec5bf..c06f84c315e1c 100644 --- a/packages/create-gatsby/src/init-starter.ts +++ b/packages/create-gatsby/src/init-starter.ts @@ -92,13 +92,7 @@ const install = async ( } } if (getPackageManager() === `yarn` && checkForYarn()) { - if (await fs.pathExists(`package-lock.json`)) { - if (!(await fs.pathExists(`yarn.lock`))) { - await execa(`yarnpkg`, [`import`]) - } - await fs.remove(`package-lock.json`) - } - + await fs.remove(`package-lock.json`) const args = packages.length ? [`add`, silent, ...packages] : [silent] await execa(`yarnpkg`, args) } else { diff --git a/packages/gatsby-cli/src/init-starter.ts b/packages/gatsby-cli/src/init-starter.ts index 2d7bea11b203e..9846aaad2791a 100644 --- a/packages/gatsby-cli/src/init-starter.ts +++ b/packages/gatsby-cli/src/init-starter.ts @@ -111,12 +111,7 @@ const install = async (rootPath: string): Promise => { } } if (getPackageManager() === `yarn` && checkForYarn()) { - if (await fs.pathExists(`package-lock.json`)) { - if (!(await fs.pathExists(`yarn.lock`))) { - await spawn(`yarnpkg import`) - } - await fs.remove(`package-lock.json`) - } + await fs.remove(`package-lock.json`) await spawn(`yarnpkg`) } else { await fs.remove(`yarn.lock`) diff --git a/scripts/publish-starters.sh b/scripts/publish-starters.sh index eec3b78e90710..905ed9beedd4c 100755 --- a/scripts/publish-starters.sh +++ b/scripts/publish-starters.sh @@ -29,7 +29,7 @@ for folder in $GLOB; do if [ "$IS_WORKSPACE" = null ]; then rm -f yarn.lock - if ["$MINIMAL_STARTER" != "$NAME"]; then # ignore minimal starter because we don't want any lock files for create-gatsby + if [ "$MINIMAL_STARTER" != "$NAME" ]; then # ignore minimal starter because we don't want any lock files for create-gatsby yarn import # generate a new yarn.lock file based on package-lock.json, gatsby new does this is new CLI versions but will ignore if file exists fi fi