yllieth / semantic-release-ms-teams

A plugin for semantic-release which publish release notes in a Microsoft Teams channel
MIT License
19 stars 15 forks source link

feat: replace aggregate-error library with standard NodeJS AggregateError #43

Open SopTrie opened 7 months ago

SopTrie commented 7 months ago

In a new project I encountered problems in the interaction of this library and the latest version of Semantic-Release (23.0.5):

$ yarn release --dry-run
[08:56:28] [semantic-release] » ℹ  Running semantic-release version 23.0.5
[08:56:28] [semantic-release] » ✘  An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module C:\<project-path>\node_modules\aggregate-error\index.js from C:\<project-path>\node_modules\semantic-release-ms-teams\lib\lifecycle-verify-conditions.js not supported.
Instead change the require of index.js in C:\<project-path>\node_modules\semantic-release-ms-teams\lib\lifecycle-verify-conditions.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (C:\<project-path>\node_modules\semantic-release-ms-teams\lib\lifecycle-verify-conditions.js:1:24) {
  code: 'ERR_REQUIRE_ESM'
}
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\<project-path>\node_modules\aggregate-error\index.js from C:\<project-path>\node_modules\semantic-release-ms-teams\lib\lifecycle-verify-conditions.js not supported.
Instead change the require of index.js in C:\<project-path>\node_modules\semantic-release-ms-teams\lib\lifecycle-verify-conditions.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (C:\<project-path>\node_modules\semantic-release-ms-teams\lib\lifecycle-verify-conditions.js:1:24) {
  code: 'ERR_REQUIRE_ESM'
}

As you can see in the log, it is not possible to import the library aggregate-error via require. This is no longer possible since version 4.0, as the library is delivered as a pure ESM package. Semantic-Release now uses version 5.0.0.

However, since NodeJS 15 it is possible to use the "native" AggregateError object. This change finally allows this library to be operated in the latest Semantic-Release version.

Fix #40