How do I dist JUST my non-development npm dependencies after building my app

7 Views Asked by At

We have many projects - they are typescript but that is not of particular importance, the important thing is that we have dev dependencies. In fact most of our projects have far more dev dependencies than prod dependencies - endless testing frameworks.

So, I checkout all my dependencies, build and test my app and assuming it is all OK I want to dist my compiled application, with its dependencies.

Is there an easy way of doing this?

1

There are 1 best solutions below

0
On

One way I thought of that is a possible solution is as follows: (this runs on a CI build so we need to start from scratch)

  • npm install
  • npm run build
  • npm test
  • npm rimraf node_modules (I assume this will work...)
  • npm install --production

Comments on this approach?