`changeset publish` and `changeset version` do not run package.json `prepublish` or `version` scripts
See original GitHub issueThanks for your work on this.
NPM lifecycle scripts do not seem to work. When I run a command like changeset publish
on a repo using yarn workspaces, I’m not seeing any prepublish scripts run. When I do yarn workspace <workspace_name> exec npm publish
, the prepublish scripts run as usual.
Affected Packages
@changesets/cli
https://github.com/changesets/changesets/tree/main/packages/cli/src/commands/publish
Problem
Running changeset publish
or changeset version
does not trigger any npm lifecycle scripts.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Creating git tags fails · Issue #196 · changesets ... - GitHub
When running yarn changeset publish (on Debian) I get this error: ... info @undataforum/tokens is being published because our local version ...
Read more >How to detect when `prepublish` script is executed as a result ...
I want my script to execute only in case of user executing npm publish . However, NPM will execute "prepublish" script if user...
Read more >@changesets/cli - npm
Organise your package versioning and publishing to make both contributors and maintainers happy. Latest version: 2.25.2, last published: 25 ...
Read more >Creating a Yarn Monorepo in 2022 - Heygrady
This step will install Yarn Berry, create a package.json pre-configured ... "yarn build && changeset publish", "version": "changeset version ...
Read more >publish-police - NPM Package Overview - Socket - Socket.dev
check npm dist before publish. Version: 0.0.3 was published by qidanta. ... { "ci:publish": "pnpm run build && publish-police && pnpm changeset publish",...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Run into the same problem, not sure if we’re in the same context when running the script, but after some digging, I found the problem probably related to run
changeset publish
in CI system like gitlab CI. So in general, npm will not execute lifecycle hooks when it’s executed in root role. (in early npm versions before npm@7 ?), so maybe that’s why it worked in the local. It’s not a problem forchangeset
, just post the results here so anybody can reference this in the future.related topics:
potential solutions:
true
yarn build
before publishHm, I’ve just tested with npm 6 in your repo and I still get the same result.