microsoft / microsoft/beachball
Error running "check" when beachball not installed at the root of the git repo
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 815
- Forks
- 93
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 12
Description
I have a git repo where the NPM workspace that uses beachball is not at the git root:
my-repo/
├─ .git
├─ web/
│ ├─ package.json <-- contains beachball as devDependency and "check": "beachball check" in the scripts section
│ ├─ package-lock.json
│ ├─ node_modules/
When I run npm run check from the web directory, I get the following error:
> beachball check
beachball v2.21.0 - the sunniest version bumping tool
An error has been detected while running beachball!
Error: invalid package.json detected
at getDefaultRemote (/my-repo/web/node_modules/workspace-tools/lib/git.js:402:15)
at Object.getDefaultRemoteBranch (/my-repo/web/node_modules/workspace-tools/lib/git.js:367:27)
at Object.getRepoOptions (/my-repo/web/node_modules/beachball/lib/options/getRepoOptions.js:34:52)
at Object.getOptions (/my-repo/web/node_modules/beachball/lib/options/getOptions.js:12:117)
at /my-repo/web/node_modules/beachball/lib/cli.js:22:34
at Generator.next (<anonymous>)
at /my-repo/web/node_modules/beachball/lib/cli.js:8:71
at new Promise (<anonymous>)
at __awaiter (/my-repo/web/node_modules/beachball/lib/cli.js:4:12)
at /my-repo/web/node_modules/beachball/lib/cli.js:21:8
The problem appears to be that beachball (or workspace-tools) is expecting a package.json to exist at the root of my-repo, next to .git.
I believe this is meant to be a supported use case, given that similar issues have been fixed in the past: #439
The only workaround I've found is to install and run beachball from the git root, as described in #340
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
Reproduce the failure by running npm run check from the web directory, then start with workspace-tools/lib/git.js and beachball/lib/options/getRepoOptions.js from the stack trace. Compare how the repository root and package.json are discovered; done means check runs successfully when the workspace is below the git root without requiring beachball at the repository root.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, typescript
- Domain
- release, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100