美文网首页程序员Node.js
用 nodejs 实现命令行工具

用 nodejs 实现命令行工具

作者: LOWINC | 来源:发表于2020-03-08 15:10 被阅读0次

Templater

查看实现代码

基于 nodejs 实现的一个命令行工具,用于生成基础代码.

默认模板中: 页面使用 Taro,数据流使用 Dva,可以通过配置 templater.json 使用自定义模板.

安装

yarn global add @lowinc/createfile

配置

根目录下

templater.json

{
  "view": "src/pages",
  "store": "src/store",
  //   可选 自定义模板
  "template": {
    "view": "template/view.tsx",
    "store": "template/store.ts"
  }
}

使用

默认生成页面

lowincCreatefile pageName

加上第二个参数 store 生成 store

lowincCreatefile storeName store

相关文章

网友评论

    本文标题:用 nodejs 实现命令行工具

    本文链接:https://www.haomeiwen.com/subject/tgwddhtx.html