npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

weapp-deploy-cli

v1.0.2

Published

微信小程序 CI 部署工具,支持上传、预览,自动版本管理与 Git Tag

Readme

weapp-deploy-cli

微信小程序 CI 部署工具,基于 miniprogram-ci,支持上传、预览、自动版本管理与 Git Tag。

安装

npm install weapp-deploy-cli miniprogram-ci -D

miniprogram-ci 是前置依赖,必须一起安装。

配置

在项目根目录创建 deploy.config.js

module.exports = {
  // --- 必填 ---
  appid: 'wxXXXXXXXXXXXX',
  privateKeyPath: './certs/private.wxXXXXXXXXXXXX.key',

  // --- 以下为可选项,均有默认值 ---

  // 构建产物目录
  // pathMap: {
  //   dev: './dist/dev/mp-weixin',
  //   build: './dist/build/mp-weixin',
  // },

  // CI 机器人编号
  // robotMap: { dev: 2, build: 1 },

  // 上传描述前缀
  // envPrefixMap: { dev: '测试', build: '正式' },

  // 默认上传描述
  // defaultDesc: '日常更新',

  // 预览编译设置
  // previewSetting: {
  //   dev: { es6: false, minify: false },
  //   build: { es6: true, minify: true },
  // },

  // 上传编译设置
  // uploadSetting: { es6: true, minify: true },

  // build 环境是否自动打 Git Tag
  // autoTagOnBuild: true,

  // 版本号提交后是否自动 git push
  // autoPush: true,

  // Git 提交信息模板,{version} 会被替换为实际版本号
  // commitMessageTemplate: 'chore: 升级小程序版本号至 {version}',
};

也支持在 package.json 中配置(优先级低于 deploy.config.js):

{
  "weappDeploy": {
    "appid": "wxXXXXXXXXXXXX",
    "privateKeyPath": "./certs/private.wxXXXXXXXXXXXX.key"
  }
}

使用

上传

# 上传正式版(自动递增版本号、打 Tag、推送)
npx weapp-deploy upload build

# 上传测试版
npx weapp-deploy upload dev

# 自定义描述
npx weapp-deploy upload build desc 修复登录问题

# 指定版本号
npx weapp-deploy upload build version 2.0.0

# 不打 Tag
npx weapp-deploy upload build tag false

预览

# 生成开发环境预览二维码
npx weapp-deploy preview dev

# 生成生产环境预览二维码
npx weapp-deploy preview build

帮助

npx weapp-deploy help

上传流程

执行 upload 时会依次完成:

  1. 读取 deploy.config.js 配置
  2. 自动递增 package.json 版本号(或使用指定版本)
  3. Git commit 版本号变更并 push(可通过 autoPush: false 关闭)
  4. 创建 Git Tag 并推送(仅 build 环境,可通过 tag false 关闭)
  5. 调用 miniprogram-ci 上传小程序
  6. 清理临时文件

编程调用

除了 CLI,也可以在 Node.js 中直接调用:

const { loadConfig, upload, preview } = require('weapp-deploy-cli');

const cwd = process.cwd();
const config = loadConfig(cwd);

// 上传
await upload(config, 'build', ['desc', '自动发布'], cwd);

// 预览
await preview(config, 'dev', cwd);

密钥获取

上传密钥需在微信公众平台获取:

  1. 登录 微信公众平台
  2. 进入 开发管理 → 开发设置 → 小程序代码上传
  3. 生成并下载上传密钥,放到项目 certs/ 目录下
  4. certs/ 加入 .gitignore 避免泄露

License

MIT