Skip to content

Commit

Permalink
fix: human readable output (#1140)
Browse files Browse the repository at this point in the history
* fix: human readable output

* fix: source member tracking percentage

* fix: bump mso

* fix: bump mso

* chore(release): 3.11.2-beta.0 [skip ci]

* fix: handle zip details

* test: update nut

---------

Co-authored-by: svc-cli-bot <[email protected]>
  • Loading branch information
mdonnalley and svc-cli-bot authored Sep 4, 2024
1 parent 6fb7327 commit 3be3278
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 108 deletions.
76 changes: 41 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,29 @@ sf plugins

<!-- commands -->

- [`sf project convert mdapi`](#sf-project-convert-mdapi)
- [`sf project convert source`](#sf-project-convert-source)
- [`sf project convert source-behavior`](#sf-project-convert-source-behavior)
- [`sf project delete source`](#sf-project-delete-source)
- [`sf project delete tracking`](#sf-project-delete-tracking)
- [`sf project deploy cancel`](#sf-project-deploy-cancel)
- [`sf project deploy preview`](#sf-project-deploy-preview)
- [`sf project deploy quick`](#sf-project-deploy-quick)
- [`sf project deploy report`](#sf-project-deploy-report)
- [`sf project deploy resume`](#sf-project-deploy-resume)
- [`sf project deploy start`](#sf-project-deploy-start)
- [`sf project deploy validate`](#sf-project-deploy-validate)
- [`sf project generate manifest`](#sf-project-generate-manifest)
- [`sf project list ignored`](#sf-project-list-ignored)
- [`sf project reset tracking`](#sf-project-reset-tracking)
- [`sf project retrieve preview`](#sf-project-retrieve-preview)
- [`sf project retrieve start`](#sf-project-retrieve-start)
- [plugin-deploy-retrieve](#plugin-deploy-retrieve)
- [Install](#install)
- [Contributing](#contributing)
- [CLA](#cla)
- [Build](#build)
- [Commands](#commands)
- [`sf project convert mdapi`](#sf-project-convert-mdapi)
- [`sf project convert source`](#sf-project-convert-source)
- [`sf project convert source-behavior`](#sf-project-convert-source-behavior)
- [`sf project delete source`](#sf-project-delete-source)
- [`sf project delete tracking`](#sf-project-delete-tracking)
- [`sf project deploy cancel`](#sf-project-deploy-cancel)
- [`sf project deploy preview`](#sf-project-deploy-preview)
- [`sf project deploy quick`](#sf-project-deploy-quick)
- [`sf project deploy report`](#sf-project-deploy-report)
- [`sf project deploy resume`](#sf-project-deploy-resume)
- [`sf project deploy start`](#sf-project-deploy-start)
- [`sf project deploy validate`](#sf-project-deploy-validate)
- [`sf project generate manifest`](#sf-project-generate-manifest)
- [`sf project list ignored`](#sf-project-list-ignored)
- [`sf project reset tracking`](#sf-project-reset-tracking)
- [`sf project retrieve preview`](#sf-project-retrieve-preview)
- [`sf project retrieve start`](#sf-project-retrieve-start)

## `sf project convert mdapi`

Expand Down Expand Up @@ -141,7 +147,7 @@ FLAG DESCRIPTIONS
If you specify this parameter, don’t specify --metadata or --source-dir.
```

_See code: [src/commands/project/convert/mdapi.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/convert/mdapi.ts)_
_See code: [src/commands/project/convert/mdapi.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/convert/mdapi.ts)_

## `sf project convert source`

Expand All @@ -153,7 +159,7 @@ USAGE
[-p <value>... | -x <value> | -m <value>...]
FLAGS
-d, --output-dir=<value> [default: metadataPackage_1725465613516] Output directory to store the Metadata
-d, --output-dir=<value> [default: metadataPackage_1725104645659] Output directory to store the Metadata
API–formatted files in.
-m, --metadata=<value>... Metadata component names to convert.
-n, --package-name=<value> Name of the package to associate with the metadata-formatted files.
Expand Down Expand Up @@ -214,7 +220,7 @@ FLAG DESCRIPTIONS
Override the api version used for api requests made by this command
```

_See code: [src/commands/project/convert/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/convert/source.ts)_
_See code: [src/commands/project/convert/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/convert/source.ts)_

## `sf project convert source-behavior`

Expand Down Expand Up @@ -271,7 +277,7 @@ EXAMPLES
$ sf project convert source-behavior --behavior decomposePermissionSetBeta --dry-run --preserve-temp-dir
```

_See code: [src/commands/project/convert/source-behavior.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/convert/source-behavior.ts)_
_See code: [src/commands/project/convert/source-behavior.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/convert/source-behavior.ts)_

## `sf project delete source`

Expand Down Expand Up @@ -411,7 +417,7 @@ FLAG DESCRIPTIONS
- Separate the test names with spaces: --tests Test1 Test2 "Test With Space"
```

_See code: [src/commands/project/delete/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/delete/source.ts)_
_See code: [src/commands/project/delete/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/delete/source.ts)_

## `sf project delete tracking`

Expand Down Expand Up @@ -448,7 +454,7 @@ EXAMPLES
$ sf project delete tracking --target-org my-scratch
```

_See code: [src/commands/project/delete/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/delete/tracking.ts)_
_See code: [src/commands/project/delete/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/delete/tracking.ts)_

## `sf project deploy cancel`

Expand Down Expand Up @@ -520,7 +526,7 @@ FLAG DESCRIPTIONS
project deploy report".
```

_See code: [src/commands/project/deploy/cancel.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/deploy/cancel.ts)_
_See code: [src/commands/project/deploy/cancel.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/deploy/cancel.ts)_

## `sf project deploy preview`

Expand Down Expand Up @@ -603,7 +609,7 @@ FLAG DESCRIPTIONS
All child components are included. If you specify this flag, don’t specify --metadata or --source-dir.
```

_See code: [src/commands/project/deploy/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/deploy/preview.ts)_
_See code: [src/commands/project/deploy/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/deploy/preview.ts)_

## `sf project deploy quick`

Expand Down Expand Up @@ -687,7 +693,7 @@ FLAG DESCRIPTIONS
deploy report".
```

_See code: [src/commands/project/deploy/quick.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/deploy/quick.ts)_
_See code: [src/commands/project/deploy/quick.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/deploy/quick.ts)_

## `sf project deploy report`

Expand Down Expand Up @@ -779,7 +785,7 @@ FLAG DESCRIPTIONS
--coverage-formatters lcov --coverage-formatters clover
```

_See code: [src/commands/project/deploy/report.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/deploy/report.ts)_
_See code: [src/commands/project/deploy/report.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/deploy/report.ts)_

## `sf project deploy resume`

Expand Down Expand Up @@ -864,7 +870,7 @@ FLAG DESCRIPTIONS
--coverage-formatters lcov --coverage-formatters clover
```

_See code: [src/commands/project/deploy/resume.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/deploy/resume.ts)_
_See code: [src/commands/project/deploy/resume.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/deploy/resume.ts)_

## `sf project deploy start`

Expand Down Expand Up @@ -1100,7 +1106,7 @@ FLAG DESCRIPTIONS
--coverage-formatters lcov --coverage-formatters clover
```

_See code: [src/commands/project/deploy/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/deploy/start.ts)_
_See code: [src/commands/project/deploy/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/deploy/start.ts)_

## `sf project deploy validate`

Expand Down Expand Up @@ -1273,7 +1279,7 @@ FLAG DESCRIPTIONS
--coverage-formatters lcov --coverage-formatters clover
```

_See code: [src/commands/project/deploy/validate.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/deploy/validate.ts)_
_See code: [src/commands/project/deploy/validate.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/deploy/validate.ts)_

## `sf project generate manifest`

Expand Down Expand Up @@ -1350,7 +1356,7 @@ EXAMPLES
$ sf project generate manifest --from-org [email protected] --include-packages unlocked
```

_See code: [src/commands/project/generate/manifest.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/generate/manifest.ts)_
_See code: [src/commands/project/generate/manifest.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/generate/manifest.ts)_

## `sf project list ignored`

Expand Down Expand Up @@ -1392,7 +1398,7 @@ EXAMPLES
$ sf project list ignored --source-dir package.xml
```

_See code: [src/commands/project/list/ignored.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/list/ignored.ts)_
_See code: [src/commands/project/list/ignored.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/list/ignored.ts)_

## `sf project reset tracking`

Expand Down Expand Up @@ -1441,7 +1447,7 @@ EXAMPLES
$ sf project reset tracking --revision 30
```

_See code: [src/commands/project/reset/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/reset/tracking.ts)_
_See code: [src/commands/project/reset/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/reset/tracking.ts)_

## `sf project retrieve preview`

Expand Down Expand Up @@ -1495,7 +1501,7 @@ FLAG DESCRIPTIONS
production orgs.
```

_See code: [src/commands/project/retrieve/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/retrieve/preview.ts)_
_See code: [src/commands/project/retrieve/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/retrieve/preview.ts)_

## `sf project retrieve start`

Expand Down Expand Up @@ -1664,6 +1670,6 @@ FLAG DESCRIPTIONS
If you specify this parameter, don’t specify --metadata or --source-dir.
```

_See code: [src/commands/project/retrieve/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.3-dev.0/src/commands/project/retrieve/start.ts)_
_See code: [src/commands/project/retrieve/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.12.2/src/commands/project/retrieve/start.ts)_

<!-- commandsstop -->
1 change: 1 addition & 0 deletions src/commands/project/delete/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export class Source extends SfCommand<DeleteSourceJson> {
stages.start({ deploy, username: this.org.getUsername() });
this.deployResult = await deploy.pollStatus({ timeout: this.flags.wait });
if (!deploy.id) {
stages.error();
throw new SfError('The deploy id is not available.');
}
await DeployCache.update(deploy.id, { status: this.deployResult.response.status });
Expand Down
73 changes: 37 additions & 36 deletions src/commands/project/deploy/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { ConfigVars } from '../../../configMeta.js';
import { coverageFormattersFlag, fileOrDirFlag, testLevelFlag, testsFlag } from '../../../utils/flags.js';
import { writeConflictTable } from '../../../utils/conflicts.js';
import { getOptionalProject } from '../../../utils/project.js';
import { getZipFileSize } from '../../../utils/output.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata');
Expand Down Expand Up @@ -203,44 +202,31 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
const username = flags['target-org'].getUsername();
const title = flags['dry-run'] ? 'Deploying Metadata (dry-run)' : 'Deploying Metadata';

this.stages = new DeployStages({
title,
jsonEnabled: this.jsonEnabled(),
});
const lifecycle = Lifecycle.getInstance();
// eslint-disable-next-line @typescript-eslint/require-await
let message: string = '';

lifecycle.on('apiVersionDeploy', async (apiData: DeployVersionData) => {
message = messages.getMessage('apiVersionMsgDetailed', [
flags['dry-run'] ? 'Deploying (dry-run)' : 'Deploying',
// technically manifestVersion can be undefined, but only on raw mdapi deployments.
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
flags['metadata-dir'] ? '<version specified in manifest>' : `v${apiData.manifestVersion}`,
username,
apiData.apiVersion,
apiData.webService,
]);

return Promise.resolve();
});

lifecycle.on('deployZipData', async (zipData: DeployZipData) => {
this.zipSize = zipData.zipSize;
if (flags.verbose && this.zipSize) {
this.stages.update({
deploySize: `${getZipFileSize(this.zipSize)} of ~39 MB limit`,
});
}
if (zipData.zipFileCount) {
this.zipFileCount = zipData.zipFileCount;
if (flags.verbose && this.zipSize) {
this.stages.update({
deployFileCount: `${this.zipFileCount} of 10,000 limit`,
});
}
}
});

lifecycle.on('apiVersionDeploy', async (apiData: DeployVersionData) =>
Promise.resolve(
this.stages.update({
message: messages.getMessage('apiVersionMsgDetailed', [
flags['dry-run'] ? 'Deploying (dry-run)' : 'Deploying',
// technically manifestVersion can be undefined, but only on raw mdapi deployments.
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
flags['metadata-dir'] ? '<version specified in manifest>' : `v${apiData.manifestVersion}`,
username,
apiData.apiVersion,
apiData.webService,
]),
})
)
);
return Promise.resolve();
});

const { deploy } = await executeDeploy(
{
Expand All @@ -252,7 +238,6 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
);

if (!deploy) {
this.stages.stop();
this.log('No changes to deploy');
return { status: 'Nothing to deploy', files: [] };
}
Expand All @@ -261,7 +246,23 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
throw new SfError('The deploy id is not available.');
}

this.stages.start({ username, deploy });
this.stages = new DeployStages({
title,
jsonEnabled: this.jsonEnabled(),
});

this.stages.start(
{ username, deploy },
{
message,
...(flags.verbose
? {
deploySize: this.zipSize,
deployFileCount: this.zipFileCount,
}
: {}),
}
);

if (flags.async) {
this.stages.done({ status: 'Queued', username });
Expand Down Expand Up @@ -292,8 +293,8 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
protected catch(error: Error | SfError): Promise<never> {
if (error instanceof SourceConflictError && error.data) {
if (!this.jsonEnabled()) {
this.stages.update({ status: 'Failed' });
this.stages.stop(error);
this.stages?.update({ status: 'Failed' });
this.stages?.error();
writeConflictTable(error.data);
// set the message and add plugin-specific actions
return super.catch({
Expand Down
Loading

0 comments on commit 3be3278

Please sign in to comment.