Skip to content

Commit

Permalink
fix: bump execa to v9.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Sep 25, 2024
1 parent c1e9837 commit 5284d92
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 143 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
"chalk": "5.3.0",
"commander": "9.3.0",
"consolidate": "1.0.4",
"execa": "5.1.1",
"execa": "9.4.0",
"figures": "6.1.0",
"fs-extra": "11.1.0",
"fs-extra": "^11.2.0",
"handlebars": "4.7.8",
"handlebars-helpers": "0.10.0",
"inquirer": "8.2.6",
Expand Down
50 changes: 25 additions & 25 deletions packages/cli-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,33 @@
"@tsed/normalize-path": ">=7.14.2",
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^9.0.7",
"ajv": "8.17.1",
"axios": "1.7.7",
"chalk": "5.3.0",
"ajv": "^8.17.1",
"axios": "^1.7.7",
"chalk": "^5.3.0",
"change-case": "^5.4.4",
"commander": "9.3.0",
"consolidate": "1.0.4",
"create-frame": "1.0.0",
"enquirer": "2.4.1",
"execa": "5.1.1",
"figures": "6.1.0",
"fs-extra": "11.1.0",
"globby": "11.1.0",
"handlebars": "4.7.8",
"handlebars-utils": "1.0.6",
"inquirer": "8.2.6",
"inquirer-autocomplete-prompt": "2.0.1",
"js-yaml": "4.1.0",
"listr2": "5.0.8",
"read-pkg-up": "7.0.1",
"registry-url": "5.1.0",
"commander": "^9.3.0",
"consolidate": "^1.0.4",
"create-frame": "^1.0.0",
"enquirer": "^2.4.1",
"execa": "^9.4.0",
"figures": "^6.1.0",
"fs-extra": "^11.2.0",
"globby": "^11.1.0",
"handlebars": "^4.7.8",
"handlebars-utils": "^1.0.6",
"inquirer": "^8.2.6",
"inquirer-autocomplete-prompt": "^2.0.1",
"js-yaml": "^4.1.0",
"listr2": "^5.0.8",
"read-pkg-up": "^7.0.1",
"registry-url": "^5.1.0",
"rxjs": "^7.8.1",
"semver": "7.6.3",
"split": "1.0.1",
"tslib": "2.3.1",
"tunnel": "0.0.6",
"update-notifier": "7.3.1",
"url-parse": "1.5.10",
"semver": "^7.6.3",
"split": "^1.0.1",
"tslib": "^2.3.1",
"tunnel": "^0.0.6",
"update-notifier": "^7.3.1",
"url-parse": "^1.5.10",
"uuid": "^10.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-core/src/CliCore.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {normalizePath} from "@tsed/normalize-path";
import execa from "execa";
import {execa} from "execa";

import {CliCore} from "./CliCore.js";
import {CliService} from "./services/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import {Inject, Injectable} from "@tsed/di";
import type {Options} from "execa";
import {EMPTY, throwError} from "rxjs";
import {catchError} from "rxjs/operators";

import {ProjectPackageJson} from "../services/ProjectPackageJson.js";
import {isValidVersion} from "../utils/isValidVersion.js";
import {BaseManager} from "./supports/BaseManager.js";
import {BaseManager, type ManagerCmdOpts} from "./supports/BaseManager.js";
import {BunManager} from "./supports/BunManager.js";
import {NpmManager} from "./supports/NpmManager.js";
import {PNpmManager} from "./supports/PNpmManager.js";
Expand Down Expand Up @@ -146,7 +145,7 @@ export class PackageManagersModule {
...opts
}: {
ignoreError?: boolean;
} & Options &
} & ManagerCmdOpts &
Record<string, any> = {}
) {
const options = {
Expand Down
15 changes: 9 additions & 6 deletions packages/cli-core/src/packageManagers/supports/BaseManager.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Inject} from "@tsed/di";
import execa from "execa";
import type {Options, SyncOptions} from "execa";
import {Observable} from "rxjs";

import {CliExeca} from "../../services/CliExeca.js";

export type ManagerCmdOpts = {verbose?: boolean} & execa.Options;
export type ManagerCmdSyncOpts = {verbose?: boolean} & execa.SyncOptions;
export type ManagerCmdOpts = {verbose?: boolean} & Omit<Options, "verbose">;
export type ManagerCmdSyncOpts = {verbose?: boolean} & Omit<SyncOptions, "verbose">;

export abstract class BaseManager {
abstract readonly name: string;
Expand All @@ -26,7 +26,7 @@ export abstract class BaseManager {
}
}

async init(opts: ManagerCmdSyncOpts): Promise<void> {}
async init(opts: ManagerCmdOpts): Promise<void> {}

abstract install(options: ManagerCmdOpts): Observable<any>;

Expand All @@ -38,7 +38,10 @@ export abstract class BaseManager {
return this.run("run", [script], options);
}

run(cmd: string, args: any[], options: {verbose?: boolean} & execa.Options<string>) {
return this.cliExeca.run(this.cmd, [cmd, options.verbose && this.verboseOpt, ...args].filter(Boolean) as string[], options);
run(cmd: string, args: any[], options: ManagerCmdOpts) {
return this.cliExeca.run(this.cmd, [cmd, options.verbose && this.verboseOpt, ...args].filter(Boolean) as string[], {
...options,
verbose: options.verbose ? "full" : undefined
});
}
}
4 changes: 2 additions & 2 deletions packages/cli-core/src/packageManagers/supports/BunManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Injectable} from "@tsed/di";
import execa from "execa";
import type {Options} from "execa";
import {Observable} from "rxjs";

