Skip to content

chore: modernize tooling and convert to ESM#30

Merged
zkochan merged 2 commits intomasterfrom
chore/modernize-esm
May 8, 2026
Merged

chore: modernize tooling and convert to ESM#30
zkochan merged 2 commits intomasterfrom
chore/modernize-esm

Conversation

@zkochan
Copy link
Copy Markdown
Member

@zkochan zkochan commented May 8, 2026

Summary

  • Convert package to ESM (type: module, exports map with types/default).
  • Bump Node engine to >=22.13; modern tsconfig (module/moduleResolution: nodenext, target: es2022, verbatimModuleSyntax).
  • Replace tape + ts-node + tslint + package-preview with the built-in node:test runner driven by tsx. Tests now import from ../src/index.ts directly instead of resolving the published package name.
  • Replace Travis with GitHub Actions, matrix testing Node 22/24 across Ubuntu/macOS/Windows.
  • Source cleanup: deprecated String.prototype.substrslice; CJS-style import x = require(...) → ESM imports; export a ParsedTarballUrl type.
  • parseNpmTarballUrl switched from default export to named export, consistent with the rest of the pnpm ecosystem.
  • Drop typings/index.d.ts — it stubbed semver-regex, which the source does not use.

Breaking changes

  • ESM-only consumers required.
  • Named import: import { parseNpmTarballUrl } from 'parse-npm-tarball-url' (was a default import).
  • Node >= 22.13 required.

Test plan

  • pnpm install clean
  • pnpm run build produces ESM lib/index.js + lib/index.d.ts
  • pnpm test — all 6 tests pass on node:test
  • CI green on Linux/macOS/Windows × Node 22/24

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Major version update to 5.0.0
    • Minimum Node.js version raised to 22.13
    • API updated to use named exports instead of default export
  • New Features

    • Added ES module support
  • Improvements

    • Modernized CI/CD pipeline and build toolchain
    • Simplified TypeScript configuration
  • Documentation

    • Updated usage examples for named imports

- Convert package to ESM (type=module, exports map)
- Bump Node engine to >=22.13
- Replace tape/ts-node/tslint/package-preview with node:test + tsx
- Switch tsconfig to NodeNext, target es2022
- Replace Travis CI with GitHub Actions (Node 22, 24 on Ubuntu/macOS/Windows)
- Replace deprecated substr() with slice()
- Replace default export of parseNpmTarballUrl with a named export
- Drop unused typings/ directory (stub for semver-regex which is not used)
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR modernizes a npm-tarball-url parser from CommonJS to ES modules (ESM) with TypeScript, updates the Node.js engine requirement to >=22.13, migrates from Travis CI to GitHub Actions, replaces Tape tests with Node.js native test runner, and removes deprecated tooling (TSLint, ambient typings).

Changes

ESM Migration & Toolchain Modernization

Layer / File(s) Summary
Public API & Type Exports
src/index.ts
Module converts from default export to named export parseNpmTarballUrl; new ParsedTarballUrl type with { host, name, version } shape introduced.
Package Configuration & Exports
package.json
Version bumped to 5.0.0, adds type: "module", configures exports map with types and default entrypoints, raises Node engine to >=22.13, excludes *.map from published files.
TypeScript & Build Configuration
tsconfig.json, pnpm-workspace.yaml
tsconfig.json switches to nodenext module resolution and es2022 target, enables strict and verbatimModuleSyntax, sets rootDir: src and outDir: lib. pnpm-workspace.yaml enables esbuild builds.
Build Scripts & Dependencies
package.json
Build script changed to rimraf lib && tsc, test script uses tsx --test test/*.test.ts, prepublishOnly runs build. Dependencies updated: semver ^7.6.3, TypeScript/tsx/rimraf refreshed; old tooling removed (ts-node, tape, tslint, package-preview). pnpm devEngine set to v11.
Test Suite Migration
test/index.test.ts, test/index.ts
New native Node.js test suite added covering unscoped/scoped packages, prerelease versions, and invalid URL handling. Old Tape test suite removed.
CI/CD Migration
.github/workflows/ci.yml, .travis.yml
GitHub Actions workflow added to test across Ubuntu/macOS/Windows and Node 22/24 using pnpm install --frozen-lockfile and pnpm test. Travis CI configuration removed.
Tooling & Type Configuration Removal
tslint.json, typings/index.d.ts
tslint.json completely removed; ambient semver-regex module typing removed as types now managed via exports.
Documentation & Metadata
README.md, LICENSE
README example updated to use named import; LICENSE copyright extended to 2026.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 From CommonJS to modules so bright,
Named exports dancing in ESM light,
TypeScript strict and Node modern true,
GitHub Actions now testing askew,
Tape's gone—native tests shine through! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: modernize tooling and convert to ESM' accurately summarizes the main objective of the pull request, which is to modernize the project's tooling and convert it to ESM.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/modernize-esm

Comment @coderabbitai help to get the list of available commands and usage tips.

@zkochan zkochan merged commit c211813 into master May 8, 2026
6 of 7 checks passed
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