a script to find and fix out-of-sync dependencies in package.json files

Craig Fletcher 0c0d97db8f Fix missing version bug há 1 ano atrás
src 0c0d97db8f Fix missing version bug há 1 ano atrás
.gitignore ddb2707fcd Initial commit há 1 ano atrás
.nvmrc ddb2707fcd Initial commit há 1 ano atrás
README.md 3f965e53d0 Add npm task and update usage info há 1 ano atrás
eslint.config.js 1152b6ff63 Organise code, add formatting rules há 1 ano atrás
package-lock.json 1152b6ff63 Organise code, add formatting rules há 1 ano atrás
package.json 1152b6ff63 Organise code, add formatting rules há 1 ano atrás

README.md

sync-package-json-deps

A script to find and fix out-of-sync dependencies in package.json files.

Pass this script an array of globs or paths to your package.json files, it'll collect all dependencies and highlight those that don't match across package definitions. When run with the -w/--write flag, will update all package.json files to the latest found version across all files.

Installation

Install and run from your project folder, globally, or use npm run build to compile a (massive) single executable and stick it in your path.

npm i -g /path/to/sync-package-json-deps/repo

npm i -g git+https://git.lpapi.io/leakypixel/sync-package-json-deps

Usage

As a standalone script (ensure you have deps installed globally): node /path/to/script.js [options] [glob patterns]

From this project: npm run sync [options] [glob patterns]

As a binary in your path: sync-package-json-deps [options] [glob patterns]

Through npx (if installed globally): npx sync-package-json-deps [options] [glob patterns]

Options:

tabWidth: Tab width in spaces, passed to JSON.stringify for output.

flags: -tw,--tab-width

number of arguments: 1

default: 2

write: Write changes to files.

flags: -w,--write

number of arguments: 0

default: false

help: Prints the help message, options and usage info then exits.

flags: -h,--help

number of arguments: 0

default: false

Building

Check out this repo, then:

  • Make sure you're using Node 20: nvm use .
  • Install deps (inc devDeps): npm i or yarn
  • Run the nexe build: npm run build

If you're having trouble with nexe, it's best to treat that as a separate issue unrelated to this repo and look for information/help over there: https://github.com/nexe/nexe