2.2.7-alpha.1.0.0 • Published 6 years ago

code-template-generator v2.2.7-alpha.1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

code-template-generator

Node.js version code-template-generator

Table of contents

  1. Introduction
  2. Main features
  3. Installation
  4. Usage
  5. Examples
  6. Thanks you!

1. Introduction

This is a lightweight React code template generator that is a Node.js CLI application with these main features:

  • Project template generation that has a part of the Build environments project.
  • Component generation.
  • User asset generation.
  • Utility.

You have more choices for your frontend development environment. It makes your life easier.

Screenshot

Demo

What's new in version 2.2.x

Assets

  1. Reasons:
    • You may have your own libraries, code templates and many more like .gitignore, .editorconfig, .eslinttrc.json, .eslintignore, ect. You need use them while you are coding or when you start a new project. We say at they are your assets.
    • You don't want to do the same things (search/ copy/ paste) many times. You want have your assets whenever you need.
    • It makes you happy by the new feature "User asset generation" and another things are below. ;-)
  2. New features:
    • User asset generation:
      • The new options, sub options and their respective aliases:
        • -cf, --config is used with its sub options:
          • --set-asset
          • --view-asset
        • -m, --my-asset
      • Syntaxes:
        • generate -cf --set-asset <path-to-your-local-directory>
        • generate -cf --view-asset
        • generate -m
    • The config file code-template-generator.json is stored at your Home directory and it depends on your platform. Examples:
      • Windows: C:\Users\<yourname>
      • Ubuntu: /home/<yourname>
      • MacOS: /Users/<yourname>
    • The new short command gen is added - You can start a command line by using one of them generate or gen.
  3. Improvements for:
    • Performance.
    • Resolving handling.
    • Error handling.

(You can view how to use and examples are below for more details)

2. Main features

  • Project template generation:
    • Without running the git init command.
    • With running the git init command and generation of a .gitignore file while a project is generated from a chosen template.
  • Component generation:
    • There are two kinds of generated components: React and React-Redux.
    • It can become:
      • A single component that is a file *.js or *.jsx.
      • A full component that is a directory with two files *.js and *.css are within.
  • .gitignore file generation.
  • Automatic update checking for the latest stable version.
  • Project templates:
    • It's simple for:
      • Configuration and installation for dependencies you need.
      • Using together or moving to/from another React build environment.
    • Code splitting.
    • Image handling.
    • CSS, JS code injected automatic into the HTML template /src/index.html.
    • Hot Module Replacement (HMR) is enabled.
    • You don't need to care about the distribution directory /dist. The things you care are only the source directory /src.
    • Anti-caching.
  • User asset generation.

Supported project templates

TemplatesMain dependencies
react-advanceBabel 7, Babel Loader 8, SplitChunksPlugin for code splitting
react-simpleBabel 7, Babel Loader 8
react-typescriptTypeScript 3, awesome-typescript-loader
simple-express-serverExpress, cors

You can view more details about these project templates in the repository Build environments.

Supported component templates

ComponentReactReact-Redux (*)Description
SingleXXA file with these supported extension *.js or *.jsx.
FullXXA directory with two files *.js and *.css that are generated within.

(*) You need install and config Redux, React-Redux by yourself.

3. Installation

$ npm install --global code-template-generator

System requirements:

  • The minimum supported Node.js version is 8.3.0 (Node.js LTS is a good choice for the stability).
  • Administrator permission is required by your operating system when:
    • You install code-template-generator on global by the option --global.
    • You run the command $ generate -u for the latest stable version updating.

4. Usage

$ generate [-option] [--sub-option] [project-name][component-name][path]

Tip! You can use the command gen instead of generate from version 2.2.0. It's more quickly when you enter a command line.

Examples:

  • generate --version -> Main command.
  • gen --version -> Short command.

Options

OptionUsed withDescription
-<project-name>Generate a new project from a chosen template (without Git support)
-g<project-name>Run automatically the git init command and generate a .gitignore file on the root of project directory during generation
-c<component-name.js>Generate a single React component (*.js or *.jsx) in the current directory
-r<component-name.js>Generate a single React-Redux component (*.js or *.jsx) in the current directory
-fc<component-name>Generate a full React component that is a directory with *.js, *.css files in the current directory
-fr<component-name>Generate a full React-Redux component that is a directory with *.js, *.css files in the current directory
-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
-m-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.

Aliases

OptionAlias
-g--git
-c--component
-r--redux-component
-fc--full-component
-fr--full-redux-component
-i--gitignore
-v--version
-help--help
-u--update
-cf--config
-m--my-asset

Sub options

  • --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)
OptionSub optionUsed withDescription
---no-install<project-name>Generate a project without running git init and installation of dependencies
-g--no-install<project-name>Generate a project with running git init but without installation of dependencies
-cf--set-asset<path>Store a local path to your own asset directory into the application config file
-cf--view-asset-View the current asset path

