Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(command): add support for disabling spinner in upgrade command #749

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion command/upgrade/provider/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class NpmProvider extends Provider {
private readonly packageName?: string;
private readonly packageScope?: string;

constructor({ main, logger, ...options }: NpmProviderOptions) {
constructor({ main, logger, ...options }: NpmProviderOptions = {}) {
super({ main, logger });
if ("package" in options) {
if (options.package.startsWith("@")) {
Expand Down
10 changes: 7 additions & 3 deletions command/upgrade/upgrade_command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface UpgradeCommandOptions<
> extends RuntimeOptions {
provider: TProvider | Array<TProvider>;
runtime?: RuntimeOptionsMap;
spinner?: boolean;
}

/**
Expand Down Expand Up @@ -58,7 +59,8 @@ export class UpgradeCommand extends Command {
private readonly providers: ReadonlyArray<Provider>;

constructor(
{ provider, ...options }: UpgradeCommandOptions,
{ provider, spinner: withSpinner = true, ...options }:
UpgradeCommandOptions,
) {
super();
this.providers = Array.isArray(provider) ? provider : [provider];
Expand Down Expand Up @@ -108,7 +110,9 @@ export class UpgradeCommand extends Command {
"-v, --verbose",
"Log verbose output.",
)
.option("--no-spinner", "Disable spinner.")
.option("--no-spinner", "Disable spinner.", {
hidden: !withSpinner,
})
.complete("version", () => this.getAllVersions())
.action(
async (
Expand All @@ -123,7 +127,7 @@ export class UpgradeCommand extends Command {
const name: string = this.getMainCommand().getName();
const currentVersion: string | undefined = this.getVersion();

const spinner = spinnerEnabled
const spinner = withSpinner && spinnerEnabled
? new Spinner({
message: brightBlue(
`Upgrading ${bold(name)} from version ${
Expand Down