Repository navigation
refactor(core): fetch the release index with @nodevu/fetchindex - #145
Merged
Merged
Conversation
…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.
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.
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #144 (base
bnb/fetchindex-own-deps). Once #144 merges, this targets main.core/util/prod/versions.jswas the same function asfetchindex/index.js: fetch the index URL with the givenfetch, throw naming the URL and status when the response isn't ok, and return the JSON. Only the JSDoc differed.core/test/versions.jswas the same set of tests asfetchindex/test/test.js. This keeps fetchindex as the one implementation.Changed:
core/index.jsrequires@nodevu/fetchindexinstead of./util/prod/versions. Core passes its parsed options, whosefetchandurls.indexare what fetchindex reads.core/package.jsonlists@nodevu/fetchindex^1.1.0as a dependency, added withnpm 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.jsonreferences../fetchindex, sonpm run typesbuilds fetchindex's declarations before core's.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, sincenodevu()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 oftsc -b --forceunchanged.Checked with
npm run lint(oxlint, oxfmt, docov, harden, lint:rules, knip),npm run types,npm run coverage(100% in all 10 packages) andnpm 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.