1.1.16 • Published 4 years ago

template-cli-core v1.1.16

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

template-cli

命令行模板生成

安装

npm i template-cli-core -g # npm安装

生成项目

tpl project

tpl p # 简写

生成模块或组件

  • 安装需要使用的模板package

  • 执行生成命令

    tpl generate
    
    tpl g # 简写
  • 根据命令选择需要生成的组件并初始化组件参数

  • 模板可直接使用angular schematics,但需要将package前缀命名为template-cli-schematics-

生成接口

  • 在项目根目录下创建如下generate.conf.js配置文件

    module.exports = {
        path: './api', //生成后保存路径
        serviceTemplatePath: './template/service.js', // 接口模板
        entityTemplatePath: './template/entity.js', // 实体模板
        include: [
            {path: '/user/**'},
            {path: '/test/**', methods: ['get']},
        ], // 需要生成的接口
        exclude: [
        //     {path: '**', methods: ['delete', 'put', 'options', 'patch', 'head']},
        //     {path: '/error'},
        ], // 排除需要生成的接口,会覆盖include配置
        projects: [
            {
                url: 'http://192.168.1.146:8520/v2/api-docs', // swagger地址
                data: { // 接口信息,可在模板中获取
                    baseUrl: 'common',
                    prefix: ''
                }
            },
        ],
        assetsPath: './template/assets', // 需要直接生成的资源文件
    };

    模板可参考node_modules/api-service-generator/template路径下的entity.jsservice.js,模板语法采用mustache

  • 执行生成命令

    tpl api
    
    tpl a # 简写

开发

  • git clone克隆代码到本地

  • npm i安装依赖

  • 开发完成后,npm run build打包

  • npm publish发布到npm仓库

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago