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

Validate starterPath isn't a dot fixes #3789 #3810

Merged
merged 1 commit into from
Feb 1, 2018
Merged
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
10 changes: 10 additions & 0 deletions packages/gatsby-cli/src/init-starter.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ const copy = async (starterPath: string, rootPath: string) => {
if (!fs.existsSync(starterPath)) {
throw new Error(`starter ${starterPath} doesn't exist`)
}

if (starterPath === `.`) {
throw new Error(
`You can't create a starter from the existing directory. If you want to
create a new site in the current directory, the trailing dot isn't
necessary. If you want to create a new site from a local starter, run
something like "gatsby new new-gatsby-site ../my-gatsby-starter"`
)
}

report.info(`Creating new site from local starter: ${starterPath}`)

report.log(`Copying local starter to ${rootPath} ...`)
Expand Down