5. Examples

// Project generation
$ generate first-project             // Without any options
$ generate -g secondproject          // Running `git init`
$ generate --git ThirdProject        // Using alias --git instead of -g
$ generate -g --no-install OtherProject
$ generate --no-install LastProject  // Without installation of dependencies

// Single component -> A file
$ generate -c SearchComponent.js   // React component
$ generate -r ReviewComponent.jsx  // React-Redux component

// Full component -> A directory
$ generate -fc ProductComponent
$ generate -fr CartComponent

// 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 the current asset location
$ generate -m                 // Show the asset list

// Others
$ generate --gitignore  // Generate a .gitignore file
$ generate --version    // View the installed version
$ generate --help       // View help documentation
$ generate --update     // Check and install the latest stable version

6. Thank you!

Special thanks to Harriet Ryder!

Many thanks to Commander.js for the inspiration.

3.0.15

5 years ago

3.0.14

5 years ago

3.0.13

5 years ago

3.0.12

5 years ago

3.0.11

5 years ago

3.0.10

5 years ago

3.0.9

5 years ago

3.0.8

6 years ago

3.0.7

6 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

3.0.0-beta.1.0.0

6 years ago

2.4.20

6 years ago

2.4.19

6 years ago

2.4.18

6 years ago

2.4.17

6 years ago

2.4.16

6 years ago

2.4.15

6 years ago

2.4.14

6 years ago

2.4.13

6 years ago

2.4.12

6 years ago

2.4.11

6 years ago

2.4.10

6 years ago

2.4.9

6 years ago

2.4.8

6 years ago

2.4.7

6 years ago

2.4.6

6 years ago

2.4.5

6 years ago

2.4.4

6 years ago

2.4.3

6 years ago

2.4.2

6 years ago

2.4.1

6 years ago

2.4.1-beta.1.2.7

6 years ago

2.4.1-beta.1.2.6

6 years ago

2.4.1-beta.1.2.5

6 years ago

2.4.1-beta.1.2.4

6 years ago

2.4.1-beta.1.2.3

6 years ago

2.4.1-beta.1.2.2

6 years ago

2.4.1-beta.1.2.1

6 years ago

2.4.1-beta.1.2.0

6 years ago

2.4.1-beta.1.1.1

6 years ago

2.4.1-beta.1.1.0

6 years ago

2.4.1-beta.1.0.0

6 years ago

2.4.0

6 years ago

2.4.0-beta.1.0.0

6 years ago

2.3.7

6 years ago

2.3.6

6 years ago

2.3.5

6 years ago

2.3.4

6 years ago

2.3.3

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.3.0-beta.1.0.0

6 years ago

2.2.11

6 years ago

2.2.10

6 years ago

2.2.9

6 years ago

2.2.8

6 years ago

2.2.7

6 years ago

2.2.7-beta.1.0.0

6 years ago

2.2.6

6 years ago

2.2.5

6 years ago

2.2.4

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.2.0-beta.1.0.1

6 years ago

2.2.0-beta.1.0.0

6 years ago

2.1.11

6 years ago

2.1.10

6 years ago

2.1.9

6 years ago

2.1.8

6 years ago

2.1.7

6 years ago

2.1.6

6 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.1.0-beta.1.0.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

2.0.0-beta.1.0.7

6 years ago

2.0.0-beta.1.0.6

6 years ago

2.0.0-beta.1.0.5

6 years ago

2.0.0-beta.1.0.4

6 years ago

2.0.0-beta.1.0.3

6 years ago

2.0.0-beta.1.0.2

6 years ago

2.0.0-beta.1.0.1

6 years ago

2.0.0-beta.1.0.0

6 years ago

1.4.6

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.23

7 years ago

1.3.22

7 years ago

1.3.21

7 years ago

1.3.20

7 years ago

1.3.19

7 years ago

1.3.18

7 years ago

1.3.17

7 years ago

1.3.16

7 years ago

1.3.15

7 years ago

1.3.14

7 years ago

1.3.13

7 years ago

1.3.12

7 years ago

1.3.11

7 years ago

1.3.10

7 years ago

1.3.9

7 years ago

1.3.8

7 years ago

1.3.7-next

7 years ago

1.3.6-next

7 years ago

1.3.5-next

7 years ago

1.3.4-next

7 years ago

1.3.3-next

7 years ago

1.3.2-next

7 years ago

1.2.1

7 years ago

1.3.1-next

7 years ago

1.3.0-next

7 years ago

1.2.0

7 years ago

1.1.15

7 years ago

1.1.14

7 years ago

1.1.13

7 years ago

1.1.12

7 years ago

1.1.11

7 years ago

1.1.10

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago