0

Please or Register to create posts and topics.

Moving from concurrently to npm-run-all in package.json

The below update affects QuickApp Pro and QuickApp Standard and existing applications are encouraged to make this change.

In order to dynamically build changes you make to your themes in QuickApp, we use the npm package concurrently to watch for changes in the theme files and build them using node-sass when you change them.

This is done by starting ng serve and node-sass in watch mode when you run npm start.

But the package concurrently has the limitations of not accepting external arguments. So any arguments you pass to npm start (including --port xyz) gets ignored. One of the very nuisance of this limitation is you can only start one instance of QuickApp through the npm start command, since they'll all start with the default port 4200. This also affects starting from VisualStudio with F5.

Now the switch to npm-run-all. npm-run-all allows external arguments to pass through to the underlying scripts, hence the negative effects with concurrently described above are averted.

With npm-run-all, npm start will now accept your command parameters and also you can run more than one instance of QuickApp in VisualStudio by simply pressing F5 without any port collisions.

 

CHANGES:

From:

"scripts": {
    ...
    "start": "concurrently --kill-others \"ng serve\" \"npm run theme\"",
    "theme": "node-sass --watch src/app/assets/themes/ --output src/assets/themes/ --output-style=compressed",
    ...
  },

"devDependencies": {
    ...
    "concurrently": "^x.y.z"
    ...
  }

 

To:

"scripts": {
    ...
    "start": "run-p theme \"serve -- {@}\" --",
    "serve": "ng serve",
    "theme": "node-sass --watch src/app/assets/themes/ --output src/assets/themes/ --output-style=compressed",
    ...
  },

"devDependencies": {
    ...
    "npm-run-all": "^x.y.z"
    ...
  }