Replace update-notifier-cjs with a zero-dependency equivalent (removes 46 packages)
Maintainer thường phản hồi trong vòng 5 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- node.js, typescript
Hướng nghiên cứu
Xem xét mục nhập manifest và lệnh gọi require hiện có trong src/bin/server.ts, sau đó so sánh API của nano-update-notifier với cách sử dụng hiện tại. Chạy npm ci, tiếp theo là npm run build, npm run lint và npm run test-unit; được coi là hoàn tất khi cây phụ thuộc không còn các package đã báo cáo và các kết quả build, lint và test hiện có không bị suy giảm.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
update-notifier-cjs pulls 46 packages into superstatic's dependency tree to check
whether a newer version has been published. That is 46 packages to resolve, audit and
trust, in service of one request to the registry and a box drawn on stderr. It is also
a fork that exists only because upstream update-notifier went ESM-only, and its last
release was January 2025.
I would like to propose replacing it with nano-update-notifier, which implements the
same public API — same options, same notifier.update shape, same suppression rules —
on Node.js built-ins alone, with no runtime dependencies. It ships both ESM and CommonJS
entry points, so the existing require keeps working.
The change is two lines: the manifest entry, and
-const updateNotifier = require("update-notifier-cjs");
+const updateNotifier = require("nano-update-notifier");
in src/bin/server.ts.
Measured
Against [email protected] at superstatic 4bd82b9, on Node 22.14.0 and
npm 10.9.2. Every row is a real run — npm ci on a clean checkout, then the two-line
change, then npm install:
| Dependency delta | added 1 package, and removed 46 packages — npm's own words. 536 installed entries down to 491 |
npm run build |
clean, exit 0 |
npm run lint |
994 problems, 0 errors — identical to the same run before the change |
npm run test-unit |
181 passing, 10 pending, 19 failing — identical to the run before the change, and the set of failing test titles diffs empty against it |
Those 46 entries are 39 distinct package names. Five of them — camelcase,
graceful-fs, semver, strip-json-comments and type-fest — are nested copies whose
name survives elsewhere in the tree, and ini goes from three paths at once. I lead
with 46 because that is what npm install prints; the 39 below is the list of names.
The 19 failures are pre-existing on my machine, all trailing slash cases, which look
like Windows path handling rather than anything related to this change. What matters is
that the swap does not move them.
The 39 names: @pnpm/config.env-replace, @pnpm/network.ca-file, @pnpm/npm-conf,
ansi-align, boxen, ci-info, cli-boxes, config-chain, configstore,
crypto-random-string, deep-extend, dot-prop, escape-goat, global-dirs,
has-yarn, import-lazy, ini, is-ci, is-installed-globally, is-npm, is-obj,
is-yarn-global, isomorphic-fetch, minimist, node-fetch, proto-list, pupa,
rc, registry-auth-token, registry-url, semver-diff, tr46, unique-string,
update-notifier-cjs, webidl-conversions, whatwg-fetch, whatwg-url,
widest-line, xdg-basedir.
The rendered notification is not byte-identical, and here is exactly how
I rendered the notification through superstatic's own call — updateCheckInterval of
one week, shouldNotifyInNpmScript: true — under both libraries and diffed the output.
Eight lines on each side. Lines 2 through 7, the borders, the padding and both text
lines, are byte-identical. Lines 1 and 8 are the blank margin lines, and they differ:
update-notifier-cjsrenders through boxen 5, which emits a yellow-open escape
immediately followed by a yellow-close on those lines.nano-update-notifierreplicates boxen 7, which emits nothing.
Each of those two lines is 10 bytes under update-notifier-cjs — the escape pair
ESC[33m ESC[39m with nothing between them — and 0 bytes here, so the whole output
differs by 20 bytes and nothing else. On the run I measured that was 601 bytes against
581. Both render as a blank line in any terminal, and stripping ANSI makes the two
byte-equal. I would rather state that than claim an equality I cannot support.
How compatibility is held
Differential test suites run update-notifier, boxen, wrap-ansi, semver and
string-width as oracles: the full box option matrix, notification rendering with
colour enabled, ANSI-aware wrapping, and fuzzed version comparison. 300 tests, green on
Ubuntu, Windows and macOS across Node 18, 22 and 24. The package is published from a
GitHub Actions release through npm trusted publishing, with SLSA provenance attached.
Not verified
test-integration, and any run on Linux or macOS — I measured on Windows.
Two things worth raising
Disclosure: I wrote nano-update-notifier. That is why this is an issue rather than
a pull request. CONTRIBUTING asks for discussion before a larger contribution, and a
proposal to adopt my own package deserves that more than most. If this is not something
you want to take on, saying so costs you nothing and I will not push it.
I understand the Google CLA is needed before anything can merge, and I am happy to sign
it. CONTRIBUTING notes it is not required until after review, so I am raising the idea
first rather than signing speculatively.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.1k
- Fork
- 90
- Merge trung bình
- 3 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của firebase/superstatic
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
firebase/superstatic#622 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
superstatic always loads configs from existing `firebase.json` file on project rootCó thể đã có người làm @jabrailkhalil đã nhận 45 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
firebase/superstatic#503 · 2 reaction ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Redirect inserting unexpected slash between index and parametersCó thể đã có người làm @sean0407 đã nhận 28 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
firebase/superstatic#300 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Rewrite upstream request headersĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
firebase/superstatic#286 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
firebase/superstatic#277 · 4 reaction ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của firebase/superstatic
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vercel-labs/ui#865 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
outline/outline#14638 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
wayfinder:grilling
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
patricktree/cup#484 ·
-
bot:ai-assisted component:platform-js status:untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
midnightntwrk/platform-js#69 ·
Maintainer thường phản hồi trong vòng 1 ngày