This document discusses using npm scripts for front-end automation and builds. It argues that npm scripts provide a simple, cross-compatible way to automate tasks like bundling, transpiling, testing and deployment without additional build tools. Npm scripts take advantage of existing CLI tools and allow decomposing complex automation into simple, composable tasks through lifecycle scripts and npm-run-all. Some tradeoffs are less extensibility and ongoing challenges with cross-platform support, but the approach aims to provide simpler mental models than alternative build systems.
6. “Systems tend to grow, and as they grow, they encroach”
“Systems tend to expand to fill the known universe.”
—John Gall, The Systems Bible
7. The more complex and self-sufficient the
automated system, the more difficult it
will be understand and operate.
The Paradoxes and Ironies of Automation, David Wentzel.
http://www.davewentzel.com/content/paradoxes-and-ironies-automation
8.
9. 1. Takes advantage of the natural interface presented
by its component parts;
2. Breaks down complex things into simple,
composable things;
3. Makes compromises intentionally, not
circumstantially
Your system can win, if it:
13. npm scripts can:
transpile es2015, transpile jsx, minify/optimize code, optimize svgs, copy,
rename and move files, compile css via a pre-processor, add autoprefixing,
source maps for js/css development, build Android and Firefox OS apps from
source with cordova, run unit tests, run code linting, run style checking,
run test coverage reporting, deploy releases, run watch for developer
environment and live reload dev server, etc. etc. etc.
in twenty lines or less, with zero plugins.
40. Components of an automated system are simple
when they have a single, well-defined objective.
Good complex tasks are composed
of well-defined simple ones.