I have a NodeJS app for HTTP call managment
I must execute one JS file (./src/starter.js
) before real app starts (./src/boot/index.js
)
This is my package.json
file:
"engines": {
"node": ">=16.0.0",
"npm": ">=8.0.0"
},
"scripts": {
"dev": "nodemon",
"build": "npm-run-all clean transpile",
"server": "cross-env NODE_ENV=production node --max-old-space-size=8192 ./dist/boot/index.js",
"server:stage": "cross-env NODE_ENV=stage node --max-old-space-size=8192 ./dist/boot/index.js",
"server:test": "cross-env NODE_ENV=test node --max-old-space-size=8192 ./dist/boot/index.js",
"server:production": "cross-env NODE_ENV=production node --max-old-space-size=8192 ./dist/boot/index.js",
"transpile": "babel ./src --out-dir dist",
"clean": "rimraf dist",
"build:css": "node-sass --include-path scss scss/app.scss public/css/app.css --output-style compressed",
"watch:css": "nodemon -e scss -x \"npm run build:css\"",
"watch:dev": "cross-env NODE_ENV=development babel-node --max-old-space-size=8192 ./src/boot/index.js"
},
[...]
And this is my nodemon.json
(Nodemon configuration file):
{
"exec": "npm-run-all --parallel watch:dev watch:css",
"watch": [
"src/*",
"public/*",
"scss/*",
"lowdb"
],
"ignore": [
"docker",
"dist"
]
}
How can I run "./src/starter.js
" file before the "dev" script (in terminal: npm run dev
)?
Thank you
CodePudding user response:
"dev": "./src/starter.js && nodemon",