Is it possible to invoke a yarn script in a dependency module?

Issue

I have a node application which has dependency. This dependency comes with a yarn script defined in the dependency’s package.json.

So it’s

app.js
package.json
node_modules
  my_dep_module
    package.json // contains this line { scripts: { runme: "node util.js" } }
    util.js

How can I invoke, if at all, the runme script of my_dep_module from the application (root) context?

Solution

It seems that if your dependency wanted to export one or more executable scripts for your use, they’d have added them to their package.json’s bin field.

Answered By – Ian Phillips

Answer Checked By – Timothy Miller (AngularFixing Admin)

Leave a Reply

Your email address will not be published.