DEV Community

Discussion on: Create a React component library with Vite and Typescript

Collapse
 
palmerama profile image
Adam Palmer

Great article! Thanks. But your prepack script deletes all my deps on npm publish. Is there a way to make it add them back in?

Collapse
 
nicolaserny profile image
Nicolas Erny • Edited

For my use case, it wasn't an issue because I only run pack/publish in our CI environment.
If you want to get the deps back, here's a quick idea:

  • create a temporary backup of the package.json file in the prepack script
  • add a postpack script to restore the package.json file

Perhaps, we could find a tool to manage the packaging/versioning. For more advanced use cases, I would start digging here: turbo.build/repo/docs/handbook/pub....

Hopefully, my answer will be useful.

Collapse
 
palmerama profile image
Adam Palmer

Thanks Nicolas. I've actually just implemented this, which solves it nicely. Removes and adds back in the deps, along with anything else the package doesn't need, like scripts. npmjs.com/package/clean-package

Thread Thread
 
stephyswe profile image
Stephanie

any way to share repo? :) @palmerama