-2

if i published my project, i can get through

npm i <myproject>

if i want to use, i need to call like

./nodemodules/myproject [arg0] [arg1]

or

npx myproject [arg0] [arg1]

but i don't want to call ./node.. or npx instead i want to use custom keyword to call my project like newman

If you see this project : https://www.npmjs.com/package/newman

they are simply calling

newman run colname environment 

no where they are using

./nodemodules/newman or npx newman

likewise, i want custom keyword that should recognize mine ./nodemodules/myproject

suggest me how newman did this ? or suggest how to achieve this ?

Jayanth Bala
  • 758
  • 1
  • 5
  • 11
  • https://docs.npmjs.com/cli/v6/configuring-npm/package-json#bin – jonrsharpe Sep 28 '21 at 08:15
  • https://docs.npmjs.com/creating-and-publishing-scoped-public-packages – perepm Sep 28 '21 at 08:30
  • @jonrsharpe i added the bin too "bin": { "my-package": "out/index.js" } .......... if i call "my-package", i am getting the error - is not recognized as an internal or external command, – Jayanth Bala Sep 28 '21 at 09:13
  • 1
    Are you installing it _globally_? If not, as the docs say, it's linked to `./node_modules/.bin` (which is added to the path when you `npm run` a script). – jonrsharpe Sep 28 '21 at 09:14
  • let me install it globally and try it. – Jayanth Bala Sep 28 '21 at 09:16
  • @jonrsharpe Thank you so much. this should not be installed locally. please add this as comment. people can upvote. it is working for me now after installing it globally. – Jayanth Bala Sep 28 '21 at 09:20

1 Answers1

0

Global installation resolved the issue, Thank you @jonrsharpe. New module exposed in npm registry

https://www.npmjs.com/package/jaiman

Jayanth Bala
  • 758
  • 1
  • 5
  • 11