npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

command aliasing in package.json

Locally app runs using dev-dep ts-node. When deployed everything is transpiled, dev-deps get dropped and app runs just node . My run scripts loook like this:

"scripts": {
  "start": "ts-node src/index",
  "start:js": "node src/index",
  "init": "ts-node bin/init",
  "init:js": "node bin/init",
  "database:init": "ts-node bin/database-init",
  "database:init:js": "node bin/database-init",
  "database:migrate": "ts-node bin/database-migrate",
  "database:migrate:js": "node bin/database-migrate",
  "add:user:to:organization": "ts-node bin/add-user-to-organization",
  "add:user:to:organization:js": "node bin/add-user-to-organization"
},

if something like an alias field could be added, I can do this…

"aliases": {
    "right-node": "$(which ts-node || which node)"
}
"scripts": {
  "start": "right-node src/index",
}