@modernpoacher/deps 2.3.2 → 2.3.4
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/package.json +1 -1
- package/src/common/format/index.mjs +9 -1
- package/src/common/git/index.mjs +42 -17
package/package.json
CHANGED
|
@@ -108,7 +108,15 @@ export function use (key) {
|
|
|
108
108
|
* @returns {void}
|
|
109
109
|
*/
|
|
110
110
|
function write (v) {
|
|
111
|
-
|
|
111
|
+
const s = v.trim()
|
|
112
|
+
if (s) {
|
|
113
|
+
const d = resolve(normalize(s))
|
|
114
|
+
if (d.startsWith(HOME)) {
|
|
115
|
+
log(d.replace(new RegExp('^' + HOME), '~'))
|
|
116
|
+
} else {
|
|
117
|
+
log(v.trimEnd())
|
|
118
|
+
}
|
|
119
|
+
}
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
/**
|
package/src/common/git/index.mjs
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
import stripAnsi from 'strip-ansi'
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
|
-
normalize
|
|
15
|
+
normalize,
|
|
16
|
+
resolve
|
|
16
17
|
} from 'node:path'
|
|
17
18
|
|
|
18
19
|
import {
|
|
@@ -23,11 +24,11 @@ import debug from '#deps/src/common/debug'
|
|
|
23
24
|
|
|
24
25
|
import {
|
|
25
26
|
BIN,
|
|
26
|
-
PLATFORM
|
|
27
|
+
PLATFORM,
|
|
28
|
+
HOME
|
|
27
29
|
} from '#deps/src/common/env'
|
|
28
30
|
|
|
29
31
|
import {
|
|
30
|
-
formatDirectory,
|
|
31
32
|
use,
|
|
32
33
|
trim
|
|
33
34
|
} from '#deps/src/common/format'
|
|
@@ -131,9 +132,21 @@ export function out (key, directory) {
|
|
|
131
132
|
* @returns {void}
|
|
132
133
|
*/
|
|
133
134
|
function write (v) {
|
|
134
|
-
|
|
135
|
+
const s = v.trim()
|
|
136
|
+
if (s) {
|
|
137
|
+
const d = resolve(normalize(s))
|
|
138
|
+
if (d.startsWith(HOME)) {
|
|
139
|
+
log(d.replace(new RegExp('^' + HOME), '~'))
|
|
140
|
+
} else {
|
|
141
|
+
log(v.trimEnd())
|
|
142
|
+
}
|
|
143
|
+
}
|
|
135
144
|
}
|
|
136
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @param {string} value
|
|
148
|
+
* @returns {void}
|
|
149
|
+
*/
|
|
137
150
|
return function out (value) {
|
|
138
151
|
value.split(LF)
|
|
139
152
|
.filter(filter).filter(filterOut)
|
|
@@ -168,9 +181,21 @@ export function err (key, directory) {
|
|
|
168
181
|
* @returns {void}
|
|
169
182
|
*/
|
|
170
183
|
function write (v) {
|
|
171
|
-
|
|
184
|
+
const s = v.trim()
|
|
185
|
+
if (s) {
|
|
186
|
+
const d = resolve(normalize(s))
|
|
187
|
+
if (d.startsWith(HOME)) {
|
|
188
|
+
log(d.replace(new RegExp('^' + HOME), '~'))
|
|
189
|
+
} else {
|
|
190
|
+
log(v.trimEnd())
|
|
191
|
+
}
|
|
192
|
+
}
|
|
172
193
|
}
|
|
173
194
|
|
|
195
|
+
/**
|
|
196
|
+
* @param {string} value
|
|
197
|
+
* @returns {void}
|
|
198
|
+
*/
|
|
174
199
|
return function err (value) {
|
|
175
200
|
value.split(LF)
|
|
176
201
|
.filter(filter).filter(filterErr)
|
|
@@ -242,8 +267,8 @@ export function gitConfigUserName (d = DIRECTORY) {
|
|
|
242
267
|
stderr
|
|
243
268
|
} = exec(commands, options, handleComplete)
|
|
244
269
|
|
|
245
|
-
if (stdout) stdout.on('data', out('git-config-user-name',
|
|
246
|
-
if (stderr) stderr.on('data', err('git-config-user-name',
|
|
270
|
+
if (stdout) stdout.on('data', out('git-config-user-name', directory))
|
|
271
|
+
if (stderr) stderr.on('data', err('git-config-user-name', directory))
|
|
247
272
|
})
|
|
248
273
|
)
|
|
249
274
|
}
|
|
@@ -278,8 +303,8 @@ export function gitConfigUserEmail (d = DIRECTORY) {
|
|
|
278
303
|
stderr
|
|
279
304
|
} = exec(commands, options, handleComplete)
|
|
280
305
|
|
|
281
|
-
if (stdout) stdout.on('data', out('git-config-user-email',
|
|
282
|
-
if (stderr) stderr.on('data', err('git-config-user-email',
|
|
306
|
+
if (stdout) stdout.on('data', out('git-config-user-email', directory))
|
|
307
|
+
if (stderr) stderr.on('data', err('git-config-user-email', directory))
|
|
283
308
|
})
|
|
284
309
|
)
|
|
285
310
|
}
|
|
@@ -316,8 +341,8 @@ export function catGitRefsRemotesOriginHead (d = DIRECTORY) {
|
|
|
316
341
|
stderr
|
|
317
342
|
} = exec(commands, options, handleComplete)
|
|
318
343
|
|
|
319
|
-
if (stdout) stdout.on('data', out('cat-git-refs-remotes-origin-head',
|
|
320
|
-
if (stderr) stderr.on('data', err('cat-git-refs-remotes-origin-head',
|
|
344
|
+
if (stdout) stdout.on('data', out('cat-git-refs-remotes-origin-head', directory))
|
|
345
|
+
if (stderr) stderr.on('data', err('cat-git-refs-remotes-origin-head', directory))
|
|
321
346
|
})
|
|
322
347
|
)
|
|
323
348
|
}
|
|
@@ -354,8 +379,8 @@ export function awkGitRemoteShowOriginHead (d = DIRECTORY) {
|
|
|
354
379
|
stderr
|
|
355
380
|
} = exec(commands, options, handleComplete)
|
|
356
381
|
|
|
357
|
-
if (stdout) stdout.on('data', out('git-remote-show-origin-head',
|
|
358
|
-
if (stderr) stderr.on('data', err('git-remote-show-origin-head',
|
|
382
|
+
if (stdout) stdout.on('data', out('git-remote-show-origin-head', directory))
|
|
383
|
+
if (stderr) stderr.on('data', err('git-remote-show-origin-head', directory))
|
|
359
384
|
})
|
|
360
385
|
)
|
|
361
386
|
}
|
|
@@ -392,8 +417,8 @@ export function gitRevParseShowTopLevel (d = DIRECTORY) {
|
|
|
392
417
|
stderr
|
|
393
418
|
} = exec(commands, options, handleComplete)
|
|
394
419
|
|
|
395
|
-
if (stdout) stdout.on('data', out('git-rev-parse-show-toplevel',
|
|
396
|
-
if (stderr) stderr.on('data', err('git-rev-parse-show-toplevel',
|
|
420
|
+
if (stdout) stdout.on('data', out('git-rev-parse-show-toplevel', directory))
|
|
421
|
+
if (stderr) stderr.on('data', err('git-rev-parse-show-toplevel', directory))
|
|
397
422
|
})
|
|
398
423
|
)
|
|
399
424
|
}
|
|
@@ -430,8 +455,8 @@ export function gitRevParseAbbrevRefHead (d = DIRECTORY) {
|
|
|
430
455
|
stderr
|
|
431
456
|
} = exec(commands, options, handleComplete)
|
|
432
457
|
|
|
433
|
-
if (stdout) stdout.on('data', out('git-rev-parse-abbrev-ref-head',
|
|
434
|
-
if (stderr) stderr.on('data', err('git-rev-parse-abbrev-ref-head',
|
|
458
|
+
if (stdout) stdout.on('data', out('git-rev-parse-abbrev-ref-head', directory))
|
|
459
|
+
if (stderr) stderr.on('data', err('git-rev-parse-abbrev-ref-head', directory))
|
|
435
460
|
})
|
|
436
461
|
)
|
|
437
462
|
}
|