Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSR fails on npm version step in workspaces #112

Closed
deanohyeah opened this issue Apr 21, 2022 · 4 comments
Closed

MSR fails on npm version step in workspaces #112

deanohyeah opened this issue Apr 21, 2022 · 4 comments

Comments

@deanohyeah
Copy link
Contributor

After NPM V8.5 MSR fails to properly version packages.

The cause seems to be rooted in NPM version here.
npm/cli@723a091

npm version now triggers an update. This causes MSR to fail because it hasn't updated the version numbers to the packages workspace dependencies.

command: 'npm version 1.1.17 --userconfig /private/var/folders/ma/04c2f7cs14lf92g8gf2dsq/T/fa64d3b635b5700135e79f5158c3/.npmrc --no-git-tag-version --allow-same-version',
  escapedCommand: 'npm version 1.1.17 --userconfig "/private/var/folders/ma/04c2f7c4lf92g8gf2ds1sc0000gq/T/fa2a9d64d635b5700135e79f5158c3/.npmrc" --no-git-tag-version --allow-same-version',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '@ui/user\nv1.1.17',
  stderr: 'npm ERR! code ETARGET\n' +
    'npm ERR! notarget No matching version found for @ui/dropdown@1.10.0.\n' +
    'npm ERR! notarget In most cases you or one of your dependencies are requesting\n' +
    "npm ERR! notarget a package version that doesn't exist.\n" +
    '\n' +
    'npm ERR! A complete log of this run can be found in:\n' +

Since this behavior is now default, would need to some how get a --no-workspaces-update to semantic releases use of npm version in
https://github.com/semantic-release/npm/blob/master/lib/prepare.js#L12

@antongolub
Copy link
Collaborator

Similar issues raises in yarn 2+. We use a semrel/exec-based workaround:

module.exports = {
  branch: 'master',
  plugins: [
    [
      '@semantic-release/commit-analyzer',
      {
        preset: 'angular',
        releaseRules: [
          {type: 'docs', release: 'patch'},
          {type: 'refactor', release: 'patch'},
        ],
        parserOpts: {
          noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES']
        }
      }
    ],
    '@semantic-release/release-notes-generator',
    '@semantic-release/changelog',
    [
      '@semantic-release/exec',
      {
        prepareCmd: 'YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install && git add ../../yarn.lock',
      }
    ],
    '@semrel-extra/npm',
    '@semantic-release/github'
    ...

@deanohyeah
Copy link
Contributor Author

@antongolub thank you for the suggestion!

I was actually able to get it to work by running
npm config set workspaces-update false
before the MSR command
I wasn't aware that was a valid config

@antongolub
Copy link
Collaborator

Great! Maybe you'd lke to add some notes to the readme.md troubleshooting section?

@deanohyeah
Copy link
Contributor Author

Sure thing, how bout this #113

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

No branches or pull requests

2 participants