π¦ A flexible and lightweight updater for packages
Allows you to update, customize according to your needs and easily automate mono repositories.
I plan to expand this project into an GitHub Actions project in the future. You can see a prototype here.
- CLI and API (in-code) usage
- Custom rules per dependency
- Global and custom rules per dependency for mono repositories
- Filter and exclude dependencies
- Zero configurations (unless you want to)
- Custom
package.json
and configuration files - Dynamic update according to version operator prefixer per dependency
And much more.
npm i -D packages-update
npx pu
You can use
latest
,minor
,patch
ormajor
as the last CLI parameter.
import { pu } from 'packages-update';
await pu();
You can also use all available options:
await pu({
target: 'latest',
});
npx pu
npx packages-update
You can customize the global settings by creating a .purc.json
config file.
- CLI and API (in-code) options will overwrite the global options.
Option | CLI | Description | Default Value |
---|---|---|---|
packageFile | --package-file | Relative path to package.json file | "./package.json" |
followPrefix | --follow-prefix | Update dependencies respecting version prefixes | false |
target | --target | Type of update strategy (e.g., latest , major , minor and patch ) |
"latest" |
filter | --filter | Filter the specified dependencies to include in the update | [] |
exclude | --exclude | Exclude the specified dependencies to exclude from the update | [] |
peer | --peer | Update peer dependencies | false |
indentation | --indentation | JSON indentation level | 2 |
registry | --registry | Specify the registry URL | "registry.npmjs.org" |
quiet | --quiet | Suppress output messages | false |
checkOnly | --check-only | Perform checks without applying updates | false |
configFile | --config-file | Custom config path | "./.purc.json" |
overrides | Override update strategy for specific packages |
npx pu --package-file="./custom/package.json"
{
"packageFile": "./custom/package.json"
}
npx pu --follow-prefix
{
"followPrefix": true
}
npx pu --filter=react,vue
{
"filter": ["react", "vue"]
}
npx pu --exclude=react,vue
{
"exclude": ["react", "vue"]
}
npx pu --peer
{
"peer": true
}
npx pu --indentation=4
{
"indentation": 4
}
https
only.
npx pu --registry="registry.custom.org"
{
"registry": "registry.custom.org"
}
npx pu --quiet
{
"quiet": true
}
npx pu --check-only
{
"checkOnly": true
}
Not available in the configuration file itself.
npx pu --config-file=./custom/.purc.json
await pu({
configFile: './custom/.purc.json';
})
Not available for CLI.
{
"overrides": {
"eslint": {
"target": "minor"
},
"custom-package": {
"registry": "custom.registry.org"
}
}
}
Get the default latest version for each package.
npx pu
npx pu latest
npx pu --target=latest # alt.
# prettier: ^1.4.2 β ^2.8.1 # ...
Get the latest minor version for each package.
npx pu minor
npx pu --target=minor # alt.
# prettier: ^1.4.2 β ^1.19.1 # ...
Get the latest patch version for each package.
npx pu patch
npx pu --target=patch # alt.
# prettier: ^1.4.2 β ^1.4.4 # ...
Get the highest version for each package, even if it is not the default latest.
npx pu major
npx pu --target=major # alt.
# prettier: ^1.4.2 β ^2.8.1
# ...
- After updating package.json, run
npm i
,yarn install
,pnpm install
orbun install
to install new versions. - This updater looks the package.json for
devDependencies
,dependencies
and (if configured)peerDependencies
. - This updater doesn't search or update for tag and local versions (alpha, beta, rc, etc.).