UNPKG

@ygyg/yg-cli

Version:

A simple CLI for front-end engineering automation construction tool.

172 lines (113 loc) 4.41 kB
# yg-cli 前端工程自动化构建工具 该构建模版可选择 react.js 或 vue.js 的 PC 端模版, react.js 相关的移动端模版 - 安装 ### `npm install yg-cli -g` - 配置文件 .ygclirc 当前环境指定的配置文件,dev 与 build 会更新文件 例子:examples ``` module.exports = { envfile: {path: 'examples/defaultSetting.json',key:'channelName'} }; ``` egg 环境 ``` module.exports = { envfile: {path: 'app/web/utils/defaultSetting.json',key:'channelName'} }; ``` - 用法 ### `yg dev` 直接输入 `yg dev -- -x ygego:alpha` 交互式 `yg dev` 手工输入 [saas 门户渠道:环境] ``` $ ygego:alpha ``` 不输入,直接回车,默认按选择交互方式 ``` 选择 ygego 选择 alpha ``` ### `yg build` 直接输入 `yg build -- -x ygego:alpha` 交互式 `yg build` 手工输入 [saas 门户渠道:环境] ``` $ ygego:alpha ``` 不输入,直接回车,默认按选择交互方式 ``` 选择 ygego 选择 alpha ``` ### yg urls 生成 httpUrls ``` apiprefix: { url:'http://{channelName}.ygego.{channelServer}', envs:[ 'alpha1','alpha2','alpha3','alpha4','alpha5','alpha5', 'test1','test2','test3','test4','test5','test5','test6', ], }, ``` 由 apiprefix 的 envs 指定 生成至指定的 defaultSetting.json 中 ## yg-cli 支持 非渠道设置 dev build 交互选择 ok dev -- -x ygego:alpha ok build -- -x ygego:alpha ok ``` needChannel: false, // 2.0.7 channels: { default: {name: 'yunadmin', value: 1}, // 平台后台 }, ``` ## lint 设置 ygclirc 设置 ``` lints: { lintpath: './app/web/src', }, ``` 或者在package.json设置 ``` "ygcliConfig": { "lints": { "lintpath": "./src" } }, ``` 默认值:"lintpath": "./src" ## release 支持monorepo 支持独立的package包,采用semantic-release faq: 继承非relase的历史版本号? 如果第一次发,会采用1.0.0, 为继承已有版本号,建议standard-version -r 'patch',用于设置lastrelease. ## Semantic Git environment variables | Variable | Description | Default | |-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------| | `GIT_AUTHOR_NAME` | The author name associated with the [Git release tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging). See [Git environment variables](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing). | @semantic-release-bot. | | `GIT_AUTHOR_EMAIL` | The author email associated with the [Git release tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging). See [Git environment variables](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing). | @semantic-release-bot email address. | | `GIT_COMMITTER_NAME` | The committer name associated with the [Git release tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging). See [Git environment variables](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing). | @semantic-release-bot. | | `GIT_COMMITTER_EMAIL` | The committer email associated with the [Git release tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging). See [Git environment variables](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing). | @semantic-release-bot email address. | ### TODO:`yg init` **前端自动化构建流程:** 1. 获取远程模板信息 2. 选择所需远程模板 3. 判断本地模板仓库是否有该模板? 若没有进入第 4 步; 若有,则进入确认是否覆盖? 若确认覆盖则进入第 4 步, 反之跳到第 64. 输入模板远程仓库中你所需的分支,默认是 master 5. 下载模板至本地模板库 6. 回答四个问题: A)项目名称; B)项目版本; C)项目描述; D)项目路径 7. 进入构建过程 8. 构建完毕,进入开发阶段