redwood icon indicating copy to clipboard operation
redwood copied to clipboard

Project Installation (create redwood app) Improvements [Tracking Issue]

Open thedavidprice opened this issue 3 years ago • 10 comments

In general, there's a lot of room to improve the DX during the installation process. We could have a helpful pre-flight (versions, system, etc), handle failures better (link to docs, prompt for sending error report, etc.), prompt for customization options, add a git init step, use Yarn 3 or pnp to speed up package installation (or find some other way). Here's the working list of related Issues:

  • [x] #3889
  • [ ] #1954
  • [ ] #1936
  • [ ] #1935
  • [ ] #288
  • [ ] #6275
  • [ ] check for Windows env and warn + link to Setup Cookbook accordingly (via #3685)
  • [ ] Improve overall experience and branding
    • prompt for configuration: TS or JS, Install packages, Git Init (and commit message)
    • remove Listr (see yarn create remix for example)
    • add brand feel

thedavidprice avatar Dec 22 '21 20:12 thedavidprice

add a git init step

I've forever wondered why this wasn't part of the install. I just assumed this was something decided early on, before my involvement. Is there any more background info on this?

Tobbe avatar Jan 09 '22 09:01 Tobbe

I've forever wondered why this wasn't part of the install. I just assumed this was something decided early on, before my involvement. Is there any more background info on this?

I originally added it, but Tom and Rob vetoed it. Very up for revisiting!

thedavidprice avatar Mar 14 '22 22:03 thedavidprice

Prompts to consider adding to create:

  • git (user adds commit message)
  • ts or js
  • auth
  • yarn install
  • UI: tailwind or chakra
  • deploy target
  • story and test files generated by default

I do think it's time to remove Listr.

Should revisit final message — shorten and focus, add more flare!

thedavidprice avatar Mar 14 '22 22:03 thedavidprice

Packages to consider:

  • https://www.npmjs.com/package/chalk-animation
  • https://www.npmjs.com/package/inquirer (prompt alternative)

thedavidprice avatar Mar 14 '22 22:03 thedavidprice

I ran yarn create remix, and then looked at their code. They use

  • meow instead of yargs
  • inquirer for prompts
  • ora for progress text + spinners

The remix cli experience for my first install was nice. There were a few things I'd change, but that's for a PR on another repo 😉

Looking at the code however I'm not sure if I like that any better than our current setup with yargs + listr.

@thedavidprice "I do think it's time to remove Listr." What makes you say that?

Tobbe avatar Apr 20 '22 21:04 Tobbe

Thanks @Tobbe To be clear, I don't care about the underlying tools. I just think there's a lot we can do to improve the overall experience. Listr can be fine and I'm not specifically saying we remove it. I do think across the CLI we've overused it. So in this case I'd be open to other ideas for managing the step-by-step installation process.

I'd start by adding prompts, which both allow for customization at the time of installation as well as discovery about all the things Redwood can do out of the box.

thedavidprice avatar Apr 20 '22 22:04 thedavidprice

Also noting that we've used prompts in other parts of the codebase but I'm not sure which one is better. And if we were going to consider swapping out yargs (realistically I don't think we will right now / there's probably other optimizations we could do first) I'd want to give clipanion a solid look. It's what yarn uses.

jtoar avatar Apr 21 '22 07:04 jtoar

Thanks @thedavidprice and @jtoar. I've been happy with both yargs and listr. And totally agree switching out any of our cli tools right now is a lot of work with questionable roi. I won't jump on this now, but I think a good next step for whoever picks this up would be to look at both prompt and inquirer and see if any of them enables us to do something we need that the other one doesn't, and then try to add a couple of questions to the setup process.

Tobbe avatar Apr 21 '22 07:04 Tobbe

image

See the duplicated Prerendering /blog-post/1 -> web/dist/blog-post/1.html etc lines? It's an issue with Listr.

Tried to find a solution, and found listr2 which over-all seems more actively maintained. But it has the exact same problem https://github.com/cenk1cenk2/listr2/issues/403. listr2 blames log-update which listr also uses. The listr2 author says that switching to stdout-update is the answer. But that still hasn't happened over a year later. The stdout-update author has written tasktree (that uses stdout-update). So maybe we should look into switching to tasktree instead.

Tobbe avatar May 28 '22 22:05 Tobbe

From David:

I’ll drop an idea here that I mentioned to Dom a few weeks ago. Because our engine requirements are tightly coupled to deploy-target support (e.g. no lambdas support 18), people can conceivably do whatever they want. We just need to let them know why. So imaging during the create redwood-app process.

  1. yarn create redwood-app
  2. install checks system versions against engine requirements
  3. if check fails, Prompt =>
  4. Message: Your Node (or yarn) version does not meet Redwood’s supported range X. The requirements are set to match versions supported by deployment providers. We recommend you use versions within range X, but you may proceed with installation using any version — just understand you this may result in unexpected compatibility issues you will need to manage.
  5. Proceed? y/No

Because we now use Yarn 3, I don’t think we even need to clear the package.json engine config. But we might want to take that step given that some deploy providers set the build/deploy Node version based on the engine.

Tobbe avatar Aug 27 '22 08:08 Tobbe

Heyo - have any of you tried the Astro CLI installer - WOW! It is really amazing. Nothing more than that, just thought it might be a worthwhile one to checkout and explore.

ehowey avatar Nov 20 '22 22:11 ehowey

I created a topic with my experience setting up Zero-Installs "plug-n-play" here https://community.redwoodjs.com/t/zero-installs-plug-n-play/4519

pi0neerpat avatar Jan 25 '23 21:01 pi0neerpat