rthor / cra-generate Goto Github PK
View Code? Open in Web Editor NEWScaffold a React component.
Scaffold a React component.
Not all projects keep components in the src directory, allow changes.
$ cra-generate --root-dir='app' foo
> /app/components/Foo/Foo.js
See title.
Guess there are endless options to consider, but this one would "only" need one comment in both js files. Right?
When setting semi: false in package.json the false value is ignored.
The reason is twofold:
1 config.js (line 26) always overwrites the value from both defaultOptions and package.json
2 --no-semi means that if you don't specifically include this option when you use cra-generate (in the command line) the value will be set to semi: true
So reason 2 makes sure that the command line sets the option to true if you don't explicitly set it to false and reason 1 makes sure that the defaultOptions and package.json is ignored completely
css
, scss
, styl
and less
all have compatible syntax for what's needed.
Like App.css in cra.
Like in create-react-app
It would be great if we can remove the link between the package version and the templates that the CLI uses to generate new components. Currently, it's really awkward to change a template, say fix a typo, then all users need to update their global cra-generate
version, which, tbh, no one does.
I propose that we move the templates to a different package and have cra-generate
install a new version per project (think npm install --save-dev cra-generate-templates@latest
). Doing it like this, we get a fresh version of the templates for each project that uses cra-generate and we can utilize npm's caching.
Here's how I imagine the flow:
Use in a new project:
$ cra-generate some-component
{
"devDependency": {
"cra-generate-templates": "[some version]"
}
}
Use in a project that already installed the templates:
$ cra-generate some-component
Use offline:
cra-generate
should have a dependency on the templates itself and use in case of network loss.Need to test the transformers at the very least.
I'ld really like to see these things fixed in this project:
Add support for TS generated components.
For js-in-css projects, we don't want a css file for components. Would be nice to have a project setting to skip that, like we can already skip the tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.