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

fix(remix-dev/cli): Remove excess fetching and improve error handling #2500

Merged
merged 18 commits into from
Mar 30, 2022

Conversation

chaance
Copy link
Collaborator

@chaance chaance commented Mar 25, 2022

Instead of fetching early to detect template types in the CLI, we can simplify the code and speed up the setup process with a few heuristics:

  1. Check if the user passed a local file. If they hand us an explicit file URL, we'll validate it first. Otherwise we just ping the filesystem to see if the string references a filepath and, if not, move on.
  2. If the provided template contains no slashes, spaces, or special chars, we assume it is one of our templates and attempt to fetch it.
  3. If the template is a GitHub URL or shorthand :org/:repo, we fetch the repo.
  4. Any other URLs are assumed to be direct tarball URLs, so we try to fetch them.

Worth noting that there are probably more opportunities to improve error handling. We'll want to iterate here.

  • Docs
  • Tests

chaance added 2 commits March 25, 2022 13:59
Instead of fetching early to detect template types, we can simplify the
code and speed up the setup process with a few heuristics.
@MichaelDeBoey MichaelDeBoey changed the title fix(cli): Remove excess fetching and improve error handling fix(remix-dev/cli): Remove excess fetching and improve error handling Mar 27, 2022
@mcansh
Copy link
Collaborator

mcansh commented Mar 29, 2022

can you cut an experimental when you get time? looks great 👌

chaance and others added 3 commits March 29, 2022 08:05
@chaance
Copy link
Collaborator Author

chaance commented Mar 29, 2022

@mcansh Cut before I committed your suggested change, but you can test everything else w/ v0.0.0-experimental-21ec8370

@@ -305,7 +305,8 @@ export async function run(argv: string[] = process.argv.slice(2)) {
templateType! || (answers.appType === "stack" ? "repo" : "template"),
projectDir,
remixVersion: flags.remixVersion,
installDeps: flags.install ?? answers.install,
installDeps: flags.install || answers.install,
useTypeScript: flags.typescript || answers.useTypeScript,
useTypeScript: flags.typescript ?? answers.useTypeScript,
Copy link
Collaborator

@mcansh mcansh Mar 29, 2022

Choose a reason for hiding this comment

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

heh oops, the commit suggestion didn't let me remove the previous useTypeScript 🤦

and appTemplate needs to be updated to || as well :oof:

import inquirer from "inquirer";
// import chalkAnimation from "chalk-animation";
Copy link
Member

Choose a reason for hiding this comment

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

Could you remove this dep from the lockfile and package.json so we can close #2547?

@kiliman
Copy link
Collaborator

kiliman commented Mar 29, 2022

Hmm.. just noticed that create-remix@latest doesn't even announce that you're creating a Remix project. Also, a previous version stopped displaying the version as well.

Any chance we can get those back in the CLI? It's nice knowing what version I'm going to be installing.

@kentcdodds
Copy link
Member

Once we get this merged, I'm going to be doing a bit more work in the CLI too. I may bring back the animated thing as well.

@mcansh
Copy link
Collaborator

mcansh commented Mar 29, 2022

Hmm.. just noticed that create-remix@latest doesn't even announce that you're creating a Remix project. Also, a previous version stopped displaying the version as well.

looks like 1.3.3 dropped the "welcome" message and 1.3.0 dropped the version and animation when we did some reshuffling - hoping to bring both back soon enough

@mcansh
Copy link
Collaborator

mcansh commented Mar 29, 2022

Once we get this merged, I'm going to be doing a bit more work in the CLI too. I may bring back the animated thing as well.

sweet! i loved that little touch

@brophdawg11
Copy link
Contributor

I may bring back the animated thing as well.

yes please!! 🙌

@chaance
Copy link
Collaborator Author

chaance commented Mar 29, 2022

Note about the animation: I like it as well but it creates some noise for screen-reader users. Want to make sure we ensure that the --no-color flag is respected there.

@kentcdodds kentcdodds changed the base branch from dev to cli-temp March 30, 2022 17:17
@kentcdodds kentcdodds merged commit f957655 into cli-temp Mar 30, 2022
@kentcdodds kentcdodds deleted the chance/cli-optimizations branch March 30, 2022 17:17
@kentcdodds
Copy link
Member

I'm going to get this across the line. Just putting it into cli-temp for now so I can combine it with my test improvements.

kentcdodds pushed a commit that referenced this pull request Apr 5, 2022
kentcdodds pushed a commit that referenced this pull request Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants