Skip to content

Commit

Permalink
refactor: Command thunks return execa results.
Browse files Browse the repository at this point in the history
  • Loading branch information
darkobits committed Mar 12, 2024
1 parent 17ede77 commit 36e79ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/etc/types/CommandThunk.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { IS_COMMAND_THUNK } from 'etc/constants';
import type { ExecaReturnValue } from 'execa';


/**
* Return type of `command`.
*/
export interface CommandThunk {
(): Promise<void>;
(): Promise<ExecaReturnValue>;
[IS_COMMAND_THUNK]: true;
}
3 changes: 1 addition & 2 deletions src/lib/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ function commandBuilder(builderOptions: CommandBuilderOptions): CommandThunk {
executable: ow.string,
name: ow.optional.string,
args: ow.optional.any(
//
ow.string,
ow.number,
ow.boolean,
Expand Down Expand Up @@ -308,7 +307,7 @@ function commandBuilder(builderOptions: CommandBuilderOptions): CommandThunk {
// chalk.gray(getEscapedCommand(executable, childProcess.spawnargs))
// );

await childProcess;
return await childProcess;
} catch (err: any) {
throw new Error(`${prefixedName} failed • ${err.message}`, { cause: err });
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export function script(name: string, instructions: InstructionSet, options: Scri
log.verbose(log.prefix(logPrefix), '•', chalk.green('start'));
}

await pSeries(resolvedInstructions);
await pSeries<any>(resolvedInstructions);

if (timing) {
heroLog([
Expand Down

0 comments on commit 36e79ec

Please sign in to comment.