microsoft / microsoft/beachball
Enable beachball usage in Angular workspace
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 815
- Forks
- 93
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 12
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the publish argument assembly in beachball/lib/packageManager/npmArgs.js and compare it with the Angular library publishing flow described in the issue. Trace how package.json and invoke-publish are selected, then define a configurable publish command and verify that registry, tag, and authentication arguments still reach the command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- release
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100