reduxjs / redux-templates

Official Redux templates for Vite, Create-React-App, and more
https://redux.js.org
MIT License
1.42k stars 250 forks source link

README Cloning Details #44

Closed BretMishler closed 3 years ago

BretMishler commented 3 years ago

I think a lot of folks who are spinning up new Create React apps are used to getting out-of-the-box:

npm start

I for one am definitely reliant on it and not super familiar with the interworkings under the hood. I tried adding

"start" : "react-scripts start",

to my package.json and then running npm start but then get complaints about

Error: ENOENT: no such file or directory, open '.../cra-template-redux-typescript/src/react-app-env.d.ts'.

So once I move the file to where it needs, I further just keep getting errors. Is this project set up to run once cloned or are there a lot of steps to do? I've checked out the README's but their inaccurate. For example, as stated previous, there is no start argument set in the package.json.

msutkowski commented 3 years ago

@BretMishler Did you clone this repo? Or did you follow the instructions and create your project as a template as instructed?

yarn create react-app my-app --template redux-typescript

If you run that and follow the instructions in your terminal, it'll work.

markerikson commented 3 years ago

Yep. The repo itself isn't cloneable as-is. It's the codebase for the published cra-template-redux-typescript package, which is only meant to be used through the create-react-app CLI command.

BretMishler commented 3 years ago

@msutkowski @markerikson I did clone the repo; you're correct.

Though I don't feel that it should come to a surprise to anyone why I, or others, would clone this repo when the Redux and Redux Toolkit documentation says,

The recommended way to start new apps with React and Redux is by using the official Redux+JS template or Redux+TS template for Create React App

both have links that point to this repo here, not the one at the Create React App repo.

While it may be obvious to you guys from the docs that this is a "template" only, it wasn't obvious to me and Im not sure it would be obvious to others as well, especially given the quote above. Just some thoughts.

Thank you guys so much for the work you do.

markerikson commented 3 years ago

Hmm. The README for this repo does say, up front:

Usage: npx create-react-app my-app --template redux

as do both docs "Getting Started" pages.

I suppose we could remove the links to these template repos, since in that sense the repos don't actually matter for setting up a project?

BretMishler commented 3 years ago

You're absolutely right to point to

Usage: npx create-react-app my-app --template redux

as proof that the documentation mentions how to install the Create React App with the Redux template.

Though because of my prior experiences, which I assume to be commonly reinforced amongst others who are new to spa apps, Im used to being able to just clone a repo and then npm start (build) that repo. Being new, I didn't realize until the learning experience just now that

  1. Cloning this repo
  2. Following this repo's documentation

were going to result in two different outcomes (the former downloads an unconfigured template, the later downloads a buildable project with that template preconfigured). With that said, I think removing the links to these templates would do a disservice to individuals who can distinguish the difference between cloning a template and cloning the actual Create React App project with said template. Maybe there could be prefixed to the README here that cloning this project clones a template that will need to be integrated manually with the react app and that for a works-out-of-the-box experience, it's recommended to

npx create-react-app my-app --template redux

But if this feels like it caters to too small an audience, I can concede to that point of view. Again, thank you.

markerikson commented 3 years ago

Sure, can you file a PR to this repo to update the wording? We can apply it to the TS template as well after that.