diff --git a/packages/cli/src/core/pkg_manager.ts b/packages/cli/src/core/pkg_manager.ts index 44869bd..9777696 100644 --- a/packages/cli/src/core/pkg_manager.ts +++ b/packages/cli/src/core/pkg_manager.ts @@ -52,20 +52,19 @@ export class PkgManager { } /** - * @param pkgManager The package manager to use. + * Runs a command using the package manager. + * @param pkgManager - The package manager to use. + * @param commands - The commands to run. + * @param options - The options to use when running the command. */ - public async install( + public async run( pkgManager: PkgManagerName, + commands: Array, options?: { - install?: string spawn?: Parameters[2] } ): Promise { - const installCommands: string[] = options?.install - ? ['install', options.install] - : ['install'] - - await this.$shell.spawn$(pkgManager, installCommands, { + await this.$shell.spawn$(pkgManager, commands, { stdio: 'inherit', ...options?.spawn, env: { @@ -79,4 +78,25 @@ export class PkgManager { }, }) } + + /** + * Installs the dependencies using the package manager. + * @param pkgManager - The package manager to use. + * @param options - The options to use when running the command. + */ + public async install( + pkgManager: PkgManagerName, + options?: { + commands?: string + spawn?: Parameters[2] + } + ): Promise { + const installCommands: string[] = options?.commands + ? ['install', options.commands] + : ['install'] + + await this.run(pkgManager, installCommands, { + spawn: options?.spawn, + }) + } }