updates/README.md

63 lines
2.3 KiB
Markdown
Raw Normal View History

2017-12-03 11:15:02 +00:00
# updates
2023-04-18 21:29:08 +00:00
[![](https://img.shields.io/npm/v/updates.svg?style=flat)](https://www.npmjs.org/package/updates) [![](https://img.shields.io/npm/dm/updates.svg)](https://www.npmjs.org/package/updates) [![](https://packagephobia.com/badge?p=updates)](https://packagephobia.com/result?p=updates)
2019-03-07 20:23:03 +00:00
2020-07-14 20:57:33 +00:00
![](./screenshot.png)
2023-06-18 00:08:11 +00:00
`updates` is a CLI tool which checks for npm and poetry dependency updates of the current project and optionally updates `package.json`/`pyproject.toml`. It is highly configurable and is typically able to complete in less than a second.
2017-12-03 11:15:02 +00:00
# Usage
2024-03-16 16:46:46 +00:00
`bun` and `node` are officially supported. `deno` should work as well. For bun, replace `npx` with `bunx` and `npm` with `bun`.
2024-03-16 03:35:45 +00:00
2020-04-07 15:43:13 +00:00
```bash
2023-04-18 21:29:08 +00:00
# check for updates
npx updates
2023-04-23 21:45:14 +00:00
# update package.json and install new dependencies
2023-04-18 21:29:08 +00:00
npx updates -u && npm i
```
2019-03-07 20:23:03 +00:00
## Options
See `--help`. Options that take multiple arguments can take them either via comma-separated value or by specifying the option multiple times.
If an option has a optional `pkg` argument but none is given, the option will be applied to all packages instead.
All `pkg` options support glob matching via [picomatch](https://github.com/micromatch/picomatch) or regex (on CLI, wrap the regex in slashes, e.g. `'/^foo/'`).
2018-09-02 08:35:47 +00:00
2024-03-16 16:40:56 +00:00
## Notes
2024-03-16 16:42:26 +00:00
The module uses global `fetch` under the hood. In Node.js HTTP proxies from environment are [not supported](https://github.com/nodejs/undici/issues/1650), but it's still possible to enable `updates` to use them by installing the `undici` dependency into your project.
2024-03-16 16:40:56 +00:00
## Config File
2024-03-09 01:52:24 +00:00
The config file is used to configure certain options of the module. CLI arguments have precedence over options in the config file, except for `include` and `exclude` options which are merged.
```js
export default {
exclude: [
2023-04-23 21:33:16 +00:00
"semver",
2023-09-04 23:20:26 +00:00
"@vitejs/*",
/^react(-dom)?$/,
],
};
2017-12-03 16:05:35 +00:00
```
2017-12-03 11:15:02 +00:00
2024-03-09 01:52:24 +00:00
### Config File Locations
2024-03-09 02:00:00 +00:00
The config file can be placed in these locations, relative to `package.json`:
2024-03-09 01:52:24 +00:00
- `updates.config.js`
- `updates.config.mjs`
- `.config/updates.js`
- `.config/updates.mjs`
2023-07-14 11:04:30 +00:00
### Config File Options
- `include` *Array[String|Regexp]*: Array of dependencies to include
- `exclude` *Array[String|Regexp]*: Array of dependencies to exclude
2023-08-07 23:40:42 +00:00
- `types` *Array[String]*: Array of dependency types
2023-04-24 16:29:25 +00:00
- `registry` *String*: URL to npm registry
2017-12-03 11:15:02 +00:00
© [silverwind](https://github.com/silverwind), distributed under BSD licence