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(create-gatsby): Add -y flag #28468

Merged
merged 7 commits into from
Dec 8, 2020
Merged

Conversation

laurieontech
Copy link
Contributor

@laurieontech laurieontech commented Dec 3, 2020

This flag bypasses all prompts other than naming your site.

[ch20045]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 3, 2020
@laurieontech laurieontech added topic: cli Related to the Gatsby CLI and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Dec 3, 2020
@ascorbic
Copy link
Contributor

ascorbic commented Dec 4, 2020

I like the idea, but I'm not sure about the implementation. This fails silently if the kebabified version of the name is invalid, or the folder exists. I also think that a -y flag implies that it's not interactive at all. My suggestion would be that -y requires them to pass in a folder name and we fail immediately (with an error) if the folder exists or is invalid. Otherwise it just installs it with no prompts, either using the folder name as the site name as before, or making an attempt to un-kebab it.

@@ -79,6 +82,7 @@ export const questions = (initialFolderName: string): any => [
initial: initialFolderName,
format: (value: string): string => c.cyan(value),
validate: validateProjectName,
skip,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we're still calling this question with an initial folder name to process the results but skipping it so that the user isn't prompted. Theoretically we could create the data object directly, but this seemed cleaner.

@laurieontech laurieontech merged commit a93c71d into master Dec 8, 2020
@delete-merged-branch delete-merged-branch bot deleted the feat/create-gatsby-flag branch December 8, 2020 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: cli Related to the Gatsby CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants