The syntax should work (and seems to, looking at your comments). I would suggest splitting your npm scripts across multiple points, though:
{
"bundle": "NODE_ENV=production webpack --output-file bundledFile.js",
"copy": "cp package.json dist/ && cp README.md dist/ && cp .npmrc dist/",
"build": "npm run bundle && npm run copy"
}
In order to be cross-platform compatible (cp
is not typically available on windows), I would also suggest adding a build file somewhere such as ./tools/copy-distrubution-files.js
which would make use of fs
to copy the necessary files, then call it in the npm scripts with node ./tools/copy-distribution-files.js
. That will be (mostly) platform independent (you still have to assume that node
is available as the nodejs executable, but that seems fairly reasonable to me).