In a npm project I want to call a custom function with arguments, or better, provide it as a script in the package.json in a manner like: npm run custom-function "Hello, World".
At the moment I have a a file src/myFunction.ts:
import * as extLib from 'libFromNodeModules'; // we need npm to resolve this dependency
export const runFunction = function (arg: string) {
  console.log(extLib.process(arg));
};
The closest thing I've managed to call this function is:
{
  ...
  scripts: {
        "custom-function": "ts-node -e 'require(\"./src/myFunction.ts\").runFunction()'",
  }
  ...
}
This does a tad more than just ts-node src/myFunction.ts, but still doesn't allow me to pass arguments and is probably not the right approach anyway. How do I have to set this up correctly?
 
    