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

Sh/pvc verbose #236

Merged
merged 6 commits into from
Feb 2, 2023
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
353 changes: 122 additions & 231 deletions CHANGELOG.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"target-hub-org",
"uninstall-script",
"validate-schema",
"verbose",
"version-description",
"version-name",
"version-number",
Expand Down
8 changes: 8 additions & 0 deletions messages/package_version_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ Language for the package.

Specify the language using a language code listed under "Supported Languages" in Salesforce Help. If no language is specified, the language defaults to the language of the Dev Hub user who created the package.

# flags.verbose.summary

Display verbose command output.

# flags.verbose.description

Display verbose command output. When polling for the status of the creation, this will output status and timeout data on a separate line for each poll request, which is useful in CI systems where timeouts can occur with long periods of no output from commands.

# InProgress

Package version creation request status is '%s'. Run "%s package:version:create:report -i %s" to query for status.
Expand Down
2 changes: 1 addition & 1 deletion messages/package_version_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ New installation key for key-protected package (default: null)

# success

Successfully updated the package version.
Successfully updated the package version. %s
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@
"publishConfig": {
"access": "public"
}
}
}
27 changes: 24 additions & 3 deletions src/commands/package/version/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ export class PackageVersionCreateCommand extends SfCommand<PackageVersionCommand
summary: messages.getMessage('flags.language.summary'),
description: messages.getMessage('flags.language.description'),
}),
verbose: Flags.boolean({
summary: messages.getMessage('flags.verbose.summary'),
description: messages.getMessage('flags.verbose.description'),
}),
};

public async run(): Promise<PackageVersionCommandResult> {
Expand All @@ -193,10 +197,15 @@ export class PackageVersionCreateCommand extends SfCommand<PackageVersionCommand
// eslint-disable-next-line @typescript-eslint/require-await
async (data: PackageVersionCreateReportProgress) => {
if (data.Status !== Package2VersionStatus.success && data.Status !== Package2VersionStatus.error) {
this.spinner.status = messages.getMessage('packageVersionCreateWaitingStatus', [
const status = messages.getMessage('packageVersionCreateWaitingStatus', [
data.remainingWaitTime.minutes,
data.Status,
]);
if (flags.verbose) {
this.log(status);
} else {
this.spinner.status = status;
}
}
}
);
Expand All @@ -208,7 +217,13 @@ export class PackageVersionCreateCommand extends SfCommand<PackageVersionCommand
}
);

this.spinner.start(messages.getMessage('requestInProgress'));
const startMsg = messages.getMessage('requestInProgress');
// verbose does not use a spinner to ensure a separate line for each status update.
if (flags.verbose) {
this.log(`${startMsg}..`);
} else {
this.spinner.start(startMsg);
}

const result = await PackageVersion.create(
{
Expand All @@ -223,7 +238,13 @@ export class PackageVersionCreateCommand extends SfCommand<PackageVersionCommand
frequency,
}
);
this.spinner.stop(messages.getMessage('packageVersionCreateFinalStatus', [result.Status]));
const finalStatusMsg = messages.getMessage('packageVersionCreateFinalStatus', [result.Status]);
if (flags.verbose) {
this.log(finalStatusMsg);
} else {
this.spinner.stop(finalStatusMsg);
}

switch (result.Status) {
case 'Error':
throw messages.createError('multipleErrors', [
Expand Down
2 changes: 1 addition & 1 deletion src/commands/package/version/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class PackageVersionUpdateCommand extends SfCommand<PackageSaveResult> {
Tag: flags.tag,
});

this.logSuccess(messages.getMessage('success'));
this.logSuccess(messages.getMessage('success', [result.id]));

return result;
}
Expand Down
Loading