Custom build script in Node.js
For simple build tasks in Node.js I use a custom script. Let’s consider the following requirements:
- Create the
distanddist/assetsfolders. - Concatenate several JavaScript files and save to
dist/background-dist.js. - Copy
assets/*.pngfiles todist/assets/. - Copy several other files.
Here is the source file:
JS
build.js
Finally, add the script to package.json:
JSON
package.json
Read next
By the way, I’ve put together a small collection of tools I use regularly — things like time tracking, Git helpers, database utilities, and a few others that make development a bit smoother.