Create-react-app: [Feature Request] --bare option

Created on 7 Apr 2017  路  8Comments  路  Source: facebook/create-react-app

CRA creates a bunch of stuff I don't necessarily want:

  • App.css
  • App.test.js
  • index.css
  • logo.svg
  • comments in index.html
  • favicon.ico

Any thoughts on simply adding an option to create apps sans all that stuff?

proposal

Most helpful comment

Instead of adding flags, I鈥檇 prefer that if the terminal is interactive, we offer to choose one of a few predefined templates. I believe this is what React Native does (or planned to do). We could include a few common application options (empty, hello world, tic tac toe app from the official tutorial, twitter timeline viewer). What do you think about this?

All 8 comments

How often do you create new apps? 馃槈

Let me chime in ;)

How often do you create new apps?

Depending on time of the year, I'm using create-react-app up to once a week (4 times a month) to setup apps. My react apps are mostly sophisticated forms/wizards for websites we are working on at agency and are embed on existing pages.

Ability to tell create-react-app to just give me building, watching and linting sans css/images/html or webserver would be a god send.

Instead of adding flags, I鈥檇 prefer that if the terminal is interactive, we offer to choose one of a few predefined templates. I believe this is what React Native does (or planned to do). We could include a few common application options (empty, hello world, tic tac toe app from the official tutorial, twitter timeline viewer). What do you think about this?

How often do you create new apps?

Learning React and like to completely throw away old stuff and spin up fresh stuff. Probably use it 3-5 times a day right now.

Once I'm good I'll probably bespoke environments, but for now CRA really helps with side-stepping all that stuff.

I personally prefer flags. They seem a bit faster (than having to take a survey every time I create an app), and they might scare newbs away from configuring weird setups.

But my feelings on whether it's a flag or interactive prompt are pretty minuscule so do whatever you think is best.

both

No flags triggers interactive prompt.

This might be a bad idea as it'd introduce a way for people to push through feature requests and cause CRA to grow in complexity. I'll leave it up to you guys.

鈿狅笍 Either of these options might introduce a way for people to get a myriad of features into CRA鈥攚hich I think is against its core principle. That said, they might also be absolutely amazing. I guess it depends on how it's implemented.

@corysimmons Why don't you CRA, modify it to your liking, and keep it in a directory. Then when you want a new one you can copy your bare CRA somewhere and just change the package name.

@tbillington CRA pulls a fresh copy of React, scripts are updated with best practices in mind, etc.

I could do what you're suggesting, but I'd need to do it somewhat frequently to get all that good stuff.

Instead of doing that, I opened an issue and see if the team/community seems responsive to it.

@gaearon I was going to open a new ticket but saw your comment above about different templates which basically covers what I was going to say: could we have the ability to make our own templates? I saw this article https://auth0.com/blog/how-to-configure-create-react-app/ but it requires direct manipulation of react-scripts and then remembering to sync with upstream which seems a bit messy. This would be very handy in a corporate environment where we currently maintain a repo that uses react-scripts as a base. Being able to inject project name into various custom files (the first that comes to mind is our Dockerfile) on creation would be great. So I suppose that's a double-barrelled feature request: custom templates, and variable injection. I know this may be asking for too much customisation but it would certainly make CRA a force to be reckoned with in a corporate environment. Let me know if you'd prefer this to be put in to its own issue.

Closing in favor of more generic https://github.com/facebookincubator/create-react-app/issues/2960.

@will-stone create-react-app itself doesn't do much. It basically creates a directory and runs npm install in it. If you need custom logic you can write your own Node tool that does pretty much the same, but also generates other files you want.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jnachtigall picture jnachtigall  路  3Comments

barcher picture barcher  路  3Comments

fson picture fson  路  3Comments

onelson picture onelson  路  3Comments

rdamian3 picture rdamian3  路  3Comments