| 1 |
# Update JavaScript dependencies and their versions |
| 2 |
|
| 3 |
There are two kinds of dependency definitions in this theme: |
| 4 |
|
| 5 |
- `package.json` contains the **base dependencies** for this theme. They are broken down into a few categories like `dependencies` and `devDependencies`. It is edited by the maintainers. |
| 6 |
- `package-lock.json` contains the complete **frozen dependency chain** for this theme, including all sub-dependencies of our base dependencies. It is automatically generated. |
| 7 |
|
| 8 |
To update or add a JS dependency, follow these steps: |
| 9 |
|
| 10 |
1. **Edit `package.json`** by adding or modifying a dependency. |
| 11 |
2. **Re-generate `package-lock.json`** in order to create a new set of frozen dependencies for the theme. To do this, run the following command from the [Sphinx Theme Builder](https://sphinx-theme-builder.readthedocs.io/en/latest/). |
| 12 |
|
| 13 |
``` |
| 14 |
stb npm install --include=dev |
| 15 |
``` |
| 16 |
|
| 17 |
3. **Commit both files** to the repository. When new people pull in the latest commits, their `npm` environment will automatically update according to the new lockfile. |