Giter VIP home page Giter VIP logo

template-cli's Introduction

脚手架

简单的模板生成器,目前支持 project 模板和 markdown 模板两类

目前提供模板如下:

  • rw-ts(react-web-typescript) 特性:
    • 集成 antd、react-css-modules、less、typescript、babel
    • 使用 webpack4 打包
  • rw-ts-w5(react-web-typescript) 特性:
    • 同上
    • 使用 webpack5 打包
  • rc-ts (react-component-typescript) 特性:
    • 集成 antd、react-css-modules、less、typescript、babel
    • 使用 webpack 打包,支持通过运行 example 预览组件最终效果
  • lib-ts(library-typescript) 特性:
    • 支持 esm、cjs、umd 等形式
    • 集成 typescript、babel
    • 使用 rollup 打包
  • lib-ts-w5(library-typescript-webpack5) 特性:
    • 支持 esm、cjs、umd 等形式
    • 集成 typescript、babel
    • 使用 webpack5 打包
  • markdowns: markdown 模板

一、Project 使用(以开发 react 组件为例)

1、安装本地命令

git clone https://github.com/Demian1996/template-cli.git
cd template-cli/
npm install // 安装commander等依赖
npm link // 将tpl作为全局命令

// 检测
tpl -v // 若此时显示版本号,则安装成功

2、命令使用和参数介绍

命令:

tpl cli
tpl create

cli 命令

该命令通过调用 inquirer 实现可交互命令行,如下所示:

1

create 命令

使用该命令,可以手动指定当前要创建的项目和模板。

例如生成项目 react-web-demo,使用 rw-ts 模板:

tpl create -p react-demo -t rw-ts

运行成功后会在命令运行目录下生成文件夹 react-demo。

目前仅有两个参数,详细描述如下:

-p --project 项目名,会将该字段手动填充到模板文件的 package.json 中

-p react-demo

-t --template 模板名,用简称表示对应 templates 下各模板文件的文件夹名

-t rw-ts

3、启动模板项目

cd react-demo // 进入到已生成的模板项目中
yarn install // 安装模板依赖
yarn dev // 运行webpack-dev-server

最终显示如下:

demo

二、Markdown

cli 命令

2

create 命令

生成每日工作计划模板

tpl create -m 每日工作计划 -t m-ds

template-cli's People

Contributors

demian1996 avatar

Stargazers

Roman avatar 刘涛 avatar  avatar 彭道宽 avatar

Watchers

James Cloos avatar  avatar

Forkers

pdksophia

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.