I made a package with react and typescript. Because of how typescript handles the publishing of the classes and interfaces, I need to build the package and commit the built files with every change.
Is there a way to tell npm, that it has to build the specific package after "npm install" or "yarn install"?
I tried adding "postinstall": "npm run build" and "prepare": "npm run build" but it seems, that the project, in which the package is installed, runs this commands in his own root directory, so it builds itself, instead of just the package.
I thought of something like this:
- Coding in a project
yarn add packageXyarn install- packageX runs
npm run buildin its own directory - make changes in packageX
- run
yarn update packageX - packageX runs
npm run buildin its own directory - run
yarn buildin project root - Project builds itself
Is there a way to accomplish that?
Thanks for your answers.