0

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

1 Answer 1

1
"dev": "./src/starter.js && nodemon",
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.