saitho / semantic-release-backmerge

:twisted_rightwards_arrows: semantic-release plugin to back-merge a release into a develop branch
https://saitho.github.io/semantic-release-backmerge/
56 stars 11 forks source link

Backmerge is incompatible with semantic-release v22 #57

Closed christian98 closed 11 months ago

christian98 commented 11 months ago

Is there an existing issue for this?

Current Behavior

After upgrading to semantic-release v22, I am getting the following console output:

[9:59:18 AM] [semantic-release] › ℹ  Running semantic-release version 22.0.0
(node:26) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:26) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
[9:59:19 AM] [semantic-release] › ✘  An error occurred while running semantic-release: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/get-git-auth-url.js' is not defined by "exports" in /usr/local/lib/node_modules/semantic-release/package.json imported from /usr/local/lib/node_modules/@saithodev/semantic-release-backmerge/dist/perform-backmerge.js
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:259:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:589:9)
    at packageResolve (node:internal/modules/esm/resolve:763:14)
    at moduleResolve (node:internal/modules/esm/resolve:829:20)
    at defaultResolve (node:internal/modules/esm/resolve:1034:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:375:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:344:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:220:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/get-git-auth-url.js' is not defined by "exports" in /usr/local/lib/node_modules/semantic-release/package.json imported from /usr/local/lib/node_modules/@saithodev/semantic-release-backmerge/dist/perform-backmerge.js
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:259:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:589:9)
    at packageResolve (node:internal/modules/esm/resolve:763:14)
    at moduleResolve (node:internal/modules/esm/resolve:829:20)
    at defaultResolve (node:internal/modules/esm/resolve:1034:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:375:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:344:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:220:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Expected Behavior

It should work 😛

Steps To Reproduce

  1. Install semantic-release v22 and this package
  2. Run the cli command.

Environment

- **semantic-release/semantic-release** version: 22.0.0
- **@saithodev/semantic-release-backmerge** version: 3.2.0

Anything else?

The problem is, that the commit https://github.com/semantic-release/semantic-release/commit/72ab317bb0c6333c643f457f5658c318b78e4740 introduced the exports property in the package.json which makes it impossible to import internal files of the package. There is also already an issue discussing this issue on the semantic-release repo: https://github.com/semantic-release/semantic-release/issues/2968.

I just wanted to drop the info here if anybody else is experiencing this issue. But also to be aware of any possible fix discussed in the linked issue of the semantic-release repo.

jagiella commented 11 months ago

I confirm, we have the same problem

saitho commented 11 months ago

I restricted the dependencies to disallow using it with v22 for now. I am not actively maintaining this plugin anymore, so I'd appreciate pull requests for any open issues.

luckyf commented 11 months ago

I restricted the dependencies to disallow using it with v22 for now. I am not actively maintaining this plugin anymore, so I'd appreciate pull requests for any open issues.

Thanks a lot @saitho. Could you trigger a new Release with your change from yesterday?

My current workaround: Add manual resolution of the semantic-release package to the package.json and then recreate the lockfile. Tested it with Yarn v1 and prevents it from installing semantic-release v22 as a dependency for @saithodev/semantic-release-backmerge.

{
  ...
  "devDependencies": {
    ...
    "@saithodev/semantic-release-backmerge": "3.2.0",
    "semantic-release": "21.1.2",
    ...
  },
  ...
  "resolutions": {
    "semantic-release": "21.1.2"
  },
  ...
}
saitho commented 11 months ago

Oh right, the build failed. Fixed and new version is released.

travi commented 11 months ago

see https://github.com/semantic-release/semantic-release/releases/tag/v22.0.3