Skip to content

refactor(core): fetch the release index with @nodevu/fetchindex - #145

Merged
botandbang merged 6 commits into
mainfrom
bnb/fetchindex-single-source
Nov 11, 2026
Merged

botandbang merged 6 commits into
mainfrom
bnb/fetchindex-single-source

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

Stacked on #144 (base bnb/fetchindex-own-deps). Once #144 merges, this targets main.

core/util/prod/versions.js was the same function as fetchindex/index.js: fetch the index URL with the given fetch, throw naming the URL and status when the response isn't ok, and return the JSON. Only the JSDoc differed. core/test/versions.js was the same set of tests as fetchindex/test/test.js. This keeps fetchindex as the one implementation.

Changed:

  • core/index.js requires @nodevu/fetchindex instead of ./util/prod/versions. Core passes its parsed options, whose fetch and urls.index are what fetchindex reads.
  • core/package.json lists @nodevu/fetchindex ^1.1.0 as a dependency, added with npm i @nodevu/fetchindex -w core. 1.1.0 is already on npm with the same code, so core's published dependency resolves without a new fetchindex release.
  • core/tsconfig.json references ../fetchindex, so npm run types builds fetchindex's declarations before core's.
  • CI's changed-package filter adds fetchindex/** to core and to the packages built on core (newest, oldest, ranges, static, translate).

Removed:

  • core/util/prod/versions.js, the copy.
  • core/test/versions.js, the copy of fetchindex's tests. Core's other tests still go through fetchindex on every run, since nodevu() fetches the index with it.
  • core/types/util/prod/versions.d.ts, generated from the deleted file. The rest of core's committed types come out of tsc -b --force unchanged.

Checked with npm run lint (oxlint, oxfmt, docov, harden, lint:rules, knip), npm run types, npm run coverage (100% in all 10 packages) and npm run docs. Core's and static's CI test jobs (npm ci -w <package> then coverage) also pass on their own in a clean copy with fetchindex linked.

…dency

The two tests passed core's optionsParser output to fetchindex, which repeated the two tests above them with the same options. They required core's optionsParser by relative path, and fetchindex listed luxon only so that file could load. knip.jsonc no longer needs its fetchindex exception.
…re's luxon

luxon reads the time through Date.now, so stubbing it in the build's child process stops core's clock without resolving core's own copy of luxon. That drops static's luxon exception from knip.jsonc, and the root's @types/luxon, which knip then reported as unused. core still lists @types/luxon, so npm run types is unchanged.
core's index.json, schedule.json and now.json snapshots, the at() and beforeEachTemplate helpers, and the scripts that refresh the snapshots move into fixtures/, published nowhere (private: true). core, newest, oldest, parsefiles, ranges, static and translate list @nodevu/fixtures as a devDependency and require it by name, so no test reaches into another package's folder. ranges' at() was core's with a default date, so the two are now one at() with that default.
…kages

tools/oxlint/nodevu/ is the repo's own oxlint JS plugin. Its no-cross-package-paths rule reports require(), require.resolve(), import and export paths, written out in full, that resolve into a different package's folder than the file's own. oxlint's no-restricted-imports only checks ESM imports, so it can't do this for CommonJS. npm run lint:rules tests the rule with oxlint's RuleTester and runs as part of npm run lint. The rule found translate/examples/default.js requiring ../../ranges, which now requires @nodevu/ranges.
core/util/prod/versions.js was fetchindex's index.js under another name, and core/test/versions.js was a copy of fetchindex's tests. core now depends on @nodevu/fetchindex (^1.1.0, which is on npm with the same code) and both copies are gone, along with the generated core/types/util/prod/versions.d.ts. core's tsconfig references fetchindex, and CI's changed-package filter retests core and the packages built on it when fetchindex changes.
Base automatically changed from bnb/fetchindex-own-deps to main November 10, 2026 21:27
Brings in #143 and #144's squash. The merge keeps main's tree plus this branch's change: core requires @nodevu/fetchindex, and core/util/prod/versions.js, core/test/versions.js and its generated types stay deleted. #143's new assertion in core/test/versions.js, that the newest release lists npm, v8, uv, zlib, openssl and modules, is already in fetchindex's tests. CI's path filters for core and the packages built on it include fetchindex/**, and package-lock.json is updated with npm.
@botandbang
botandbang merged commit 01024db into main Nov 11, 2026
37 checks passed
@botandbang
botandbang deleted the bnb/fetchindex-single-source branch November 11, 2026 06:24
@nodevu-ci nodevu-ci Bot mentioned this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant