Skip to content

Instantly share code, notes, and snippets.

@thomasballinger
Last active November 24, 2024 23:57
Show Gist options
  • Save thomasballinger/c703c32100d6bfdba15eac91cb9f15c1 to your computer and use it in GitHub Desktop.
Save thomasballinger/c703c32100d6bfdba15eac91cb9f15c1 to your computer and use it in GitHub Desktop.
tom gut Svelte CLI answers

thomasballinger's gut answers to TanStack Start CLI Questions:

should vinxi deployment targets be include in the CLI?

No, can't you build the same project multiple ways? I want to say no unless generating code specific to one of them.

what would the default deployment target be? @tannerlinsley you should probably answer this one

should we allow people to not use typescript?

No! Choice like that is expensive when multiplied over the other options.

I think if typescript is chosen the strictness should be set as it's important to the router - is that correct?

Yeah, choose good defaults — I don't want to worry about this.

should we allow for the option to choose between file based and code based routing?

my gut it no, file-based is suggested right? If I'm using code I'm fine writing a little more code

should non tanstack-start package versions in templates be automatically kept up to date?

Seems like yes, but do you mean Renovate should update them less frequently? Is there an alternative?

which CLI tool should be used? I like strict-cli - it is typesafe and feels like a logical choice for the tanstack stack

never used it, sounds fine

should the CLI allow for choosing the version of tanstack router / start to install? I think if the answer is yes then it should only be for a very basic template

no, latest stable once that exists. Devs can add flag someday for using alpha builds, or for linking to packages in the monorepo.

Implementation:

for prompts - @inquirer/prompts for cli - currently undecided. Question above ^^^^ General

usage npx create tanstack@latest add documentation to website All prompts will have an associated CLI flag so you can run the CLI without being prompted Theme to match tanstack colors ascii palm tree and TANSTACK logo with gradient at top - animate it appearing. Will be nice to share on X shows the current version of the CLI at the top detects package manager being used and uses it for install step after the final step in the prompts, visuall indicate each of the steps being completed as they're done (creating folder, adding template, installing dependencies etc) Prompt Order: directory template typescript

suggestion: skip

typescript strictness

suggestion: skip

install dependencies git update to github workflow to run tests templates should have the versions updated as router / start is updated Tests

e2e: templates should include their own tests to ensure they're working correctly when a new version is deployed unit tests Flags

--hide-logo -l - hides the logo

What's this for, CI logs? I'd skip

--silent -s - runs the cli without prompting - accepts any Y/N questoins automatically

is this usually --yes -y? --silent sounds like not printing logs

--install-dependencies -i - installs the dependencies after folder created

I'd reverse this (--no-install-dependencies) and make it the default

--initiate-git -g - initiates git

I'd reverse this (--no-initialize-git) and make it the default and s/initiate/initialize/

Flags / Prompts

directory First positional arugment in CLI Prompt Where should the project be installed? Default - two random words put together

I'd default to my-app, and offer to overwrite the directory if it already exists

Validations folder doesn't exist kebab case more than one character lower case first character is alpha Is used as the name for the project in the package.json deployment target Flag: --deployment-target -d Prompt: Deployment Target: select from list - default undecided sets the deployment target in the app.config.ts Tailwind when on - adds tailwind with postcss Flag: --tailwind -t Prompt: Tailwind: Yes / No templates need to account for tailwind being on or off Template Flag: --template -t Prompt: Template - select from list. Defaults to starter (a simple example using tailwind to showcase some features) Validations template-name must exist when using flag Inital Templates

empty - bare bones template with an empty index route sample - has some sample files to see how tanstack works

@timoconnellaus
Copy link

Agree on most things - here's my disagreements and why

  • The logo is a nice to have for sure - definitely not v1 - but I think if this is people's first interaction with tanstack start, you want it to start off nice
  • install dependencies flag - I think it actually needs to be a true / false flag - the purpose is to skip the prompt and you need to be able to choose which option. Being prompted to install dependencies is a common question in create clis (astro for example)
  • same as previous for git
  • the folder name is an astro cli thing too - to random words guarantees you can create the app. But I think maybe we could prefix it like - tanstack-start-app-randomword - and only use the random word if tanstack-start-app isn't available. This way it gets a meaningful name and nothing is accidentally deleted - plus it groups them nicely for you in the folder
  • it's common not to use typescript - nextjs and astro both offer this option. I think it's important to accomodate that but say in the cli that typescript is recommended
  • not 100% convinced that code based routing should be excluded as an option - I assume it's used by some devs
  • I think adding deployment option should be OK - but just for the tested options. Needs more clarifiaction I think. Vinxi does the leg work on this - so I think mostly it would be about adding the deployment prefix in the app.config.ts file + a .env.example file that has the required env variable (if there is one) and maybe there could even be a section of the readme added. However, I think probably this is a nice to have / future feature now that I think it through

@thomasballinger
Copy link
Author

thomasballinger commented Nov 24, 2024

All sounds reasonable! I'd prefer fewer options plus flags to make the different behaviors scriptable, but if you like the interactive questions (makes options more discoverable) that is a nice way to communicate what's going on. You're doing the work, make whatever decisions you like here! Added responses that aren't important.


re Logo, I mean I think hiding it doesn't seem important initially, just print it until someone complains
re installing dependencies, I'd prefer fewer prompts by default but if you think it's important to prompt then yeah makes sense that both flags --install-dependencies and --no-install-dependencies are needed
re git this just sounds like a lot of prompts, choosing a default like not initializing a git repo seems fine to me, and add a flag for the other option
re random word, interesting, if I'm not willing to give it a name I'd rather delete the old test app by replacing it than have these projects made from templates pile up, or use my-app-5 if previous my-app names are taken and you really don't want to delete.
re TypeScript, really? TanStack Start just isn't going to work that well without TypeScript is it? Unless that means still installing TypeScript, but enabling allowJs. I think this depends on if the team is interested in doing the extra support work to accommodate developers writing in JavaScript. If not, this should not be encouraged.
re excluding code-based routing as an option, developers can always make the change themselves! At least initially would be nice to push developers down the common path here. I guess the argument for including it is that it's helpful for advertising that it's possible.

I'd never tried the astro CLI, seems nice! Not a fan of the artificial delays but the welcome flow is nice. Asking you whether you want to e.g. create a git repo does at least effectively communicate that it's going to happen.

@timoconnellaus
Copy link

I think you're right - less options to begin with. Then it can be expanded as necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment