`afterPublish` is called before the package is effectively published
- Dominant language
- JavaScript
- Stars
- 776
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I'm trying to [upgrade my package dependency after it was published](https://github.com/francoischalifour/autocomplete.js/blob/5594bf0eb13956e760144e271e047069703dea2a/ship.config.js#L18-L32) with the `afterPublish` hook. However, [Ship.js doesn't wait for the publication](https://github.com/algolia/shipjs/blob/ef5f8b9ba9571c787b7e4ec7569ed4920f3189d9/packages/shipjs/src/flow/release.js#L51-L52) to run `afterPublish`. Therefore, the npm registry isn't updated when the function is called, [resulting in an upgrade error](https://circleci.com/gh/francoischalifour/autocomplete.js/204).
**To Reproduce**
Steps to reproduce the behavior:
1. Add an `afterPublish` hook that relies on the npm registry
2. Trigger a release (on CircleCI for instance)
3. `afterPublish` errors because it's called before the package is effectively published to the npm registry
**Expected behavior**
We should somehow await [before calling `runAfterPublish`](https://github.com/algolia/shipjs/blob/ef5f8b9ba9571c787b7e4ec7569ed4920f3189d9/packages/shipjs/src/flow/release.js#L51-L52) so that this kind of `afterPublish` scripts is made possible.
**Side note**
It'd be nice to have access to a `version` parameter in the `afterPublish` function so that we don't need to read it from `package.json`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in packages/shipjs/src/flow/release.js at the call to runAfterPublish referenced by the issue. Trace how publication completion is handled before that point, then verify with the release flow tests that an afterPublish hook depending on the npm registry runs only after the package is effectively published.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- release
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100