Skip to content

Commit

Permalink
Validate starterPath isn't a dot fixes #3789 (#3810)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Feb 1, 2018
1 parent 6bbc0d1 commit 1106bbb
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit 1106bbb

Please sign in to comment.