RFC: Plans for future `bolt publish`
- Dominant language
- JavaScript
- Stars
- 2.4k
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
Just putting some of our discussion about bolt publish here for further discussion and visibility.
**Current state**
`bolt publish` currently only accepts one flag (`--access`) and will currently do the following:
* fetch the `latest` version of each (non-private) package in the project (`npm info packageName version`)
* compares these versions to the ones on disk
* for each package who's local version is `semver.gt` than the version on npm
* npm publish is called (with `--access` flag passed in)
**Feature request**
* Users would like to be able to pass the `--tag` flag in as well.
* To support this we might need to think about how the flags get applied to all the packages being published (should it apply to all of them?)
**Going forward**
I think the first thing we should think about is how different users will be using the `publish` feature.
1. They have a tool that is bumping versions and dependencies and need to publish all packages that are ahead of npm (i.e `bolt release`)
2. They are doing manual versioning (manual meaning on their local machine, they could be using `bolt version` for example).
* They might want to also be doing tagged releases here
3. They have a mono-repo but want lock-stepped versioning across all the packages and want them all the release together (i.e https://github.com/electron-userland/electron-forge CC: @MarshallOfSound )
**Suggested Plan**
I think we can solve all of these usecases by doing the following
```
if: we are in a package instead of a project root:
just pass flags on and call `npm publish`
exit
if: we are in a non-interactive shell
(go with current behaviour)
get all package versions from npm
get list of our packages that are ahead of npm version (being careful with `semver.gt`
run `npm publish` with whichever flags were passed to us
warn/throw if npm is ahead of us
exit
collect list of packages that are ahead of npm
show list to user and allow them to select which they want to publish
publish only those
```
Any/all of this functionality could live behind flags (`--all`, `--interactive`, `--warnOnNpmAhead`, just wanted to get this up here for discussion
Contributor guide
Research direction
Start by reading the current `bolt publish` command implementation, especially how `--access`, `npm info`, version comparisons, and `npm publish` are handled. The issue is an RFC with several proposed workflows and flags but no selected design, so completion depends on reaching agreement before implementation and testing can be defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, release
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100