@naturalcycles/nodejs-lib 12.103.2 → 12.104.0

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.
Files changed (62) hide show
  1. package/dist/bin/del.js +2 -2
  2. package/dist/bin/generate-build-info.js +6 -6
  3. package/dist/bin/json2env.js +4 -4
  4. package/dist/bin/kpy.js +2 -2
  5. package/dist/bin/secrets-decrypt.js +3 -3
  6. package/dist/bin/secrets-encrypt.js +3 -3
  7. package/dist/bin/secrets-gen-key.js +3 -3
  8. package/dist/bin/slack-this.js +2 -2
  9. package/dist/colors/colors.d.ts +28 -0
  10. package/dist/colors/colors.js +33 -1
  11. package/dist/fs/del.js +1 -1
  12. package/dist/fs/fs.util.d.ts +136 -23
  13. package/dist/fs/fs.util.js +53 -25
  14. package/dist/fs/json2env.d.ts +4 -0
  15. package/dist/fs/json2env.js +16 -5
  16. package/dist/fs/kpy.js +1 -1
  17. package/dist/index.d.ts +4 -1
  18. package/dist/index.js +4 -1
  19. package/dist/secret/secrets-decrypt.util.js +1 -1
  20. package/dist/secret/secrets-encrypt.util.js +1 -1
  21. package/dist/stream/ndjson/ndjson.model.js +1 -1
  22. package/dist/stream/ndjson/pipelineFromNDJsonFile.js +1 -1
  23. package/dist/stream/ndjson/pipelineToNDJsonFile.js +1 -1
  24. package/dist/stream/sizeStack.js +1 -1
  25. package/dist/stream/transform/transformLogProgress.js +2 -3
  26. package/dist/stream/transform/transformMap.js +1 -1
  27. package/dist/stream/transform/transformMapSync.js +1 -1
  28. package/dist/util/git.util.js +1 -1
  29. package/package.json +1 -1
  30. package/src/bin/del.ts +1 -1
  31. package/src/bin/generate-build-info.ts +2 -2
  32. package/src/bin/json2env.ts +2 -2
  33. package/src/bin/kpy.ts +1 -1
  34. package/src/bin/secrets-decrypt.ts +2 -2
  35. package/src/bin/secrets-encrypt.ts +2 -2
  36. package/src/bin/secrets-gen-key.ts +2 -2
  37. package/src/bin/slack-this.ts +1 -1
  38. package/src/colors/colors.ts +35 -0
  39. package/src/fs/del.ts +1 -1
  40. package/src/fs/fs.util.ts +53 -30
  41. package/src/fs/json2env.ts +15 -4
  42. package/src/fs/kpy.ts +1 -1
  43. package/src/index.ts +4 -1
  44. package/src/secret/secrets-decrypt.util.ts +1 -1
  45. package/src/secret/secrets-encrypt.util.ts +1 -1
  46. package/src/stream/ndjson/ndjson.model.ts +1 -1
  47. package/src/stream/ndjson/pipelineFromNDJsonFile.ts +1 -1
  48. package/src/stream/ndjson/pipelineToNDJsonFile.ts +1 -1
  49. package/src/stream/sizeStack.ts +1 -1
  50. package/src/stream/transform/transformLogProgress.ts +1 -2
  51. package/src/stream/transform/transformMap.ts +1 -1
  52. package/src/stream/transform/transformMapSync.ts +1 -1
  53. package/src/util/git.util.ts +1 -1
  54. package/dist/colors/index.d.ts +0 -28
  55. package/dist/colors/index.js +0 -35
  56. package/dist/fs/index.d.ts +0 -3
  57. package/dist/fs/index.js +0 -6
  58. package/src/colors/index.ts +0 -35
  59. package/src/fs/index.ts +0 -3
  60. /package/dist/script/{index.d.ts → runScript.d.ts} +0 -0
  61. /package/dist/script/{index.js → runScript.js} +0 -0
  62. /package/src/script/{index.ts → runScript.ts} +0 -0
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NDJsonStats = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
- const colors_1 = require("../../colors");
5
+ const colors_1 = require("../../colors/colors");
6
6
  class NDJsonStats {
7
7
  constructor() {
8
8
  this.tookMillis = 0;
@@ -5,7 +5,7 @@ const node_zlib_1 = require("node:zlib");
5
5
  const fs = require("node:fs");
6
6
  const js_lib_1 = require("@naturalcycles/js-lib");
7
7
  const __1 = require("../..");
8
- const colors_1 = require("../../colors");
8
+ const colors_1 = require("../../colors/colors");
9
9
  const ndjson_model_1 = require("./ndjson.model");
10
10
  const transformJsonParse_1 = require("./transformJsonParse");
11
11
  /**
@@ -5,7 +5,7 @@ const node_zlib_1 = require("node:zlib");
5
5
  const fs = require("node:fs");
6
6
  const js_lib_1 = require("@naturalcycles/js-lib");
7
7
  const __1 = require("../..");
8
- const colors_1 = require("../../colors");
8
+ const colors_1 = require("../../colors/colors");
9
9
  const ndjson_model_1 = require("./ndjson.model");
10
10
  const transformToNDJson_1 = require("./transformToNDJson");
11
11
  /**
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SizeStack = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
- const colors_1 = require("../colors");
5
+ const colors_1 = require("../colors/colors");
6
6
  const zip_util_1 = require("../util/zip.util");
7
7
  class SizeStack extends js_lib_1.NumberStack {
8
8
  constructor(name, size) {
@@ -4,11 +4,10 @@ exports.transformLogProgress = void 0;
4
4
  const node_stream_1 = require("node:stream");
5
5
  const node_util_1 = require("node:util");
6
6
  const js_lib_1 = require("@naturalcycles/js-lib");
7
- const colors_1 = require("../../colors");
8
- const colors_2 = require("../../colors/colors");
7
+ const colors_1 = require("../../colors/colors");
9
8
  const sizeStack_1 = require("../sizeStack");
10
9
  const inspectOpt = {
11
- colors: colors_2.hasColors,
10
+ colors: colors_1.hasColors,
12
11
  breakLength: 300,
13
12
  };
14
13
  /**
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformMap = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
5
  const through2Concurrent = require("through2-concurrent");
6
- const colors_1 = require("../../colors");
6
+ const colors_1 = require("../../colors/colors");
7
7
  const stream_util_1 = require("../stream.util");
8
8
  // doesn't work, cause here we don't construct our Transform instance ourselves
9
9
  // export class TransformMap extends AbortableTransform {}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformMapSync = exports.TransformMapSync = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
- const colors_1 = require("../../colors");
5
+ const colors_1 = require("../../colors/colors");
6
6
  const pipeline_1 = require("../pipeline/pipeline");
7
7
  const stream_util_1 = require("../stream.util");
8
8
  class TransformMapSync extends pipeline_1.AbortableTransform {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.gitCurrentRepoName = exports.gitCurrentBranchName = exports.gitCurrentCommitTimestamp = exports.gitCurrentCommitSha = exports.gitPush = exports.gitPull = exports.gitIsAhead = exports.gitCommitAll = exports.gitHasUncommittedChanges = exports.commitMessageToTitleMessage = exports.getLastGitCommitMsg = void 0;
4
4
  const cp = require("node:child_process");
5
5
  const path = require("node:path");
6
- const colors_1 = require("../colors");
6
+ const colors_1 = require("../colors/colors");
7
7
  function getLastGitCommitMsg() {
8
8
  return execSync('git log -1 --pretty=%B');
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "12.103.2",
3
+ "version": "12.104.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "docs-serve": "vuepress dev docs",
package/src/bin/del.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as yargs from 'yargs'
4
4
  import { delSync } from '../fs/del'
5
- import { runScript } from '../script'
5
+ import { runScript } from '../script/runScript'
6
6
 
7
7
  runScript(async () => {
8
8
  const { _: patterns, ...opt } = yargs.demandCommand(1).options({
@@ -3,8 +3,8 @@
3
3
  import * as fs from 'node:fs'
4
4
  import * as path from 'node:path'
5
5
  import * as yargs from 'yargs'
6
- import { appendToBashEnv, appendToGithubEnv, appendToGithubOutput } from '../fs'
7
- import { runScript } from '../script'
6
+ import { appendToBashEnv, appendToGithubEnv, appendToGithubOutput } from '../fs/json2env'
7
+ import { runScript } from '../script/runScript'
8
8
  import { generateBuildInfo } from '../util/buildInfo.util'
9
9
 
10
10
  runScript(async () => {
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import * as yargs from 'yargs'
4
- import { json2env } from '../fs'
5
- import { runScript } from '../script'
4
+ import { json2env } from '../fs/json2env'
5
+ import { runScript } from '../script/runScript'
6
6
 
7
7
  runScript(() => {
8
8
  const { argv } = yargs.demandCommand(1).options({
package/src/bin/kpy.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as yargs from 'yargs'
4
4
  import { kpySync } from '../fs/kpy'
5
- import { runScript } from '../script'
5
+ import { runScript } from '../script/runScript'
6
6
 
7
7
  runScript(() => {
8
8
  const {
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import * as yargs from 'yargs'
4
- import { dimGrey } from '../colors'
5
- import { runScript } from '../script'
4
+ import { dimGrey } from '../colors/colors'
5
+ import { runScript } from '../script/runScript'
6
6
  import { DecryptCLIOptions, secretsDecrypt } from '../secret/secrets-decrypt.util'
7
7
 
8
8
  runScript(() => {
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import * as yargs from 'yargs'
4
- import { dimGrey } from '../colors'
5
- import { runScript } from '../script'
4
+ import { dimGrey } from '../colors/colors'
5
+ import { runScript } from '../script/runScript'
6
6
  import { EncryptCLIOptions, secretsEncrypt } from '../secret/secrets-encrypt.util'
7
7
 
8
8
  runScript(() => {
@@ -2,8 +2,8 @@
2
2
 
3
3
  import * as crypto from 'node:crypto'
4
4
  import * as yargs from 'yargs'
5
- import { dimGrey } from '../colors'
6
- import { runScript } from '../script'
5
+ import { dimGrey } from '../colors/colors'
6
+ import { runScript } from '../script/runScript'
7
7
 
8
8
  runScript(() => {
9
9
  const { sizeBytes } = yargs.option('sizeBytes', {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as yargs from 'yargs'
4
4
  import { SlackService } from '..'
5
- import { runScript } from '../script'
5
+ import { runScript } from '../script/runScript'
6
6
 
7
7
  runScript(async () => {
8
8
  const {
@@ -1,4 +1,7 @@
1
1
  import * as tty from 'node:tty'
2
+ import * as chalk from 'chalk'
3
+
4
+ export { chalk }
2
5
 
3
6
  /**
4
7
  * Based on: https://github.com/sindresorhus/yoctocolors/pull/5
@@ -6,3 +9,35 @@ import * as tty from 'node:tty'
6
9
  * @experimental
7
10
  */
8
11
  export const hasColors = !process.env['NO_COLOR'] && tty.WriteStream.prototype.hasColors()
12
+
13
+ // The point of re-exporting is:
14
+ // 1. Fix typings to allow to pass `number` (very common case)
15
+ // 2. Easier/shorter to import, rather than from 'chalk'
16
+ // export type ColorFn = (...args: (string | number)[]) => string
17
+
18
+ export const white = chalk.white
19
+ export const dimWhite = chalk.dim.white
20
+ export const boldWhite = chalk.bold.white
21
+ export const inverseWhite = chalk.inverse.white
22
+ export const grey = chalk.grey
23
+ export const dimGrey = chalk.dim.grey
24
+ export const boldGrey = chalk.bold.grey
25
+ export const yellow = chalk.yellow
26
+ export const dimYellow = chalk.dim.yellow
27
+ export const boldYellow = chalk.bold.yellow
28
+ export const inverseYellow = chalk.inverse.yellow
29
+ export const green = chalk.green
30
+ export const dimGreen = chalk.dim.green
31
+ export const boldGreen = chalk.bold.green
32
+ export const red = chalk.red
33
+ export const dimRed = chalk.dim.red
34
+ export const boldRed = chalk.bold.red
35
+ export const blue = chalk.blue
36
+ export const dimBlue = chalk.dim.blue
37
+ export const boldBlue = chalk.bold.blue
38
+ export const magenta = chalk.magenta
39
+ export const dimMagenta = chalk.dim.magenta
40
+ export const boldMagenta = chalk.bold.magenta
41
+ export const cyan = chalk.cyan
42
+ export const dimCyan = chalk.dim.cyan
43
+ export const boldCyan = chalk.bold.cyan
package/src/fs/del.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'node:fs'
2
2
  import * as fsp from 'node:fs/promises'
3
3
  import { pFilter, pMap, _since } from '@naturalcycles/js-lib'
4
- import { dimGrey, yellow } from '../colors'
4
+ import { dimGrey, yellow } from '../colors/colors'
5
5
  import { _pathExists, _pathExistsSync, globby } from '../index'
6
6
 
7
7
  export interface DelOptions {
package/src/fs/fs.util.ts CHANGED
@@ -19,6 +19,48 @@ import * as fsp from 'node:fs/promises'
19
19
  import * as path from 'node:path'
20
20
  import { _jsonParse } from '@naturalcycles/js-lib'
21
21
 
22
+ /**
23
+ * fs2 conveniently groups filesystem functions together.
24
+ * Supposed to be almost a drop-in replacement for these things together:
25
+ *
26
+ * 1. node:fs
27
+ * 2. node:fs/promises
28
+ * 3. fs-extra
29
+ */
30
+ export const fs2 = {
31
+ // "Omit" is here to workaround this TS error:
32
+ // Exported variable 'fs2' has or is using name 'StreamOptions' from external module "fs" but cannot be named.
33
+ ...(fs as Omit<typeof fs, 'StreamOptions'>),
34
+ readFile: _readFile,
35
+ readFileSync: _readFileSync,
36
+ readFileAsBuffer: _readFileAsBuffer,
37
+ readFileAsBufferSync: _readFileAsBufferSync,
38
+ readJson: _readJson,
39
+ readJsonSync: _readJsonSync,
40
+ writeFile: _writeFile,
41
+ writeFileSync: _writeFileSync,
42
+ outputJson: _outputJson,
43
+ outputJsonSync: _outputJsonSync,
44
+ writeJson: _writeJson,
45
+ writeJsonSync: _writeJsonSync,
46
+ outputFile: _outputFile,
47
+ outputFileSync: _outputFileSync,
48
+ pathExists: _pathExists,
49
+ pathExistsSync: _pathExistsSync,
50
+ ensureDir: _ensureDir,
51
+ ensureDirSync: _ensureDirSync,
52
+ ensureFile: _ensureFile,
53
+ ensureFileSync: _ensureFileSync,
54
+ removePath: _removePath,
55
+ removePathSync: _removePathSync,
56
+ emptyDir: _emptyDir,
57
+ emptyDirSync: _emptyDirSync,
58
+ copyPath: _copyPath,
59
+ copyPathSync: _copyPathSync,
60
+ movePath: _movePath,
61
+ movePathSync: _movePathSync,
62
+ }
63
+
22
64
  export interface JsonOptions {
23
65
  spaces?: number
24
66
  }
@@ -30,6 +72,10 @@ export async function _readFile(filePath: string): Promise<string> {
30
72
  return await fsp.readFile(filePath, 'utf8')
31
73
  }
32
74
 
75
+ export async function _readFileAsBuffer(filePath: string): Promise<Buffer> {
76
+ return await fsp.readFile(filePath)
77
+ }
78
+
33
79
  /**
34
80
  * Convenience wrapper that defaults to utf-8 string output.
35
81
  */
@@ -37,26 +83,23 @@ export function _readFileSync(filePath: string): string {
37
83
  return fs.readFileSync(filePath, 'utf8')
38
84
  }
39
85
 
86
+ /**
87
+ * Convenience wrapper that defaults to utf-8 string output.
88
+ */
89
+ export function _readFileAsBufferSync(filePath: string): Buffer {
90
+ return fs.readFileSync(filePath)
91
+ }
92
+
40
93
  export async function _readJson<T = unknown>(filePath: string): Promise<T> {
41
94
  const str = await fsp.readFile(filePath, 'utf8')
42
95
  return _jsonParse(str)
43
96
  }
44
97
 
45
- /**
46
- * @deprecated use _readJson
47
- */
48
- export const _readJsonFile = _readJson
49
-
50
98
  export function _readJsonSync<T = unknown>(filePath: string): T {
51
99
  const str = fs.readFileSync(filePath, 'utf8')
52
100
  return _jsonParse(str)
53
101
  }
54
102
 
55
- /**
56
- * @deprecated use _readJsonSync
57
- */
58
- export const _readJsonFileSync = _readJsonSync
59
-
60
103
  export async function _writeFile(filePath: string, data: string | Buffer): Promise<void> {
61
104
  await fsp.writeFile(filePath, data)
62
105
  }
@@ -88,41 +131,21 @@ export async function _writeJson(filePath: string, data: any, opt?: JsonOptions)
88
131
  await fsp.writeFile(filePath, str)
89
132
  }
90
133
 
91
- /**
92
- * @deprecated use _writeJson
93
- */
94
- export const _writeJsonFile = _writeJson
95
-
96
134
  export function _writeJsonSync(filePath: string, data: any, opt?: JsonOptions): void {
97
135
  const str = JSON.stringify(data, null, opt?.spaces)
98
136
  fs.writeFileSync(filePath, str)
99
137
  }
100
138
 
101
- /**
102
- * @deprecated use _writeJsonSync
103
- */
104
- export const _writeJsonFileSync = _writeJsonSync
105
-
106
139
  export async function _outputJson(filePath: string, data: any, opt?: JsonOptions): Promise<void> {
107
140
  const str = JSON.stringify(data, null, opt?.spaces)
108
141
  await _outputFile(filePath, str)
109
142
  }
110
143
 
111
- /**
112
- * @deprecated use _outputJson
113
- */
114
- export const _outputJsonFile = _outputJson
115
-
116
144
  export function _outputJsonSync(filePath: string, data: any, opt?: JsonOptions): void {
117
145
  const str = JSON.stringify(data, null, opt?.spaces)
118
146
  _outputFileSync(filePath, str)
119
147
  }
120
148
 
121
- /**
122
- * @deprecated use _outputJsonSync
123
- */
124
- export const _outputJsonFileSync = _outputJsonSync
125
-
126
149
  export async function _pathExists(filePath: string): Promise<boolean> {
127
150
  try {
128
151
  await fsp.access(filePath)
@@ -1,6 +1,6 @@
1
1
  import * as fs from 'node:fs'
2
2
  import { AnyObject } from '@naturalcycles/js-lib'
3
- import { dimGrey } from '../colors'
3
+ import { dimGrey } from '../colors/colors'
4
4
  import { _pathExistsSync, _readJsonSync, _writeFileSync } from './fs.util'
5
5
 
6
6
  export interface Json2EnvOptions {
@@ -95,7 +95,7 @@ export function appendToBashEnv(obj: AnyObject, prefix = ''): void {
95
95
  if (BASH_ENV) {
96
96
  const data = objectToShellExport(obj, prefix)
97
97
  fs.appendFileSync(BASH_ENV, data)
98
- console.log(`BASH_ENV file appended (${dimGrey(BASH_ENV)})\n${data}`)
98
+ console.log(`BASH_ENV appended:\n${data}`)
99
99
  }
100
100
  }
101
101
 
@@ -104,7 +104,7 @@ export function appendToGithubEnv(obj: AnyObject, prefix = ''): void {
104
104
  if (GITHUB_ENV) {
105
105
  const data = objectToGithubActionsEnv(obj, prefix)
106
106
  fs.appendFileSync(GITHUB_ENV, data)
107
- console.log(`GITHUB_ENV file appended (${dimGrey(GITHUB_ENV)})\n${data}`)
107
+ console.log(`GITHUB_ENV appended:\n${data}`)
108
108
  }
109
109
  }
110
110
 
@@ -113,7 +113,18 @@ export function appendToGithubOutput(obj: AnyObject, prefix = ''): void {
113
113
  if (GITHUB_OUTPUT) {
114
114
  const data = objectToGithubActionsEnv(obj, prefix)
115
115
  fs.appendFileSync(GITHUB_OUTPUT, data)
116
- console.log(`GITHUB_OUTPUT file appended (${dimGrey(GITHUB_OUTPUT)})\n${data}`)
116
+ console.log(`GITHUB_OUTPUT appended:\n${data}`)
117
+ }
118
+ }
119
+
120
+ /**
121
+ * https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary
122
+ */
123
+ export function appendToGithubSummary(str: string): void {
124
+ const { GITHUB_STEP_SUMMARY } = process.env
125
+ if (GITHUB_STEP_SUMMARY) {
126
+ fs.appendFileSync(GITHUB_STEP_SUMMARY, str + '\n')
127
+ console.log(`GITHUB_STEP_SUMMARY appended:\n${str}`)
117
128
  }
118
129
  }
119
130
 
package/src/fs/kpy.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as path from 'node:path'
2
2
  import { _since } from '@naturalcycles/js-lib'
3
- import { boldWhite, dimGrey, grey, yellow } from '../colors'
3
+ import { boldWhite, dimGrey, grey, yellow } from '../colors/colors'
4
4
  import {
5
5
  _copyPath,
6
6
  _copyPathSync,
package/src/index.ts CHANGED
@@ -88,9 +88,12 @@ export * from './validation/joi/joi.model'
88
88
  export * from './validation/joi/joi.shared.schemas'
89
89
  export * from './validation/joi/joi.validation.error'
90
90
  export * from './validation/joi/joi.validation.util'
91
- export * from './script'
91
+ export * from './script/runScript'
92
92
  export * from './jwt/jwt.service'
93
93
  export * from './fs/fs.util'
94
+ export * from './fs/del'
95
+ export * from './fs/json2env'
96
+ export * from './fs/kpy'
94
97
 
95
98
  export type {
96
99
  GlobbyOptions,
@@ -1,7 +1,7 @@
1
1
  import * as path from 'node:path'
2
2
  import * as fs from 'node:fs'
3
3
  import { _assert } from '@naturalcycles/js-lib'
4
- import { dimGrey, yellow } from '../colors'
4
+ import { dimGrey, yellow } from '../colors/colors'
5
5
  import { _readJsonSync, _writeJsonSync, fastGlob } from '../index'
6
6
  import { decryptObject, decryptRandomIVBuffer } from '../security/crypto.util'
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'node:fs'
2
2
  import * as path from 'node:path'
3
3
  import { _assert } from '@naturalcycles/js-lib'
4
- import { dimGrey, yellow } from '../colors'
4
+ import { dimGrey, yellow } from '../colors/colors'
5
5
  import { _readJsonSync, _writeJsonSync, fastGlob } from '../index'
6
6
  import { encryptObject, encryptRandomIVBuffer } from '../security/crypto.util'
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { _hb, _ms } from '@naturalcycles/js-lib'
2
- import { boldWhite, dimWhite } from '../../colors'
2
+ import { boldWhite, dimWhite } from '../../colors/colors'
3
3
 
4
4
  export class NDJsonStats {
5
5
  static create(o: Partial<NDJsonStats> = {}): NDJsonStats {
@@ -2,7 +2,7 @@ import { createUnzip, ZlibOptions } from 'node:zlib'
2
2
  import * as fs from 'node:fs'
3
3
  import { _hb } from '@naturalcycles/js-lib'
4
4
  import { transformTap, _pipeline, transformSplit } from '../..'
5
- import { dimWhite, grey } from '../../colors'
5
+ import { dimWhite, grey } from '../../colors/colors'
6
6
  import { NDJsonStats } from './ndjson.model'
7
7
  import { transformJsonParse, TransformJsonParseOptions } from './transformJsonParse'
8
8
 
@@ -2,7 +2,7 @@ import { createGzip, ZlibOptions } from 'node:zlib'
2
2
  import * as fs from 'node:fs'
3
3
  import { AppError } from '@naturalcycles/js-lib'
4
4
  import { transformTap, _pipeline, _pathExistsSync, _ensureFileSync } from '../..'
5
- import { grey } from '../../colors'
5
+ import { grey } from '../../colors/colors'
6
6
  import { NDJsonStats } from './ndjson.model'
7
7
  import { transformToNDJson, TransformToNDJsonOptions } from './transformToNDJson'
8
8
 
@@ -1,5 +1,5 @@
1
1
  import { _hb, CommonLogger, NumberStack } from '@naturalcycles/js-lib'
2
- import { yellow } from '../colors'
2
+ import { yellow } from '../colors/colors'
3
3
  import { gzipBuffer } from '../util/zip.util'
4
4
 
5
5
  export class SizeStack extends NumberStack {
@@ -8,8 +8,7 @@ import {
8
8
  CommonLogger,
9
9
  localTime,
10
10
  } from '@naturalcycles/js-lib'
11
- import { boldWhite, dimGrey, white, yellow } from '../../colors'
12
- import { hasColors } from '../../colors/colors'
11
+ import { hasColors, boldWhite, dimGrey, white, yellow } from '../../colors/colors'
13
12
  import { SizeStack } from '../sizeStack'
14
13
  import { TransformOptions, TransformTyped } from '../stream.model'
15
14
 
@@ -9,7 +9,7 @@ import {
9
9
  SKIP,
10
10
  } from '@naturalcycles/js-lib'
11
11
  import through2Concurrent = require('through2-concurrent')
12
- import { yellow } from '../../colors'
12
+ import { yellow } from '../../colors/colors'
13
13
  import { AbortableTransform } from '../pipeline/pipeline'
14
14
  import { TransformTyped } from '../stream.model'
15
15
  import { pipelineClose } from '../stream.util'
@@ -7,7 +7,7 @@ import {
7
7
  Predicate,
8
8
  SKIP,
9
9
  } from '@naturalcycles/js-lib'
10
- import { yellow } from '../../colors'
10
+ import { yellow } from '../../colors/colors'
11
11
  import { AbortableTransform } from '../pipeline/pipeline'
12
12
  import { TransformTyped } from '../stream.model'
13
13
  import { pipelineClose } from '../stream.util'
@@ -1,7 +1,7 @@
1
1
  import * as cp from 'node:child_process'
2
2
  import * as path from 'node:path'
3
3
  import type { UnixTimestampNumber } from '@naturalcycles/js-lib'
4
- import { grey } from '../colors'
4
+ import { grey } from '../colors/colors'
5
5
 
6
6
  export function getLastGitCommitMsg(): string {
7
7
  return execSync('git log -1 --pretty=%B')
@@ -1,28 +0,0 @@
1
- import * as chalk from 'chalk';
2
- export { chalk };
3
- export declare const white: chalk.Chalk;
4
- export declare const dimWhite: chalk.Chalk;
5
- export declare const boldWhite: chalk.Chalk;
6
- export declare const inverseWhite: chalk.Chalk;
7
- export declare const grey: chalk.Chalk;
8
- export declare const dimGrey: chalk.Chalk;
9
- export declare const boldGrey: chalk.Chalk;
10
- export declare const yellow: chalk.Chalk;
11
- export declare const dimYellow: chalk.Chalk;
12
- export declare const boldYellow: chalk.Chalk;
13
- export declare const inverseYellow: chalk.Chalk;
14
- export declare const green: chalk.Chalk;
15
- export declare const dimGreen: chalk.Chalk;
16
- export declare const boldGreen: chalk.Chalk;
17
- export declare const red: chalk.Chalk;
18
- export declare const dimRed: chalk.Chalk;
19
- export declare const boldRed: chalk.Chalk;
20
- export declare const blue: chalk.Chalk;
21
- export declare const dimBlue: chalk.Chalk;
22
- export declare const boldBlue: chalk.Chalk;
23
- export declare const magenta: chalk.Chalk;
24
- export declare const dimMagenta: chalk.Chalk;
25
- export declare const boldMagenta: chalk.Chalk;
26
- export declare const cyan: chalk.Chalk;
27
- export declare const dimCyan: chalk.Chalk;
28
- export declare const boldCyan: chalk.Chalk;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.boldCyan = exports.dimCyan = exports.cyan = exports.boldMagenta = exports.dimMagenta = exports.magenta = exports.boldBlue = exports.dimBlue = exports.blue = exports.boldRed = exports.dimRed = exports.red = exports.boldGreen = exports.dimGreen = exports.green = exports.inverseYellow = exports.boldYellow = exports.dimYellow = exports.yellow = exports.boldGrey = exports.dimGrey = exports.grey = exports.inverseWhite = exports.boldWhite = exports.dimWhite = exports.white = exports.chalk = void 0;
4
- const chalk = require("chalk");
5
- exports.chalk = chalk;
6
- // The point of re-exporting is:
7
- // 1. Fix typings to allow to pass `number` (very common case)
8
- // 2. Easier/shorter to import, rather than from 'chalk'
9
- // export type ColorFn = (...args: (string | number)[]) => string
10
- exports.white = chalk.white;
11
- exports.dimWhite = chalk.dim.white;
12
- exports.boldWhite = chalk.bold.white;
13
- exports.inverseWhite = chalk.inverse.white;
14
- exports.grey = chalk.grey;
15
- exports.dimGrey = chalk.dim.grey;
16
- exports.boldGrey = chalk.bold.grey;
17
- exports.yellow = chalk.yellow;
18
- exports.dimYellow = chalk.dim.yellow;
19
- exports.boldYellow = chalk.bold.yellow;
20
- exports.inverseYellow = chalk.inverse.yellow;
21
- exports.green = chalk.green;
22
- exports.dimGreen = chalk.dim.green;
23
- exports.boldGreen = chalk.bold.green;
24
- exports.red = chalk.red;
25
- exports.dimRed = chalk.dim.red;
26
- exports.boldRed = chalk.bold.red;
27
- exports.blue = chalk.blue;
28
- exports.dimBlue = chalk.dim.blue;
29
- exports.boldBlue = chalk.bold.blue;
30
- exports.magenta = chalk.magenta;
31
- exports.dimMagenta = chalk.dim.magenta;
32
- exports.boldMagenta = chalk.bold.magenta;
33
- exports.cyan = chalk.cyan;
34
- exports.dimCyan = chalk.dim.cyan;
35
- exports.boldCyan = chalk.bold.cyan;
@@ -1,3 +0,0 @@
1
- export * from './del';
2
- export * from './json2env';
3
- export * from './kpy';
package/dist/fs/index.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./del"), exports);
5
- tslib_1.__exportStar(require("./json2env"), exports);
6
- tslib_1.__exportStar(require("./kpy"), exports);