multiple npm commnd aliases for same npm script

Viewed 197

Is there a way to create many aliases / command names for same same npm scripts in package.json.

ex: i want following, i.e either user runs npm run cmd1 or npm run cmd2 same thing happens.

package.json:

{
  "name": "....",
  "version": "1.0.0",
  "description": ".....",
  "scripts": {
    "cmd1 [or] cmd2": "some big script here",
    // "cmd2": "same big script here", // don't want this redundant line

    // something like 
    "install [or] i": "initialization script here",
    "start [or] begin": "starter script here",

  }
}
1 Answers

I think, it's not possible. However, you could stick to the following attempt, which skips the redundant statement of your script:

"scripts": {
  "cmd1": "npm run cmd3",
  "cmd2": "npm run cmd3",
  "cmd3": "big script here",
  ...
}
Related