surpath-tpl
v1.2.2
Published
创建统一模块模板,支持模板有 umi js、umi ts、ts js 函数组件、mvc目录结构模板等
Downloads
11
Readme
tpl
创建统一模块模板,支持模板有 umi js、umi ts、ts js 函数组件、mvc目录结构模板等
结构如下:
安装
npm i surpath-tpl -g
使用
为了规范,在创建模块的时候,同时支持传入头文件注释 author,命令行:
$ sptpl 模块名 --author=小明
或者使用简写
$ sptpl 模块名 -a=小明
头文件注释 author可省略
$ sptpl 模块名
例如:需要创建 home 模块,则运行如下命令
sptpl home
运行结果:
函数组件模板
该 tpl 也支持 umi ts|js 函数组件模板,如果有 src/components 目录,则在该目录下创建,否则在执行的目录下创建组件;
组件名称默认会做首字母大写自动转化;
普通 react mvc 模板
该 tpl 也支持 react redux mvc 模板,经过命令行选择后
运行结果:
说明
1.该模板是针对使用 umi 框架的项目,创建统一功能模块模板;
2.安装完成之后,直接在项目的根目录 cmd 下运行命令(VSCode 直接打开终端运行命令);
3.由于实际项目开发,模块一般都是在
src/pages
下创建,所以,默认创建的模块放在src/pages
目录下;4.如果执行命令的目录下没有
src/pages
,则默认在执行的目录下创建模块;5.支持创建模块的时候,同时传入头文件注释 author,简写命令为:
$ sptpl 模块名 -a=xxx
6.目前支持的模板有:
1.页面: umi ts, umi js,mvc ts,mvc js。
2.函数组件: ts js。