@magic/cli 0.0.50 → 0.0.52

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
@@ -572,6 +572,14 @@ update dependencies
572
572
  - types: add single to ParseProps
573
573
  - update dependencies
574
574
 
575
- ##### 0.0.51 - unreleased
575
+ ##### 0.0.51
576
+
577
+ - exec and execFile options are correctly typed
578
+
579
+ ##### 0.0.52
580
+
581
+ - actually publish the types from 0.0.51.
582
+
583
+ ##### 0.0.53 - unreleased
576
584
 
577
585
  - ...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic/cli",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "homepage": "https://magic.github.io/cli",
5
5
  "description": "declarative command line interfaces with aliasing, commands and environment sanitization",
6
6
  "scripts": {
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/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: (