Package Exports
- code-template-generator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (code-template-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
code-template-generator (version 2)
Code template generator is used for React projects. It is a part of Build environments project.
Templates | Main dependencies |
---|---|
react-babel-6 | Babel 6, Babel Loader 7 |
react-babel-7 | Babel 7, Babel Loader 8 |
react-code-splitting | Babel 7, Babel Loader 8, SplitChunksPlugin for code splitting |
react-typescript-3 | TypeScript 3 and using awesome-typescript-loader |
Main features
- It's simple to config and install the dependencies you need.
- Project generation.
- Component generation (React and React-Redux).
- Git support generation (It runs automatically
git init
and generates a.gitignore
file while the project is generated). .gitignore
generation whenever you want.- Automatic update checking.
- Code template supports:
- Code splitting.
- Image handling.
- CSS, JS code injected automatic into HTML template.
- Hot Module Replacement (HMR) enabled.
- You don't need to care about the distribution (publish) directory (It is useful for anti-caching).
You can view more about this package's features and how to use it on GitHub.
Installation
$ npm i -g code-template-generator@alpha
Using
$ generate [option] <project-name>[<component-name>]
Argument | Used with | Description |
---|---|---|
<project-name> |
- | Generate a new project by the selected code template (without Git support) |
-g |
<project-name> |
Git is installed automatically (git init ) and a .gitignore file is also created on the root of work directory while a new project is generated |
-c |
<component-name.js> |
It will be generate a React component (*.js or *.jsx) in the current directory and you decide its name |
-r |
<component-name.js> |
It will be generate a React-Redux component (*.js or *.jsx) in the current directory and you decide its name |
-fc |
<component-name> |
It will be generate a full React component (a directory with *.js, *.css ) in the current directory and you decide its name |
-fr |
<component-name> |
It will be generate a full React-Redux component (a directory with *.js, *.css ) in the current directory and you decide its name |
-i |
- | A .gitignore file will be generated in the current directory |
-v |
- | View the installed version |
-help |
- | View the help information |
Breaking changes:
- The
git
support option.- Version 1:
$ generate react-counter git
- Version 2:
$ generate -g react-counter
- Version 1:
- Requirement for Nodejs is >= version 8.0.0
Example
$ generate new-project
$ generate -g other-project
$ generate -c ProductList.js
$ generate -c Payment.jsx
$ generate -r Cart.js
$ generate -fc Product
$ generate -fr ShoppingCart
$ generate -i
$ generate -v
$ generate -help
Thank you!
Special thanks to Harriet Ryder!