UMS-Toolkit
银联商务小程序命令行工具,用于生成小程序工程模板,开发者仅需要在工程模板内添加代码逻辑,即可快速开发出自己的小程序。
环境准备
安装Node环境
进入NodeJS官方网站下载最新稳定版Node.
查看自己的node版本:
node -v
npm -v
安装cnpm
npm install cnpm -g
通过cnpm安装ums-toolkit
cnpm install -g ums-toolkit
使用选项
Usage: ums <command> [options]
Options:
-V, --version output the version number
-v, --version display version
--port [port] http listening port number ,default is 8081 (default: 8081)
-e, --entry [entry] the entry file in a folder
-h, --help output usage information
Commands:
init|i [projectName] genenrate a new project from template
add [options] Help you install dependency from npm
debug|d [options] [file] start debugger
创建项目
$ ums init your_project_name
运行成功后的目录结构如下:
project-template
│ .babelrc // 支持ES6语法的配置文件,删除后无法使用ES6
│ .eslintrc // ESLint 配置文件
│ app.js // 不需要修改。Debug时的入口文件
│ config.json // 小程序项目配置文件,在此文件中添加应用信息
│ favicon.png // 小程序在应用市场上显示的图标
│ index.html // 不需要修改。在浏览器上打开小程序应用的首页,
│ package.json // npm的配置文件,包含小程序开发所用依赖配置
│ README.md // 项目README文件
│ weex.html // 不需要修改。浏览器预览页面
│
├─assets // 不需要修改。为Debug页面资源文件
│ phantom-limb.js
│ qrcode.js
│ qrcode.min.js
│ style.css
│ url.js
│
├─build // webpack配置文件,一般不需要修改
│ webpack.base.conf.js
│ webpack.dev.conf.js
│ webpack.prod.conf.js
│
└─src // 项目开发的源文件目录
index.vue
logo.png
安装项目依赖
进入目录,运行
cnpm install
调试项目
ums debug youfile.vue
项目编译
npm run build
打包
npm run pack