diff --git a/package-lock.json b/package-lock.json index f08fca0..14f73a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/common", - "version": "4.15.0", + "version": "4.15.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@athenna/common", - "version": "4.15.0", + "version": "4.15.1", "license": "MIT", "dependencies": { "@fastify/formbody": "^7.4.0", diff --git a/package.json b/package.json index d126a12..c8296e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/common", - "version": "4.15.0", + "version": "4.15.1", "description": "The Athenna common helpers to use in any Node.js ESM project.", "license": "MIT", "author": "João Lenon ", diff --git a/src/helpers/Exec.ts b/src/helpers/Exec.ts index 6736664..cc33997 100644 --- a/src/helpers/Exec.ts +++ b/src/helpers/Exec.ts @@ -12,15 +12,14 @@ import { File } from '#src/helpers/File' import { Options } from '#src/helpers/Options' import { request as requestHttp } from 'node:http' import { request as requestHttps } from 'node:https' -import type { PaginationOptions, PaginatedResponse } from '#src/types' -import { - execa, - execaNode, - execaCommand, - type Options as CommandOptions, - type NodeOptions as NodeCommandOptions, - type ExecaChildProcess as CommandOutput -} from 'execa' +import { execa, execaNode, execaCommand } from 'execa' +import type { + CommandInput, + CommandOutput, + NodeCommandInput, + PaginationOptions, + PaginatedResponse +} from '#src/types' export class Exec { /** @@ -47,7 +46,7 @@ export class Exec { */ public static async shell( command: string, - options: CommandOptions = {} + options: CommandInput = {} ): Promise { return execa('sh', ['-c', command], options) } @@ -57,7 +56,7 @@ export class Exec { */ public static async command( command: string, - options: CommandOptions = {} + options: CommandInput = {} ): Promise { return execaCommand(command, options) } @@ -68,7 +67,7 @@ export class Exec { public static async node( path: string, argv: string[] = [], - options: NodeCommandOptions = {} + options: NodeCommandInput = {} ): Promise { return execaNode(path, argv, options) } @@ -78,7 +77,7 @@ export class Exec { */ public static async artisan( path: string, - options: NodeCommandOptions = {} + options: NodeCommandInput = {} ): Promise { options = Options.create(options, { preferLocal: true, diff --git a/src/types/CommandInput.ts b/src/types/CommandInput.ts new file mode 100644 index 0000000..bf4f5c0 --- /dev/null +++ b/src/types/CommandInput.ts @@ -0,0 +1,12 @@ +/** + * @athenna/common + * + * (c) João Lenon + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import type { Options } from 'execa' + +export type CommandInput = Options diff --git a/src/types/CommandOutput.ts b/src/types/CommandOutput.ts index 61abd48..82c2370 100644 --- a/src/types/CommandOutput.ts +++ b/src/types/CommandOutput.ts @@ -7,8 +7,6 @@ * file that was distributed with this source code. */ -export type CommandOutput = { - stdout: string - stderr: string - exitCode: number -} +import type { ExecaChildProcess } from 'execa' + +export type CommandOutput = ExecaChildProcess diff --git a/src/types/NodeCommandInput.ts b/src/types/NodeCommandInput.ts new file mode 100644 index 0000000..7a4ad3b --- /dev/null +++ b/src/types/NodeCommandInput.ts @@ -0,0 +1,12 @@ +/** + * @athenna/common + * + * (c) João Lenon + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import type { NodeOptions } from 'execa' + +export type NodeCommandInput = NodeOptions diff --git a/src/types/index.ts b/src/types/index.ts index 1145641..31d6c9f 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -28,7 +28,9 @@ export type { export * from '#src/types/Merge' export * from '#src/types/Except' export * from '#src/types/PathDirs' +export * from '#src/types/CommandInput' export * from '#src/types/CommandOutput' +export * from '#src/types/NodeCommandInput' export * from '#src/types/ObjectBuilderOptions' export * from '#src/types/json/FileJson'