npm.io
1.0.4 • Published 8 years agoCLI

kzmp-cli

Licence
ISC
Version
1.0.4
Deps
2
Size
101 kB
Vulns
0
Weekly
0

mp-cli

Use

Build a page to a wxml file
kzmp -p page.json

// page.json
[
    {
        "eid":"11",
        "name":"kz-button",
        "value":{
            "text":"按钮",
            "height": 100
        }
    }
]

// generate a file named index.wxml
<wxs module="pageData">
var data = [{"text":"按钮", "height": 100}];
module.exports.data = data;
</wxs>
<kz-button text="{{pageData.data[0].text}}" height="{{pageData.data[0].height}}"/>
Build a complete miniprogram project
// need mp-templates
npm install mp-templates --save-dev

// app is dir of some page json config
// tree app
// app
// ├── detail.json
// └── index.json
kzmp -P app mp

// we will get a mp project
dist/mp
├── app.js
├── app.json
├── app.wxss
├── components
│   ├── good-desc
│   │   ├── README.md
│   │   ├── index.js
│   │   ├── index.json
│   │   ├── index.wxml
│   │   └── index.wxss
│   ├── good-info
│   │   ├── README.md
│   │   ├── images
│   │   │   └── qd.png
│   │   ├── index.js
│   │   ├── index.json
│   │   ├── index.wxml
│   │   └── index.wxss
│   ├── kz-swiper
│   │   ├── README.md
│   │   ├── index.js
│   │   ├── index.json
│   │   ├── index.wxml
│   │   └── index.wxss
│   └── shop-list-easy
│       ├── README.md
│       ├── index.js
│       ├── index.json
│       ├── index.wxml
│       └── index.wxss
├── jsconfig.json
├── pages
│   ├── detail
│   │   ├── index.js
│   │   ├── index.json
│   │   ├── index.wxml
│   │   └── index.wxss
│   └── index
│       ├── index.js
│       ├── index.json
│       ├── index.wxml
│       └── index.wxss
├── project.config.json
├── typings
│   └── wx.d.ts
└── utils
    └── util.js
Name

// 目前的设计
button => @kuaizhan/button
shop-list/shop-list-easy => @kuaizhan/shop-list/shop-list-easy


// Extend: download from github
@github.com/konglx90/mp-templates/components/button

// Extend: other space
@konglx/button
Test

npm run build && node lib/input.js -P test/app