@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.
@@ -1,4 +1,4 @@
1
- import type { AnyObject, NumberOfMilliseconds } from '@naturalcycles/js-lib';
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.
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
3
  "type": "module",
4
- "version": "14.3.2",
4
+ "version": "14.3.3",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@types/js-yaml": "^4",
package/src/util/exec2.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import { execSync, spawn, spawnSync } from 'node:child_process'
2
- import type { AnyObject, NumberOfMilliseconds, UnixTimestampMillis } from '@naturalcycles/js-lib'
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'),