diff-lockfiles 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +420 -0
- package/bin/diff-lockfiles.js +58 -0
- package/lib/index.js +117 -0
- package/package.json +31 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
# diff-lockfiles
|
|
2
|
+
|
|
3
|
+
Note: this is a fork of <https://github.com/mxweaver/lock-diff>, but it
|
|
4
|
+
operates on Git commit ranges rather than on files.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/diff-lockfiles)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install diff-lockfiles
|
|
13
|
+
diff-lockfiles origin/main dependabot/branch
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
diff-lockfiles.js --help
|
|
20
|
+
Usage: diff-lockfiles.js [options] <from> <to>
|
|
21
|
+
|
|
22
|
+
diff all changed package-lock.json files in repo
|
|
23
|
+
|
|
24
|
+
Options:
|
|
25
|
+
-V, --version output the version number
|
|
26
|
+
-f, --format <format> changes the output format (default: "text")
|
|
27
|
+
-m, --max-buffer maximum read buffer size
|
|
28
|
+
-c, --color colorizes certain output formats (default: false)
|
|
29
|
+
-h, --help display help for command
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### `--format=text` (default)
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
$ diff-lockfiles.js --format text HEAD~1 HEAD
|
|
36
|
+
node_modules/@jest/console 29.6.2 -> 29.6.3
|
|
37
|
+
node_modules/@jest/core 29.6.2 -> 29.6.3
|
|
38
|
+
node_modules/@jest/environment 29.6.2 -> 29.6.3
|
|
39
|
+
node_modules/@jest/expect 29.6.2 -> 29.6.3
|
|
40
|
+
node_modules/@jest/expect-utils 29.6.2 -> 29.6.3
|
|
41
|
+
node_modules/@jest/fake-timers 29.6.2 -> 29.6.3
|
|
42
|
+
node_modules/@jest/globals 29.6.2 -> 29.6.3
|
|
43
|
+
node_modules/@jest/reporters 29.6.2 -> 29.6.3
|
|
44
|
+
node_modules/@jest/schemas 29.6.0 -> 29.6.3
|
|
45
|
+
node_modules/@jest/source-map 29.6.0 -> 29.6.3
|
|
46
|
+
node_modules/@jest/test-result 29.6.2 -> 29.6.3
|
|
47
|
+
node_modules/@jest/test-sequencer 29.6.2 -> 29.6.3
|
|
48
|
+
node_modules/@jest/transform 29.6.2 -> 29.6.3
|
|
49
|
+
node_modules/@jest/types 29.6.1 -> 29.6.3
|
|
50
|
+
node_modules/@types/babel__core 7.20.0 -> 7.20.1
|
|
51
|
+
node_modules/@types/babel__traverse 7.18.2 -> 7.20.1
|
|
52
|
+
node_modules/babel-jest 29.6.2 -> 29.6.3
|
|
53
|
+
node_modules/babel-plugin-jest-hoist 29.5.0 -> 29.6.3
|
|
54
|
+
node_modules/babel-preset-jest 29.5.0 -> 29.6.3
|
|
55
|
+
node_modules/dedent 1.3.0 -> 1.5.1
|
|
56
|
+
node_modules/diff-sequences 29.4.3 -> 29.6.3
|
|
57
|
+
node_modules/expect 29.6.2 -> 29.6.3
|
|
58
|
+
node_modules/fsevents 2.3.2 -> 2.3.3
|
|
59
|
+
node_modules/is-core-module 2.12.1 -> 2.13.0
|
|
60
|
+
node_modules/jest 29.6.2 -> 29.6.3
|
|
61
|
+
node_modules/jest-changed-files 29.5.0 -> 29.6.3
|
|
62
|
+
node_modules/jest-circus 29.6.2 -> 29.6.3
|
|
63
|
+
node_modules/jest-cli 29.6.2 -> 29.6.3
|
|
64
|
+
node_modules/jest-config 29.6.2 -> 29.6.3
|
|
65
|
+
node_modules/jest-diff 29.6.2 -> 29.6.3
|
|
66
|
+
node_modules/jest-docblock 29.4.3 -> 29.6.3
|
|
67
|
+
node_modules/jest-each 29.6.2 -> 29.6.3
|
|
68
|
+
node_modules/jest-environment-node 29.6.2 -> 29.6.3
|
|
69
|
+
node_modules/jest-get-type 29.4.3 -> 29.6.3
|
|
70
|
+
node_modules/jest-haste-map 29.6.2 -> 29.6.3
|
|
71
|
+
node_modules/jest-leak-detector 29.6.2 -> 29.6.3
|
|
72
|
+
node_modules/jest-matcher-utils 29.6.2 -> 29.6.3
|
|
73
|
+
node_modules/jest-message-util 29.6.2 -> 29.6.3
|
|
74
|
+
node_modules/jest-mock 29.6.2 -> 29.6.3
|
|
75
|
+
node_modules/jest-regex-util 29.4.3 -> 29.6.3
|
|
76
|
+
node_modules/jest-resolve 29.6.2 -> 29.6.3
|
|
77
|
+
node_modules/jest-resolve-dependencies 29.6.2 -> 29.6.3
|
|
78
|
+
node_modules/jest-runner 29.6.2 -> 29.6.3
|
|
79
|
+
node_modules/jest-runtime 29.6.2 -> 29.6.3
|
|
80
|
+
node_modules/jest-snapshot 29.6.2 -> 29.6.3
|
|
81
|
+
node_modules/jest-util 29.6.2 -> 29.6.3
|
|
82
|
+
node_modules/jest-validate 29.6.2 -> 29.6.3
|
|
83
|
+
node_modules/jest-watcher 29.6.2 -> 29.6.3
|
|
84
|
+
node_modules/jest-worker 29.6.2 -> 29.6.3
|
|
85
|
+
node_modules/pretty-format 29.6.2 -> 29.6.3
|
|
86
|
+
node_modules/resolve 1.22.2 -> 1.22.4
|
|
87
|
+
node_modules/@jest/reporters/node_modules/istanbul-lib-instrument added
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `--format=json`
|
|
91
|
+
|
|
92
|
+
`diff-lockfiles.js --format text HEAD~1 HEAD`
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"node_modules/@jest/console": [
|
|
97
|
+
"29.6.2",
|
|
98
|
+
"29.6.3"
|
|
99
|
+
],
|
|
100
|
+
"node_modules/@jest/core": [
|
|
101
|
+
"29.6.2",
|
|
102
|
+
"29.6.3"
|
|
103
|
+
],
|
|
104
|
+
"node_modules/@jest/environment": [
|
|
105
|
+
"29.6.2",
|
|
106
|
+
"29.6.3"
|
|
107
|
+
],
|
|
108
|
+
"node_modules/@jest/expect": [
|
|
109
|
+
"29.6.2",
|
|
110
|
+
"29.6.3"
|
|
111
|
+
],
|
|
112
|
+
"node_modules/@jest/expect-utils": [
|
|
113
|
+
"29.6.2",
|
|
114
|
+
"29.6.3"
|
|
115
|
+
],
|
|
116
|
+
"node_modules/@jest/fake-timers": [
|
|
117
|
+
"29.6.2",
|
|
118
|
+
"29.6.3"
|
|
119
|
+
],
|
|
120
|
+
"node_modules/@jest/globals": [
|
|
121
|
+
"29.6.2",
|
|
122
|
+
"29.6.3"
|
|
123
|
+
],
|
|
124
|
+
"node_modules/@jest/reporters": [
|
|
125
|
+
"29.6.2",
|
|
126
|
+
"29.6.3"
|
|
127
|
+
],
|
|
128
|
+
"node_modules/@jest/schemas": [
|
|
129
|
+
"29.6.0",
|
|
130
|
+
"29.6.3"
|
|
131
|
+
],
|
|
132
|
+
"node_modules/@jest/source-map": [
|
|
133
|
+
"29.6.0",
|
|
134
|
+
"29.6.3"
|
|
135
|
+
],
|
|
136
|
+
"node_modules/@jest/test-result": [
|
|
137
|
+
"29.6.2",
|
|
138
|
+
"29.6.3"
|
|
139
|
+
],
|
|
140
|
+
"node_modules/@jest/test-sequencer": [
|
|
141
|
+
"29.6.2",
|
|
142
|
+
"29.6.3"
|
|
143
|
+
],
|
|
144
|
+
"node_modules/@jest/transform": [
|
|
145
|
+
"29.6.2",
|
|
146
|
+
"29.6.3"
|
|
147
|
+
],
|
|
148
|
+
"node_modules/@jest/types": [
|
|
149
|
+
"29.6.1",
|
|
150
|
+
"29.6.3"
|
|
151
|
+
],
|
|
152
|
+
"node_modules/@types/babel__core": [
|
|
153
|
+
"7.20.0",
|
|
154
|
+
"7.20.1"
|
|
155
|
+
],
|
|
156
|
+
"node_modules/@types/babel__traverse": [
|
|
157
|
+
"7.18.2",
|
|
158
|
+
"7.20.1"
|
|
159
|
+
],
|
|
160
|
+
"node_modules/babel-jest": [
|
|
161
|
+
"29.6.2",
|
|
162
|
+
"29.6.3"
|
|
163
|
+
],
|
|
164
|
+
"node_modules/babel-plugin-jest-hoist": [
|
|
165
|
+
"29.5.0",
|
|
166
|
+
"29.6.3"
|
|
167
|
+
],
|
|
168
|
+
"node_modules/babel-preset-jest": [
|
|
169
|
+
"29.5.0",
|
|
170
|
+
"29.6.3"
|
|
171
|
+
],
|
|
172
|
+
"node_modules/dedent": [
|
|
173
|
+
"1.3.0",
|
|
174
|
+
"1.5.1"
|
|
175
|
+
],
|
|
176
|
+
"node_modules/diff-sequences": [
|
|
177
|
+
"29.4.3",
|
|
178
|
+
"29.6.3"
|
|
179
|
+
],
|
|
180
|
+
"node_modules/expect": [
|
|
181
|
+
"29.6.2",
|
|
182
|
+
"29.6.3"
|
|
183
|
+
],
|
|
184
|
+
"node_modules/fsevents": [
|
|
185
|
+
"2.3.2",
|
|
186
|
+
"2.3.3"
|
|
187
|
+
],
|
|
188
|
+
"node_modules/is-core-module": [
|
|
189
|
+
"2.12.1",
|
|
190
|
+
"2.13.0"
|
|
191
|
+
],
|
|
192
|
+
"node_modules/jest": [
|
|
193
|
+
"29.6.2",
|
|
194
|
+
"29.6.3"
|
|
195
|
+
],
|
|
196
|
+
"node_modules/jest-changed-files": [
|
|
197
|
+
"29.5.0",
|
|
198
|
+
"29.6.3"
|
|
199
|
+
],
|
|
200
|
+
"node_modules/jest-circus": [
|
|
201
|
+
"29.6.2",
|
|
202
|
+
"29.6.3"
|
|
203
|
+
],
|
|
204
|
+
"node_modules/jest-cli": [
|
|
205
|
+
"29.6.2",
|
|
206
|
+
"29.6.3"
|
|
207
|
+
],
|
|
208
|
+
"node_modules/jest-config": [
|
|
209
|
+
"29.6.2",
|
|
210
|
+
"29.6.3"
|
|
211
|
+
],
|
|
212
|
+
"node_modules/jest-diff": [
|
|
213
|
+
"29.6.2",
|
|
214
|
+
"29.6.3"
|
|
215
|
+
],
|
|
216
|
+
"node_modules/jest-docblock": [
|
|
217
|
+
"29.4.3",
|
|
218
|
+
"29.6.3"
|
|
219
|
+
],
|
|
220
|
+
"node_modules/jest-each": [
|
|
221
|
+
"29.6.2",
|
|
222
|
+
"29.6.3"
|
|
223
|
+
],
|
|
224
|
+
"node_modules/jest-environment-node": [
|
|
225
|
+
"29.6.2",
|
|
226
|
+
"29.6.3"
|
|
227
|
+
],
|
|
228
|
+
"node_modules/jest-get-type": [
|
|
229
|
+
"29.4.3",
|
|
230
|
+
"29.6.3"
|
|
231
|
+
],
|
|
232
|
+
"node_modules/jest-haste-map": [
|
|
233
|
+
"29.6.2",
|
|
234
|
+
"29.6.3"
|
|
235
|
+
],
|
|
236
|
+
"node_modules/jest-leak-detector": [
|
|
237
|
+
"29.6.2",
|
|
238
|
+
"29.6.3"
|
|
239
|
+
],
|
|
240
|
+
"node_modules/jest-matcher-utils": [
|
|
241
|
+
"29.6.2",
|
|
242
|
+
"29.6.3"
|
|
243
|
+
],
|
|
244
|
+
"node_modules/jest-message-util": [
|
|
245
|
+
"29.6.2",
|
|
246
|
+
"29.6.3"
|
|
247
|
+
],
|
|
248
|
+
"node_modules/jest-mock": [
|
|
249
|
+
"29.6.2",
|
|
250
|
+
"29.6.3"
|
|
251
|
+
],
|
|
252
|
+
"node_modules/jest-regex-util": [
|
|
253
|
+
"29.4.3",
|
|
254
|
+
"29.6.3"
|
|
255
|
+
],
|
|
256
|
+
"node_modules/jest-resolve": [
|
|
257
|
+
"29.6.2",
|
|
258
|
+
"29.6.3"
|
|
259
|
+
],
|
|
260
|
+
"node_modules/jest-resolve-dependencies": [
|
|
261
|
+
"29.6.2",
|
|
262
|
+
"29.6.3"
|
|
263
|
+
],
|
|
264
|
+
"node_modules/jest-runner": [
|
|
265
|
+
"29.6.2",
|
|
266
|
+
"29.6.3"
|
|
267
|
+
],
|
|
268
|
+
"node_modules/jest-runtime": [
|
|
269
|
+
"29.6.2",
|
|
270
|
+
"29.6.3"
|
|
271
|
+
],
|
|
272
|
+
"node_modules/jest-snapshot": [
|
|
273
|
+
"29.6.2",
|
|
274
|
+
"29.6.3"
|
|
275
|
+
],
|
|
276
|
+
"node_modules/jest-util": [
|
|
277
|
+
"29.6.2",
|
|
278
|
+
"29.6.3"
|
|
279
|
+
],
|
|
280
|
+
"node_modules/jest-validate": [
|
|
281
|
+
"29.6.2",
|
|
282
|
+
"29.6.3"
|
|
283
|
+
],
|
|
284
|
+
"node_modules/jest-watcher": [
|
|
285
|
+
"29.6.2",
|
|
286
|
+
"29.6.3"
|
|
287
|
+
],
|
|
288
|
+
"node_modules/jest-worker": [
|
|
289
|
+
"29.6.2",
|
|
290
|
+
"29.6.3"
|
|
291
|
+
],
|
|
292
|
+
"node_modules/pretty-format": [
|
|
293
|
+
"29.6.2",
|
|
294
|
+
"29.6.3"
|
|
295
|
+
],
|
|
296
|
+
"node_modules/resolve": [
|
|
297
|
+
"1.22.2",
|
|
298
|
+
"1.22.4"
|
|
299
|
+
],
|
|
300
|
+
"node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": [
|
|
301
|
+
null,
|
|
302
|
+
"6.0.0"
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### `--format=table`
|
|
308
|
+
|
|
309
|
+
```texst
|
|
310
|
+
$ diff-lockfiles.js --format table HEAD~1 HEAD
|
|
311
|
+
╔═══════════════════════════════════════════════════════════════════╤═════════════╤═════════════╗
|
|
312
|
+
║ package-lock.json │ │ ║
|
|
313
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
314
|
+
║ package │ old version │ new version ║
|
|
315
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
316
|
+
║ node_modules/@jest/console │ 29.6.2 │ 29.6.3 ║
|
|
317
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
318
|
+
║ node_modules/@jest/core │ 29.6.2 │ 29.6.3 ║
|
|
319
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
320
|
+
║ node_modules/@jest/environment │ 29.6.2 │ 29.6.3 ║
|
|
321
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
322
|
+
║ node_modules/@jest/expect │ 29.6.2 │ 29.6.3 ║
|
|
323
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
324
|
+
║ node_modules/@jest/expect-utils │ 29.6.2 │ 29.6.3 ║
|
|
325
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
326
|
+
║ node_modules/@jest/fake-timers │ 29.6.2 │ 29.6.3 ║
|
|
327
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
328
|
+
║ node_modules/@jest/globals │ 29.6.2 │ 29.6.3 ║
|
|
329
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
330
|
+
║ node_modules/@jest/reporters │ 29.6.2 │ 29.6.3 ║
|
|
331
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
332
|
+
║ node_modules/@jest/schemas │ 29.6.0 │ 29.6.3 ║
|
|
333
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
334
|
+
║ node_modules/@jest/source-map │ 29.6.0 │ 29.6.3 ║
|
|
335
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
336
|
+
║ node_modules/@jest/test-result │ 29.6.2 │ 29.6.3 ║
|
|
337
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
338
|
+
║ node_modules/@jest/test-sequencer │ 29.6.2 │ 29.6.3 ║
|
|
339
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
340
|
+
║ node_modules/@jest/transform │ 29.6.2 │ 29.6.3 ║
|
|
341
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
342
|
+
║ node_modules/@jest/types │ 29.6.1 │ 29.6.3 ║
|
|
343
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
344
|
+
║ node_modules/@types/babel__core │ 7.20.0 │ 7.20.1 ║
|
|
345
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
346
|
+
║ node_modules/@types/babel__traverse │ 7.18.2 │ 7.20.1 ║
|
|
347
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
348
|
+
║ node_modules/babel-jest │ 29.6.2 │ 29.6.3 ║
|
|
349
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
350
|
+
║ node_modules/babel-plugin-jest-hoist │ 29.5.0 │ 29.6.3 ║
|
|
351
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
352
|
+
║ node_modules/babel-preset-jest │ 29.5.0 │ 29.6.3 ║
|
|
353
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
354
|
+
║ node_modules/dedent │ 1.3.0 │ 1.5.1 ║
|
|
355
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
356
|
+
║ node_modules/diff-sequences │ 29.4.3 │ 29.6.3 ║
|
|
357
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
358
|
+
║ node_modules/expect │ 29.6.2 │ 29.6.3 ║
|
|
359
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
360
|
+
║ node_modules/fsevents │ 2.3.2 │ 2.3.3 ║
|
|
361
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
362
|
+
║ node_modules/is-core-module │ 2.12.1 │ 2.13.0 ║
|
|
363
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
364
|
+
║ node_modules/jest │ 29.6.2 │ 29.6.3 ║
|
|
365
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
366
|
+
║ node_modules/jest-changed-files │ 29.5.0 │ 29.6.3 ║
|
|
367
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
368
|
+
║ node_modules/jest-circus │ 29.6.2 │ 29.6.3 ║
|
|
369
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
370
|
+
║ node_modules/jest-cli │ 29.6.2 │ 29.6.3 ║
|
|
371
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
372
|
+
║ node_modules/jest-config │ 29.6.2 │ 29.6.3 ║
|
|
373
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
374
|
+
║ node_modules/jest-diff │ 29.6.2 │ 29.6.3 ║
|
|
375
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
376
|
+
║ node_modules/jest-docblock │ 29.4.3 │ 29.6.3 ║
|
|
377
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
378
|
+
║ node_modules/jest-each │ 29.6.2 │ 29.6.3 ║
|
|
379
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
380
|
+
║ node_modules/jest-environment-node │ 29.6.2 │ 29.6.3 ║
|
|
381
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
382
|
+
║ node_modules/jest-get-type │ 29.4.3 │ 29.6.3 ║
|
|
383
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
384
|
+
║ node_modules/jest-haste-map │ 29.6.2 │ 29.6.3 ║
|
|
385
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
386
|
+
║ node_modules/jest-leak-detector │ 29.6.2 │ 29.6.3 ║
|
|
387
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
388
|
+
║ node_modules/jest-matcher-utils │ 29.6.2 │ 29.6.3 ║
|
|
389
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
390
|
+
║ node_modules/jest-message-util │ 29.6.2 │ 29.6.3 ║
|
|
391
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
392
|
+
║ node_modules/jest-mock │ 29.6.2 │ 29.6.3 ║
|
|
393
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
394
|
+
║ node_modules/jest-regex-util │ 29.4.3 │ 29.6.3 ║
|
|
395
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
396
|
+
║ node_modules/jest-resolve │ 29.6.2 │ 29.6.3 ║
|
|
397
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
398
|
+
║ node_modules/jest-resolve-dependencies │ 29.6.2 │ 29.6.3 ║
|
|
399
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
400
|
+
║ node_modules/jest-runner │ 29.6.2 │ 29.6.3 ║
|
|
401
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
402
|
+
║ node_modules/jest-runtime │ 29.6.2 │ 29.6.3 ║
|
|
403
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
404
|
+
║ node_modules/jest-snapshot │ 29.6.2 │ 29.6.3 ║
|
|
405
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
406
|
+
║ node_modules/jest-util │ 29.6.2 │ 29.6.3 ║
|
|
407
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
408
|
+
║ node_modules/jest-validate │ 29.6.2 │ 29.6.3 ║
|
|
409
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
410
|
+
║ node_modules/jest-watcher │ 29.6.2 │ 29.6.3 ║
|
|
411
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
412
|
+
║ node_modules/jest-worker │ 29.6.2 │ 29.6.3 ║
|
|
413
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
414
|
+
║ node_modules/pretty-format │ 29.6.2 │ 29.6.3 ║
|
|
415
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
416
|
+
║ node_modules/resolve │ 1.22.2 │ 1.22.4 ║
|
|
417
|
+
╟───────────────────────────────────────────────────────────────────┼─────────────┼─────────────╢
|
|
418
|
+
║ node_modules/@jest/reporters/node_modules/istanbul-lib-instrument │ null │ 6.0.0 ║
|
|
419
|
+
╚═══════════════════════════════════════════════════════════════════╧═════════════╧═════════════╝
|
|
420
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { exec } from 'node:child_process';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
import { diff, print } from '../lib/index.js';
|
|
7
|
+
|
|
8
|
+
const execPromise = promisify(exec);
|
|
9
|
+
|
|
10
|
+
const lockFiles = async function getLockChangedLockFiles(a, b) {
|
|
11
|
+
const output = await execPromise(`git diff ${a} ${b} --name-only | grep package-lock.json`);
|
|
12
|
+
const lines = output.stdout;
|
|
13
|
+
const list = lines.trim().split(/\r\n|\r|\n/);
|
|
14
|
+
|
|
15
|
+
if (output.stderr.trim !== '') {
|
|
16
|
+
// console.error(output.stderr.trim);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return list;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const lockFileString = async function getLockFileString(maxBuffer, branch, filename) {
|
|
23
|
+
const output = await execPromise(`git show ${branch}:${filename}`, { maxBuffer: maxBuffer });
|
|
24
|
+
const lines = output.stdout.trim();
|
|
25
|
+
|
|
26
|
+
if (output.stderr.trim() !== '') {
|
|
27
|
+
console.error(output.stderr.trim());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return lines;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const cli = new Command();
|
|
34
|
+
cli
|
|
35
|
+
.command('diff-lockfiles.js')
|
|
36
|
+
.description('diff all changed package-lock.json files in repo')
|
|
37
|
+
.version('1.0.0')
|
|
38
|
+
.arguments('<from> <to>')
|
|
39
|
+
.option('-f, --format <format>', 'changes the output format', 'text')
|
|
40
|
+
.option('-m, --max-buffer', 'maximum read buffer size', 1024 * 10000)
|
|
41
|
+
.option('-c, --color', 'colorizes certain output formats', false)
|
|
42
|
+
.action((from, to, options) => {
|
|
43
|
+
lockFiles(from, to).then((v) => {
|
|
44
|
+
for (let filename of v) {
|
|
45
|
+
const a = lockFileString(options.maxBuffer, from, filename).then((s) => { return JSON.parse(s); });
|
|
46
|
+
const b = lockFileString(options.maxBuffer, to, filename).then((s) => { return JSON.parse(s); });
|
|
47
|
+
Promise.all([a, b]).then((values) => {
|
|
48
|
+
const changes = diff(values[0], values[1]);
|
|
49
|
+
print(changes, {
|
|
50
|
+
color: options.color,
|
|
51
|
+
format: options.format,
|
|
52
|
+
title: filename,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
})
|
|
58
|
+
.parse();
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// This is a fork of <https://github.com/mxweaver/lock-diff>
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import semver from 'semver';
|
|
4
|
+
import { table } from 'table';
|
|
5
|
+
|
|
6
|
+
export function diff(oldLock, newLock) {
|
|
7
|
+
const changes = {};
|
|
8
|
+
|
|
9
|
+
Object.entries(oldLock.packages).forEach(([name, { version }]) => {
|
|
10
|
+
changes[name] = [version, null];
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
Object.entries(newLock.packages).forEach(([name, { version }]) => {
|
|
14
|
+
if (changes[name] && changes[name][0]) {
|
|
15
|
+
if (semver.eq(changes[name][0], version)) {
|
|
16
|
+
delete changes[name];
|
|
17
|
+
} else {
|
|
18
|
+
changes[name] = [changes[name][0], version];
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
changes[name] = [null, version];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return changes;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function printJSON(changes) {
|
|
29
|
+
/* eslint-disable no-console */
|
|
30
|
+
console.log(JSON.stringify(changes));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function printText(changes, options) {
|
|
34
|
+
/* eslint-disable no-console */
|
|
35
|
+
|
|
36
|
+
Object.entries(changes).forEach(([name, [oldVersion, newVersion]]) => {
|
|
37
|
+
if (!oldVersion) {
|
|
38
|
+
if (options.color) {
|
|
39
|
+
console.log(`${name} ${chalk.green('added')}`);
|
|
40
|
+
} else {
|
|
41
|
+
console.log(`${name} added`);
|
|
42
|
+
}
|
|
43
|
+
} else if (!newVersion) {
|
|
44
|
+
if (options.color) {
|
|
45
|
+
console.log(`${name} ${chalk.red('removed')}`);
|
|
46
|
+
} else {
|
|
47
|
+
console.log(`${name} removed`);
|
|
48
|
+
}
|
|
49
|
+
} else if (!semver.eq(oldVersion, newVersion)) {
|
|
50
|
+
if (options.color) {
|
|
51
|
+
const color = semver.gt(oldVersion, newVersion)
|
|
52
|
+
? chalk.red
|
|
53
|
+
: chalk.green;
|
|
54
|
+
console.log(`${name} ${color(`${oldVersion} -> ${newVersion}`)}`);
|
|
55
|
+
} else {
|
|
56
|
+
console.log(`${name} ${oldVersion} -> ${newVersion}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/* eslint-enable no-console */
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function printTable(changes, options) {
|
|
65
|
+
/* eslint-disable no-console */
|
|
66
|
+
|
|
67
|
+
let data = Object.entries(changes)
|
|
68
|
+
.map(([name, [oldVersion, newVersion]]) => ([
|
|
69
|
+
name,
|
|
70
|
+
oldVersion,
|
|
71
|
+
newVersion,
|
|
72
|
+
]));
|
|
73
|
+
|
|
74
|
+
if (options.color) {
|
|
75
|
+
data = data.map(([name, oldVersion, newVersion]) => {
|
|
76
|
+
if (semver.valid(oldVersion) && semver.valid(newVersion)) {
|
|
77
|
+
if (semver.lt(oldVersion, newVersion)) {
|
|
78
|
+
oldVersion = chalk.red(oldVersion);
|
|
79
|
+
newVersion = chalk.green(newVersion);
|
|
80
|
+
} else if (semver.gt(oldVersion, newVersion)) {
|
|
81
|
+
oldVersion = chalk.green(oldVersion);
|
|
82
|
+
newVersion = chalk.red(newVersion);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return [name, oldVersion, newVersion];
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
data.unshift(['package', 'old version', 'new version']);
|
|
91
|
+
if (options.title !== '') {
|
|
92
|
+
data.unshift([options.title, '', '']);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (options.color) {
|
|
96
|
+
data[0] = data[0].map((heading) => chalk.bold(heading));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
console.log(table(data));
|
|
100
|
+
|
|
101
|
+
/* eslint-disable no-console */
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function print(changes, options) {
|
|
105
|
+
switch (options.format) {
|
|
106
|
+
case 'json':
|
|
107
|
+
printJSON(changes, options);
|
|
108
|
+
break;
|
|
109
|
+
case 'table':
|
|
110
|
+
printTable(changes, options);
|
|
111
|
+
break;
|
|
112
|
+
case 'text':
|
|
113
|
+
default:
|
|
114
|
+
printText(changes, options);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "diff-lockfiles",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "a diff for package-lock.json files",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+ssh://git@github.com/oalders/diff-lockfiles.git"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"bin": {
|
|
11
|
+
"diff-lockfiles": "bin/diff-lockfiles.js"
|
|
12
|
+
},
|
|
13
|
+
"main": "lib/index.js",
|
|
14
|
+
"author": "Olaf Alders <olaf@wundersolutions.com> (https://olafalders.com/)",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "./bin/diff-lockfiles.js",
|
|
18
|
+
"lint": "eslint .",
|
|
19
|
+
"test": "jest"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"chalk": "^5.3.0",
|
|
23
|
+
"commander": "^11.0.0",
|
|
24
|
+
"semver": "^7.5.4",
|
|
25
|
+
"table": "^6.8.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"eslint": "^8.48.0",
|
|
29
|
+
"jest": "^29.6.2"
|
|
30
|
+
}
|
|
31
|
+
}
|