Modernize tooling and drop the build step#34
Merged
Conversation
This is a 35-line library; the babel transpile chain, copy-pasted
frontend jest config, and husky/lint-staged setup were heavier than
the code they wrapped. Rewrite the source as plain CommonJS and ship
src/ directly so consumers (and tests) just require it.
- Source: ESM `export` → `module.exports`; tests use `require`.
- Delete .babelrc.js; drop @babel/cli, @babel/core, @babel/preset-env.
- Drop the `build` and `prepare` scripts; point `main` at
./src/index.js and add a `files` allowlist so npm publishes just src/.
- Drop husky + lint-staged config (optional local-only tooling that
the maintainer can re-add at will).
- Delete jest.config.js — its only non-default settings were a
frontend-app asset moduleNameMapper and a babel-jest transform,
neither of which apply to a CommonJS date library.
- Bump remaining devDeps: jest 26 → 30, prettier 2 → 3,
@philihp/eslint-config 3 → 6 (eslint 7 → 8).
- CI: bump Node matrix from 10/11/12/13/14.x (all EOL) to 18/20/22.x;
bump actions/{checkout,setup-node} to v4 and coverallsapp to v2;
drop the now-meaningless `npm run build --if-present` step.
- Bump .tool-versions to nodejs 22.11.0.
All 22 tests pass; coverage still produces coverage/lcov.info for
Coveralls.
Coverage Report for CI Build 25929668808Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Owner
Author
|
thanks dad |
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.
Summary
This is a 35-line library, and the tooling around it was disproportionate: a babel transpile chain, a
jest.config.jscopy-pasted from a frontend app (with asset moduleNameMapper for images/CSS), husky + lint-staged, etc. Pretty much none of it was pulling its weight.What changed
src/index.jsnow usesmodule.exports; the test usesrequire. Bothimport WeekDate from 'week-date'(default-interop) andimport { parse } from 'week-date'still work for consumers..babelrc.js; removed@babel/cli,@babel/core,@babel/preset-env. Removed thebuildandpreparescripts.mainnow points at./src/index.js. Added afiles: ["src"]allowlist so npm publishes just the source.jest.config.js. Its only non-default settings were a babel-jest transform and a frontend-app asset moduleNameMapper, neither of which apply here. Jest defaults are fine.jest26 → 30,prettier2 → 3,@philihp/eslint-config3 → 6 (eslint 7 → 8).actions/checkoutandactions/setup-node→ v4;coverallsapp/github-action→ v2; dropped the now-meaninglessnpm run build --if-presentstep..tool-versionsbumped tonodejs 22.11.0.Net result:
7 files changed, 27 insertions(+), 64 deletions(-), andnode_modulesdrops from ~880 to ~545 packages.Test plan
npm test— 22/22 passnpm run test:coverage— 100% coverage;coverage/lcov.infoproduced for Coverallsrequire('week-date').parse('2020-W09-6')andrequire('week-date').default ?? require('week-date')both yield2020-02-29T00:00:00.000ZGenerated by Claude Code