It's difficult to make yarn link
work as intended when developing a command line project. The easiest way is:
-
yarn link
in your cli project
assume your cli project is cli-project
, assume the name is cliProject
# in cli-project
yarn link
- create a demo project and init with yarn
mkdir demo-project
cd demo-project
yarn init -y
add your cli project as dependency in
package.json
yarn link cliProject
indemo-project
# in demo-project
yarn link cliProject
now you can use yarn cliProject
here. In my situation, I would
# in demo-project
yarn cliProject --version # to check if yarn link succeeded
yarn cliProject new haha-project # to test my new command
Top comments (0)