2.0.0 • Published 1 year ago

packages-update v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Why

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.

Some features

  • 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.


Table of Contents


Install

Install Size

npm i -D packages-update

Usage

CLI

npx pu

You can use latest, minor, patch or major as the last CLI parameter.

API (in-code)

import { pu } from 'packages-update';

await pu();

You can also use all available options:

await pu({
  target: 'latest',
});

Aliases

npx pu
npx packages-update

Configs

You can customize the global settings by creating a .purc.json config file.

  • CLI and API (in-code) options will overwrite the global options.
OptionCLIDescriptionDefault Value
packageFile--package-fileRelative path to package.json file"./package.json"
followPrefix--follow-prefixUpdate dependencies respecting version prefixesfalse
target--targetType of update strategy (e.g., latest, major, minor and patch)"latest"
filter--filterFilter the specified dependencies to include in the update[]
exclude--excludeExclude the specified dependencies to exclude from the update[]
peer--peerUpdate peer dependenciesfalse
indentation--indentationJSON indentation level2
registry--registrySpecify the registry URL"registry.npmjs.org"
quiet--quietSuppress output messagesfalse
checkOnly--check-onlyPerform checks without applying updatesfalse
configFile--config-fileCustom config path"./.purc.json"
overridesOverride update strategy for specific packages

packageFile

CLI
npx pu --package-file="./custom/package.json"
.purc.json and API (in-code)
{
  "packageFile": "./custom/package.json"
}

followPrefix

CLI
npx pu --follow-prefix
.purc.json and API (in-code)
{
  "followPrefix": true
}

filter

CLI
npx pu --filter=react,vue
.purc.json and API (in-code)
{
  "filter": ["react", "vue"]
}

exclude

CLI
npx pu --exclude=react,vue
.purc.json and API (in-code)
{
  "exclude": ["react", "vue"]
}

peer

CLI
npx pu --peer
.purc.json and API (in-code)
{
  "peer": true
}

indentation

CLI
npx pu --indentation=4
.purc.json and API (in-code)
{
  "indentation": 4
}

registry

https only.

CLI
npx pu --registry="registry.custom.org"
.purc.json and API (in-code)
{
  "registry": "registry.custom.org"
}

quiet

CLI
npx pu --quiet
.purc.json and API (in-code)
{
  "quiet": true
}

checkOnly

CLI
npx pu --check-only
.purc.json and API (in-code)
{
  "checkOnly": true
}

configFile

Not available in the configuration file itself.

CLI
npx pu --config-file=./custom/.purc.json
API (in-code)
await pu({
  configFile: './custom/.purc.json';
})

overrides

Not available for CLI.

.purc.json and API (in-code)
{
  "overrides": {
    "eslint": {
      "target": "minor"
    },
    "custom-package": {
      "registry": "custom.registry.org"
    }
  }
}

Examples

Update to latest version

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
# ...

Update to latest minor version

Get the latest minor version for each package.

npx pu minor
npx pu --target=minor  # alt.
# prettier: ^1.4.2 ➜ ^1.19.1
# ...

Update to latest patch version

Get the latest patch version for each package.

npx pu patch
npx pu --target=patch  # alt.
# prettier: ^1.4.2 ➜ ^1.4.4
# ...

Update to greatest version

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
# ...

Limitations

  • After updating package.json, run npm i, yarn install, pnpm install or bun 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.).

Acknowledgements

Contributors

2.0.0

1 year ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago