My package.json looks like the following:
{
\"name\": \"project\",
\"version\": \"1.0.0\",
\"description\": \"\",
\"main\": \"server.js\",
\"scripts\":
Another common alternative is to write an npm
command that references a local bash script (where you have more power to do what you want).
i.e.
# package.json
{
"name": "project",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"lint": "./node_modules/eslint/bin/eslint.js --format \"./node_modules/eslint-friendly-formatter/index.js\" .",
"build:server": "./build-server.sh"
}
}
# build-server.sh
#!/bin/bash
./node_modules/babel-cli/bin/babel.js . \
-d dist/server \
--ignore \
node_modules,\
dist,\
client,\
public,\
webpack*
NOTE: make sure you give yourself permission to run the file; otherwise you'll run into permission issues
sudo chmod 755 'build-server.sh'
See: Run script on mac prompt "Permission denied"