sezna / nps

NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to execute locally-defined function?

dkent600 opened this issue · comments

Hi, this is just a question:

I want to execute a javascript function (as opposed to a script) using nps. But I haven't been able to figure out how to do it. I've defined the function in the package-script.js file in several ways but the best I have been able to get from nps is that "myFunction is not recognized as an internal or external command"

I imagine there must be some trick to doing this, but can't find any clues in all of the example code you provide.

Is this possible?

Thanks!

Hi @dkent600,

So part of nps mission is to not become another gulp where it allows you to run arbitrary JavaScript for your scripts (it's in the roadmap). If you want to do that, put that javascript in another file and make your script node ./your-script.

Good luck!

Thanks, that was the clue I needed!