feat: additional arguments publishArgs and versionArgs for npm commands
          #534
        
          
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
I built my own monorepo ecosystem based on semantic release.
During the NPM release process, I encountered resistance, so I added two conservative features.
Since specifying a workspace in
.npmrcsuch asworkspace=packageswill change the behavior of executingnpm runin the root directory, we usually don't want to store.npmrc, and NPM will not automatically read the.workspacessettings in package.json when runningnpm publishandnpm version, which is quite inconvenient.Of course, we can execute
echo -e "\nworkspace=packages/**/*" >> .npmrcon CI, but as mentioned above, it will affect the execution of subsequent instructions, which will make the command of the project not predictable.Before submitting this PR I removed
@semantic-release/npmpackage and solved my problem inpublishCmd:{ "publishCmd": "npm publish --workspace=packages" }But I found that I was missing a lot of the benefits that
@semantic-release/npmbrought me.You can see the use cases I added in the README:
{ "publishArgs": ["--workspace", "packages"], "versionArgs": ["--workspace", "packages"] }These test cases were failing before I made any changes:
I even use it on the Master CSS open source project, which is a monorepo, and it works nicely with Semantic Release.
This is not a monorepo-specific feature, but this can be very useful in monorepo projects with multiple packages. Hope this feature passes quickly, thanks to the Semantic Release team for all you do.