omi/packages/omi-cli
dntzhang 43acac408e update site 2019-03-22 11:11:57 +08:00
..
bin add init-template command 2018-12-19 03:59:06 +08:00
lib fix https://github.com/Tencent/omi/issues/274 2019-03-06 15:31:00 +08:00
template omi-cli - fix svg error in ie8 2019-03-22 10:59:54 +08:00
.eslintrc eslintrc (#93) 2018-10-22 12:39:56 +03:00
.gitignore standart code styling 2018-10-21 22:56:05 +03:00
.npmignore omi-cli 2018-10-19 08:04:39 +08:00
README.md update site 2019-03-22 11:11:57 +08:00
package.json update package.json 2019-03-22 11:03:16 +08:00
yarn.lock omi-cli 2018-10-19 08:04:39 +08:00

README.md

omi-cli

$ npm i omi-cli -g     # install cli
$ omi init my-app      # init project, you can also exec 'omi init' in an empty folder
$ cd my-app            # please ignore this command if you executed 'omi init' in an empty folder
$ npm start            # develop
$ npm run build        # release

npx omi-cli init my-app is also supported(npm v5.2.0+).

Directory description:

├─ config
├─ public
├─ scripts
├─ src
│  ├─ assets
│  ├─ elements    //Store all custom elements
│  ├─ store       //Store all this store of pages
│  ├─ admin.js    //Entry js of compilerwill build to admin.html
│  └─ index.js    //Entry js of compilerwill build to index.html

Project Template

Template Type Command Describe
Base Template(v3.3.0+) omi init my-app Basic omi or omio(IE8+) project template.
小程序模板(v3.3.5+) omi init-p my-app Omi 开发小程序
基础模板(v3.3.9+) omi init-o my-app 支持 IE8 的基础模板,只是 build 的时候支持 IE8开发调试请用 IE9
Base Template with snapshoot omi init-snap my-app Basic omi or omio(IE8+) project template with snapshoot prerendering.
TypeScript Template(omi-cli v3.3.0+) omi init-ts my-app Basic template with typescript.
Mobile Template omi init-weui my-app Mobile web app template with weui and omi-router.
omi-mp Template(omi-cli v3.0.13+) omi init-mp my-app Developing web with mini program template.
MVVM Template(omi-cli v3.0.22+) omi init-mvvm my-app MVVM template.

CLI's auto-created project scaffolding is based on a single-page create-react-app to be converted into a multi-page one, with configuration issues to see create-react-app user guide

About compiled website URL

Such as in windows:

"scripts": {
  "start": "node scripts/start.js",
  "_build": "node scripts/build.js",
  "build":"set PUBLIC_URL=https://fe.wxpay.oa.com/dv&& npm run _build"
}

In mac os:

"scripts": {
    "start": "node scripts/start.js",
    "_build": "node scripts/build.js",
    "build":"PUBLIC_URL=https://fe.wxpay.oa.com/dv npm run _build",
    "fix": "eslint src --fix"
  },

License

This content is released under the MIT License.