Skip to content

feat: ES Module#526

Open
babblebey wants to merge 23 commits intobetafrom
esm
Open

feat: ES Module#526
babblebey wants to merge 23 commits intobetafrom
esm

Conversation

@babblebey
Copy link
Member

@babblebey babblebey commented Oct 11, 2024

This PR converts the plugin to ESM only.

Related to semantic-release/semantic-release#2133

BREAKING CHANGE: @semantic-release/git is now a native ES Module. It has named exports for each plugin hook (verifyConditions, prepare)

BREAKING CHANGE: the minimum required version of semantic-release to use @semantic-release/changelog is now v20.1.0

Other Notable Changes

  • @semantic-release/error ^3^4 (ESM-only)
  • aggregate-error ^3^5 (ESM-only, uses native AggregateError)
  • execa ^5^9 (ESM-only, named export)
  • p-reduce ^2^3 (ESM-only)
  • Removed CJS-only devDeps: clear-module, file-url, fs-extra, get-stream, nyc
  • Added c8 for coverage; bumped ava, sinon, tempy, semantic-release, prettier
  • Engine: ^22.14.0 || >= 24.10.0; peer dep: >=24.1.0
  • Scripts: nycc8, added pretest, removed test:ci

Related Issue

This commit updates the code to use ES6 module syntax by replacing the `require` statements with `import` statements. This improves the code readability and maintainability.

Refactor the `index.js` file to use ES6 module syntax

Refactor the `lib/definitions/errors.js` file to use ES6 module syntax

Refactor the `lib/get-error.js` file to use ES6 module syntax

Refactor the `lib/git.js` file to use ES6 module syntax

Refactor the `lib/prepare.js` file to use ES6 module syntax

Refactor the `lib/resolve-config.js` file to use ES6 module syntax

Refactor the `lib/verify.js` file to use ES6 module syntax
@babblebey babblebey changed the base branch from master to beta March 3, 2026 18:14
…e support

- Bump @semantic-release/error from ^3.0.0 to ^4.0.0
- Bump aggregate-error from ^3.0.0 to ^5.0.0
- Bump execa from ^5.0.0 to ^9.0.0
- Bump p-reduce from ^2.0.0 to ^3.0.0
- Update devDependencies:
  - Bump ava from 3.15.0 to 6.2.0
  - Add c8 for coverage reporting
  - Bump prettier from ^3.3.3 to 3.5.3
  - Bump semantic-release from 21.1.2 to 24.2.1
  - Bump sinon from 17.0.1 to 19.0.2
  - Bump tempy from 1.0.1 to 3.1.0
- Update Node.js engine support to ^22.14.0 || >= 24.10.0
- Add pretest script to run linting before tests
- Replace nyc with c8 for test coverage reporting
- Update peerDependencies for semantic-release to >=24.1.0
- Changed require statements to import statements in integration, prepare, and verify tests.
- Replaced fs-extra's outputFile with native fs/promises methods for file operations.
- Updated test cases to enhance consistency in formatting and structure.
- Improved error handling in verification tests for assets and message options.
@babblebey babblebey changed the title feat: ES Modules feat: ES Module Mar 3, 2026
@babblebey babblebey marked this pull request as ready for review March 3, 2026 18:43
- Updated semantic-release to version ^25.0.3
- Updated sinon to version ^21.0.1
- Added npm-run-all to manage parallel test execution
- Modified test script to run linting and tests in parallel
- Introduced separate test scripts for unit and integration tests
Copy link
Member

@travi travi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just spot the one adjustment. then i think this is good to go. thanks a ton for the investment into getting these updated!

@travi
Copy link
Member

travi commented Mar 13, 2026

Attn to the failing workflows, I don't seem to understand them... A little light there please 🤔

it looks like execa is making a true git call, which i would be surprised if it was doing that before. i havent looked deep enough to confirm that or what might need to change. my first thought was to check if there is an execa update available that was unblocked by the esm change, but it looks like youve already updated to the latest major. maybe there was a breaking change, or even just the nature or the esm change, that changed the way that was previously stubbed to allow the call through when it wasnt doing that before

@babblebey
Copy link
Member Author

it looks like execa is making a true git call, which i would be surprised if it was doing that before.

I don't know how the tests have been passing originally.... but I just found some error relating to the CI runner not having a global git user.name/user.email configured, and the test helpers don't mock them before repo operations.

@babblebey babblebey requested a review from travi March 15, 2026 01:13
- Added lockfile-lint, ls-engines, and publint for improved linting and validation.
- Updated linting scripts to include separate commands for prettier and lockfile checks.
- Configured lockfile-lint settings for package-lock.json.
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.

2 participants