@naturalcycles/nodejs-lib 14.0.1 → 14.0.2
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/generate-build-info.js +2 -2
- package/dist/bin/json2env.js +4 -2
- package/dist/bin/kpy.js +4 -2
- package/dist/bin/secrets-gen-key.js +2 -2
- package/dist/bin/slack-this.js +2 -3
- package/package.json +1 -1
- package/src/bin/generate-build-info.ts +2 -2
- package/src/bin/json2env.ts +34 -32
- package/src/bin/kpy.ts +30 -28
- package/src/bin/secrets-gen-key.ts +2 -2
- package/src/bin/slack-this.ts +2 -3
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import yargs from 'yargs';
|
|
5
4
|
import { appendToBashEnv, appendToGithubEnv, appendToGithubOutput } from '../fs/json2env.js';
|
|
6
5
|
import { runScript } from '../script/runScript.js';
|
|
7
6
|
import { generateBuildInfo } from '../util/buildInfo.util.js';
|
|
7
|
+
import { _yargs } from '../yargs.util.js';
|
|
8
8
|
runScript(async () => {
|
|
9
|
-
const { dir, overrideTimestamp } =
|
|
9
|
+
const { dir, overrideTimestamp } = _yargs().options({
|
|
10
10
|
dir: {
|
|
11
11
|
type: 'string',
|
|
12
12
|
desc: 'Output directory',
|
package/dist/bin/json2env.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import yargs from 'yargs';
|
|
3
2
|
import { json2env } from '../fs/json2env.js';
|
|
4
3
|
import { runScript } from '../script/runScript.js';
|
|
4
|
+
import { _yargs } from '../yargs.util.js';
|
|
5
5
|
runScript(() => {
|
|
6
|
-
const { argv } =
|
|
6
|
+
const { argv } = _yargs()
|
|
7
|
+
.demandCommand(1)
|
|
8
|
+
.options({
|
|
7
9
|
prefix: {
|
|
8
10
|
type: 'string',
|
|
9
11
|
},
|
package/dist/bin/kpy.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import yargs from 'yargs';
|
|
3
2
|
import { kpySync } from '../fs/kpy.js';
|
|
4
3
|
import { runScript } from '../script/runScript.js';
|
|
4
|
+
import { _yargs } from '../yargs.util.js';
|
|
5
5
|
runScript(() => {
|
|
6
|
-
const { _: [baseDir, ...inputPatterns], ...opt } =
|
|
6
|
+
const { _: [baseDir, ...inputPatterns], ...opt } = _yargs()
|
|
7
|
+
.demandCommand(2)
|
|
8
|
+
.options({
|
|
7
9
|
silent: {
|
|
8
10
|
type: 'boolean',
|
|
9
11
|
desc: 'Suppress all text output',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
|
-
import yargs from 'yargs';
|
|
4
3
|
import { dimGrey } from '../colors/colors.js';
|
|
5
4
|
import { runScript } from '../script/runScript.js';
|
|
5
|
+
import { _yargs } from '../yargs.util.js';
|
|
6
6
|
runScript(() => {
|
|
7
|
-
const { sizeBytes } =
|
|
7
|
+
const { sizeBytes } = _yargs().option('sizeBytes', {
|
|
8
8
|
type: 'number',
|
|
9
9
|
default: 256,
|
|
10
10
|
}).argv;
|
package/dist/bin/slack-this.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { SlackService } from '../index.js';
|
|
2
|
+
import { _yargs, SlackService } from '../index.js';
|
|
4
3
|
import { runScript } from '../script/runScript.js';
|
|
5
4
|
runScript(async () => {
|
|
6
|
-
const { channel, msg, username, emoji, webhook: webhookUrl, } =
|
|
5
|
+
const { channel, msg, username, emoji, webhook: webhookUrl, } = _yargs().options({
|
|
7
6
|
channel: {
|
|
8
7
|
type: 'string',
|
|
9
8
|
demandOption: true,
|
package/package.json
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
import fs from 'node:fs'
|
|
4
4
|
import path from 'node:path'
|
|
5
5
|
import type { UnixTimestamp } from '@naturalcycles/js-lib'
|
|
6
|
-
import yargs from 'yargs'
|
|
7
6
|
import { appendToBashEnv, appendToGithubEnv, appendToGithubOutput } from '../fs/json2env.js'
|
|
8
7
|
import { runScript } from '../script/runScript.js'
|
|
9
8
|
import { generateBuildInfo } from '../util/buildInfo.util.js'
|
|
9
|
+
import { _yargs } from '../yargs.util.js'
|
|
10
10
|
|
|
11
11
|
runScript(async () => {
|
|
12
|
-
const { dir, overrideTimestamp } =
|
|
12
|
+
const { dir, overrideTimestamp } = _yargs().options({
|
|
13
13
|
dir: {
|
|
14
14
|
type: 'string',
|
|
15
15
|
desc: 'Output directory',
|
package/src/bin/json2env.ts
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import yargs from 'yargs'
|
|
4
3
|
import { json2env } from '../fs/json2env.js'
|
|
5
4
|
import { runScript } from '../script/runScript.js'
|
|
5
|
+
import { _yargs } from '../yargs.util.js'
|
|
6
6
|
|
|
7
7
|
runScript(() => {
|
|
8
|
-
const { argv } =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
8
|
+
const { argv } = _yargs()
|
|
9
|
+
.demandCommand(1)
|
|
10
|
+
.options({
|
|
11
|
+
prefix: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
},
|
|
14
|
+
saveEnvFile: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
desc: 'Save $JSON_FILE_NAME.sh file that exports json vars as environment vars',
|
|
17
|
+
default: true,
|
|
18
|
+
},
|
|
19
|
+
bashEnv: {
|
|
20
|
+
type: 'boolean',
|
|
21
|
+
desc: 'Populate $BASH_ENV file if BASH_ENV env variable exists',
|
|
22
|
+
default: true,
|
|
23
|
+
},
|
|
24
|
+
githubEnv: {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
desc: 'Populate $GITHUB_ENV file if GITHUB_ENV env variable exists',
|
|
27
|
+
default: true,
|
|
28
|
+
},
|
|
29
|
+
fail: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
desc: 'Fail (exit status 1) on non-existing input file',
|
|
32
|
+
default: true,
|
|
33
|
+
},
|
|
34
|
+
debug: {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
},
|
|
37
|
+
silent: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
},
|
|
40
|
+
})
|
|
39
41
|
|
|
40
42
|
const { _: args, prefix, saveEnvFile, bashEnv, githubEnv, fail, debug, silent } = argv
|
|
41
43
|
if (debug) console.log({ argv })
|
package/src/bin/kpy.ts
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import yargs from 'yargs'
|
|
4
3
|
import { kpySync } from '../fs/kpy.js'
|
|
5
4
|
import { runScript } from '../script/runScript.js'
|
|
5
|
+
import { _yargs } from '../yargs.util.js'
|
|
6
6
|
|
|
7
7
|
runScript(() => {
|
|
8
8
|
const {
|
|
9
9
|
_: [baseDir, ...inputPatterns],
|
|
10
10
|
...opt
|
|
11
|
-
} =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
} = _yargs()
|
|
12
|
+
.demandCommand(2)
|
|
13
|
+
.options({
|
|
14
|
+
silent: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
desc: 'Suppress all text output',
|
|
17
|
+
},
|
|
18
|
+
verbose: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
desc: 'Report progress on every file',
|
|
21
|
+
},
|
|
22
|
+
overwrite: {
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
default: true,
|
|
25
|
+
},
|
|
26
|
+
dotfiles: {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
},
|
|
29
|
+
flat: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
},
|
|
32
|
+
dry: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
},
|
|
35
|
+
move: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
descr: 'Move files instead of copy',
|
|
38
|
+
},
|
|
39
|
+
}).argv
|
|
38
40
|
|
|
39
41
|
const outputDir = inputPatterns.pop() as string
|
|
40
42
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { randomBytes } from 'node:crypto'
|
|
4
|
-
import yargs from 'yargs'
|
|
5
4
|
import { dimGrey } from '../colors/colors.js'
|
|
6
5
|
import { runScript } from '../script/runScript.js'
|
|
6
|
+
import { _yargs } from '../yargs.util.js'
|
|
7
7
|
|
|
8
8
|
runScript(() => {
|
|
9
|
-
const { sizeBytes } =
|
|
9
|
+
const { sizeBytes } = _yargs().option('sizeBytes', {
|
|
10
10
|
type: 'number',
|
|
11
11
|
default: 256,
|
|
12
12
|
}).argv
|
package/src/bin/slack-this.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { SlackService } from '../index.js'
|
|
3
|
+
import { _yargs, SlackService } from '../index.js'
|
|
5
4
|
import { runScript } from '../script/runScript.js'
|
|
6
5
|
|
|
7
6
|
runScript(async () => {
|
|
@@ -11,7 +10,7 @@ runScript(async () => {
|
|
|
11
10
|
username,
|
|
12
11
|
emoji,
|
|
13
12
|
webhook: webhookUrl,
|
|
14
|
-
} =
|
|
13
|
+
} = _yargs().options({
|
|
15
14
|
channel: {
|
|
16
15
|
type: 'string',
|
|
17
16
|
demandOption: true,
|