@modernpoacher/deps 2.3.3 → 2.3.5
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 +5 -3
- package/src/common/git/index.mjs +32 -20
package/package.json
CHANGED
|
@@ -108,9 +108,11 @@ export function use (key) {
|
|
|
108
108
|
* @returns {void}
|
|
109
109
|
*/
|
|
110
110
|
function write (v) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
const s = v.trim()
|
|
112
|
+
if (s) {
|
|
113
|
+
if (s.startsWith(HOME)) {
|
|
114
|
+
const d = resolve(normalize(s))
|
|
115
|
+
log(d.replace(new RegExp('^' + HOME), '~'))
|
|
114
116
|
} else {
|
|
115
117
|
log(v.trimEnd())
|
|
116
118
|
}
|
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 {
|
|
@@ -28,7 +29,6 @@ import {
|
|
|
28
29
|
} from '#deps/src/common/env'
|
|
29
30
|
|
|
30
31
|
import {
|
|
31
|
-
formatDirectory,
|
|
32
32
|
use,
|
|
33
33
|
trim
|
|
34
34
|
} from '#deps/src/common/format'
|
|
@@ -132,15 +132,21 @@ export function out (key, directory) {
|
|
|
132
132
|
* @returns {void}
|
|
133
133
|
*/
|
|
134
134
|
function write (v) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
const s = v.trim()
|
|
136
|
+
if (s) {
|
|
137
|
+
if (s.startsWith(HOME)) {
|
|
138
|
+
const d = resolve(normalize(s))
|
|
139
|
+
log(d.replace(new RegExp('^' + HOME), '~'))
|
|
138
140
|
} else {
|
|
139
141
|
log(v.trimEnd())
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @param {string} value
|
|
148
|
+
* @returns {void}
|
|
149
|
+
*/
|
|
144
150
|
return function out (value) {
|
|
145
151
|
value.split(LF)
|
|
146
152
|
.filter(filter).filter(filterOut)
|
|
@@ -175,15 +181,21 @@ export function err (key, directory) {
|
|
|
175
181
|
* @returns {void}
|
|
176
182
|
*/
|
|
177
183
|
function write (v) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
const s = v.trim()
|
|
185
|
+
if (s) {
|
|
186
|
+
if (s.startsWith(HOME)) {
|
|
187
|
+
const d = resolve(normalize(s))
|
|
188
|
+
log(d.replace(new RegExp('^' + HOME), '~'))
|
|
181
189
|
} else {
|
|
182
190
|
log(v.trimEnd())
|
|
183
191
|
}
|
|
184
192
|
}
|
|
185
193
|
}
|
|
186
194
|
|
|
195
|
+
/**
|
|
196
|
+
* @param {string} value
|
|
197
|
+
* @returns {void}
|
|
198
|
+
*/
|
|
187
199
|
return function err (value) {
|
|
188
200
|
value.split(LF)
|
|
189
201
|
.filter(filter).filter(filterErr)
|
|
@@ -255,8 +267,8 @@ export function gitConfigUserName (d = DIRECTORY) {
|
|
|
255
267
|
stderr
|
|
256
268
|
} = exec(commands, options, handleComplete)
|
|
257
269
|
|
|
258
|
-
if (stdout) stdout.on('data', out('git-config-user-name',
|
|
259
|
-
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))
|
|
260
272
|
})
|
|
261
273
|
)
|
|
262
274
|
}
|
|
@@ -291,8 +303,8 @@ export function gitConfigUserEmail (d = DIRECTORY) {
|
|
|
291
303
|
stderr
|
|
292
304
|
} = exec(commands, options, handleComplete)
|
|
293
305
|
|
|
294
|
-
if (stdout) stdout.on('data', out('git-config-user-email',
|
|
295
|
-
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))
|
|
296
308
|
})
|
|
297
309
|
)
|
|
298
310
|
}
|
|
@@ -329,8 +341,8 @@ export function catGitRefsRemotesOriginHead (d = DIRECTORY) {
|
|
|
329
341
|
stderr
|
|
330
342
|
} = exec(commands, options, handleComplete)
|
|
331
343
|
|
|
332
|
-
if (stdout) stdout.on('data', out('cat-git-refs-remotes-origin-head',
|
|
333
|
-
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))
|
|
334
346
|
})
|
|
335
347
|
)
|
|
336
348
|
}
|
|
@@ -367,8 +379,8 @@ export function awkGitRemoteShowOriginHead (d = DIRECTORY) {
|
|
|
367
379
|
stderr
|
|
368
380
|
} = exec(commands, options, handleComplete)
|
|
369
381
|
|
|
370
|
-
if (stdout) stdout.on('data', out('git-remote-show-origin-head',
|
|
371
|
-
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))
|
|
372
384
|
})
|
|
373
385
|
)
|
|
374
386
|
}
|
|
@@ -405,8 +417,8 @@ export function gitRevParseShowTopLevel (d = DIRECTORY) {
|
|
|
405
417
|
stderr
|
|
406
418
|
} = exec(commands, options, handleComplete)
|
|
407
419
|
|
|
408
|
-
if (stdout) stdout.on('data', out('git-rev-parse-show-toplevel',
|
|
409
|
-
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))
|
|
410
422
|
})
|
|
411
423
|
)
|
|
412
424
|
}
|
|
@@ -443,8 +455,8 @@ export function gitRevParseAbbrevRefHead (d = DIRECTORY) {
|
|
|
443
455
|
stderr
|
|
444
456
|
} = exec(commands, options, handleComplete)
|
|
445
457
|
|
|
446
|
-
if (stdout) stdout.on('data', out('git-rev-parse-abbrev-ref-head',
|
|
447
|
-
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))
|
|
448
460
|
})
|
|
449
461
|
)
|
|
450
462
|
}
|