@modernpoacher/deps 2.0.28 → 2.0.30
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/README.md +18 -17
- package/bin/execute/app.mjs +38 -14
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
# @modernpoacher/deps
|
|
2
2
|
|
|
3
|
-
*Deps* updates
|
|
3
|
+
*Deps* updates your `package.json` dependencies to their latest version.
|
|
4
4
|
|
|
5
|
-
*Deps* updates both `dependencies` and `devDependencies` by default. You can choose to update only _production_ or _development_ dependencies.
|
|
5
|
+
*Deps* updates both `dependencies` and `devDependencies` by default. You can [choose to update only _production_ or _development_ dependencies](#using-deps).
|
|
6
6
|
|
|
7
|
-
Where a dependency has an _exact_ version, *Deps*
|
|
7
|
+
Where a dependency has an _exact_ version, *Deps* does not update that dependency by default. *Deps* can be configured to [update to an _exact_ version or to `latest` as an _exact_ version](#using-depsrc).
|
|
8
8
|
|
|
9
9
|
## Installing Deps
|
|
10
10
|
|
|
11
11
|
Globally:
|
|
12
12
|
|
|
13
|
-
```
|
|
13
|
+
```bash
|
|
14
14
|
npm i -g @modernpoacher/deps
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
To your project:
|
|
18
18
|
|
|
19
|
-
```
|
|
19
|
+
```bash
|
|
20
20
|
npm i -D @modernpoacher/deps
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Using Deps
|
|
24
24
|
|
|
25
25
|
When installed globally, change into the root directory of the package you want to update and execute the command:
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
```bash
|
|
27
28
|
deps
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
When installed locally, or not installed, use `npx`:
|
|
31
32
|
|
|
32
|
-
```
|
|
33
|
+
```bash
|
|
33
34
|
npx @modernpoacher/deps
|
|
34
35
|
```
|
|
35
36
|
|
|
@@ -45,7 +46,7 @@ Alternatively, use `npm` with a script target in your project's `package.json`:
|
|
|
45
46
|
|
|
46
47
|
Then:
|
|
47
48
|
|
|
48
|
-
```
|
|
49
|
+
```bash
|
|
49
50
|
npm run deps
|
|
50
51
|
```
|
|
51
52
|
|
|
@@ -53,19 +54,19 @@ npm run deps
|
|
|
53
54
|
|
|
54
55
|
To update only _production_ dependencies (on the `dependencies` field):
|
|
55
56
|
|
|
56
|
-
```
|
|
57
|
+
```bash
|
|
57
58
|
deps --save-prod # or -P
|
|
58
59
|
```
|
|
59
60
|
|
|
60
61
|
Or:
|
|
61
62
|
|
|
62
|
-
```
|
|
63
|
+
```bash
|
|
63
64
|
npx @modernpoacher/deps --save-prod # or -P
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
Or:
|
|
67
68
|
|
|
68
|
-
```
|
|
69
|
+
```bash
|
|
69
70
|
npm run deps -- --save-prod # or -P
|
|
70
71
|
```
|
|
71
72
|
|
|
@@ -73,19 +74,19 @@ npm run deps -- --save-prod # or -P
|
|
|
73
74
|
|
|
74
75
|
To update only _development_ dependencies (dependencies on the `devDependencies` field):
|
|
75
76
|
|
|
76
|
-
```
|
|
77
|
+
```bash
|
|
77
78
|
deps --save-dev # or -D
|
|
78
79
|
```
|
|
79
80
|
|
|
80
81
|
Or:
|
|
81
82
|
|
|
82
|
-
```
|
|
83
|
+
```bash
|
|
83
84
|
npx @modernpoacher/deps --save-dev # or -D
|
|
84
85
|
```
|
|
85
86
|
|
|
86
87
|
Or:
|
|
87
88
|
|
|
88
|
-
```
|
|
89
|
+
```bash
|
|
89
90
|
npm run deps -- --save-dev # or -D
|
|
90
91
|
```
|
|
91
92
|
|
|
@@ -118,7 +119,7 @@ Add an `author` field to `.depsrc`:
|
|
|
118
119
|
|
|
119
120
|
### Ignore
|
|
120
121
|
|
|
121
|
-
Instruct *Deps* not to
|
|
122
|
+
Instruct *Deps* not to update your package with an `ignore` field in `.depsrc`:
|
|
122
123
|
|
|
123
124
|
```json
|
|
124
125
|
{
|
|
@@ -142,7 +143,7 @@ With the `.depsrc` configuration file as the example above:
|
|
|
142
143
|
|
|
143
144
|
*Deps* only refers to the `.depsrc` configuration file when it encounters an _exact_ version in `package.json`. If there is no entry for that dependency in the `.depsrc` configuration file then *Deps* will not upgrade, downgrade or otherwise modify it.
|
|
144
145
|
|
|
145
|
-
You need not duplicate an _exact_ version in `.depsrc`. Let `package.json` be the source of truth.
|
|
146
|
+
You need not duplicate an _exact_ version in `.depsrc`. (Let `package.json` be the source of truth.)
|
|
146
147
|
|
|
147
148
|
Typically, an entry in the `.depsrc` configuration file will contain `latest`.
|
|
148
149
|
|
package/bin/execute/app.mjs
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
} from '#deps/src/common/git'
|
|
33
33
|
|
|
34
34
|
import {
|
|
35
|
+
DIRECTORY,
|
|
35
36
|
REGISTRY,
|
|
36
37
|
getIgnore,
|
|
37
38
|
getAuthor,
|
|
@@ -61,8 +62,6 @@ const log = debug('@modernpoacher/deps')
|
|
|
61
62
|
|
|
62
63
|
log(`\`execute\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
63
64
|
|
|
64
|
-
const DIRECTORY = process.cwd()
|
|
65
|
-
|
|
66
65
|
function handleCommandError (e) {
|
|
67
66
|
const {
|
|
68
67
|
code = 0
|
|
@@ -239,14 +238,21 @@ function getPathList (directory) {
|
|
|
239
238
|
)
|
|
240
239
|
}
|
|
241
240
|
|
|
242
|
-
async function getDepsList (directories) {
|
|
241
|
+
async function getDepsList (directories = []) {
|
|
243
242
|
log('getDepsList')
|
|
244
243
|
|
|
244
|
+
const alpha = (
|
|
245
|
+
directories
|
|
246
|
+
.filter(filterDeps)
|
|
247
|
+
.reduce(reduceDeps, [])
|
|
248
|
+
.sort()
|
|
249
|
+
)
|
|
250
|
+
|
|
245
251
|
try {
|
|
246
|
-
const
|
|
252
|
+
const omega = await Promise.all(alpha.map(mapRevParseShowTopLevel))
|
|
247
253
|
|
|
248
254
|
return (
|
|
249
|
-
|
|
255
|
+
omega
|
|
250
256
|
.filter(filterDeps)
|
|
251
257
|
.reduce(reduceDeps, [])
|
|
252
258
|
.sort()
|
|
@@ -294,6 +300,26 @@ async function iterate ([directory, ...directories] = [], registry, force, messa
|
|
|
294
300
|
}
|
|
295
301
|
}
|
|
296
302
|
|
|
303
|
+
async function iteratePath (directory, registry, force, message, author) {
|
|
304
|
+
log('iteratePath')
|
|
305
|
+
|
|
306
|
+
if (directory) {
|
|
307
|
+
const D = resolve(directory)
|
|
308
|
+
|
|
309
|
+
const pathList = await getPathList(D)
|
|
310
|
+
|
|
311
|
+
if (pathList.length) {
|
|
312
|
+
const depsList = await getDepsList(pathList)
|
|
313
|
+
|
|
314
|
+
if (depsList.length) {
|
|
315
|
+
return (
|
|
316
|
+
await iterate(depsList, registry, force, message, author)
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
297
323
|
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
298
324
|
log('execute')
|
|
299
325
|
|
|
@@ -374,19 +400,17 @@ async function executePath (directory, registry, force, message, author) {
|
|
|
374
400
|
}
|
|
375
401
|
}
|
|
376
402
|
} catch (e) {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const pathList = await getPathList(D)
|
|
381
|
-
|
|
382
|
-
if (pathList.length) {
|
|
383
|
-
const depsList = await getDepsList(pathList)
|
|
403
|
+
const {
|
|
404
|
+
code
|
|
405
|
+
} = e
|
|
384
406
|
|
|
385
|
-
if (
|
|
407
|
+
if (code === 128) {
|
|
386
408
|
return (
|
|
387
|
-
await
|
|
409
|
+
await iteratePath(directory, registry, force, message, author)
|
|
388
410
|
)
|
|
389
411
|
}
|
|
412
|
+
|
|
413
|
+
handleCommandError(e)
|
|
390
414
|
}
|
|
391
415
|
}
|
|
392
416
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.30",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -57,15 +57,14 @@
|
|
|
57
57
|
"supports-color": "8.1.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@babel/
|
|
61
|
-
"@babel/core": "^7.21.8",
|
|
60
|
+
"@babel/core": "^7.22.1",
|
|
62
61
|
"@babel/eslint-parser": "^7.21.8",
|
|
63
|
-
"@babel/preset-env": "^7.
|
|
62
|
+
"@babel/preset-env": "^7.22.2",
|
|
64
63
|
"@babel/register": "^7.21.0",
|
|
65
64
|
"chai": "^4.3.7",
|
|
66
65
|
"core-js": "^3.30.2",
|
|
67
66
|
"cross-env": "^7.0.3",
|
|
68
|
-
"eslint": "^8.
|
|
67
|
+
"eslint": "^8.41.0",
|
|
69
68
|
"eslint-config-standard": "^17.0.0",
|
|
70
69
|
"eslint-plugin-import": "^2.27.5",
|
|
71
70
|
"eslint-plugin-node": "^11.1.0",
|