I have a frontend web app created using Angular 2 and TypeScript, and I just can't find a way to properly organize the build process.
Let's say I have this structure which I think is reasonable:
/
- dist/ <-- transpiled .js files
- src/ <-- .ts files
- assets/
- bower_components/
- node_modules/
- package.json
- index.html
Question 1
Of course I'd like not to have the src folder on the production server. But when should I delete it, if I should? With a npm script? With a Grunt task? With a rm when creating a Docker image?
The same thing applies for package.json and Gruntfile.js.
Question 2
A similar issue comes from the node_modules folder: I use Browserify to bundle most of the dependencies of my app into a single file, so for example Angular becomes part of dist/bundle.js.
Should I delete node_modules on the production server, given that it isn't useful anymore? How?
For some reason I might use some modules that won't get included into the final bundle (e.g. because they're referenced from <script> tags): how do I know what to delete and what to keep?