0.0.4 • Published 5 years ago
eva-ya v0.0.4
@sk/cli
功能进度
- #build b 将 App 根据 production 模式编译到 public 文件夹
- #config 指定命令行读取的配置文件,如果没有,默认为 sk.config.js/sk.config.json
- #generate g 根据 schema 生成新的模块
- #lint 运行 lint 工具
- #new n 初始化一个项目 【注】项目模版的根目录下需有 sk.config.js 文件
- #prettier 运行 prettier 工具
- serve s 将 App 根据 development 模式编译并运行,当文件有变动时自动 reload
- #version v 输出 CLI 工具的版本
- update 更新项目依赖版本号
sk.config.js 配置
module.exports = {
lint: {
write: 'app/**/*.tsx app/**/*.scss'
},
prettier: {
config: '.prettierrc.js',
write: '"app/**/*.tsx" "app/scss/*.scss"'
},
devDependencies: {
"@types/jest": "24.0.13",
"typescript": "^3.5.1"
},
serve: {
title: '辅助诊断软件',
directory: {
src: 'app',
dist: 'public',
files: 'public/files',
},
enableWebWorker: true,
ignoreMomentLocale: true,
clearExclude: ['dll', 'files', 'images', 'favicon.ico'],
dllExclude: ['antd'],
env: ['BASE_URL', 'LOGIN_URL']
},
build: {
title: '辅助诊断软件',
directory: {
src: 'app',
dist: 'public',
files: 'public/files',
},
dropConsole: true,
enableStripBlock: true,
enableWebWorker: true,
ignoreMomentLocale: true,
clearExclude: ['files'],
env: ['BASE_URL', 'LOGIN_URL']
},
};
@sk/cli 使用指南
- 打开 sk-cli 文件夹,cmd 输入 npm install -g/npm link 将项目安装到全局环境
- cmd 输入指令进行操作
基本工作流
通过sk可执行文件在命令行上调用此工具,输入以下命令或指定命令(如generate)选项的简短说明:
sk --help
ng generate --help
创建、构建、运行新项目:
sk new my-project
cd my-project
sk init
sk serve
sk new
sk new <projectName>
- projectName
新建项目名称
sk init
sk init
初始化项目
sk generate
generate <type> <name> <path>
- type
- component
- container
- action
- reducer
- model
- scss
- name 自定义项目名称
- path 生成组件位置(相对于根目录的路径)
sk lint
sk lint <path>
- path 指定检测tslint的文件目录,默认路径可在sk.config.js的lint字段配置
sk prettier
sk prettier [options]
- options
- --config | -c 选择读取的prettier配置文件,默认路径可在sk.config.js的prettier.config字段配置
- --write | -w 选择执行prettier的目录地址,默认路径可在sk.config.js的prettier.config字段配置
sk serve
sk serve | s
sk build
sk build | b
sk check
sk check
sk version
sk version
to be done:
- sk serve、 sk build
- 可借鉴阿里飞冰里的插件机制