prune: check package.json before running

Fixes #3755.
prune: --production option to unbuild devDependencies