mip2
CLI for mip 2.0
Last updated a month ago by chenqiushi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mip2 -g
SYNC missed versions from official npm registry.

mip2 CLI npm package node

Command Line Interface for MIP 2.0.

Installation

Prerequisites: Node.js (>=8.x), npm version 3+ and Git.

$ npm install -g mip2

Usage

创建项目

$ mip2 init

新增一个组件

在项目根目录运行 mip2 add 命令,即可快速添加一个新组件

# 快速添加名为 mip-new 的组件
$ mip2 add mip-new

# 使用 -f 或 --force 参数强制覆盖同名组件
$ mip2 add mip-new -f

启动调试服务器,在项目根目录运行

$ mip2 dev

Example:

# 可使用 ——port 指定端口
$ mip2 dev --port 8888

组件和页面校验

集成到 cli 工具中的校验分为三种:

  • 组件校验
  • 页面校验
  • npm 白名单校验
$ mip2 validate

Example:

# 组件校验
$ mip2 validate components
$ mip2 validate -c components

# 页面校验
$ mip2 validate -p page.html

# npm 白名单校验
$ mip2 validate -w path-to-project

构建组件,在项目根目录运行

$ mip2 build

生成 Service Worker

mip2 CLI 提供了 sw 命令,帮助开发者更简单快速地生成 Service Worker,支持离线可用等特性。

# 在项目根目录运行
$ mip2 sw

默认情况下,将导出 Service Worker 文件到 dist/sw.js,并对静态资源(如 js,css)及 html 文档进行缓存,实现页面的离线可用。

mip2 sw 命令提供了选项:

-o, --output // 指定 sw 导出路径,如 mip2 -o output/service-worker.js
-c, --config // 指定配置文件路径,默认使用项目根目录 mip.config.js

除此之外,我们可以在 mip.config.js 中增加 serviceWorker 配置项,对 Service Worker 进行进一步的配置,如预缓存列表、动态缓存策略、skipWaitingclientsClaim 等。

module.exports = {
  dev: {/*...*/},
  serviceWorker: {
    cacheId: 'mipuser',
    skipWaiting: true,
    clientsClaim: true,
    runtimeCaching: [],
    globPatterns: [],
    globIgnores: []
  }
}

更多的配置选项可以参考 Workbox 配置项

常用插件

本地启动 SF 调试环境

$ mip2 sf

运行命令后,会在本地启动一个服务器,可以通过 http://localhost:8210/sf 进行访问,对页面嵌入 SF 的情况进行调试和验证。

详情可以查看插件项目仓库 mip-cli-plugin-sf

Current Tags

  • 1.5.15                                ...           latest (a month ago)
  • 1.5.14-alpha                                ...           next (3 months ago)

80 Versions

  • 1.5.15                                ...           a month ago
  • 1.5.14                                ...           3 months ago
  • 1.5.14-alpha                                ...           3 months ago
  • 1.5.13                                ...           3 months ago
  • 1.5.13-alpha-rc3                                ...           3 months ago
  • 1.5.13-alpha-rc2                                ...           3 months ago
  • 1.5.13-alpha                                ...           3 months ago
  • 1.5.12                                ...           4 months ago
  • 1.5.12-alpha                                ...           4 months ago
  • 1.5.11                                ...           4 months ago
  • 1.5.11-beta                                ...           4 months ago
  • 1.5.10                                ...           4 months ago
  • 1.5.9-2                                ...           4 months ago
  • 1.5.9-1                                ...           4 months ago
  • 1.5.10-alpha                                ...           5 months ago
  • 1.5.9                                ...           5 months ago
  • 1.5.8                                ...           5 months ago
  • 1.5.7                                ...           6 months ago
  • 1.5.6-alpha-2                                ...           6 months ago
  • 1.5.5-alpha-2                                ...           6 months ago
  • 1.5.6-alpha-1                                ...           6 months ago
  • 1.5.5-alpha-1                                ...           6 months ago
  • 1.5.5                                ...           6 months ago
  • 1.5.4                                ...           6 months ago
  • 1.5.3                                ...           7 months ago
  • 1.5.2                                ...           8 months ago
  • 1.5.1                                ...           9 months ago
  • 1.5.0-alpha                                ...           9 months ago
  • 1.4.3                                ...           10 months ago
  • 1.4.2                                ...           10 months ago
  • 1.4.1                                ...           a year ago
  • 1.4.0                                ...           a year ago
  • 1.4.0-alpha                                ...           a year ago
  • 1.3.2                                ...           a year ago
  • 1.3.1                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.6                                ...           a year ago
  • 1.2.5                                ...           a year ago
  • 1.2.4                                ...           a year ago
  • 1.2.3                                ...           a year ago
  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.10                                ...           a year ago
  • 1.1.9                                ...           a year ago
  • 1.1.8                                ...           a year ago
  • 1.1.7                                ...           a year ago
  • 1.1.6                                ...           a year ago
  • 1.1.5                                ...           a year ago
  • 1.1.4                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.0.16                                ...           a year ago
  • 0.0.15                                ...           a year ago
  • 0.0.14                                ...           a year ago
  • 0.0.10                                ...           a year ago
  • 0.0.9                                ...           a year ago
  • 0.0.8                                ...           a year ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.1                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 9
Last Day 0
Last Week 7
Last Month 203
Dependencies (58)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |