{"id":19751129,"url":"https://github.com/mipengine/mip-cli","last_synced_at":"2025-04-30T10:31:18.135Z","repository":{"id":57298185,"uuid":"69548700","full_name":"mipengine/mip-cli","owner":"mipengine","description":"Command line interface for MIP","archived":false,"fork":false,"pushed_at":"2018-04-10T07:28:17.000Z","size":1545,"stargazers_count":18,"open_issues_count":8,"forks_count":14,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-06T20:51:04.141Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mipengine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-29T08:44:51.000Z","updated_at":"2019-08-21T18:28:00.000Z","dependencies_parsed_at":"2022-09-06T04:20:21.159Z","dependency_job_id":null,"html_url":"https://github.com/mipengine/mip-cli","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mipengine%2Fmip-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mipengine%2Fmip-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mipengine%2Fmip-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mipengine%2Fmip-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mipengine","download_url":"https://codeload.github.com/mipengine/mip-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224106684,"owners_count":17256918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T02:42:34.556Z","updated_at":"2024-11-12T02:42:35.285Z","avatar_url":"https://github.com/mipengine.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MIP CLI 工具\n\n[![Build Status](https://travis-ci.org/mipengine/mip-cli.svg?branch=master)](https://travis-ci.org/mipengine/mip-cli)\n\nMIP脚手架.\n\n### 安装\n\n依赖环境: [Node.js](https://nodejs.org/en/) (\u003e=4.x).\n\n``` bash\n$ [sudo] npm install -g mip-cli\n```\n*注意：*\nnodejs 5.x, 6.x 安装模块时，可能会报`node-gyp`相关错误，需要使用如下命令安装\n\n```\n$ [sudo] npm install --unsafe-perm -g mip-cli\n```\nnodejs 5.x 安装`bufferutil`模块时可能会报编译错误，建议使用`4.4`或者`6.x`以上版本。\n\n### 使用\n\n在当前项目`根目录`中初始化mip配置：\n\n``` bash\n$ mip init\n```\n会创建`mip.config`文件，相关配置如下：\n\n``` js\nmodule.exports = {\n\n    /**\n     * mip server调试的端口号\n     *\n     * @type {number}\n     */\n    port: 8000,\n\n    /**\n     * 本地mip网页后缀名，会对mip网页动态添加调试脚本\n     *\n     * @type {RegExp}\n     */\n    mipPageExt: /\\.(?:html|htm|mip)$/i,\n\n    /**\n     * 本地mip组件调试目录，主要用于开发组件时进行本地调试，自动将本地mip组件注入到当前访问的页面中\n     * 例如：配置'../mip-extensions'，会将此目录的组件注入到调试页面\n     *\n     * @type {string}\n     */\n    extensionsDir: '',\n\n    /**\n     * 本地mip调试目录，用于调试本地mip项目\n     *\n     * @type {string}\n     */\n    mipDir: '../../../mip',\n\n    /**\n     * 启用调试页面自动刷新\n     *\n     * @type {boolean}\n     */\n    livereload: true\n};\n```\n\n![](./example/mip-init.png)\n\n----\n在当前项目创建一个mip模板网页：\n\n``` bash\n$ mip add index.html [mip-xxx...]\n```\n\n![](./example/mip-add.png)\n\n----\n在`mip-extensions`仓库中创建一个mip组件：\n\n``` bash\n$ mip addelement mip-demo\n```\n\n![](./example/mip-addelement.png)\n\n----\n验证mip网页：\n\n``` bash\n$ mip validate index.html [...]\n```\n\n![](./example/mip-validate.png)\n\n----\n在当前项目或者`mip-extensions`仓库中启动mip网页调试器：\n\n``` bash\n$ mip server\n```\n\n注意：调试`mip-extensions`仓库组件时，会读取组件中`READEME.md`的使用示例，因此组件的`README.md`中\n应至少包含一段使用示例：\n\n    使用示例\n    ```html\n        \u003cmip-xxx\u003e\u003c/mip-xxx\u003e\n    ```\n\n配置了`mipDir`之后可以调试`mip`引擎。\n\n`mip server` 启动多个实例的话会报端口占用错误，需要关闭其他实例或者kill掉占用端口的进程后再启动。\n\n```\n➜  ~ mip server\nINFO livereload server start at: http://172.20.128.110:35730\nERROR PORT 8000 already in use, please retry again!\n```\n\n![](./example/mip-server.png)\n\n----\n在当前项目中，校验编写的mip组件，可以校验mip组件目录或者mip组件压缩包：\n\n``` bash\n# directory\n$ mip validateelement ./mip-demo\n\n# zip package\n$ mip validateelement ./mip-demo.zip\n```\n\n![](./example/mip-validateelement.png)\n\n----\n更新mip工具，将mip模板更新到最新版本：\n\n``` bash\n$ mip update\n```\n\n![](./example/mip-update.png)\n\n----\n\n直接从官方 npm registry 安装，可能会由于网络原因，导致安装时间较长或安装失败。此时我们可以选择速度更快的 registry。\n\n```\n$ [sudo] npm install -g mip-cli --registry=https://registry.npm.taobao.org\n```\n\n### 预览组件\n\n进入`mip-extensions`仓库，使用`mip server`命令启动调试器\n访问` http://127.0.0.1:8000`查看看组件列表，点击组件链接进行预览\n\n### License\n\n[MIT](http://opensource.org/licenses/MIT)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmipengine%2Fmip-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmipengine%2Fmip-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmipengine%2Fmip-cli/lists"}