The lightweight React code template generator
npm install code-template-generator(*) Tips and tricks for the project templates
The application is a lightweight Node.js CLI tool that is using for front-end web development with React. Main features:
* Project generation that has a part of the Build environments project.
* Component generation.
* Asset generation that is useful when you want using your own project template or config files etc.
git init command and generation of a .gitignore file while the project is generated from a chosen template./src/index.html./dist. The things you care are only the directory /src..gitignore file generation.You can view more details and other project templates in the repository Build environments.
_() Single component is a JavaScript file with these supported extensions: .js, .jsx, .ts and *.tsx._
_(*) Full component is a directory with two files are within: a CSS file and a JS file (.js, .jsx, .tsx)._
Reasons:
* You may have your own project templates, code templates, libraries and many more _(.gitignore, .editorconfig, .eslinttrc.json, .eslintignore, webpack.config.js ect)_.
* You don't want to do the same things as search-copy-paste the assets many times while you are coding or starting a new project.
_(You can view how to use and the examples are below for more details)_
$ npm install --global code-template-generatorSystem requirements:
* The minimum supported Node.js version is __8.9.0__ _(Node.js LTS version is a good choice for the stability)_.
* Administrator permission is required by your operating system for these things:
* Installation of code-template-generator on global by using the option --global.
* Running the command generate --update for the latest stable version updating.
$ generate [-option] [--sub-option] [project-name][component-name][path]__Tip!__ You can use the command gen instead of generate from version 2.2.x. It's more quickly when you enter a command line.
Examples:
* generate -v -> Main command.
* gen -v -> Short command.
| Generate a new project from a chosen template __without__ Git support. |-g|| Run automatically the git init command and generate a .gitignore file on the root of project directory during the generation.|-c|. |Generate a __single__ React component in the current directory _(.js, .jsx, .ts, .tsx)_.|-f||Generate a __full__ React component in the current directory _(.js, .jsx, *.tsx)_.|-i|-| A .gitignore file will be generated in the current directory. |-v|-|View the installed version.|-help|-|View help documentation.|-u|-| Automatic update checking and installation for the latest stable version. (*) |-cf| (**) |Using with one of these sub options: --set-asset, --view-asset.|-a|-|Show a list to retrieve chosen asset(s) into the current work directory.|(*) Administrator permission is required by your operating system. Here are the examples for MacOS and Ubuntu systems by using sudo:
* $ sudo generate -u
* $ sudo generate --update _(Using alias)_
(**) View how to use with its sub options that are below.
--no-install _(No install dependencies)_--set-asset _(Set a local path to the asset directory)_--view-asset _(View the current local path to the asset directory)_--jsx _(Using .jsx instead of *.js)_--tsx _(Using .tsx instead of *.js)_|Option|Sub option|Used with|Description|
|:---:|:---:|:---:|---|
|-|--no-install||Generate a project __without__ both running the git init command and installation of dependencies.|
|-g|--no-install||Generate a project with running the git init command but __without__ installation of dependencies.|
|-cf|--set-asset||Store a local path to the asset directory into the application config file.|
|-cf|--view-asset|-|View the current asset path.|
|-f|--jsx||The application creates a .jsx file instead of a .js file that is default when it generates a full component.|
|-f|--tsx||The application creates a .tsx file instead of a .js file that is default when it generates a full component.|
-g|--git|-c|--component|-f|--full-component|-i|--gitignore|-v|--version|-help|--help|-u|--update|-cf|--config|-a|--asset|```
// Project generation
$ generate first-project // Generates a project without any options
$ generate -g secondproject // With Git support by running 'git init'
$ generate --git ThirdProject // Using alias --git instead of -g
$ generate -g --no-install OtherProject
$ generate --no-install LastProject // No install dependencies
// Single component -> A JavaScript file
$ generate -c SearchService.js
$ generate -c ReviewComponent.jsx
$ generate -c CountService.ts
$ generate -c CounterComponent.tsx
// Full component
// -> A directory with two files are within (.css, .js|jsx|tsx)
$ generate -f Product // Default is using *.js
$ generate -f --jsx Cart // Using *.jsx
$ generate -f --tsx Counter // Using *.tsx
// Asset generation
$ generate -cf --set-asset "C:\Users\name\myassets" // Windows
$ generate -cf --set-asset "/Users/name/myassets" // MacOS
$ generate -cf --set-asset "/home/name/myassets" // Ubuntu
$ generate -cf --view-asset // View info about the current asset location
$ generate -a // Show the asset list and retrieve them
// Others
$ generate -i // Generate a .gitignore file
$ generate -v // View the installed version
$ generate -help // View help documentation
$ generate -u // Install the latest stable version
```
Many thanks to Commander.js for the inspiration.