Reputation: 61
I want to be able to install my package through npm and then run app.js
with a custom command without using npm start
. I have looked around the web and many examples show adding a line in scripts
in the package.json
file, but all of these require it to be run using npm start
. Is there a way to execute a .js
file with node using a custom command e.g. importer --file
?
Upvotes: 1
Views: 743
Reputation: 7204
Before publishing your package, you'll need to have a package.json
file with at least the following:
{
"name": "importer",
"version": "0.0.1",
"bin": "./importer.js"
}
Upvotes: 1