-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding in cli args, refactoring file structure, and changing prompts for inquirer #58
Conversation
On top of the above, I tried finding a way to easily add in a One thing we should think about doing in the future is moving over to a true templated file structure that gets hydrated before being copied over. That way we aren't maintaining copies of files just for different setup methods, and can easily update to new structures (ala the new next pages rfc) once they come out |
I guess a hack would be to just run a |
I thought about doing that temporarily, but feels SUPER hacky. |
I think |
@MWhite-22 Can you also please unselect all of the prompts by default |
Just confirming, if someone does Thats the way you want it @nexxeln? |
No, what I meant was that in the prompts to select the packages, initially nothing should be selected. |
Right right, but I am building those choices programmatically from the "default" option. So the new build will have all packages by |
Yes you got it. |
WIP for options
Incorporating results into prompt steps
Utility functions with no sideeffects moved to utils Project creators and sccafolders stay in helpers
Inquirer has: - a significantly smaller bundle size - more frequently updated - more then 2x stars in GH - is moving (slowly) to a full TS package
Should prevent mixing absolute imports with relative imports
Rename the two installPackage functions to be more descriptive Move package installer types and creation of installer map into ./installers directory
…Project Changed spinner stop to spinner succeed and fail when appropriate
Blue/cyan seems to be the more fitting color scheme then bright red
See comments. Will create an issue to discuss further
Rebased to the new readme doc |
Done and tested. Working as intended. |
Looks good! Very good PR. Thank you so much |
Looked this over and had a thought about this: // src/cli/index:133
} catch (err) {
// If the user is not calling create-t3-app from an interactive terminal, inquirer will throw an error with isTTYError = true
// If this happens, we catch the error, tell the user what has happened, and then contiue to run the program with a default t3 app
// eslint-disable-next-line -- Otherwise we have to do some fancy namespace extension logic on the Error type which feels overkill for one line
if (err instanceof Error && (err as any).isTTYError) {
logger.warn(
`${CREATE_T3_APP} needs an interactive terminal to provide options`,
);
logger.info(`Bootsrapping a default t3 app in ./${DEFAULT_APP_NAME}`);
} else {
throw err;
}
} and more specifically logger.info(`Bootsrapping a default t3 app in ./${DEFAULT_APP_NAME}`); If I have an un-interactive shell and run |
It does! Any name arg is passed in still, but the interactive part (aka: the fun language selector, and the packages selector) will not be viewable. |
Never mind, I now see what you mean. Updating the string template to ${cliResults.appName} |
Adding in cli args, refactoring file structure, and changing prompts for inquirer
I went a little nuts, so, apologies, but i'll outline all the rationale below:
Accepting args (#37 #50):
-y
or--default
: Skips over the prompts and goes straight to initializing a new repo with opinionated defaults. Can still accept a directory argument sonpx create-t3-app myApp -y
will create a "default" app named "myApp" inside the "./myApp" directory--noGit
: Skip the git initialization step-v
or--version
: Print the current create-t3-app version-h
or--help
: All of this and more in a nicely formatted help menuInquirer vs. Prompts:
Add packages as a list, not individual questions (#42):
as const
object means this list can be quickly and easily expanded in a type safe wayA few bug fixes for ora (#47):
That should be everything. If you have any questions, please ask away.