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

tauri-release-utils

v0.1.1

Published

Tauri 2 发布工具:tru CLI — macOS 定制 DMG(隔离属性修复 .command);Windows/macOS/Linux 统一构建入口与打包后 semver 第三位递增;同步 tauri.conf / Cargo.toml / package.json;可选 release.config.json。

Readme

tauri-release-utils

面向 Tauri 2 的发布辅助工具集:

  • macOS:生成带「隔离属性修复」.command 的 DMG(依赖本机 create-dmg)。
  • 任意平台(含 Windows):在 tauri build 前后同步递增 tauri.conf.json / Cargo.toml 等处的版本号。
  • 程序化 API:合并读取 release.config.jsontauri.conf.json 中的发布字段。

安装

npm install -D tauri-release-utils
# 或
pnpm add -D tauri-release-utils

release.config.json 不是必须的。 没有该文件时会使用内置默认(例如构建命令 pnpm tauri build、打包成功后自动 patch 递增版本)。仅在需要改构建命令、关闭默认递增、自定义 tauri.conf.json / Cargo.toml 路径等场景下再新建即可。

是否必须在 src-tauri/ 不必须。Tauri 模板默认把 tauri.conf.jsonCargo.toml 放在 src-tauri/,本工具也沿用该默认路径。若你的 Rust 工程在别的目录(例如 monorepo 的 crates/app/),在 release.config.json 中同时设置 tauriConfigPathcargoTomlPath 即可;macOS DMG 会从 Cargo.toml 所在目录解析 target/release/bundle,不再写死 src-tauri构建命令(如 pnpm tauri build)通常在项目根目录执行,而不是先 cdsrc-tauri

CLI:统一入口(推荐)

在 Tauri 项目根目录(含 src-tauri/tauri.conf.json)执行:

npx tru
# 或(与上等价,名称较长)
npx tauri-release-utils

# 指定目录 / 仅预览
npx tru /path/to/your-tauri-app
npx tru --dry-run

本地已安装依赖时也可:pnpm exec trupnpm tru(若在 package.jsonscripts 里配置了同名脚本则以后者为准)。

  • macOS:走 DMG 流程(create-dmg、隔离修复 .command 等)。本机需 brew install create-dmg
  • Windows / Linux:只执行 release.config.json 里的 tauriBuildCommand(未配置时默认 pnpm tauri build),不生成 DMG;与 macOS 共用下文的环境变量做构建前/后版本递增。

若 Windows 项目用 npm 而非 pnpm,在 release.config.json 中设置:

{ "tauriBuildCommand": "npm run tauri build" }

每次打包后自动递增版本号(跨平台)

默认行为:直接运行 npx tru(不设环境变量)时,会在 打包成功之后 自动 patch 递增版本(与在 release.config.json 中写 "versionBump": "post" 相同)。macOS DMG 流程与 Windows / Linux 的 tauri build 均一致。

  • 只想打包、不要改版本:环境变量 TAURI_DMG_VERSION_BUMP=off,或在 release.config.json 中设 "versionBump": false
  • 要在构建前就递增(本次产物即新版本):TAURI_DMG_VERSION_BUMP=pre 或配置 "versionBump": "pre"

递增逻辑为纯 Node.js,tauri.conf.jsonversion 为基准算出下一版,并同步写入:

  • src-tauri/Cargo.toml[package]version
  • 仓库根目录 package.json 的顶层 version(文件存在且该字段为字符串时;纯前端子包若无 version 则跳过)
  • release.config.json 中可选的 bumpExtraJsonVersionPaths 所列 JSON 的顶层 version

不需要同步 package.json 时,在 release.config.json 中设置 "packageJsonPath": false。自定义路径可使用 "packageJsonPath": "apps/desktop/package.json"

若根目录 package.jsonversiontauri.conf.json 不一致,递增前会在终端输出 警告(仍以 tauri 的版本为基准计算下一版并写回各处)。

自定义 tauri.conf.json 路径

Monorepo 等场景下若配置文件不在默认的 src-tauri/tauri.conf.json,在 release.config.json 中设置相对项目根的 tauriConfigPath,CLI 与 bump 脚本均会使用该路径,例如:

{
  "tauriConfigPath": "crates/app/tauri.conf.json",
  "cargoTomlPath": "crates/app/Cargo.toml"
}

macOS(本仓库 scripts/build-macos-dmg.sh

  • 默认:DMG 成功后在仓库内递增版本(post),本次 DMG 文件里的应用版本仍是递增前的那一版。
  • TAURI_DMG_VERSION_BUMP=pre:在 tauri build 之前递增,本次产物与应用内版本均为新版本。
  • TAURI_DMG_VERSION_BUMP=off:关闭自动递增(会覆盖配置里的默认 post)。

可选:TAURI_DMG_VERSION_BUMP_PART=patch|minor|major(默认 patch)。

示例(与默认行为一致,可省略):

export TAURI_DMG_VERSION_BUMP_PART=minor
npx tru

Windows / Linux(与 macOS 相同命令)

npx tru

关闭递增示例(cmd):set TAURI_DMG_VERSION_BUMP=off 后再执行;PowerShell:$env:TAURI_DMG_VERSION_BUMP="off"

若仍需单独调用递增脚本(例如自定义流水线),可执行:

node ./node_modules/tauri-release-utils/scripts/bump-version.mjs --dry-run

程序化读取发布配置

本包导出与 Tauri 项目根目录 release.config.json / tauri.conf.json 合并后的配置:

import { loadReleaseConfig } from 'tauri-release-utils/release-config'

const c = loadReleaseConfig('/path/to/project')
console.log(c.productName, c.version)

程序化递增版本

import { bumpProjectVersion } from 'tauri-release-utils/bump-version'

const { from, to, files } = bumpProjectVersion('/path/to/project', { part: 'patch' })

开发与本包测试

克隆本仓库后:

pnpm test
# 或
npm test

使用 Node.js 内置 node:test,无需额外测试依赖。

维护者发版:一键发布脚本在仓库根目录(与 .git 同级),说明见根目录 README.md中的「维护者:一键发版」。

许可

MIT