Monday 23 September 2019

Compile typescript on NPM package install

Hey, im looking for a a best way of handling shared code in my company in typescript. Previously we used symbolic links to make the folders appear inside the project but I came up with a better solution to leverage NPM local file references which still create symbolic links but in the node modules folder and with the nom install command.I achieved this by changing the post install script to npm prune (seems to download modules without causing recursion), rm -rf dist (remove the build directory) and tsc (to compile).This has been working moderately well until today when i was nesting a shared package inside another shared package which didnt work. Any advice on a better solution that doesnt involve storing build artifacts or publishing private code to the npm repo.tl;dr is there a better way to do ‘npm prune && rm -rf dist/ && tsc’?

Submitted September 23, 2019 at 09:12PM by NikZM

No comments:

Post a Comment