Browse Source

Add npm task and update usage info

Craig Fletcher 1 year ago
parent
commit
3f965e53d0
3 changed files with 135 additions and 381 deletions
  1. 30 2
      README.md
  2. 97 377
      package-lock.json
  3. 8 2
      package.json

+ 30 - 2
README.md

@@ -2,18 +2,34 @@
 
 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
 
-`script.js [options] [glob patterns]`
+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]`
 
-`sync-package-json-deps.js -w --tab-width 4 './packages/*/package.json' 'package.json'`
+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:
 
@@ -42,3 +58,15 @@ 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

File diff suppressed because it is too large
+ 97 - 377
package-lock.json


+ 8 - 2
package.json

@@ -4,14 +4,20 @@
   "description": "a script to find and fix out-of-sync dependencies in package.json files",
   "main": "src/sync-package-json-deps.js",
   "scripts": {
-    "build": "nexe -i src/sync-package-json-deps.js -o dist/sync-package-json-deps --build --python=$(which python3)"
+    "build": "nexe -i src/sync-package-json-deps.js -o dist/sync-package-json-deps --build --python=$(which python3)",
+    "sync": "node src/sync-package-json-deps.js"
+  },
+  "bin": {
+    "sync-package-json-deps": "src/sync-package-json-deps.js"
   },
   "keywords": [],
   "author": "",
   "license": "ISC",
   "dependencies": {
     "glob": "^11.0.0",
-    "nexe": "^4.0.0-rc.6",
     "semver": "^7.6.3"
+  },
+  "devDependencies": {
+    "nexe": "^4.0.0-rc.6"
   }
 }

Some files were not shown because too many files changed in this diff