@magic/cli 0.0.49 → 0.0.51

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
@@ -568,8 +568,14 @@ update dependencies
568
568
 
569
569
  ##### 0.0.50
570
570
 
571
+ - remove empty test file
572
+ - types: add single to ParseProps
571
573
  - update dependencies
572
574
 
573
- ##### 0.0.51 - unreleased
575
+ ##### 0.0.51
576
+
577
+ - exec and execFile options are correctly typed
578
+
579
+ ##### 0.0.52 - unreleased
574
580
 
575
581
  - ...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic/cli",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "homepage": "https://magic.github.io/cli",
5
5
  "description": "declarative command line interfaces with aliasing, commands and environment sanitization",
6
6
  "scripts": {
@@ -40,7 +40,7 @@
40
40
  "@magic/deep": "0.1.20",
41
41
  "@magic/error": "0.0.21",
42
42
  "@magic/log": "0.1.21",
43
- "@magic/types": "0.1.30"
43
+ "@magic/types": "0.1.31"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@magic-modules/git-badges": "0.0.12",
@@ -49,8 +49,8 @@
49
49
  "@magic-modules/pre": "0.0.12",
50
50
  "@magic-themes/docs": "0.0.15",
51
51
  "@magic/core": "0.0.156",
52
- "@magic/format": "0.0.68",
53
- "@magic/test": "0.2.25",
52
+ "@magic/format": "0.0.69",
53
+ "@magic/test": "0.2.28",
54
54
  "typescript": "5.9.3"
55
55
  },
56
56
  "author": "Wizards & Witches",
package/src/exec.js CHANGED
@@ -7,13 +7,12 @@ const libName = '@magic/cli.exec'
7
7
  /**
8
8
  * Executes a shell command using child_process.exec
9
9
  * @param {string} cmd - The shell command to execute.
10
- * @param {object} [options={}] - Execution options.
11
- * @param {boolean} [options.stderrToStdout=false] - If true, resolves stderr as stdout instead of rejecting.
10
+ * @param {child_process.ExecOptionsWithStringEncoding & { stderrToStdout: boolean }} [options = {}] - Execution options.
12
11
  * @returns {Promise<string>} Resolves with stdout or stderr (if stderrToStdout = true), rejects with Error.
13
12
  */
14
- export const exec = (cmd, options = {}) =>
13
+ export const exec = (cmd, options) =>
15
14
  new Promise((resolve, reject) => {
16
- const { stderrToStdout, ...opts } = options
15
+ const { stderrToStdout = false, ...opts } = options || {}
17
16
 
18
17
  child_process.exec(cmd, opts, (err, stdout, stderr) => {
19
18
  if (err) {
package/src/execFile.js CHANGED
@@ -8,7 +8,7 @@ const libName = '@magic/cli.execFile'
8
8
  * Executes a file using child_process.execFile
9
9
  * @param {string} p - Path to the executable file.
10
10
  * @param {string[]} [args=[]] - Arguments to pass to the executable.
11
- * @param {import('child_process').ExecFileOptions} [opts={}] - Execution options.
11
+ * @param {child_process.ExecFileOptions} [opts={}] - Execution options.
12
12
  * @returns {Promise<string | Buffer>} Resolves with stdout, rejects with Error.
13
13
  */
14
14
  export const execFile = (p, args = [], opts = {}) =>
package/src/index.js CHANGED
@@ -18,6 +18,7 @@ import { prompt as promptUser } from './prompt.js'
18
18
  * @property {boolean} [pureEnv]
19
19
  * @property {boolean} [pureArgv]
20
20
  * @property {boolean} [pureCommands]
21
+ * @property {string[]} [single]
21
22
  * @property {Array<string|string[]>} [commands]
22
23
  * @property {Array<[string[], string, string]>} [env]
23
24
  * @property {Array<string|string[]>} [required]
package/types/exec.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export function exec(
2
2
  cmd: string,
3
- options?: {
4
- stderrToStdout?: boolean | undefined
3
+ options?: child_process.ExecOptionsWithStringEncoding & {
4
+ stderrToStdout: boolean
5
5
  },
6
6
  ): Promise<string>
7
+ import child_process from 'child_process'
@@ -1,5 +1,6 @@
1
1
  export function execFile(
2
2
  p: string,
3
3
  args?: string[],
4
- opts?: import('child_process').ExecFileOptions,
4
+ opts?: child_process.ExecFileOptions,
5
5
  ): Promise<string | Buffer>
6
+ import child_process from 'child_process'
package/types/index.d.ts CHANGED
@@ -12,8 +12,8 @@ export const spawn: (
12
12
  ) => import('child_process').ChildProcess
13
13
  export const exec: (
14
14
  cmd: string,
15
- options?: {
16
- stderrToStdout?: boolean | undefined
15
+ options?: import('child_process').ExecOptionsWithStringEncoding & {
16
+ stderrToStdout: boolean
17
17
  },
18
18
  ) => Promise<string>
19
19
  export const prompt: (
@@ -39,6 +39,7 @@ export type ParseProps = {
39
39
  pureEnv?: boolean | undefined
40
40
  pureArgv?: boolean | undefined
41
41
  pureCommands?: boolean | undefined
42
+ single?: string[] | undefined
42
43
  commands?: (string | string[])[] | undefined
43
44
  env?: [string[], string, string][] | undefined
44
45
  required?: (string | string[])[] | undefined