You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Execute the final npm publish command from a subdirectory? #423
In tools like lerna, it's possible to set publishConfig.directory and this tell the publish command that the actual directory is different.
Proposed solution
I assume the entire flow should be the same, but these changes are needed:
If a different location needs to be published, then changesets version should be executed in order to update the original package.json with the new version number, and commit it.
Then, the custom build command should be executed (yarn build for example). This creates ./dist directory in each package of the monorepo, with the compiled code and new package.json (that already contains the updated versions, because of changesets version command)
changesets publish should take into account that publishConfig.directory might be set, and do everything the same way, except when it's running npm publish - it should use the subdiretory specified as cwd. This way it will execute it correctly and publish it from the sub-directory.
For those getting here because they're trying to publish a package like a Svelte component library using svelte-kit package (and the associated ./package directory), you just need to add the following to your package.json to get it to work with changesets:
Activity
Andarist commentedon Aug 4, 2020
This got implemented in #428 🚀
danawoodman commentedon Aug 22, 2022
For those getting here because they're trying to publish a package like a Svelte component library using
svelte-kit package(and the associated./packagedirectory), you just need to add the following to yourpackage.jsonto get it to work with changesets:{ "publishConfig": { "directory": "./package" } }