Skip to content

Commit 47b6150

Browse files
committed
change execa option type
1 parent 4b6b0bb commit 47b6150

File tree

4 files changed

+10
-27
lines changed

4 files changed

+10
-27
lines changed

packages/cli-core/src/package-manager-controller/execute_with_debugger_logger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { LogLevel } from '@aws-amplify/cli-core';
2-
import { execa as _execa } from 'execa';
2+
import { type Options, execa as _execa } from 'execa';
33
import { printer } from '../printer.js';
44

55
/**
@@ -10,7 +10,7 @@ export const executeWithDebugLogger = (
1010
executable: string,
1111
args?: Readonly<string[]>,
1212
execa = _execa,
13-
options?: { env?: Record<string, string> }
13+
options?: Options<'utf8'>
1414
) => {
1515
try {
1616
const childProcess = execa(executable, args, {

packages/cli-core/src/package-manager-controller/package_manager_controller_base.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { existsSync as _existsSync } from 'fs';
22
import _fsp from 'fs/promises';
3-
import { ExecaChildProcess, execa as _execa } from 'execa';
3+
import { type ExecaChildProcess, type Options, execa as _execa } from 'execa';
44
import * as _path from 'path';
55
import { type PackageManagerController } from '@aws-amplify/plugin-types';
66
import { LogLevel } from '../printer/printer.js';
@@ -122,14 +122,8 @@ Get started by running \`${this.binaryRunner} amplify sandbox\`.`;
122122
runWithPackageManager(
123123
args: string[] = [],
124124
dir: string,
125-
options?: {
126-
env?: Record<string, string>;
127-
stdin?: 'inherit' | 'pipe' | 'ignore';
128-
stdout?: 'inherit' | 'pipe' | 'ignore';
129-
stderr?: 'inherit' | 'pipe' | 'ignore';
130-
extendEnv?: boolean;
131-
}
132-
): ExecaChildProcess<string> {
125+
options?: Options<'utf8'>
126+
): ExecaChildProcess {
133127
return this.executeWithDebugLogger(
134128
dir,
135129
this.binaryRunner,

packages/plugin-types/API.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { IFunction } from 'aws-cdk-lib/aws-lambda';
1414
import { IRole } from 'aws-cdk-lib/aws-iam';
1515
import { IUserPool } from 'aws-cdk-lib/aws-cognito';
1616
import { IUserPoolClient } from 'aws-cdk-lib/aws-cognito';
17+
import { Options } from 'execa';
1718
import { SecretValue } from 'aws-cdk-lib';
1819
import { Stack } from 'aws-cdk-lib';
1920

@@ -143,13 +144,7 @@ export type PackageManagerController = {
143144
initializeProject: () => Promise<void>;
144145
initializeTsConfig: (targetDir: string) => Promise<void>;
145146
installDependencies: (packageNames: string[], type: 'dev' | 'prod') => Promise<void>;
146-
runWithPackageManager: (args: string[] | undefined, dir: string, options?: {
147-
env?: Record<string, string>;
148-
stdin?: 'inherit' | 'pipe' | 'ignore';
149-
stdout?: 'inherit' | 'pipe' | 'ignore';
150-
stderr?: 'inherit' | 'pipe' | 'ignore';
151-
extendEnv?: boolean;
152-
}) => ExecaChildProcess<string>;
147+
runWithPackageManager: (args: string[] | undefined, dir: string, options?: Options<'utf8'>) => ExecaChildProcess;
153148
getCommand: (args: string[]) => string;
154149
};
155150

packages/plugin-types/src/package_manager_controller.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* execa v8 doesn't support commonjs, so we need to use the types from v5
44
* https://github.com/sindresorhus/execa/issues/489#issuecomment-1109983390
55
*/
6-
import { type ExecaChildProcess } from 'execa';
6+
import { type ExecaChildProcess, type Options } from 'execa';
77

88
export type PackageManagerController = {
99
projectRoot: string;
@@ -17,13 +17,7 @@ export type PackageManagerController = {
1717
runWithPackageManager: (
1818
args: string[] | undefined,
1919
dir: string,
20-
options?: {
21-
env?: Record<string, string>;
22-
stdin?: 'inherit' | 'pipe' | 'ignore';
23-
stdout?: 'inherit' | 'pipe' | 'ignore';
24-
stderr?: 'inherit' | 'pipe' | 'ignore';
25-
extendEnv?: boolean;
26-
}
27-
) => ExecaChildProcess<string>;
20+
options?: Options<'utf8'>
21+
) => ExecaChildProcess;
2822
getCommand: (args: string[]) => string;
2923
};

0 commit comments

Comments
 (0)