Supply a list of files and they will be uglified in-place. This uses uglify - if you have ES6 code, use babili-inplace instead.
npm install -g uglify-inplace
Supply a list of files and they will be uglified. For example, the following will overwrite index.js with a minified version.
uglify-inplace index.js
You can also use wildcards. It will only minify Javascript files ending in .js and ignore other files. For example, to uglify all javascipt files in the current directory:
uglify-inplace ./*