Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit 6a280d4

Browse files
fix: yargs
1 parent 6a12c15 commit 6a280d4

File tree

6 files changed

+77
-82
lines changed

6 files changed

+77
-82
lines changed

src/bin/generate-build-info.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import fs from 'node:fs'
44
import path from 'node:path'
55
import type { UnixTimestamp } from '@naturalcycles/js-lib'
6-
import yargs from 'yargs'
76
import { appendToBashEnv, appendToGithubEnv, appendToGithubOutput } from '../fs/json2env.js'
87
import { runScript } from '../script/runScript.js'
98
import { generateBuildInfo } from '../util/buildInfo.util.js'
9+
import { _yargs } from '../yargs.util.js'
1010

1111
runScript(async () => {
12-
const { dir, overrideTimestamp } = yargs.options({
12+
const { dir, overrideTimestamp } = _yargs().options({
1313
dir: {
1414
type: 'string',
1515
desc: 'Output directory',

src/bin/json2env.ts

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
#!/usr/bin/env node
22

3-
import yargs from 'yargs'
43
import { json2env } from '../fs/json2env.js'
54
import { runScript } from '../script/runScript.js'
5+
import { _yargs } from '../yargs.util.js'
66

77
runScript(() => {
8-
const { argv } = yargs.demandCommand(1).options({
9-
prefix: {
10-
type: 'string',
11-
},
12-
saveEnvFile: {
13-
type: 'boolean',
14-
desc: 'Save $JSON_FILE_NAME.sh file that exports json vars as environment vars',
15-
default: true,
16-
},
17-
bashEnv: {
18-
type: 'boolean',
19-
desc: 'Populate $BASH_ENV file if BASH_ENV env variable exists',
20-
default: true,
21-
},
22-
githubEnv: {
23-
type: 'boolean',
24-
desc: 'Populate $GITHUB_ENV file if GITHUB_ENV env variable exists',
25-
default: true,
26-
},
27-
fail: {
28-
type: 'boolean',
29-
desc: 'Fail (exit status 1) on non-existing input file',
30-
default: true,
31-
},
32-
debug: {
33-
type: 'boolean',
34-
},
35-
silent: {
36-
type: 'boolean',
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+
})
3941

4042
const { _: args, prefix, saveEnvFile, bashEnv, githubEnv, fail, debug, silent } = argv
4143
if (debug) console.log({ argv })

src/bin/kpy.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
#!/usr/bin/env node
22

3-
import yargs from 'yargs'
43
import { kpySync } from '../fs/kpy.js'
54
import { runScript } from '../script/runScript.js'
5+
import { _yargs } from '../yargs.util.js'
66

77
runScript(() => {
88
const {
99
_: [baseDir, ...inputPatterns],
1010
...opt
11-
} = yargs.demandCommand(2).options({
12-
silent: {
13-
type: 'boolean',
14-
desc: 'Suppress all text output',
15-
},
16-
verbose: {
17-
type: 'boolean',
18-
desc: 'Report progress on every file',
19-
},
20-
overwrite: {
21-
type: 'boolean',
22-
default: true,
23-
},
24-
dotfiles: {
25-
type: 'boolean',
26-
},
27-
flat: {
28-
type: 'boolean',
29-
},
30-
dry: {
31-
type: 'boolean',
32-
},
33-
move: {
34-
type: 'boolean',
35-
descr: 'Move files instead of copy',
36-
},
37-
}).argv
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
3840

3941
const outputDir = inputPatterns.pop() as string
4042

src/bin/secrets-gen-key.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env node
22

33
import { randomBytes } from 'node:crypto'
4-
import yargs from 'yargs'
54
import { dimGrey } from '../colors/colors.js'
65
import { runScript } from '../script/runScript.js'
6+
import { _yargs } from '../yargs.util.js'
77

88
runScript(() => {
9-
const { sizeBytes } = yargs.option('sizeBytes', {
9+
const { sizeBytes } = _yargs().option('sizeBytes', {
1010
type: 'number',
1111
default: 256,
1212
}).argv

src/bin/slack-this.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
import yargs from 'yargs'
4-
import { SlackService } from '../index.js'
3+
import { _yargs, SlackService } from '../index.js'
54
import { runScript } from '../script/runScript.js'
65

76
runScript(async () => {
@@ -11,7 +10,7 @@ runScript(async () => {
1110
username,
1211
emoji,
1312
webhook: webhookUrl,
14-
} = yargs.options({
13+
} = _yargs().options({
1514
channel: {
1615
type: 'string',
1716
demandOption: true,

yarn.lock

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -768,14 +768,6 @@
768768
typescript-eslint "^8"
769769
vue-eslint-parser "^10"
770770

771-
"@naturalcycles/js-lib@^14":
772-
version "14.277.0"
773-
resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.277.0.tgz#c9e17784c00da43a429cf6f30f8aa6d66bc873cc"
774-
integrity sha512-nL8w+TqLSeYJ0YhsO1Sxj8OqRwq4imz4x30qwzvoh1+oyP7Zh+VdvnXE/wOprkEw8V+xCticRqMaprVz78cK8g==
775-
dependencies:
776-
tslib "^2"
777-
zod "^3"
778-
779771
"@naturalcycles/js-lib@^15":
780772
version "15.0.0"
781773
resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-15.0.0.tgz#bdd0e3177d0808f5f40373f5516a8c29bbb50028"
@@ -785,11 +777,11 @@
785777
zod "^3"
786778

787779
"@naturalcycles/nodejs-lib@^14":
788-
version "14.0.0"
789-
resolved "https://registry.yarnpkg.com/@naturalcycles/nodejs-lib/-/nodejs-lib-14.0.0.tgz#99ab6c5a2f07f9b0a07285bc1ac0848a267b5cf1"
790-
integrity sha512-EV/5aNpqozBuhoI4RMo57c9b5EQA2nHAcs0jOY+x0ZA2FZED0Df3/p5UE18oLt0VLfT5P0yFC3fpFmF3BMUY8A==
780+
version "14.0.1"
781+
resolved "https://registry.yarnpkg.com/@naturalcycles/nodejs-lib/-/nodejs-lib-14.0.1.tgz#ebef5e3c6e32c8972cd81cb36d2bcc72dddc03d6"
782+
integrity sha512-JH/Y0J2Mok+Dge2f22OqKBRV4nA+q7ekspj2gvtcgG+DZr3jhwdXror0KaGtDulNn1Ka+rDSbKazwW3xYcUT0g==
791783
dependencies:
792-
"@naturalcycles/js-lib" "^14"
784+
"@naturalcycles/js-lib" "^15"
793785
"@types/js-yaml" "^4"
794786
"@types/jsonwebtoken" "^9"
795787
"@types/yargs" "^16"
@@ -1822,9 +1814,9 @@ [email protected]:
18221814
safe-buffer "^5.0.1"
18231815

18241816
electron-to-chromium@^1.5.73:
1825-
version "1.5.138"
1826-
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.138.tgz#319e775179bd0889ed96a04d4390d355fb315a44"
1827-
integrity sha512-FWlQc52z1dXqm+9cCJ2uyFgJkESd+16j6dBEjsgDNuHjBpuIzL8/lRc0uvh1k8RNI6waGo6tcy2DvwkTBJOLDg==
1817+
version "1.5.139"
1818+
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.139.tgz#56ae7d42439e2967a54badbadaeb12f748987f37"
1819+
integrity sha512-GGnRYOTdN5LYpwbIr0rwP/ZHOQSvAF6TG0LSzp28uCBb9JiXHJGmaaKw29qjNJc5bGnnp6kXJqRnGMQoELwi5w==
18281820

18291821
emoji-regex@^10.3.0:
18301822
version "10.4.0"

0 commit comments

Comments
 (0)