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

uni-update-check

v0.1.0

Published

跨端(微信小程序 & App)的一体化版本更新检查工具,用于uni-app项目。支持wgt热更新、APK整包更新、iOS商店跳转以及小程序原生更新。

Readme

uni-update-check

跨端(uni-appApp(原生)微信小程序)的一体化 版本更新检查 工具:

  • App:支持 WGT热更新APK整包更新iOS App Store 跳转
  • 微信小程序:基于 wx.getUpdateManager 的内置更新流程;
  • 可配置更新接口、更新文案、进度回调等;
  • 无侵入,一行调用

适用于基于 uni-app 的项目。


安装

npm i uni-update-check
# 或
pnpm add uni-update-check
# 或
yarn add uni-update-check

快速使用

// 在 App.vue 的 onLaunch 或首页入口调用
import { checkUpdate } from 'uni-update-check'

checkUpdate({
  // 仅 App 端需要:你的服务端更新配置地址(JSON)
  url: 'https://your.domain.com/update.json',

  // 可选:自定义提示文案
  title: '发现新版本',
  content: '是否立即更新?',

  // 可选:下载进度回调(App端)
  onProgress: (progress) => {
    // progress: 0~100
    console.log('下载进度', progress)
  },

  // 可选:自定义弹窗(返回 true 表示你接管弹窗)
  confirmBeforeUpdate: async (serverMeta) => {
    // return true 表示你已经主动处理了弹窗,内部不再弹默认弹窗
    return false
  }
})

服务端 update.json 示例

{
  "version": "1.0.2",
  "note": "修复若干已知问题,提升稳定性",
  "type": "wgt",
  "urlWgt": "https://your.domain.com/pkg/app_1.0.2.wgt",
  "urlApk": "https://your.domain.com/pkg/app_1.0.2.apk",
  "iosAppStoreUrl": "https://apps.apple.com/cn/app/your-app/id1234567890",
  "force": false
}
  • version:服务端最新版本号(如 1.0.2)。
  • note:更新说明。
  • typewgt(热更新)或 apk(整包)。
  • urlWgt:WGT 包下载地址(当 type=wgt 时必填)。
  • urlApk:APK 下载地址(当 type=apk 时 Android 使用)。
  • iosAppStoreUrl:iOS 使用的应用商店地址(iOS 不支持 wgt/apk 安装)。
  • force:是否强制更新(可选)。

iOS 平台如果配置了 iosAppStoreUrl,将跳转到 App Store;若未配置,则只提示有新版本。

API

checkUpdate(options)

参数

| 字段 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | url | string | App端建议 | 更新配置接口地址,返回上面的 JSON | | title | string | 否 | 默认弹窗标题 | | content | string | 否 | 默认弹窗内容 | | onProgress | (n: number) => void | 否 | App 端下载进度回调(0~100) | | confirmBeforeUpdate | (meta: UpdateMeta) => Promise<boolean> \| boolean | 否 | 在默认弹窗前触发,返回 true 表示你已接管弹窗 |

返回Promise<void>

兼容性说明

  • App(原生):通过 plus.runtime/plus.downloader 实现;
  • 微信小程序:通过 wx.getUpdateManager 实现;
  • H5:默认不做任何动作。

License

MIT