|
| 1 | +# Updating Dependencies |
| 2 | + |
| 3 | +> A guide to updating project dependencies. |
| 4 | +
|
| 5 | +## Introduction |
| 6 | + |
| 7 | +This is a guide to updating project dependencies. Various project dependencies require tailored update procedures, which are documented here. |
| 8 | + |
| 9 | +## Electron |
| 10 | + |
| 11 | +To update [Electron][electron], perform the following steps: |
| 12 | + |
| 13 | +1. [ ] Check the version release notes to ensure that updating [Electron][electron] will **not** introduce breaking changes. Note that a major [Electron][electron] release does **not** imply breaking changes within the project. What matters is what changes are included in the release and whether those changes affect our usage of [Electron][electron]. If updating [Electron][electron] **will** introduce breaking changes, assess the implications to the project and determine whether the changes affect internal project usage or will cause downstream effects for project consumers. If the former, assess whether refactoring to accommodate the changes is possible. In both scenarios, consult with a project lead to determine an update strategy. |
| 14 | +2. [ ] Update the configuration file found in `/etc` for [David][david], a service which monitors npm for new releases, to use the desired [Electron][electron] version. |
| 15 | +3. [ ] Update the default `DEPS_ELECTRON_VERSION` Makefile environment variable value to the desired [Electron][electron] version. |
| 16 | +4. [ ] For each [Electron][electron] checksum found in `/deps/checksums`, rename the folder to the desired [Electron][electron] version and update the checksum for each target platform. If [Electron][electron] adds support a new target platform, add the checksum. If [Electron][electron] removes support for a target platform, remove the existing checksum. |
| 17 | +5. [ ] Commit the changes. |
| 18 | + |
| 19 | +## Node Modules |
| 20 | + |
| 21 | +To update `node_modules` dependencies, perform the following steps: |
| 22 | + |
| 23 | +1. [ ] Check the dependency's release notes, changelog, and/or commit history to ensure that updating the dependency will **not** introduce breaking changes. Note that a major release does **not** imply breaking changes within the project. What matters is what changes are included in the release and whether those changes affect our usage of the dependency. If updating a dependency **will** introduce breaking changes, assess the implications to the project and determine whether the changes affect internal project usage or will cause downstream effects for project consumers. If the former, assess whether refactoring to accommodate the changes is possible. In both scenarios, consult with a project lead to determine an update strategy. |
| 24 | + |
| 25 | +2. [ ] Remove the dependency. If the dependency is a production dependency, |
| 26 | + |
| 27 | + ```bash |
| 28 | + $ npm uninstall <package> --save |
| 29 | + ``` |
| 30 | + |
| 31 | + If the dependency is a development dependency, |
| 32 | + |
| 33 | + ```bash |
| 34 | + $ npm uninstall <package> --save-dev |
| 35 | + ``` |
| 36 | + |
| 37 | + Note that the above commands will remove the dependency **and** update the root `package.json`. |
| 38 | + |
| 39 | +3. [ ] Install the dependency. If the dependency is a production dependency, |
| 40 | + |
| 41 | + ```bash |
| 42 | + $ npm install <package> --save |
| 43 | + ``` |
| 44 | + |
| 45 | + If the dependency is a development dependency, |
| 46 | + |
| 47 | + ```bash |
| 48 | + $ npm install <package> --save-dev |
| 49 | + ``` |
| 50 | + |
| 51 | + Note that the above commands will install the dependency **and** update the root `package.json`. |
| 52 | + |
| 53 | +4. [ ] Commit the changes. |
| 54 | + |
| 55 | +<section class="links"> |
| 56 | + |
| 57 | +[electron]: https://electron.atom.io/ |
| 58 | + |
| 59 | +[david]: https://david-dm.org/ |
| 60 | + |
| 61 | +</section> |
| 62 | + |
| 63 | +<!-- /.links --> |
0 commit comments