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

income-stat-report

v1.0.7

Published

收入统计明细生成器 —— 纯前端单文件工具:上传维修/销售源表,生成《收入统计明细表》xlsx(SUMIFS 公式,无数据透视)。SheetJS 与 ExcelJS 已内联,离线可用。

Readme

发布到 npm · 收入统计明细生成器

把单文件程序发布到 npm,让用户手上的 收入统计明细生成器.html 能检查更新。

out/npm/
├── package.json           包元数据(name / version / files)—— **版本唯一来源**
├── version.json           版本清单(发布时由 package.json 自动生成,供 CDN 读取)
├── income-stat-report.html    ← 单文件产物(由 out/pack/pack-builder.html 生成后放进来)
├── 一键发布.bat            构建校验 + 发布
├── .npmrc.example         令牌模板(复制为 .npmrc 可非交互发布)
└── README.md              本文件

为什么包内文件名是 ASCII

包内文件叫 income-stat-report.html,而不是中文名。原因:更新是从 CDN 按 URL 取文件的,中文文件名在部分 CDN / 反向代理上会被转义或改写,导致取更新 404。桌面上的成品仍叫 收入统计明细生成器.html,用户侧无感。

程序内对应配置项:config.js 的 appUpdateFile(默认已是该 ASCII 名)。

发布流程(3 步)

1) 用打包器生成单文件

打开 out/pack/pack-builder.html:

  • 选入 out/webapp/ 下的 8 个源文件(index.html、styles.css、config.js、app-core.js、app-build.js、app-sheet.js、app-ui.js、logo.jpg)
  • 在「更新源」里填 包名 income-stat-report 与 版本号(必须与 package.json 的 version 一致)
  • 点「生成单文件 HTML」→ 得到 收入统计明细生成器.html(约 1.7 MB,含 SheetJS + ExcelJS,离线可用)

「更新源」留空也能打包,产物就是纯离线工具,只是页脚的检查更新会提示「尚未配置更新源」。

2) 放进发布目录

把产物复制到本目录并改名为 income-stat-report.html:

Copy-Item "$env:USERPROFILE\Downloads\收入统计明细生成器.html" "out\npm\income-stat-report.html" -Force

(一键发布.bat 在缺文件时会自动从「下载」文件夹找中文名那份并复制过来。)

3) 发布

双击 一键发布.bat。它会:

  1. 检查 node / npm
  2. 确保 income-stat-report.html 就位
  3. 由 package.json 生成 version.json(避免两处版本号漂移)
  4. 校验单文件内嵌的 appVersion 是否等于 package.json 的 version(不一致会警告,可选继续)
  5. 执行 npm publish --access public(有 .npmrc 就用它;没有则在窗口内粘贴令牌,不落盘)
  6. 打印 npm / npmmirror / jsDelivr 的验证地址

也可以手动:

cd out\npm
npm publish --access public

首次发布前建议先确认包名未被占用:npm view income-stat-report 报 404 即可用(已实测 4 个候选名 income-stat-report / income-stat-detail / wwt-income-stat / income-stat-generator 全部可用)。

发新版本

  1. 改 package.json 的 version(例如 1.0.1)——如改了取数口径,同时把 out/webapp/config.js 的 configVersion +1
  2. 用打包器按新版本号重新打包 → 覆盖 out/npm/income-stat-report.html
  3. 双击 一键发布.bat

更新机制(程序侧)

// config.js
appVersion: '1.0.0'                    // 本程序版本,发布前与 package.json 对齐
appPkg: ''                             // npm 包名;留空 = 完全不联网
appUpdateFile: 'income-stat-report.html'
updateSources: []                      // 留空则用内置顺序:
                                       //   registry.npmmirror.com/<pkg>/latest
                                       //   cdn.jsdelivr.net/npm/<pkg>@latest/version.json
                                       //   registry.npmjs.org/<pkg>/latest
  • 填了 appPkg:启动后台静默检查一次(失败不打扰)+ 页脚「检查更新」按钮手动检查; 发现新版本时给出下载链接(cdn.jsdelivr.net/npm/<pkg>@<ver>/income-stat-report.html)。
  • 留空:程序完全不发起任何网络请求,保持纯前端离线。
  • 下载到新版本后,替换本地那份 HTML 即可;规则配置(localStorage)与数据都不受影响。

实测结论:npm 官方 registry 不返回 CORS 头(OPTIONS 预检回 404),所以浏览器里不可能完成 npm publish,发布必须走 npm CLI。但读取版本信息没问题(npmmirror 对 file:// 跨域宽容,jsDelivr 返回 *)。

验证清单

# 包信息(应返回 version 字段)
curl https://registry.npmmirror.com/income-stat-report/latest
# 版本清单
curl https://cdn.jsdelivr.net/npm/income-stat-report@latest/version.json
# 单文件本体(应 >1MB)
curl -I https://cdn.jsdelivr.net/npm/income-stat-report@latest/income-stat-report.html

发布后可在页面实测:把 appPkg 填成包名,点页脚「检查更新」,应显示「已是最新版本 vX.Y.Z」。