Yarn Licenses and Yarn Link commands
In the previous tutorial, we looked at the yarn install command, in the tutorial you are about to read, we will examine the workings of the yarn licenses and yarn link commands.
Yarn licenses
The yarn licenses command lists all the licenses for installed packages.
yarn licenses list
When you run the yarn licenses list command in any project directory, it will list alphabetically all the packages that are installed in that project using yarn or yarn install, it will also give you the license (and URL to the source code) associated with each package.
Here is a result obtained by running yarn licenses list from a .
(BSD-2-Clause OR MIT OR Apache-2.0)
? +- [email protected]
? +- URL: https://github.com/dominictarr/rc.git
? +- VendorName: Dominic Tarr
? +- VendorUrl: dominictarr.com
+- (BSD-3-Clause OR GPL-2.0)
? +- [email protected]
? +- URL: https://github.com/digitalbazaar/forge
? +- VendorName: Digital Bazaar, Inc.
? +- VendorUrl: https://github.com/digitalbazaar/forge
+- (MIT AND BSD-3-Clause)
? +- [email protected]
? +- URL: git://github.com/crypto-browserify/sha.js.git
? +- VendorName: Dominic Tarr
? +- VendorUrl: https://github.com/crypto-browserify/sha.js
+- (MIT AND Zlib)
? +- [email protected]
? +- URL: https://github.com/nodeca/pako.git
? +- VendorUrl: https://github.com/nodeca/pako
+- (MIT OR Apache-2.0)
? +- [email protected]
? +- URL: git://git.coolaj86.com/coolaj86/atob.js.git
? +- VendorName: AJ ONeal
? +- VendorUrl: https://git.coolaj86.com/coolaj86/atob.js.git
+- (WTFPL OR MIT)
? +- [email protected]
? +- URL: https://github.com/domenic/path-is-inside.git
? +- VendorName: Domenic Denicola
? +- VendorUrl: https://domenic.me
+- Apache 2
? +- [email protected]
? +- URL: [email protected]:esnext/es6-templates.git
? +- VendorName: Square, Inc.
+- Apache-2.0
? +- @xtuc/[email protected]
? ? +- URL: https://github.com/dcodeIO/long.js.git
? ? +- VendorName: Daniel Wirtz
? +- [email protected]
? ? +- URL: git://github.com/Tjatse/ansi-html.git
? ? +- VendorName: Tjatse
? ? +- VendorUrl: https://github.com/Tjatse/ansi-html
? +- [email protected]
? ? +- URL: git://github.com/lovell/detect-libc
? ? +- VendorName: Lovell Fuller
? +- [email protected]
? ? +- URL: git://github.com/faye/faye-websocket-node.git
? ? +- VendorName: James Coglan
yarn licenses generate-disclaimer
Whenever this command is run, it will return a sorted list of licenses from all the packages that you have installed to the stdout.
yarn link
The yarn link will symlink a package folder during development.
During development, you can link a package into another project. In most cases this is used to test out new features or when you are trying to debug an issue in a package that manifests itself in another project.
The two commands used to facilitate this workflow are:
a. yarn link (in the package you want to link)
b. yarn link [package]
yarn link (in the package you want to link)
You run this command in the package folder that you would like to link, for instance, if you are working on vue and would like to use your local version to debug a problem in vue-calendar, first thing to do is to run yarn link inside the vue project.
yarn link [package]
You can use the yarn link [package] command to link another that you would like to test into your current project. continuing from the previous step, in the vue-calendar project, you would need to run yarn link vue to use your local version of vue that was linked in the previous step.
Here is a complete example, where I have two folders vue and vue-calendar
Commands:
$ cd vue
$ yarn link
Output:
yarn link v1.2.1
success Registered "vue".
info You can now run `yarn link "vue"` in the projects that you want to use this module and it will be used instead.
Commands:
$ cd ../vue-calendar
$ yarn link vue
Output
yarn link v1.2.1
success Registered "vue".
The result of this is the creation of a symlink named vue-calendar/node_modules/vue that links to your local copy of the vue project.
If you want to reverse this process, all you need to do is to run yarn unlink or yarn unlink [package]
Previous:
Yarn Install commands.
Next:
Yarn List, Lockfile, Login, and Logout Commands.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/yarn/yarn-licenses-and-yarn-link-cli-commands.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics