Skip to content

Commit

Permalink
fix: Fix starter publish and scripts (#28260)
Browse files Browse the repository at this point in the history
* Fix starter publish script

* Don't use yarn import because @arcanis says it's a bad idea
#28238 (comment)
  • Loading branch information
ascorbic authored Nov 24, 2020
1 parent bd0a7f4 commit f6417dd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
8 changes: 1 addition & 7 deletions packages/create-gatsby/src/init-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions packages/gatsby-cli/src/init-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,7 @@ const install = async (rootPath: string): Promise<void> => {
}
}
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`)
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish-starters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f6417dd

Please sign in to comment.