import {BaseManager, type ManagerCmdOpts} from "./BaseManager.js";
Expand All @@ -19,7 +19,7 @@ export class BunManager extends BaseManager {
return this.run("add", ["-d", ...deps], options);
}

install(options: {verbose?: boolean} & execa.Options): Observable<any> {
install(options: {verbose?: boolean} & Options): Observable<any> {
return this.run("install", [options.verbose && "--verbose"], options);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Inject, Injectable} from "@tsed/di";
import execa from "execa";
import {join} from "path";
import {Observable} from "rxjs";

Expand All @@ -16,12 +15,12 @@ export class YarnBerryManager extends BaseManager {
@Inject()
protected cliYaml: CliYaml;

async init(options: ManagerCmdSyncOpts) {
async init(options: ManagerCmdOpts) {
// init yarn v1
this.install(options);

// then switch write file
await this.cliYaml.write(join(options.cwd!, ".yarnrc.yml"), {
await this.cliYaml.write(join(String(options.cwd!), ".yarnrc.yml"), {
nodeLinker: "node-modules"
});

Expand All @@ -37,7 +36,7 @@ export class YarnBerryManager extends BaseManager {
return this.run("add", ["-D", ...deps], options);
}

install(options: {verbose?: boolean} & execa.Options): Observable<any> {
install(options: ManagerCmdOpts): Observable<any> {
return this.run("install", [options.verbose && "--verbose"], options);
}
}
4 changes: 2 additions & 2 deletions packages/cli-core/src/packageManagers/supports/YarnManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Injectable} from "@tsed/di";
import execa from "execa";
import type {Options} from "execa";
import {Observable} from "rxjs";

import {BaseManager, type ManagerCmdOpts} from "./BaseManager.js";
Expand All @@ -19,7 +19,7 @@ export class YarnManager extends BaseManager {
return this.run("add", ["-D", "--ignore-engines", ...deps], options);
}

install(options: {verbose?: boolean} & execa.Options): Observable<any> {
install(options: {verbose?: boolean} & Options): Observable<any> {
return this.run("install", [options.verbose && "--verbose"], options);
}
}
9 changes: 5 additions & 4 deletions packages/cli-core/src/services/CliExeca.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Injectable} from "@tsed/di";
import type {Options, SyncOptions} from "execa";
import execa from "execa";
import {execa, execaSync} from "execa";
import {filter, mergeWith} from "rxjs/operators";
// @ts-ignore
import split from "split";
Expand All @@ -10,6 +10,7 @@ import {streamToObservable} from "../utils/streamToObservable.js";
@Injectable()
export class CliExeca {
readonly raw = execa;
readonly rawSync = execaSync;

/**
*
Expand All @@ -26,14 +27,14 @@ export class CliExeca {
}

runSync(cmd: string, args: string[], opts?: SyncOptions) {
return this.raw.sync(cmd, args, opts);
return this.rawSync(cmd, args, opts);
}

async getAsync(cmd: string, args: string[], opts?: SyncOptions) {
async getAsync(cmd: string | URL, args: readonly string[], opts?: Options) {
return (await this.raw(cmd, args, opts)).stdout;
}

get(cmd: string, args: string[], opts?: SyncOptions) {
return this.raw.sync(cmd, args, opts).stdout;
return this.rawSync(cmd, args, opts).stdout;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import execa from "execa";
import {execa} from "execa";

import {CliCore, Command, CommandProvider, Tasks} from "../../src/index.js";
import {CliCore, Command, type CommandProvider, type Tasks} from "../../src/index.js";

vi.mock("execa");

Expand Down
10 changes: 5 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
"@tsed/logger": ">=6.2.1",
"@tsed/openspec": ">=7.14.2",
"@tsed/schema": ">=7.14.2",
"chalk": "5.3.0",
"change-case": "5.4.4",
"chalk": "^5.3.0",
"change-case": "^5.4.4",
"esm-module-alias": "^2.2.1",
"globby": "11.1.0",
"read-pkg-up": "7.0.1",
"globby": "^11.1.0",
"read-pkg-up": "^7.0.1",
"semver": "^7.6.3",
"tslib": "2.3.1"
"tslib": "^2.3.1"
},
"devDependencies": {
"@tsed/typescript": "workspace:*",
Expand Down
Loading

0 comments on commit 5284d92

Please sign in to comment.