ziu v2.0.2
ziu
a simple CLI for scaffolding Vue.js/React.js/微信小程序/支付宝小程序/jQuery projects.
Installation
- Node.js >= 6.4
$ npm install -g ziuUsage
$ ziu init <project-name>Example:
$ ziu init testThe command pulls the templates from ziu-templates, and then we list all templates in the repro. Like this: aliapp - 支付宝小程序模板 bdapp - 百度小程序模板 lib-pac - 基于Rollup打包组件和基础库模板 react - a react template with webpack ttapp - 头条/抖音小程序模板 usual - 传统项目模板(use jQuery) vue-3 - 使用vue-cli@3版本的项目模板 weapp - 微信小程序模板
then, prompts for some information, and generates the project at ./test/.
查看已有的项目模板
ziu list环境变量
- 每一个模板都有4中环境,
development、testing、staging、production 环境变量是以
yaml的文件格式编译,在项目根目录下的config文件夹下有5个yaml文件,default.yml、development.yml、testing.yml、staging.yml、production.yml,分别对应4中环境中使用的环境变量;default.yml是默认配置,其他环境的配置会和default.yml中的配置合并环境变量在JavaScript中获取
在yaml中配置的环境变量都存储在process.env.ENV_DATA中:
// 获取当前环境
// 这里并没有使用process.env.NODE_ENV作为环境区分,主要为了避免第三方库依赖process.env.NODE_ENV导致出现异常
const env = process.env.ENV_DATA.PRJ_ENV;Dev
$ npm run devstart a local server to development
Testing
generates tesing files
$ npm run testingbuild
$ npm run buildgenerates production files
4 years ago
4 years ago
4 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago