@magic/cli 0.0.55 → 0.0.56

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/README.md CHANGED
@@ -17,24 +17,9 @@ ecmascript modules only. no commonjs support.
17
17
  [html-docs](https://magic.github.io/cli/)
18
18
 
19
19
  [![NPM version][npm-image]][npm-url]
20
- [![Linux Build Status][travis-image]][travis-url]
21
- [![Windows Build Status][appveyor-image]][appveyor-url]
22
- [![Coverage Status][coveralls-image]][coveralls-url]
23
- [![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]
24
- [![Known Vulnerabilities][snyk-image]][snyk-url]
25
20
 
26
21
  [npm-image]: https://img.shields.io/npm/v/@magic/cli.svg
27
22
  [npm-url]: https://www.npmjs.com/package/@magic/cli
28
- [travis-image]: https://img.shields.io/travis/com/magic/cli.svg?branch=master
29
- [travis-url]: https://travis-ci.com/magic/cli
30
- [appveyor-image]: https://img.shields.io/appveyor/ci/magic/cli/master.svg
31
- [appveyor-url]: https://ci.appveyor.com/project/magic/cli/branch/master
32
- [coveralls-image]: https://coveralls.io/repos/github/magic/cli/badge.svg
33
- [coveralls-url]: https://coveralls.io/github/magic/cli
34
- [greenkeeper-image]: https://badges.greenkeeper.io/magic/cli.svg
35
- [greenkeeper-url]: https://badges.greenkeeper.io/magic/cli.svg
36
- [snyk-image]: https://snyk.io/test/github/magic/cli/badge.svg
37
- [snyk-url]: https://snyk.io/test/github/magic/cli
38
23
 
39
24
  - [dependencies](#dependencies)
40
25
  - [install](#install)
@@ -593,6 +578,11 @@ update dependencies
593
578
 
594
579
  - update dependencies
595
580
 
596
- ##### 0.0.56 - unreleased
581
+ ##### 0.0.56
582
+
583
+ - add @magic/lint and tsc, fix issues
584
+ - update dependencies
585
+
586
+ ##### 0.0.57 - unreleased
597
587
 
598
588
  - ...
package/package.json CHANGED
@@ -1,8 +1,33 @@
1
1
  {
2
2
  "name": "@magic/cli",
3
- "version": "0.0.55",
4
- "homepage": "https://magic.github.io/cli",
3
+ "version": "0.0.56",
5
4
  "description": "declarative command line interfaces with aliasing, commands and environment sanitization",
5
+ "keywords": [
6
+ "cli",
7
+ "command line interface",
8
+ "declarative",
9
+ "magic"
10
+ ],
11
+ "homepage": "https://magic.github.io/cli",
12
+ "license": "AGPL-3.0",
13
+ "author": "Wizards & Witches",
14
+ "contributors": [
15
+ {
16
+ "name": "jascha ehrenreich",
17
+ "github": "jaeh"
18
+ }
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/magic/cli.git"
23
+ },
24
+ "files": [
25
+ "src",
26
+ "types"
27
+ ],
28
+ "type": "module",
29
+ "main": "src/index.js",
30
+ "types": "types/index.d.ts",
6
31
  "scripts": {
7
32
  "start": "t -p",
8
33
  "format": "f -w --exclude docs",
@@ -14,35 +39,16 @@
14
39
  "dev": "magic dev",
15
40
  "calls": "calls",
16
41
  "tsc": "tsc --noEmit",
17
- "check": "npm run tsc"
42
+ "tsc:test": "tsc --noEmit -p tsconfig.test.json",
43
+ "lint": "lint",
44
+ "check": "npm run tsc && npm run tsc:test && npm run lint"
18
45
  },
19
- "main": "src/index.js",
20
- "types": "types/index.d.ts",
21
- "type": "module",
22
- "files": [
23
- "src",
24
- "types"
25
- ],
26
- "engines": {
27
- "node": ">=14.15.4"
28
- },
29
- "engineStrict": true,
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/magic/cli.git"
33
- },
34
- "keywords": [
35
- "magic",
36
- "cli",
37
- "command line interface",
38
- "declarative"
39
- ],
40
46
  "dependencies": {
41
- "@magic/cases": "0.0.14",
42
- "@magic/deep": "0.1.22",
43
- "@magic/error": "0.0.24",
44
- "@magic/log": "0.1.23",
45
- "@magic/types": "0.1.38"
47
+ "@magic/cases": "0.0.15",
48
+ "@magic/deep": "0.1.23",
49
+ "@magic/error": "0.0.26",
50
+ "@magic/log": "0.1.26",
51
+ "@magic/types": "0.1.42"
46
52
  },
47
53
  "devDependencies": {
48
54
  "@magic-modules/git-badges": "0.0.12",
@@ -50,17 +56,18 @@
50
56
  "@magic-modules/no-spy": "0.0.9",
51
57
  "@magic-modules/pre": "0.0.12",
52
58
  "@magic-themes/docs": "0.0.15",
53
- "@magic/core": "0.0.159",
54
- "@magic/format": "0.0.74",
55
- "@magic/test": "0.3.21",
56
- "typescript": "6.0.3"
59
+ "@magic/core": "0.0.161",
60
+ "@magic/format": "0.0.79",
61
+ "@magic/lint": "0.0.5",
62
+ "@magic/test": "0.3.56",
63
+ "@types/node": "26.6.6",
64
+ "typescript": "npm:@typescript/typescript6"
57
65
  },
58
- "author": "Wizards & Witches",
59
- "license": "AGPL-3.0",
60
- "contributors": [
61
- {
62
- "name": "jascha ehrenreich",
63
- "github": "jaeh"
64
- }
65
- ]
66
+ "engines": {
67
+ "node": ">=14.15.4"
68
+ },
69
+ "engineStrict": true,
70
+ "allowScripts": {
71
+ "@swc/core@1.15.47": true
72
+ }
66
73
  }
package/src/exec.js CHANGED
@@ -1,4 +1,4 @@
1
- import child_process from 'child_process'
1
+ import child_process from 'node:child_process'
2
2
 
3
3
  import error from '@magic/error'
4
4
 
package/src/execFile.js CHANGED
@@ -1,4 +1,4 @@
1
- import child_process from 'child_process'
1
+ import child_process from 'node:child_process'
2
2
 
3
3
  import error from '@magic/error'
4
4
 
@@ -22,7 +22,6 @@ export const execFile = (p, args = [], options = {}) =>
22
22
  opts,
23
23
  (err, stdout, stderr) => {
24
24
  if (err) {
25
- const e = error(err, 'E_EXECFILE_ERR')
26
25
  reject(err)
27
26
  return
28
27
  }
@@ -1,4 +1,4 @@
1
- import deep from '@magic/deep'
1
+ import is from '@magic/types'
2
2
 
3
3
  /**
4
4
  * Finds the longest string within a (possibly nested) array.
@@ -7,7 +7,7 @@ import deep from '@magic/deep'
7
7
  * @returns {string} The longest string found in the array.
8
8
  */
9
9
  export const findLongestString = arr => {
10
- const sorted = arr.flat(200).sort((a, b) => {
10
+ const sorted = arr.flat(Infinity).sort((a, b) => {
11
11
  if (a.length !== b.length) {
12
12
  return b.length - a.length
13
13
  }
@@ -15,5 +15,10 @@ export const findLongestString = arr => {
15
15
  return a > b ? 1 : -1
16
16
  })
17
17
 
18
- return sorted[0]
18
+ let final = sorted[0]
19
+ while (is.arr(final)) {
20
+ final = final[0]
21
+ }
22
+
23
+ return final
19
24
  }
package/src/parse/argv.js CHANGED
@@ -67,7 +67,9 @@ export const parseArgv = (props = {}) => {
67
67
 
68
68
  // Parsing loop
69
69
  argvCopy.forEach((arg, i) => {
70
- if (i <= 1) return
70
+ if (i <= 1) {
71
+ return
72
+ }
71
73
 
72
74
  if (arg.startsWith('-')) {
73
75
  /** @type {string} */
@@ -85,10 +87,14 @@ export const parseArgv = (props = {}) => {
85
87
  if (argvArg) {
86
88
  lastArg = argvArg
87
89
  argv[lastArg] = argv[lastArg] || []
88
- if (!pure) argvCopy[i] = lastArg
90
+ if (!pure) {
91
+ argvCopy[i] = lastArg
92
+ }
89
93
  }
90
94
  } else {
91
- if (lastArg) argv[lastArg].push(arg)
95
+ if (lastArg) {
96
+ argv[lastArg].push(arg)
97
+ }
92
98
  }
93
99
  })
94
100
 
@@ -101,7 +107,9 @@ export const parseArgv = (props = {}) => {
101
107
  if (!argv[k] || argv[k].length === 0) {
102
108
  argv[k] = is.array(v) ? v.map(String) : [String(v)]
103
109
  argvRest.push(k)
104
- if (!is.array(v)) v = [v]
110
+ if (!is.array(v)) {
111
+ v = [v]
112
+ }
105
113
  v.forEach(vv => argvRest.push(String(vv)))
106
114
  }
107
115
  })
package/src/prompt.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import is from '@magic/types'
2
- import readline from 'readline'
2
+ import readline from 'node:readline'
3
3
  /**
4
4
  * Prompts the user for input or confirmation.
5
5
  * @param {string|string[]} [msg=''] - Message to display in the prompt.
package/src/spawn.js CHANGED
@@ -1,13 +1,13 @@
1
- import child_process from 'child_process'
1
+ import child_process from 'node:child_process'
2
2
 
3
- /** @typedef {import('child_process').SpawnOptions} CLISpawnOptions*/
3
+ /** @typedef {import('node:child_process').SpawnOptions} CLISpawnOptions*/
4
4
 
5
5
  /**
6
6
  * Spawns a new process.
7
7
  * @param {string} cmd - Command to run.
8
8
  * @param {string[]} [args=[]] - Arguments for the command.
9
9
  * @param {CLISpawnOptions} [options={}] - Spawn options.
10
- * @returns {import('child_process').ChildProcess} The spawned process.
10
+ * @returns {import('node:child_process').ChildProcess} The spawned process.
11
11
  */
12
12
  export const spawn = (cmd, args = [], options = {}) => {
13
13
  /** @type {CLISpawnOptions} */
package/types/exec.d.ts CHANGED
@@ -2,4 +2,4 @@ export function exec(cmd: string, options?: CLIExecOptions): Promise<string>
2
2
  export type CLIExecOptions = child_process.ExecOptionsWithStringEncoding & {
3
3
  stderrToStdout?: boolean
4
4
  }
5
- import child_process from 'child_process'
5
+ import child_process from 'node:child_process'
@@ -6,4 +6,4 @@ export function execFile(
6
6
  export type CLIExecFileOptions = child_process.ExecFileOptions & {
7
7
  stderrToStdout?: boolean
8
8
  }
9
- import child_process from 'child_process'
9
+ import child_process from 'node:child_process'
package/types/spawn.d.ts CHANGED
@@ -2,5 +2,5 @@ export function spawn(
2
2
  cmd: string,
3
3
  args?: string[],
4
4
  options?: CLISpawnOptions,
5
- ): import('child_process').ChildProcess
6
- export type CLISpawnOptions = import('child_process').SpawnOptions
5
+ ): import('node:child_process').ChildProcess
6
+ export type CLISpawnOptions = import('node:child_process').SpawnOptions