"it's" is "it is" and not "its" !!
2 KiB
Working with Packages
As we are using yarn
for managing packages, here are some helpful tips for
whenever you need to work with them.
Install packages
To ensure you have the right version of dependencies, run this command after cloning or switching branches.
> yarn
This will restore the versions stored in the lock file to the node_modules
folder.
Add new packages
Rather than updating the package.json
explicitly, you can install new
dependencies via the yarn
command line:
# adds the package to the dependencies list
> yarn add [package-name]
# adds the package to the devDependencies list
> yarn add [package-name] --dev
Updating packages
To see which packages have newer versions available:
> yarn outdated
To upgrade a package to its latest version:
> yarn upgrade --latest [package-name]
To upgrade a package to a specific version (or version range):
> yarn upgrade [package-name]@[version]
Removing packages
To remove any packages that are no longer needed:
> yarn remove [package-name]
Upgrading Yarn
Desktop uses a local version of yarn
to ensure one version is used on all
platforms that we develop on. To upgrade Desktop to the latest version of yarn
:
- download the
yarn-x-y.z.js
file from the latest release on GitHub - add it to the root
vendor
folder on disk - remove any previous version
- edit
.yarnrc
to use this new version (ensuring thex.y.z
matches the version you just downloaded)
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
yarn-path "./vendor/yarn-x.y.z.js"
- edit
app/.yarnrc
to use this new version (ensuring thex.y.z
matches the version you just downloaded)
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
yarn-path "../vendor/yarn-x.y.z.js"
- Commit these changes and open a pull request to get them reviewed