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-dev-cli): install deps if there are no gatsby deps but --forceInstall was used #27055

Merged
merged 1 commit into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/gatsby-dev-cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ If you prefer to place them in your package.json dependencies instead,
gatsby-dev will pick them up.
`
)
process.exit()
if (!argv.forceInstall) {
process.exit()
} else {
console.log(
`Continuing other dependencies installation due to "--forceInstall" flag`
)
}
}

watch(gatsbyLocation, argv.packages, {
Expand Down
23 changes: 16 additions & 7 deletions packages/gatsby-dev-cli/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,22 @@ async function watch(

if (forceInstall) {
try {
await publishPackagesLocallyAndInstall({
packagesToPublish: allPackagesToWatch,
root,
localPackages,
ignorePackageJSONChanges,
yarnWorkspaceRoot,
})
if (allPackagesToWatch.length > 0) {
await publishPackagesLocallyAndInstall({
packagesToPublish: allPackagesToWatch,
root,
localPackages,
ignorePackageJSONChanges,
yarnWorkspaceRoot,
})
} else {
// run `yarn`
const yarnInstallCmd = [`yarn`]

console.log(`Installing packages from public NPM registry`)
await promisifiedSpawn(yarnInstallCmd)
console.log(`Installation complete`)
}
} catch (e) {
console.log(e)
}
Expand Down