Skip to content

Commit 1106bbb

Browse files
authored
Validate starterPath isn't a dot fixes #3789 (#3810)
1 parent 6bbc0d1 commit 1106bbb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/gatsby-cli/src/init-starter.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ const copy = async (starterPath: string, rootPath: string) => {
5151
if (!fs.existsSync(starterPath)) {
5252
throw new Error(`starter ${starterPath} doesn't exist`)
5353
}
54+
55+
if (starterPath === `.`) {
56+
throw new Error(
57+
`You can't create a starter from the existing directory. If you want to
58+
create a new site in the current directory, the trailing dot isn't
59+
necessary. If you want to create a new site from a local starter, run
60+
something like "gatsby new new-gatsby-site ../my-gatsby-starter"`
61+
)
62+
}
63+
5464
report.info(`Creating new site from local starter: ${starterPath}`)
5565

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

0 commit comments

Comments
 (0)