Understanding npm Lifecycle Scripts (Once and For All)

Or: how a simple question about prepare vs prepublishOnly turned into a full-blown reverse-engineering of npm.