Reputation: 246
I'm trying to build a CLI using oclif and it doesn't seem to work for anything I tried. I see a lot of people making it work for them so can maybe someone point me to my issue!
My steps:
1. mkdir test && cd test
2. npm init -f
3. npm i oclif
4. npx oclif generate my_test //this generates a new cli
5. cd my_test
6. npx oclif generate command bob
7. npm link
8. npx my_test bob
I always get
› Error: command bob not found
Same if I do ./bin/run bob
However, if I run the test for the bob command, the test passes.
Thank you in advance.
Upvotes: 4
Views: 3814
Reputation: 163
Sorry for being late replying... Intel's answer is almost correct - and until version 6 of npm it actually was. Correct is:
npm run build
Whereas oclif generate command
just creates the Typescript file for the command and its test class under src/, above will create its Javascript file into dist/. npm link
does probably nothing to your project at all - just creates a symlink pointing to it. npm test
makes use of ts-node to directly execute Typescript.
Upvotes: 3