semantic-release-monorepo ignores pkgRoot

442 Views Asked by At

I created a minimal reproduction which is a monorepo contains only one workspace in `./package' dir

both root and package (the workspace) have exactly the same release.config.js file except that package extends semantic-release-monorepo.

both of them use the default configurations and only two plugins

module.exports = {
  plugins: [
    "@semantic-release/commit-analyzer",
    ["@semantic-release/npm", { pkgRoot: "dist" }],
  ],
  // extends: ["semantic-release-monorepo"],
};

the important part here is that @semantic-release/npm uses { pkgRoot: "dist" }

package contents are typically the same as the root including dist folder, except the package name.

if I run semantic-release from the root, i.e without semantic-release-monorepo it packs the package as expected, and puts the contents of pkgRoot dir in the top-level of the published package.

in contrast, when I run the same command from package, i.e with semantic-release-monorepo, it ignores the option pkgRoot and the packed packages contain the folder dist instead of its contents.

steps for reproduction 1- clone the repo and install dependencies 2- remove all local and remote tags if exist 3- switch to the branch next 4- modify root's and package's files and create feat/fix commits 5- run the script release from the root and package and see the tarball's contents in both cases

you will see different behavior.

0

There are 0 best solutions below