beachball
beachball copied to clipboard
Enable beachball usage in Angular workspace
In an angular workspace the package.json for the library is not the package that npm publish is called on. Instead Angular creates a separate dist/my-lib folder with a new package.json that should be published. See the publishing your library Angular topic.
We have been able to workaround this behavior by:
- Creating a custom
invoke-publishcommand that redirects to the actual package to publish:"invoke-publish": "npm run invoke-publish:setup && cd ../dist/nimble-angular && npm publish", // call publish in the new built package "invoke-publish:setup": "cd ../ && npm run build:nimble" // rebuild the package in angular so it has the beachball bumped version - Patch beachball using patch-package to run the custom
invoke-publishcommanddiff --git a/node_modules/beachball/lib/packageManager/npmArgs.js b/node_modules/beachball/lib/packageManager/npmArgs.js index 9ed1d08..a3f064c 100644 --- a/node_modules/beachball/lib/packageManager/npmArgs.js +++ b/node_modules/beachball/lib/packageManager/npmArgs.js @@ -9,7 +9,9 @@ function getNpmPublishArgs(packageInfo, options) { const { registry, token, authType, access } = options; const pkgCombinedOptions = packageInfo.combinedOptions; const args = [ - 'publish', + 'run', + 'invoke-publish', // Note the new command name + '--', // Note the -- flag used so that parameters are passed to the sub command of the new command '--registry', registry, '--tag',
An alternate publish command is required because one can't prevent the default publish behavior of the publish script.
Could beachball support a configurable publish command for this kind of scenario / be open to a contribution? Related #651