@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.
- package/dist/bin/del.js +2 -2
- package/dist/bin/generate-build-info.js +6 -6
- package/dist/bin/json2env.js +4 -4
- package/dist/bin/kpy.js +2 -2
- package/dist/bin/secrets-decrypt.js +3 -3
- package/dist/bin/secrets-encrypt.js +3 -3
- package/dist/bin/secrets-gen-key.js +3 -3
- package/dist/bin/slack-this.js +2 -2
- package/dist/colors/colors.d.ts +28 -0
- package/dist/colors/colors.js +33 -1
- package/dist/fs/del.js +1 -1
- package/dist/fs/fs.util.d.ts +136 -23
- package/dist/fs/fs.util.js +53 -25
- package/dist/fs/json2env.d.ts +4 -0
- package/dist/fs/json2env.js +16 -5
- package/dist/fs/kpy.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/secret/secrets-decrypt.util.js +1 -1
- package/dist/secret/secrets-encrypt.util.js +1 -1
- package/dist/stream/ndjson/ndjson.model.js +1 -1
- package/dist/stream/ndjson/pipelineFromNDJsonFile.js +1 -1
- package/dist/stream/ndjson/pipelineToNDJsonFile.js +1 -1
- package/dist/stream/sizeStack.js +1 -1
- package/dist/stream/transform/transformLogProgress.js +2 -3
- package/dist/stream/transform/transformMap.js +1 -1
- package/dist/stream/transform/transformMapSync.js +1 -1
- package/dist/util/git.util.js +1 -1
- package/package.json +1 -1
- package/src/bin/del.ts +1 -1
- package/src/bin/generate-build-info.ts +2 -2
- package/src/bin/json2env.ts +2 -2
- package/src/bin/kpy.ts +1 -1
- package/src/bin/secrets-decrypt.ts +2 -2
- package/src/bin/secrets-encrypt.ts +2 -2
- package/src/bin/secrets-gen-key.ts +2 -2
- package/src/bin/slack-this.ts +1 -1
- package/src/colors/colors.ts +35 -0
- package/src/fs/del.ts +1 -1
- package/src/fs/fs.util.ts +53 -30
- package/src/fs/json2env.ts +15 -4
- package/src/fs/kpy.ts +1 -1
- package/src/index.ts +4 -1
- package/src/secret/secrets-decrypt.util.ts +1 -1
- package/src/secret/secrets-encrypt.util.ts +1 -1
- package/src/stream/ndjson/ndjson.model.ts +1 -1
- package/src/stream/ndjson/pipelineFromNDJsonFile.ts +1 -1
- package/src/stream/ndjson/pipelineToNDJsonFile.ts +1 -1
- package/src/stream/sizeStack.ts +1 -1
- package/src/stream/transform/transformLogProgress.ts +1 -2
- package/src/stream/transform/transformMap.ts +1 -1
- package/src/stream/transform/transformMapSync.ts +1 -1
- package/src/util/git.util.ts +1 -1
- package/dist/colors/index.d.ts +0 -28
- package/dist/colors/index.js +0 -35
- package/dist/fs/index.d.ts +0 -3
- package/dist/fs/index.js +0 -6
- package/src/colors/index.ts +0 -35
- package/src/fs/index.ts +0 -3
- /package/dist/script/{index.d.ts → runScript.d.ts} +0 -0
- /package/dist/script/{index.js → runScript.js} +0 -0
- /package/src/script/{index.ts → runScript.ts} +0 -0
package/dist/bin/del.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const yargs = require("yargs");
|
|
5
5
|
const del_1 = require("../fs/del");
|
|
6
|
-
const
|
|
7
|
-
(0,
|
|
6
|
+
const runScript_1 = require("../script/runScript");
|
|
7
|
+
(0, runScript_1.runScript)(async () => {
|
|
8
8
|
const { _: patterns, ...opt } = yargs.demandCommand(1).options({
|
|
9
9
|
verbose: {
|
|
10
10
|
type: 'boolean',
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const yargs = require("yargs");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const json2env_1 = require("../fs/json2env");
|
|
8
|
+
const runScript_1 = require("../script/runScript");
|
|
9
9
|
const buildInfo_util_1 = require("../util/buildInfo.util");
|
|
10
|
-
(0,
|
|
10
|
+
(0, runScript_1.runScript)(async () => {
|
|
11
11
|
const { dir, overrideTimestamp } = yargs.options({
|
|
12
12
|
dir: {
|
|
13
13
|
type: 'string',
|
|
@@ -27,7 +27,7 @@ const buildInfo_util_1 = require("../util/buildInfo.util");
|
|
|
27
27
|
const buildInfoPath = dir ? path.resolve(dir, 'buildInfo.json') : 'buildInfo.json';
|
|
28
28
|
fs.writeFileSync(buildInfoPath, JSON.stringify(buildInfo, null, 2));
|
|
29
29
|
const prefix = 'buildInfo_';
|
|
30
|
-
(0,
|
|
31
|
-
(0,
|
|
32
|
-
(0,
|
|
30
|
+
(0, json2env_1.appendToBashEnv)(buildInfo, prefix);
|
|
31
|
+
(0, json2env_1.appendToGithubEnv)(buildInfo, prefix);
|
|
32
|
+
(0, json2env_1.appendToGithubOutput)(buildInfo, prefix);
|
|
33
33
|
});
|
package/dist/bin/json2env.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const yargs = require("yargs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
(0,
|
|
5
|
+
const json2env_1 = require("../fs/json2env");
|
|
6
|
+
const runScript_1 = require("../script/runScript");
|
|
7
|
+
(0, runScript_1.runScript)(() => {
|
|
8
8
|
const { argv } = yargs.demandCommand(1).options({
|
|
9
9
|
prefix: {
|
|
10
10
|
type: 'string',
|
|
@@ -40,7 +40,7 @@ const script_1 = require("../script");
|
|
|
40
40
|
if (debug)
|
|
41
41
|
console.log({ argv });
|
|
42
42
|
const jsonPath = args[0];
|
|
43
|
-
(0,
|
|
43
|
+
(0, json2env_1.json2env)({
|
|
44
44
|
jsonPath,
|
|
45
45
|
prefix,
|
|
46
46
|
saveEnvFile,
|
package/dist/bin/kpy.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const yargs = require("yargs");
|
|
5
5
|
const kpy_1 = require("../fs/kpy");
|
|
6
|
-
const
|
|
7
|
-
(0,
|
|
6
|
+
const runScript_1 = require("../script/runScript");
|
|
7
|
+
(0, runScript_1.runScript)(() => {
|
|
8
8
|
const { _: [baseDir, ...inputPatterns], ...opt } = yargs.demandCommand(2).options({
|
|
9
9
|
silent: {
|
|
10
10
|
type: 'boolean',
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const yargs = require("yargs");
|
|
5
|
-
const colors_1 = require("../colors");
|
|
6
|
-
const
|
|
5
|
+
const colors_1 = require("../colors/colors");
|
|
6
|
+
const runScript_1 = require("../script/runScript");
|
|
7
7
|
const secrets_decrypt_util_1 = require("../secret/secrets-decrypt.util");
|
|
8
|
-
(0,
|
|
8
|
+
(0, runScript_1.runScript)(() => {
|
|
9
9
|
const { dir, file, encKey, del, jsonMode } = getDecryptCLIOptions();
|
|
10
10
|
(0, secrets_decrypt_util_1.secretsDecrypt)(dir, file, encKey, del, jsonMode);
|
|
11
11
|
});
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const yargs = require("yargs");
|
|
5
|
-
const colors_1 = require("../colors");
|
|
6
|
-
const
|
|
5
|
+
const colors_1 = require("../colors/colors");
|
|
6
|
+
const runScript_1 = require("../script/runScript");
|
|
7
7
|
const secrets_encrypt_util_1 = require("../secret/secrets-encrypt.util");
|
|
8
|
-
(0,
|
|
8
|
+
(0, runScript_1.runScript)(() => {
|
|
9
9
|
const { pattern, file, encKey, del, jsonMode } = getEncryptCLIOptions();
|
|
10
10
|
(0, secrets_encrypt_util_1.secretsEncrypt)(pattern, file, encKey, del, jsonMode);
|
|
11
11
|
});
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const crypto = require("node:crypto");
|
|
5
5
|
const yargs = require("yargs");
|
|
6
|
-
const colors_1 = require("../colors");
|
|
7
|
-
const
|
|
8
|
-
(0,
|
|
6
|
+
const colors_1 = require("../colors/colors");
|
|
7
|
+
const runScript_1 = require("../script/runScript");
|
|
8
|
+
(0, runScript_1.runScript)(() => {
|
|
9
9
|
const { sizeBytes } = yargs.option('sizeBytes', {
|
|
10
10
|
type: 'number',
|
|
11
11
|
default: 256,
|
package/dist/bin/slack-this.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const yargs = require("yargs");
|
|
5
5
|
const __1 = require("..");
|
|
6
|
-
const
|
|
7
|
-
(0,
|
|
6
|
+
const runScript_1 = require("../script/runScript");
|
|
7
|
+
(0, runScript_1.runScript)(async () => {
|
|
8
8
|
const { channel, msg, username, emoji, webhook: webhookUrl, } = yargs.options({
|
|
9
9
|
channel: {
|
|
10
10
|
type: 'string',
|
package/dist/colors/colors.d.ts
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
+
import * as chalk from 'chalk';
|
|
2
|
+
export { chalk };
|
|
1
3
|
/**
|
|
2
4
|
* Based on: https://github.com/sindresorhus/yoctocolors/pull/5
|
|
3
5
|
*
|
|
4
6
|
* @experimental
|
|
5
7
|
*/
|
|
6
8
|
export declare const hasColors: boolean;
|
|
9
|
+
export declare const white: chalk.Chalk;
|
|
10
|
+
export declare const dimWhite: chalk.Chalk;
|
|
11
|
+
export declare const boldWhite: chalk.Chalk;
|
|
12
|
+
export declare const inverseWhite: chalk.Chalk;
|
|
13
|
+
export declare const grey: chalk.Chalk;
|
|
14
|
+
export declare const dimGrey: chalk.Chalk;
|
|
15
|
+
export declare const boldGrey: chalk.Chalk;
|
|
16
|
+
export declare const yellow: chalk.Chalk;
|
|
17
|
+
export declare const dimYellow: chalk.Chalk;
|
|
18
|
+
export declare const boldYellow: chalk.Chalk;
|
|
19
|
+
export declare const inverseYellow: chalk.Chalk;
|
|
20
|
+
export declare const green: chalk.Chalk;
|
|
21
|
+
export declare const dimGreen: chalk.Chalk;
|
|
22
|
+
export declare const boldGreen: chalk.Chalk;
|
|
23
|
+
export declare const red: chalk.Chalk;
|
|
24
|
+
export declare const dimRed: chalk.Chalk;
|
|
25
|
+
export declare const boldRed: chalk.Chalk;
|
|
26
|
+
export declare const blue: chalk.Chalk;
|
|
27
|
+
export declare const dimBlue: chalk.Chalk;
|
|
28
|
+
export declare const boldBlue: chalk.Chalk;
|
|
29
|
+
export declare const magenta: chalk.Chalk;
|
|
30
|
+
export declare const dimMagenta: chalk.Chalk;
|
|
31
|
+
export declare const boldMagenta: chalk.Chalk;
|
|
32
|
+
export declare const cyan: chalk.Chalk;
|
|
33
|
+
export declare const dimCyan: chalk.Chalk;
|
|
34
|
+
export declare const boldCyan: chalk.Chalk;
|
package/dist/colors/colors.js
CHANGED
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasColors = void 0;
|
|
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.hasColors = exports.chalk = void 0;
|
|
4
4
|
const tty = require("node:tty");
|
|
5
|
+
const chalk = require("chalk");
|
|
6
|
+
exports.chalk = chalk;
|
|
5
7
|
/**
|
|
6
8
|
* Based on: https://github.com/sindresorhus/yoctocolors/pull/5
|
|
7
9
|
*
|
|
8
10
|
* @experimental
|
|
9
11
|
*/
|
|
10
12
|
exports.hasColors = !process.env['NO_COLOR'] && tty.WriteStream.prototype.hasColors();
|
|
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
|
+
exports.white = chalk.white;
|
|
18
|
+
exports.dimWhite = chalk.dim.white;
|
|
19
|
+
exports.boldWhite = chalk.bold.white;
|
|
20
|
+
exports.inverseWhite = chalk.inverse.white;
|
|
21
|
+
exports.grey = chalk.grey;
|
|
22
|
+
exports.dimGrey = chalk.dim.grey;
|
|
23
|
+
exports.boldGrey = chalk.bold.grey;
|
|
24
|
+
exports.yellow = chalk.yellow;
|
|
25
|
+
exports.dimYellow = chalk.dim.yellow;
|
|
26
|
+
exports.boldYellow = chalk.bold.yellow;
|
|
27
|
+
exports.inverseYellow = chalk.inverse.yellow;
|
|
28
|
+
exports.green = chalk.green;
|
|
29
|
+
exports.dimGreen = chalk.dim.green;
|
|
30
|
+
exports.boldGreen = chalk.bold.green;
|
|
31
|
+
exports.red = chalk.red;
|
|
32
|
+
exports.dimRed = chalk.dim.red;
|
|
33
|
+
exports.boldRed = chalk.bold.red;
|
|
34
|
+
exports.blue = chalk.blue;
|
|
35
|
+
exports.dimBlue = chalk.dim.blue;
|
|
36
|
+
exports.boldBlue = chalk.bold.blue;
|
|
37
|
+
exports.magenta = chalk.magenta;
|
|
38
|
+
exports.dimMagenta = chalk.dim.magenta;
|
|
39
|
+
exports.boldMagenta = chalk.bold.magenta;
|
|
40
|
+
exports.cyan = chalk.cyan;
|
|
41
|
+
exports.dimCyan = chalk.dim.cyan;
|
|
42
|
+
exports.boldCyan = chalk.bold.cyan;
|
package/dist/fs/del.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.delSync = exports.del = void 0;
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const fsp = require("node:fs/promises");
|
|
6
6
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
7
|
-
const colors_1 = require("../colors");
|
|
7
|
+
const colors_1 = require("../colors/colors");
|
|
8
8
|
const index_1 = require("../index");
|
|
9
9
|
const DEF_OPT = {
|
|
10
10
|
patterns: [],
|
package/dist/fs/fs.util.d.ts
CHANGED
|
@@ -1,6 +1,138 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
3
4
|
import * as fs from 'node:fs';
|
|
5
|
+
/**
|
|
6
|
+
* fs2 conveniently groups filesystem functions together.
|
|
7
|
+
* Supposed to be almost a drop-in replacement for these things together:
|
|
8
|
+
*
|
|
9
|
+
* 1. node:fs
|
|
10
|
+
* 2. node:fs/promises
|
|
11
|
+
* 3. fs-extra
|
|
12
|
+
*/
|
|
13
|
+
export declare const fs2: {
|
|
14
|
+
readFile: typeof _readFile;
|
|
15
|
+
readFileSync: typeof _readFileSync;
|
|
16
|
+
readFileAsBuffer: typeof _readFileAsBuffer;
|
|
17
|
+
readFileAsBufferSync: typeof _readFileAsBufferSync;
|
|
18
|
+
readJson: typeof _readJson;
|
|
19
|
+
readJsonSync: typeof _readJsonSync;
|
|
20
|
+
writeFile: typeof _writeFile;
|
|
21
|
+
writeFileSync: typeof _writeFileSync;
|
|
22
|
+
outputJson: typeof _outputJson;
|
|
23
|
+
outputJsonSync: typeof _outputJsonSync;
|
|
24
|
+
writeJson: typeof _writeJson;
|
|
25
|
+
writeJsonSync: typeof _writeJsonSync;
|
|
26
|
+
outputFile: typeof _outputFile;
|
|
27
|
+
outputFileSync: typeof _outputFileSync;
|
|
28
|
+
pathExists: typeof _pathExists;
|
|
29
|
+
pathExistsSync: typeof _pathExistsSync;
|
|
30
|
+
ensureDir: typeof _ensureDir;
|
|
31
|
+
ensureDirSync: typeof _ensureDirSync;
|
|
32
|
+
ensureFile: typeof _ensureFile;
|
|
33
|
+
ensureFileSync: typeof _ensureFileSync;
|
|
34
|
+
removePath: typeof _removePath;
|
|
35
|
+
removePathSync: typeof _removePathSync;
|
|
36
|
+
emptyDir: typeof _emptyDir;
|
|
37
|
+
emptyDirSync: typeof _emptyDirSync;
|
|
38
|
+
copyPath: typeof _copyPath;
|
|
39
|
+
copyPathSync: typeof _copyPathSync;
|
|
40
|
+
movePath: typeof _movePath;
|
|
41
|
+
movePathSync: typeof _movePathSync;
|
|
42
|
+
link: typeof fs.link;
|
|
43
|
+
open: typeof fs.open;
|
|
44
|
+
truncate: typeof fs.truncate;
|
|
45
|
+
write: typeof fs.write;
|
|
46
|
+
close: typeof fs.close;
|
|
47
|
+
read: typeof fs.read;
|
|
48
|
+
rename: typeof fs.rename;
|
|
49
|
+
writev: typeof fs.writev;
|
|
50
|
+
renameSync: typeof fs.renameSync;
|
|
51
|
+
truncateSync: typeof fs.truncateSync;
|
|
52
|
+
ftruncate: typeof fs.ftruncate;
|
|
53
|
+
ftruncateSync: typeof fs.ftruncateSync;
|
|
54
|
+
chown: typeof fs.chown;
|
|
55
|
+
chownSync: typeof fs.chownSync;
|
|
56
|
+
fchown: typeof fs.fchown;
|
|
57
|
+
fchownSync: typeof fs.fchownSync;
|
|
58
|
+
lchown: typeof fs.lchown;
|
|
59
|
+
lchownSync: typeof fs.lchownSync;
|
|
60
|
+
lutimes: typeof fs.lutimes;
|
|
61
|
+
lutimesSync: typeof fs.lutimesSync;
|
|
62
|
+
chmod: typeof fs.chmod;
|
|
63
|
+
chmodSync: typeof fs.chmodSync;
|
|
64
|
+
fchmod: typeof fs.fchmod;
|
|
65
|
+
fchmodSync: typeof fs.fchmodSync;
|
|
66
|
+
lchmod: typeof fs.lchmod;
|
|
67
|
+
lchmodSync: typeof fs.lchmodSync;
|
|
68
|
+
stat: typeof fs.stat;
|
|
69
|
+
fstat: typeof fs.fstat;
|
|
70
|
+
fstatSync: typeof fs.fstatSync;
|
|
71
|
+
lstat: typeof fs.lstat;
|
|
72
|
+
statfs: typeof fs.statfs;
|
|
73
|
+
statfsSync: typeof fs.statfsSync;
|
|
74
|
+
linkSync: typeof fs.linkSync;
|
|
75
|
+
symlink: typeof fs.symlink;
|
|
76
|
+
symlinkSync: typeof fs.symlinkSync;
|
|
77
|
+
readlink: typeof fs.readlink;
|
|
78
|
+
readlinkSync: typeof fs.readlinkSync;
|
|
79
|
+
realpath: typeof fs.realpath;
|
|
80
|
+
realpathSync: typeof fs.realpathSync;
|
|
81
|
+
unlink: typeof fs.unlink;
|
|
82
|
+
unlinkSync: typeof fs.unlinkSync;
|
|
83
|
+
rmdir: typeof fs.rmdir;
|
|
84
|
+
rmdirSync: typeof fs.rmdirSync;
|
|
85
|
+
rm: typeof fs.rm;
|
|
86
|
+
rmSync: typeof fs.rmSync;
|
|
87
|
+
mkdir: typeof fs.mkdir;
|
|
88
|
+
mkdirSync: typeof fs.mkdirSync;
|
|
89
|
+
mkdtemp: typeof fs.mkdtemp;
|
|
90
|
+
mkdtempSync: typeof fs.mkdtempSync;
|
|
91
|
+
readdir: typeof fs.readdir;
|
|
92
|
+
readdirSync: typeof fs.readdirSync;
|
|
93
|
+
closeSync: typeof fs.closeSync;
|
|
94
|
+
openSync: typeof fs.openSync;
|
|
95
|
+
utimes: typeof fs.utimes;
|
|
96
|
+
utimesSync: typeof fs.utimesSync;
|
|
97
|
+
futimes: typeof fs.futimes;
|
|
98
|
+
futimesSync: typeof fs.futimesSync;
|
|
99
|
+
fsync: typeof fs.fsync;
|
|
100
|
+
fsyncSync: typeof fs.fsyncSync;
|
|
101
|
+
writeSync: typeof fs.writeSync;
|
|
102
|
+
readSync: typeof fs.readSync;
|
|
103
|
+
appendFile: typeof fs.appendFile;
|
|
104
|
+
appendFileSync: typeof fs.appendFileSync;
|
|
105
|
+
watchFile: typeof fs.watchFile;
|
|
106
|
+
unwatchFile: typeof fs.unwatchFile;
|
|
107
|
+
watch: typeof fs.watch;
|
|
108
|
+
exists: typeof fs.exists;
|
|
109
|
+
existsSync: typeof fs.existsSync;
|
|
110
|
+
access: typeof fs.access;
|
|
111
|
+
accessSync: typeof fs.accessSync;
|
|
112
|
+
createReadStream: typeof fs.createReadStream;
|
|
113
|
+
createWriteStream: typeof fs.createWriteStream;
|
|
114
|
+
fdatasync: typeof fs.fdatasync;
|
|
115
|
+
fdatasyncSync: typeof fs.fdatasyncSync;
|
|
116
|
+
copyFile: typeof fs.copyFile;
|
|
117
|
+
copyFileSync: typeof fs.copyFileSync;
|
|
118
|
+
writevSync: typeof fs.writevSync;
|
|
119
|
+
readv: typeof fs.readv;
|
|
120
|
+
readvSync: typeof fs.readvSync;
|
|
121
|
+
opendirSync: typeof fs.opendirSync;
|
|
122
|
+
opendir: typeof fs.opendir;
|
|
123
|
+
cp: typeof fs.cp;
|
|
124
|
+
cpSync: typeof fs.cpSync;
|
|
125
|
+
promises: typeof fs.promises;
|
|
126
|
+
Stats: typeof fs.Stats;
|
|
127
|
+
StatsFs: typeof fs.StatsFs;
|
|
128
|
+
Dirent: typeof fs.Dirent;
|
|
129
|
+
Dir: typeof fs.Dir;
|
|
130
|
+
ReadStream: typeof fs.ReadStream;
|
|
131
|
+
WriteStream: typeof fs.WriteStream;
|
|
132
|
+
statSync: fs.StatSyncFn;
|
|
133
|
+
lstatSync: fs.StatSyncFn;
|
|
134
|
+
constants: typeof fs.constants;
|
|
135
|
+
};
|
|
4
136
|
export interface JsonOptions {
|
|
5
137
|
spaces?: number;
|
|
6
138
|
}
|
|
@@ -8,44 +140,25 @@ export interface JsonOptions {
|
|
|
8
140
|
* Convenience wrapper that defaults to utf-8 string output.
|
|
9
141
|
*/
|
|
10
142
|
export declare function _readFile(filePath: string): Promise<string>;
|
|
143
|
+
export declare function _readFileAsBuffer(filePath: string): Promise<Buffer>;
|
|
11
144
|
/**
|
|
12
145
|
* Convenience wrapper that defaults to utf-8 string output.
|
|
13
146
|
*/
|
|
14
147
|
export declare function _readFileSync(filePath: string): string;
|
|
15
|
-
export declare function _readJson<T = unknown>(filePath: string): Promise<T>;
|
|
16
148
|
/**
|
|
17
|
-
*
|
|
149
|
+
* Convenience wrapper that defaults to utf-8 string output.
|
|
18
150
|
*/
|
|
19
|
-
export declare
|
|
151
|
+
export declare function _readFileAsBufferSync(filePath: string): Buffer;
|
|
152
|
+
export declare function _readJson<T = unknown>(filePath: string): Promise<T>;
|
|
20
153
|
export declare function _readJsonSync<T = unknown>(filePath: string): T;
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated use _readJsonSync
|
|
23
|
-
*/
|
|
24
|
-
export declare const _readJsonFileSync: typeof _readJsonSync;
|
|
25
154
|
export declare function _writeFile(filePath: string, data: string | Buffer): Promise<void>;
|
|
26
155
|
export declare function _writeFileSync(filePath: string, data: string | Buffer): void;
|
|
27
156
|
export declare function _outputFile(filePath: string, data: string | Buffer): Promise<void>;
|
|
28
157
|
export declare function _outputFileSync(filePath: string, data: string | Buffer): void;
|
|
29
158
|
export declare function _writeJson(filePath: string, data: any, opt?: JsonOptions): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated use _writeJson
|
|
32
|
-
*/
|
|
33
|
-
export declare const _writeJsonFile: typeof _writeJson;
|
|
34
159
|
export declare function _writeJsonSync(filePath: string, data: any, opt?: JsonOptions): void;
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated use _writeJsonSync
|
|
37
|
-
*/
|
|
38
|
-
export declare const _writeJsonFileSync: typeof _writeJsonSync;
|
|
39
160
|
export declare function _outputJson(filePath: string, data: any, opt?: JsonOptions): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated use _outputJson
|
|
42
|
-
*/
|
|
43
|
-
export declare const _outputJsonFile: typeof _outputJson;
|
|
44
161
|
export declare function _outputJsonSync(filePath: string, data: any, opt?: JsonOptions): void;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated use _outputJsonSync
|
|
47
|
-
*/
|
|
48
|
-
export declare const _outputJsonFileSync: typeof _outputJsonSync;
|
|
49
162
|
export declare function _pathExists(filePath: string): Promise<boolean>;
|
|
50
163
|
export declare function _pathExistsSync(filePath: string): boolean;
|
|
51
164
|
export declare function _ensureDir(dirPath: string): Promise<void>;
|
package/dist/fs/fs.util.js
CHANGED
|
@@ -15,11 +15,52 @@ Credit to: fs-extra (https://github.com/jprichardson/node-fs-extra)
|
|
|
15
15
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports._movePathSync = exports._movePath = exports._copyPathSync = exports._copyPath = exports._emptyDirSync = exports._emptyDir = exports._removePathSync = exports._removePath = exports._ensureFileSync = exports._ensureFile = exports._ensureDirSync = exports._ensureDir = exports._pathExistsSync = exports._pathExists = exports.
|
|
18
|
+
exports._movePathSync = exports._movePath = exports._copyPathSync = exports._copyPath = exports._emptyDirSync = exports._emptyDir = exports._removePathSync = exports._removePath = exports._ensureFileSync = exports._ensureFile = exports._ensureDirSync = exports._ensureDir = exports._pathExistsSync = exports._pathExists = exports._outputJsonSync = exports._outputJson = exports._writeJsonSync = exports._writeJson = exports._outputFileSync = exports._outputFile = exports._writeFileSync = exports._writeFile = exports._readJsonSync = exports._readJson = exports._readFileAsBufferSync = exports._readFileSync = exports._readFileAsBuffer = exports._readFile = exports.fs2 = void 0;
|
|
19
19
|
const fs = require("node:fs");
|
|
20
20
|
const fsp = require("node:fs/promises");
|
|
21
21
|
const path = require("node:path");
|
|
22
22
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
23
|
+
/**
|
|
24
|
+
* fs2 conveniently groups filesystem functions together.
|
|
25
|
+
* Supposed to be almost a drop-in replacement for these things together:
|
|
26
|
+
*
|
|
27
|
+
* 1. node:fs
|
|
28
|
+
* 2. node:fs/promises
|
|
29
|
+
* 3. fs-extra
|
|
30
|
+
*/
|
|
31
|
+
exports.fs2 = {
|
|
32
|
+
// "Omit" is here to workaround this TS error:
|
|
33
|
+
// Exported variable 'fs2' has or is using name 'StreamOptions' from external module "fs" but cannot be named.
|
|
34
|
+
...fs,
|
|
35
|
+
readFile: _readFile,
|
|
36
|
+
readFileSync: _readFileSync,
|
|
37
|
+
readFileAsBuffer: _readFileAsBuffer,
|
|
38
|
+
readFileAsBufferSync: _readFileAsBufferSync,
|
|
39
|
+
readJson: _readJson,
|
|
40
|
+
readJsonSync: _readJsonSync,
|
|
41
|
+
writeFile: _writeFile,
|
|
42
|
+
writeFileSync: _writeFileSync,
|
|
43
|
+
outputJson: _outputJson,
|
|
44
|
+
outputJsonSync: _outputJsonSync,
|
|
45
|
+
writeJson: _writeJson,
|
|
46
|
+
writeJsonSync: _writeJsonSync,
|
|
47
|
+
outputFile: _outputFile,
|
|
48
|
+
outputFileSync: _outputFileSync,
|
|
49
|
+
pathExists: _pathExists,
|
|
50
|
+
pathExistsSync: _pathExistsSync,
|
|
51
|
+
ensureDir: _ensureDir,
|
|
52
|
+
ensureDirSync: _ensureDirSync,
|
|
53
|
+
ensureFile: _ensureFile,
|
|
54
|
+
ensureFileSync: _ensureFileSync,
|
|
55
|
+
removePath: _removePath,
|
|
56
|
+
removePathSync: _removePathSync,
|
|
57
|
+
emptyDir: _emptyDir,
|
|
58
|
+
emptyDirSync: _emptyDirSync,
|
|
59
|
+
copyPath: _copyPath,
|
|
60
|
+
copyPathSync: _copyPathSync,
|
|
61
|
+
movePath: _movePath,
|
|
62
|
+
movePathSync: _movePathSync,
|
|
63
|
+
};
|
|
23
64
|
/**
|
|
24
65
|
* Convenience wrapper that defaults to utf-8 string output.
|
|
25
66
|
*/
|
|
@@ -27,6 +68,10 @@ async function _readFile(filePath) {
|
|
|
27
68
|
return await fsp.readFile(filePath, 'utf8');
|
|
28
69
|
}
|
|
29
70
|
exports._readFile = _readFile;
|
|
71
|
+
async function _readFileAsBuffer(filePath) {
|
|
72
|
+
return await fsp.readFile(filePath);
|
|
73
|
+
}
|
|
74
|
+
exports._readFileAsBuffer = _readFileAsBuffer;
|
|
30
75
|
/**
|
|
31
76
|
* Convenience wrapper that defaults to utf-8 string output.
|
|
32
77
|
*/
|
|
@@ -34,24 +79,23 @@ function _readFileSync(filePath) {
|
|
|
34
79
|
return fs.readFileSync(filePath, 'utf8');
|
|
35
80
|
}
|
|
36
81
|
exports._readFileSync = _readFileSync;
|
|
82
|
+
/**
|
|
83
|
+
* Convenience wrapper that defaults to utf-8 string output.
|
|
84
|
+
*/
|
|
85
|
+
function _readFileAsBufferSync(filePath) {
|
|
86
|
+
return fs.readFileSync(filePath);
|
|
87
|
+
}
|
|
88
|
+
exports._readFileAsBufferSync = _readFileAsBufferSync;
|
|
37
89
|
async function _readJson(filePath) {
|
|
38
90
|
const str = await fsp.readFile(filePath, 'utf8');
|
|
39
91
|
return (0, js_lib_1._jsonParse)(str);
|
|
40
92
|
}
|
|
41
93
|
exports._readJson = _readJson;
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated use _readJson
|
|
44
|
-
*/
|
|
45
|
-
exports._readJsonFile = _readJson;
|
|
46
94
|
function _readJsonSync(filePath) {
|
|
47
95
|
const str = fs.readFileSync(filePath, 'utf8');
|
|
48
96
|
return (0, js_lib_1._jsonParse)(str);
|
|
49
97
|
}
|
|
50
98
|
exports._readJsonSync = _readJsonSync;
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated use _readJsonSync
|
|
53
|
-
*/
|
|
54
|
-
exports._readJsonFileSync = _readJsonSync;
|
|
55
99
|
async function _writeFile(filePath, data) {
|
|
56
100
|
await fsp.writeFile(filePath, data);
|
|
57
101
|
}
|
|
@@ -81,37 +125,21 @@ async function _writeJson(filePath, data, opt) {
|
|
|
81
125
|
await fsp.writeFile(filePath, str);
|
|
82
126
|
}
|
|
83
127
|
exports._writeJson = _writeJson;
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated use _writeJson
|
|
86
|
-
*/
|
|
87
|
-
exports._writeJsonFile = _writeJson;
|
|
88
128
|
function _writeJsonSync(filePath, data, opt) {
|
|
89
129
|
const str = JSON.stringify(data, null, opt?.spaces);
|
|
90
130
|
fs.writeFileSync(filePath, str);
|
|
91
131
|
}
|
|
92
132
|
exports._writeJsonSync = _writeJsonSync;
|
|
93
|
-
/**
|
|
94
|
-
* @deprecated use _writeJsonSync
|
|
95
|
-
*/
|
|
96
|
-
exports._writeJsonFileSync = _writeJsonSync;
|
|
97
133
|
async function _outputJson(filePath, data, opt) {
|
|
98
134
|
const str = JSON.stringify(data, null, opt?.spaces);
|
|
99
135
|
await _outputFile(filePath, str);
|
|
100
136
|
}
|
|
101
137
|
exports._outputJson = _outputJson;
|
|
102
|
-
/**
|
|
103
|
-
* @deprecated use _outputJson
|
|
104
|
-
*/
|
|
105
|
-
exports._outputJsonFile = _outputJson;
|
|
106
138
|
function _outputJsonSync(filePath, data, opt) {
|
|
107
139
|
const str = JSON.stringify(data, null, opt?.spaces);
|
|
108
140
|
_outputFileSync(filePath, str);
|
|
109
141
|
}
|
|
110
142
|
exports._outputJsonSync = _outputJsonSync;
|
|
111
|
-
/**
|
|
112
|
-
* @deprecated use _outputJsonSync
|
|
113
|
-
*/
|
|
114
|
-
exports._outputJsonFileSync = _outputJsonSync;
|
|
115
143
|
async function _pathExists(filePath) {
|
|
116
144
|
try {
|
|
117
145
|
await fsp.access(filePath);
|
package/dist/fs/json2env.d.ts
CHANGED
|
@@ -27,6 +27,10 @@ export declare function json2env(opt: Json2EnvOptions): void;
|
|
|
27
27
|
export declare function appendToBashEnv(obj: AnyObject, prefix?: string): void;
|
|
28
28
|
export declare function appendToGithubEnv(obj: AnyObject, prefix?: string): void;
|
|
29
29
|
export declare function appendToGithubOutput(obj: AnyObject, prefix?: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary
|
|
32
|
+
*/
|
|
33
|
+
export declare function appendToGithubSummary(str: string): void;
|
|
30
34
|
/**
|
|
31
35
|
* Turns Object with keys/values into a *.sh script that exports all keys as values.
|
|
32
36
|
*
|
package/dist/fs/json2env.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectToGithubActionsEnv = exports.objectToShellExport = exports.appendToGithubOutput = exports.appendToGithubEnv = exports.appendToBashEnv = exports.json2env = void 0;
|
|
3
|
+
exports.objectToGithubActionsEnv = exports.objectToShellExport = exports.appendToGithubSummary = exports.appendToGithubOutput = exports.appendToGithubEnv = exports.appendToBashEnv = exports.json2env = void 0;
|
|
4
4
|
const fs = require("node:fs");
|
|
5
|
-
const colors_1 = require("../colors");
|
|
5
|
+
const colors_1 = require("../colors/colors");
|
|
6
6
|
const fs_util_1 = require("./fs.util");
|
|
7
7
|
const JSON2ENV_OPT_DEF = {
|
|
8
8
|
saveEnvFile: true,
|
|
@@ -55,7 +55,7 @@ function appendToBashEnv(obj, prefix = '') {
|
|
|
55
55
|
if (BASH_ENV) {
|
|
56
56
|
const data = objectToShellExport(obj, prefix);
|
|
57
57
|
fs.appendFileSync(BASH_ENV, data);
|
|
58
|
-
console.log(`BASH_ENV
|
|
58
|
+
console.log(`BASH_ENV appended:\n${data}`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
exports.appendToBashEnv = appendToBashEnv;
|
|
@@ -64,7 +64,7 @@ function appendToGithubEnv(obj, prefix = '') {
|
|
|
64
64
|
if (GITHUB_ENV) {
|
|
65
65
|
const data = objectToGithubActionsEnv(obj, prefix);
|
|
66
66
|
fs.appendFileSync(GITHUB_ENV, data);
|
|
67
|
-
console.log(`GITHUB_ENV
|
|
67
|
+
console.log(`GITHUB_ENV appended:\n${data}`);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
exports.appendToGithubEnv = appendToGithubEnv;
|
|
@@ -73,10 +73,21 @@ function appendToGithubOutput(obj, prefix = '') {
|
|
|
73
73
|
if (GITHUB_OUTPUT) {
|
|
74
74
|
const data = objectToGithubActionsEnv(obj, prefix);
|
|
75
75
|
fs.appendFileSync(GITHUB_OUTPUT, data);
|
|
76
|
-
console.log(`GITHUB_OUTPUT
|
|
76
|
+
console.log(`GITHUB_OUTPUT appended:\n${data}`);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
exports.appendToGithubOutput = appendToGithubOutput;
|
|
80
|
+
/**
|
|
81
|
+
* https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary
|
|
82
|
+
*/
|
|
83
|
+
function appendToGithubSummary(str) {
|
|
84
|
+
const { GITHUB_STEP_SUMMARY } = process.env;
|
|
85
|
+
if (GITHUB_STEP_SUMMARY) {
|
|
86
|
+
fs.appendFileSync(GITHUB_STEP_SUMMARY, str + '\n');
|
|
87
|
+
console.log(`GITHUB_STEP_SUMMARY appended:\n${str}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.appendToGithubSummary = appendToGithubSummary;
|
|
80
91
|
/**
|
|
81
92
|
* Turns Object with keys/values into a *.sh script that exports all keys as values.
|
|
82
93
|
*
|
package/dist/fs/kpy.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.kpySync = exports.kpy = void 0;
|
|
4
4
|
const path = require("node:path");
|
|
5
5
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
6
|
-
const colors_1 = require("../colors");
|
|
6
|
+
const colors_1 = require("../colors/colors");
|
|
7
7
|
const index_1 = require("../index");
|
|
8
8
|
async function kpy(opt) {
|
|
9
9
|
const started = Date.now();
|
package/dist/index.d.ts
CHANGED
|
@@ -78,8 +78,11 @@ export * from './validation/joi/joi.model';
|
|
|
78
78
|
export * from './validation/joi/joi.shared.schemas';
|
|
79
79
|
export * from './validation/joi/joi.validation.error';
|
|
80
80
|
export * from './validation/joi/joi.validation.util';
|
|
81
|
-
export * from './script';
|
|
81
|
+
export * from './script/runScript';
|
|
82
82
|
export * from './jwt/jwt.service';
|
|
83
83
|
export * from './fs/fs.util';
|
|
84
|
+
export * from './fs/del';
|
|
85
|
+
export * from './fs/json2env';
|
|
86
|
+
export * from './fs/kpy';
|
|
84
87
|
export type { GlobbyOptions, FastGlobOptions, ValidationErrorItem, Got, AfterResponseHook, BeforeErrorHook, BeforeRequestHook, AlternativesSchema, AnySchema, ArraySchema, BinarySchema, BooleanSchema, DateSchema, FunctionSchema, ObjectSchema, };
|
|
85
88
|
export { globby, fastGlob, RequestError, TimeoutError, Ajv };
|
package/dist/index.js
CHANGED
|
@@ -83,6 +83,9 @@ tslib_1.__exportStar(require("./validation/joi/joi.model"), exports);
|
|
|
83
83
|
tslib_1.__exportStar(require("./validation/joi/joi.shared.schemas"), exports);
|
|
84
84
|
tslib_1.__exportStar(require("./validation/joi/joi.validation.error"), exports);
|
|
85
85
|
tslib_1.__exportStar(require("./validation/joi/joi.validation.util"), exports);
|
|
86
|
-
tslib_1.__exportStar(require("./script"), exports);
|
|
86
|
+
tslib_1.__exportStar(require("./script/runScript"), exports);
|
|
87
87
|
tslib_1.__exportStar(require("./jwt/jwt.service"), exports);
|
|
88
88
|
tslib_1.__exportStar(require("./fs/fs.util"), exports);
|
|
89
|
+
tslib_1.__exportStar(require("./fs/del"), exports);
|
|
90
|
+
tslib_1.__exportStar(require("./fs/json2env"), exports);
|
|
91
|
+
tslib_1.__exportStar(require("./fs/kpy"), exports);
|
|
@@ -4,7 +4,7 @@ exports.secretsDecrypt = void 0;
|
|
|
4
4
|
const path = require("node:path");
|
|
5
5
|
const fs = require("node:fs");
|
|
6
6
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
7
|
-
const colors_1 = require("../colors");
|
|
7
|
+
const colors_1 = require("../colors/colors");
|
|
8
8
|
const index_1 = require("../index");
|
|
9
9
|
const crypto_util_1 = require("../security/crypto.util");
|
|
10
10
|
// Debug it like this:
|
|
@@ -4,7 +4,7 @@ exports.secretsEncrypt = void 0;
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
7
|
-
const colors_1 = require("../colors");
|
|
7
|
+
const colors_1 = require("../colors/colors");
|
|
8
8
|
const index_1 = require("../index");
|
|
9
9
|
const crypto_util_1 = require("../security/crypto.util");
|
|
10
10
|
/**
|