Add a devDependency that executes a shell command

56 views Asked by At

To run an external command as a grunt task, we can use grunt-shell, grunt-exec or grunt-spawn.

To build a project, I must ensure that a certain tool is installed. The tool isn't available via npm, but requires running a command to install. So I need to add a devDependency to a package.json that involves executing an external command. How can I do that?

1

There are 1 answers

2
hereandnow78 On BEST ANSWER

You can define preinstall/postinstall commands in the scripts block of the package.json:

{
  "scripts": {
    "preinstall": "your install-command",
    "postinstall": "your install-command"
  }
}

Choose which one fits your needs!