@naturalcycles/nodejs-lib 14.3.2 → 14.3.3
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/dist/util/exec2.d.ts +1 -1
- package/dist/util/exec2.js +3 -2
- package/package.json +1 -1
- package/src/util/exec2.ts +8 -3
package/dist/util/exec2.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AnyObject, type NumberOfMilliseconds } from '@naturalcycles/js-lib';
|
|
2
2
|
import { AppError } from '@naturalcycles/js-lib';
|
|
3
3
|
/**
|
|
4
4
|
* Set of utility functions to work with Spawn / Exec.
|
package/dist/util/exec2.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { execSync, spawn, spawnSync } from 'node:child_process';
|
|
2
|
+
import { _substringAfterLast, } from '@naturalcycles/js-lib';
|
|
2
3
|
import { _since, AppError } from '@naturalcycles/js-lib';
|
|
3
4
|
import { dimGrey, dimRed, hasColors, white } from '../colors/colors.js';
|
|
4
5
|
/**
|
|
@@ -231,7 +232,7 @@ class Exec2 {
|
|
|
231
232
|
return;
|
|
232
233
|
console.log([
|
|
233
234
|
dimGrey(...Object.entries(opt.env || {}).map(([k, v]) => [k, v].join('='))),
|
|
234
|
-
white(opt.name || cmd),
|
|
235
|
+
white(opt.name || _substringAfterLast(cmd, '/')),
|
|
235
236
|
...((!opt.name && opt.args) || []),
|
|
236
237
|
]
|
|
237
238
|
.filter(Boolean)
|
|
@@ -241,7 +242,7 @@ class Exec2 {
|
|
|
241
242
|
if (isSuccessful && !opt.logFinish)
|
|
242
243
|
return;
|
|
243
244
|
console.log([
|
|
244
|
-
white(opt.name || cmd),
|
|
245
|
+
white(opt.name || _substringAfterLast(cmd, '/')),
|
|
245
246
|
...((!opt.name && opt.args) || []),
|
|
246
247
|
dimGrey('took ' + _since(started)),
|
|
247
248
|
!isSuccessful && dimGrey('and ') + dimRed('failed'),
|
package/package.json
CHANGED
package/src/util/exec2.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { execSync, spawn, spawnSync } from 'node:child_process'
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
_substringAfterLast,
|
|
4
|
+
type AnyObject,
|
|
5
|
+
type NumberOfMilliseconds,
|
|
6
|
+
type UnixTimestampMillis,
|
|
7
|
+
} from '@naturalcycles/js-lib'
|
|
3
8
|
import { _since, AppError } from '@naturalcycles/js-lib'
|
|
4
9
|
import { dimGrey, dimRed, hasColors, white } from '../colors/colors.js'
|
|
5
10
|
|
|
@@ -256,7 +261,7 @@ class Exec2 {
|
|
|
256
261
|
console.log(
|
|
257
262
|
[
|
|
258
263
|
dimGrey(...Object.entries(opt.env || {}).map(([k, v]) => [k, v].join('='))),
|
|
259
|
-
white(opt.name || cmd),
|
|
264
|
+
white(opt.name || _substringAfterLast(cmd, '/')),
|
|
260
265
|
...((!opt.name && (opt as SpawnOptions).args) || []),
|
|
261
266
|
]
|
|
262
267
|
.filter(Boolean)
|
|
@@ -274,7 +279,7 @@ class Exec2 {
|
|
|
274
279
|
|
|
275
280
|
console.log(
|
|
276
281
|
[
|
|
277
|
-
white(opt.name || cmd),
|
|
282
|
+
white(opt.name || _substringAfterLast(cmd, '/')),
|
|
278
283
|
...((!opt.name && (opt as SpawnOptions).args) || []),
|
|
279
284
|
dimGrey('took ' + _since(started)),
|
|
280
285
|
!isSuccessful && dimGrey('and ') + dimRed('failed'),
|