@modernpoacher/deps 2.1.16 → 2.1.18
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/bin/common/index.mjs +4 -4
- package/bin/deps/execute.mjs +14 -11
- package/bin/deps.mjs +18 -18
- package/package.json +5 -3
- package/src/common/git/index.mjs +4 -2
- package/src/index.mjs +4 -4
package/bin/common/index.mjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
|
|
5
|
+
import stripAnsi from 'strip-ansi'
|
|
6
|
+
|
|
5
7
|
import {
|
|
6
8
|
argv
|
|
7
9
|
} from 'node:process'
|
|
@@ -92,16 +94,14 @@ export function getArgs () {
|
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
function filter (v) {
|
|
95
|
-
return Boolean(v.trim())
|
|
97
|
+
return Boolean(stripAnsi(v).trim())
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
export function use (key) {
|
|
99
101
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
100
102
|
|
|
101
103
|
function write (v) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (s) log(s)
|
|
104
|
+
log(v.trimEnd())
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
return function use (value) {
|
package/bin/deps/execute.mjs
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
resolve
|
|
6
|
+
resolve,
|
|
7
|
+
dirname
|
|
7
8
|
} from 'node:path'
|
|
8
9
|
|
|
9
|
-
import
|
|
10
|
+
import {
|
|
11
|
+
glob
|
|
12
|
+
} from 'glob'
|
|
10
13
|
|
|
11
14
|
import {
|
|
12
15
|
Command
|
|
@@ -226,17 +229,15 @@ function * genDirsList (directories = []) {
|
|
|
226
229
|
while (directories.length) yield directories.shift()
|
|
227
230
|
}
|
|
228
231
|
|
|
229
|
-
function getPathList (directory) {
|
|
232
|
+
async function getPathList (directory) {
|
|
230
233
|
log('getPathList')
|
|
231
234
|
|
|
235
|
+
const array = await glob(`${directory}/*/package.json`)
|
|
236
|
+
|
|
232
237
|
return (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
? resolve(array.sort())
|
|
237
|
-
: reject(error)
|
|
238
|
-
})
|
|
239
|
-
})
|
|
238
|
+
array
|
|
239
|
+
.map(dirname)
|
|
240
|
+
.sort()
|
|
240
241
|
)
|
|
241
242
|
}
|
|
242
243
|
|
|
@@ -309,7 +310,9 @@ async function iteratePath (directory, registry, force, message, author) {
|
|
|
309
310
|
if (pathList.length) {
|
|
310
311
|
const depsList = await getDepsList(pathList)
|
|
311
312
|
|
|
312
|
-
|
|
313
|
+
if (depsList.length) {
|
|
314
|
+
for (const d of genDirsList(depsList)) await iterate(d, registry, force, message, author)
|
|
315
|
+
}
|
|
313
316
|
}
|
|
314
317
|
}
|
|
315
318
|
}
|
package/bin/deps.mjs
CHANGED
|
@@ -74,6 +74,24 @@ async function app () {
|
|
|
74
74
|
* Any other command will continue
|
|
75
75
|
*/
|
|
76
76
|
|
|
77
|
+
const {
|
|
78
|
+
saveProd: P,
|
|
79
|
+
saveDev: D,
|
|
80
|
+
saveOptional: O,
|
|
81
|
+
saveBundle: B,
|
|
82
|
+
force,
|
|
83
|
+
registry
|
|
84
|
+
} = commander.opts()
|
|
85
|
+
|
|
86
|
+
log({
|
|
87
|
+
saveProd: P,
|
|
88
|
+
saveDev: D,
|
|
89
|
+
saveOptional: O,
|
|
90
|
+
saveBundle: B,
|
|
91
|
+
...(registry ? { registry } : {}),
|
|
92
|
+
...(force ? { force } : {})
|
|
93
|
+
})
|
|
94
|
+
|
|
77
95
|
const {
|
|
78
96
|
env: {
|
|
79
97
|
PWD,
|
|
@@ -93,24 +111,6 @@ async function app () {
|
|
|
93
111
|
: {}
|
|
94
112
|
)
|
|
95
113
|
|
|
96
|
-
const {
|
|
97
|
-
saveProd: P,
|
|
98
|
-
saveDev: D,
|
|
99
|
-
saveOptional: O,
|
|
100
|
-
saveBundle: B,
|
|
101
|
-
force,
|
|
102
|
-
registry
|
|
103
|
-
} = commander.opts()
|
|
104
|
-
|
|
105
|
-
log({
|
|
106
|
-
saveProd: P,
|
|
107
|
-
saveDev: D,
|
|
108
|
-
saveOptional: O,
|
|
109
|
-
saveBundle: B,
|
|
110
|
-
...(registry ? { registry } : {}),
|
|
111
|
-
...(force ? { force } : {})
|
|
112
|
-
})
|
|
113
|
-
|
|
114
114
|
if ((P && D) || (!P && !D && !O && !B)) {
|
|
115
115
|
log('Prod')
|
|
116
116
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.18",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"lint": "eslint . --ext .mjs,.cjs",
|
|
41
41
|
"lint:fix": "npm run lint -- --fix",
|
|
42
42
|
"start": "npm run deps",
|
|
43
|
-
"test": "cross-env DEBUG_COLORS=yes NODE_ENV=test mocha test --recursive --verbose --color"
|
|
43
|
+
"test": "cross-env DEBUG_COLORS=yes NODE_ENV=test mocha test --recursive --verbose --color",
|
|
44
|
+
"prepare": "husky"
|
|
44
45
|
},
|
|
45
46
|
"bin": {
|
|
46
47
|
"deps": "bin/deps.mjs",
|
|
@@ -54,7 +55,8 @@
|
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"commander": "^12.1.0",
|
|
56
57
|
"debug": "^4.3.7",
|
|
57
|
-
"glob
|
|
58
|
+
"glob": "^11.0.0",
|
|
59
|
+
"strip-ansi": "^7.1.0",
|
|
58
60
|
"supports-color": "^9.4.0"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
package/src/common/git/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
+
import stripAnsi from 'strip-ansi'
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
6
|
normalize
|
|
5
7
|
} from 'node:path'
|
|
@@ -60,7 +62,7 @@ log(`\`git\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
|
60
62
|
const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
|
|
61
63
|
|
|
62
64
|
function filter (v) {
|
|
63
|
-
return Boolean(v.trim())
|
|
65
|
+
return Boolean(stripAnsi(v).trim())
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
export function getIsDirectory (directory) {
|
|
@@ -77,7 +79,7 @@ export function use (key) {
|
|
|
77
79
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
78
80
|
|
|
79
81
|
function write (v) {
|
|
80
|
-
|
|
82
|
+
log(v.trimEnd())
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
return function use (value) {
|
package/src/index.mjs
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
import debug from 'debug'
|
|
12
12
|
|
|
13
|
+
import stripAnsi from 'strip-ansi'
|
|
14
|
+
|
|
13
15
|
import {
|
|
14
16
|
normalize
|
|
15
17
|
} from 'node:path'
|
|
@@ -46,16 +48,14 @@ const log = debug('@modernpoacher/deps')
|
|
|
46
48
|
log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
47
49
|
|
|
48
50
|
function filter (v) {
|
|
49
|
-
return Boolean(v.trim())
|
|
51
|
+
return Boolean(stripAnsi(v).trim())
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
export function use (key) {
|
|
53
55
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
54
56
|
|
|
55
57
|
function write (v) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (s) log(s)
|
|
58
|
+
log(v.trimEnd())
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
return function use (value) {
|