@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.
@@ -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 } = yargs.options({
9
+ const { dir, overrideTimestamp } = _yargs().options({
10
10
  dir: {
11
11
  type: 'string',
12
12
  desc: 'Output directory',
@@ -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 } = yargs.demandCommand(1).options({
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 } = yargs.demandCommand(2).options({
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 } = yargs.option('sizeBytes', {
7
+ const { sizeBytes } = _yargs().option('sizeBytes', {
8
8
  type: 'number',
9
9
  default: 256,
10
10
  }).argv;
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import yargs from 'yargs';
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, } = yargs.options({
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
3
  "type": "module",
4
- "version": "14.0.1",
4
+ "version": "14.0.2",
5
5
  "scripts": {
6
6
  "prepare": "husky",
7
7
  "build": "dev-lib build",
@@ -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 } = yargs.options({
12
+ const { dir, overrideTimestamp } = _yargs().options({
13
13
  dir: {
14
14
  type: 'string',
15
15
  desc: 'Output directory',
@@ -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 } = 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
+ })
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
- } = 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
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 } = yargs.option('sizeBytes', {
9
+ const { sizeBytes } = _yargs().option('sizeBytes', {
10
10
  type: 'number',
11
11
  default: 256,
12
12
  }).argv
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import yargs from 'yargs'
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
- } = yargs.options({
13
+ } = _yargs().options({
15
14
  channel: {
16
15
  type: 'string',
17
16
  demandOption: true,