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

com.hanli.app-updater

v0.3.1

Published

Unity Windows 应用通用更新工具

Readme

Hanli App Updater

com.hanli.app-updater 提供一套面向 Unity Windows Standalone 的通用更新方案,包含:

  • 运行时拉取 last.json 检查更新
  • 下载并启动外部更新器
  • 编辑器可视化配置、生成 last.zip / last.json / updater.exe
  • 按占位符模板逐文件上传发布产物

last.json 结构

{
  "version": "0.1",
  "appUrl": "https://example.com/update/last.zip",
  "appHash": "sha256...",
  "updaterUrl": "https://example.com/update/updater.exe",
  "updaterHash": "sha256..."
}

字段固定为:

  • version
  • appUrl
  • appHash
  • updaterUrl
  • updaterHash

运行时接入

  1. 在 Unity 中通过菜单 Tools/Hanli App Updater 打开配置窗口,并选择或使用默认创建的 AppUpdaterSettings 配置资产。
  2. 填写服务器基础地址、超时等配置。
  3. 在场景对象上挂载 AppUpdaterController,并指定 AppUpdaterSettings
  4. 是否启动时自动检查由 AppUpdaterController 组件上的 Auto Check On Start 控制。

如果服务器基础地址使用 http://,需要在 Project Settings > Player 中允许非安全网络连接。编辑器工具会自动检查这一项,并提供“一键允许 HTTP”按钮。

手动调用示例:

using Hanli.AppUpdater;

public class UpdateEntry
{
    public async void Check(AppUpdaterSettings settings)
    {
        var result = await AppUpdaterService.CheckForUpdatesAsync(settings);
        UnityEngine.Debug.Log($"是否需要更新: {result.hasUpdate}");
    }
}

编辑器工具

菜单入口:

  • Tools/Hanli App Updater

配置项:

  • 服务器基础地址
  • 请求超时
  • 应用输出目录
  • 上传模板预设
  • 上传命令模板

主要功能:

  • 校验配置
  • 生成
  • 上传

上传命令支持占位符:

  • {server}
  • {file}
  • {filename}
  • {directory}

示例:

curl -T "{file}" "{server}/{filename}"
cp "{file}" "\\server\share\path\\"

说明:

  • 预设支持 curlcp自定义
  • 切换预设后需要点击“套用模板”才会覆盖当前命令
  • cp 预设只是便捷起点,共享目录请自行改成真实 UNC 路径
  • 若服务器基础地址为 http://,窗口会提示并可一键修复 Non-secure network connections 设置

生成结果

点击 生成 后会在应用输出目录的父级目录生成:

  • last.zip
  • last.json
  • updater.exe

其中 last.zip 仍然打包的是“应用输出目录”里的应用文件;只是发布产物本身会落在它的父级目录,避免把更新器和元数据再次打进应用压缩包。版本号默认来自 PlayerSettings.bundleVersion,文件名固定为 last.jsonupdater.exe

打包 last.zip 时会自动排除更新元数据、tmp 目录,以及任意目录名中包含 donotship 的编译期产物目录。

更新器

包内缓存的更新器可执行文件位于:

  • Packages/com.hanli.app-updater/UpdaterExecutable~/updater.exe

点击 生成 时,编辑器工具会把这个文件复制到应用输出目录的父级目录,并写入 last.json

注意事项

  • 当前首版仅支持 Windows Standalone。
  • 仅当 last.json 中的远端版本高于 Application.version 时才判定存在更新;相同版本或较旧版本不会触发更新。
  • 版本号使用 System.Version 原生规则解析和比较,支持 2–4 段数字点分格式(如 0.26.0813);1.21.2.01.2.0.0 是依次递增的不同版本。
  • 更新失败时会输出中文提示,并提示联系作者。