wechat-devtool
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

wechat-devtool npm version

Wechat Miniprogram Devtool CLI cross-platform wrapper for NodeJS and npm

跨平台命令行调用微信开发工具

Build Status Build Status

required 所需条件

  1. 已经安装 微信开发工具 devtools
  2. 开启开发工具的设置端口调用

中文: 打开工具 -> 设置 -> 安全设置,将服务端口开启。

English: open IDE -> Settings -> Security Settings, and set Service Port On.

tips

CI集成请使用 miniprogram-build 或 miniprogram-ci

quick start

免安装,命令行调用

官网 cli用法一致(额外功能是支持相对路径): 使用npx wechat-devtool代替cli即可

npx wechat-devtool
# 参数调用和原生CLI 参数完全一样 但是支持相对路径 
npx wechat-devtool --open ./dist

快速上传

# 当前目录 
npx -p wechat-devtool upload
# 上传 dist 目录 
npx -p wechat-devtool upload ./dist
# 记录上传日志 
npx -p wechat-devtool upload ./dist --upload-info-output

高级用法

npm install wechat-devtool -D

安装之后会添加其他命令到本地项目,可在 npm scripts 中直接调用

  • cli 等同于开发工具 CLI,更具系统和安装环境自动调用
  • upload 快速上传(对 upload 操作的简化) upload [<path>] [--version version] [--desc <desc>] [--info-output <path>]

package.json 配置文件

{
  "scripts": {
    "upload": "upload ./dist",
    "cli": "cli"
  }
}

下面命令自动上传 dist 目录

npm run upload

JS 模块调用

作为 JS 模块使用

import { cli } from "wechat-devtool";
 
cli("open")
  .then(console.log)
  .catch(console.error);

Package Sidebar

Install

npm i wechat-devtool

Weekly Downloads

3

Version

2.0.0

License

MIT

Unpacked Size

43.9 kB

Total Files

38

Last publish

Collaborators

  • newfuture