Skip to content

Commit

Permalink
Merge pull request #1155 from salesforcecli/prerelease/beta
Browse files Browse the repository at this point in the history
feat: multi-stage output
  • Loading branch information
WillieRuemmele authored Oct 15, 2024
2 parents 8e68494 + a4ed4a3 commit 6e272ae
Show file tree
Hide file tree
Showing 13 changed files with 669 additions and 241 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,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.13.1/src/commands/project/convert/mdapi.ts)_
_See code: [src/commands/project/convert/mdapi.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/convert/mdapi.ts)_

## `sf project convert source`

Expand Down Expand Up @@ -214,7 +214,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.13.1/src/commands/project/convert/source.ts)_
_See code: [src/commands/project/convert/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/convert/source.ts)_

## `sf project convert source-behavior`

Expand Down Expand Up @@ -272,7 +272,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.13.1/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.13.2-beta.0/src/commands/project/convert/source-behavior.ts)_

## `sf project delete source`

Expand Down Expand Up @@ -412,7 +412,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.13.1/src/commands/project/delete/source.ts)_
_See code: [src/commands/project/delete/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/delete/source.ts)_

## `sf project delete tracking`

Expand Down Expand Up @@ -449,7 +449,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.13.1/src/commands/project/delete/tracking.ts)_
_See code: [src/commands/project/delete/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/delete/tracking.ts)_

## `sf project deploy cancel`

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

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

## `sf project deploy preview`

Expand Down Expand Up @@ -604,7 +604,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.13.1/src/commands/project/deploy/preview.ts)_
_See code: [src/commands/project/deploy/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/deploy/preview.ts)_

## `sf project deploy quick`

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

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

## `sf project deploy report`

Expand Down Expand Up @@ -780,7 +780,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.13.1/src/commands/project/deploy/report.ts)_
_See code: [src/commands/project/deploy/report.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/deploy/report.ts)_

## `sf project deploy resume`

Expand Down Expand Up @@ -865,7 +865,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.13.1/src/commands/project/deploy/resume.ts)_
_See code: [src/commands/project/deploy/resume.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/deploy/resume.ts)_

## `sf project deploy start`

Expand Down Expand Up @@ -1101,7 +1101,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.13.1/src/commands/project/deploy/start.ts)_
_See code: [src/commands/project/deploy/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/deploy/start.ts)_

## `sf project deploy validate`

Expand Down Expand Up @@ -1274,7 +1274,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.13.1/src/commands/project/deploy/validate.ts)_
_See code: [src/commands/project/deploy/validate.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/deploy/validate.ts)_

## `sf project generate manifest`

Expand Down Expand Up @@ -1351,7 +1351,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.13.1/src/commands/project/generate/manifest.ts)_
_See code: [src/commands/project/generate/manifest.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/generate/manifest.ts)_

## `sf project list ignored`

Expand Down Expand Up @@ -1393,7 +1393,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.13.1/src/commands/project/list/ignored.ts)_
_See code: [src/commands/project/list/ignored.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/list/ignored.ts)_

## `sf project reset tracking`

Expand Down Expand Up @@ -1442,7 +1442,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.13.1/src/commands/project/reset/tracking.ts)_
_See code: [src/commands/project/reset/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/reset/tracking.ts)_

## `sf project retrieve preview`

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

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

## `sf project retrieve start`

Expand Down Expand Up @@ -1665,6 +1665,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.13.1/src/commands/project/retrieve/start.ts)_
_See code: [src/commands/project/retrieve/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.13.2-beta.0/src/commands/project/retrieve/start.ts)_

<!-- commandsstop -->
12 changes: 0 additions & 12 deletions messages/retrieve.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,6 @@ Extract all files from the retrieved zip file.

File name to use for the retrieved zip file.

# spinner.start

Preparing retrieve request

# spinner.sending

Sending request to org

# spinner.polling

Waiting for the org to respond

# error.Conflicts

There are changes in your local files that conflict with the org changes you're trying to retrieve.
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@salesforce/plugin-deploy-retrieve",
"description": "deploy and retrieve commands for sf",
"version": "3.13.1",
"version": "3.13.2-beta.1",
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^4.0.28",
"@oclif/multi-stage-output": "^0.7.7",
"@salesforce/apex-node": "^8.1.9",
"@salesforce/core": "^8.6.1",
"@salesforce/kit": "^3.2.3",
Expand All @@ -14,7 +15,8 @@
"@salesforce/source-deploy-retrieve": "^12.7.4",
"@salesforce/source-tracking": "^7.1.16",
"@salesforce/ts-types": "^2.0.12",
"ansis": "^3.3.2"
"ansis": "^3.3.2",
"terminal-link": "^3.0.0"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.2.17",
Expand Down
13 changes: 10 additions & 3 deletions src/commands/project/delete/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
requiredOrgFlagWithDeprecations,
SfCommand,
} from '@salesforce/sf-plugins-core';
import { DeployStages } from '../../../utils/deployStages.js';
import { writeConflictTable } from '../../../utils/conflicts.js';
import { isNonDecomposedCustomLabel, isNonDecomposedCustomLabelsOrCustomLabel } from '../../../utils/metadataTypes.js';
import { getFileResponseSuccessProps, tableHeader } from '../../../utils/output.js';
Expand All @@ -41,7 +42,6 @@ import { getPackageDirs, getSourceApiVersion } from '../../../utils/project.js';
import { resolveApi, validateTests } from '../../../utils/deploy.js';
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
import { DeleteResultFormatter } from '../../../formatters/deleteResultFormatter.js';
import { DeployProgress } from '../../../utils/progressBar.js';
import { DeployCache } from '../../../utils/deployCache.js';
import { testLevelFlag, testsFlag } from '../../../utils/flags.js';
const testFlags = 'Test';
Expand Down Expand Up @@ -244,8 +244,14 @@ export class Source extends SfCommand<DeleteSourceJson> {

// fire predeploy event for the delete
await Lifecycle.getInstance().emit('predeploy', this.components);

const stages = new DeployStages({
title: 'Deleting Metadata',
jsonEnabled: this.jsonEnabled(),
});

const isRest = (await resolveApi()) === API['REST'];
this.log(`*** Deleting with ${isRest ? 'REST' : 'SOAP'} API ***`);
stages.update({ message: `Deleting with ${isRest ? 'REST' : 'SOAP'} API` });

const deploy = await this.componentSet.deploy({
usernameOrConnection: this.org.getUsername() as string,
Expand All @@ -257,9 +263,10 @@ export class Source extends SfCommand<DeleteSourceJson> {
},
});

new DeployProgress(deploy, this.jsonEnabled()).start();
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
9 changes: 6 additions & 3 deletions src/commands/project/deploy/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import { Messages, Org, SfProject } from '@salesforce/core';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { ComponentSet, DeployResult, MetadataApiDeploy, RequestStatus } from '@salesforce/source-deploy-retrieve';
import { DeployStages } from '../../../utils/deployStages.js';
import { buildComponentSet } from '../../../utils/deploy.js';
import { DeployProgress } from '../../../utils/progressBar.js';
import { DeployCache } from '../../../utils/deployCache.js';
import { DeployReportResultFormatter } from '../../../formatters/deployReportResultFormatter.js';
import { API, DeployResultJson } from '../../../utils/types.js';
Expand Down Expand Up @@ -70,7 +70,7 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
const jobId = cache.resolveLatest(flags['use-most-recent'], flags['job-id'], false);

const deployOpts = cache.maybeGet(jobId);
const wait = flags['wait'];
const { wait } = flags;
const org = deployOpts?.['target-org']
? await Org.create({ aliasOrUsername: deployOpts['target-org'] })
: flags['target-org'];
Expand Down Expand Up @@ -124,7 +124,10 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
if (wait) {
// poll for deploy results
try {
new DeployProgress(mdapiDeploy, this.jsonEnabled()).start();
new DeployStages({
title: 'Deploying Metadata',
jsonEnabled: this.jsonEnabled(),
}).start({ deploy: mdapiDeploy, username: org.getUsername() });
result = await mdapiDeploy.pollStatus(500, wait.seconds);
} catch (error) {
if (error instanceof Error && error.message.includes('The client has timed out')) {
Expand Down
21 changes: 15 additions & 6 deletions src/commands/project/deploy/resume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import ansis from 'ansis';
import { EnvironmentVariable, Messages, Org, SfError } from '@salesforce/core';
import { SfCommand, toHelpSection, Flags } from '@salesforce/sf-plugins-core';
import { DeployResult, MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
import { Duration } from '@salesforce/kit';
import { DeployStages } from '../../../utils/deployStages.js';
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
import { DeployProgress } from '../../../utils/progressBar.js';
import { API, DeployResultJson } from '../../../utils/types.js';
import {
buildComponentSet,
Expand Down Expand Up @@ -131,11 +130,21 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
this.project,
jobId
);

this.log(`Deploy ID: ${ansis.bold(jobId)}`);
this.deployUrl = buildDeployUrl(org, jobId);
this.log(`Deploy URL: ${ansis.bold(this.deployUrl)}`);
new DeployProgress(deploy, this.jsonEnabled()).start();
new DeployStages({
title: 'Resuming Deploy',
jsonEnabled: this.jsonEnabled(),
}).start(
{
deploy,
username: deployOpts['target-org'],
},
{
deployUrl: this.deployUrl,
verbose: flags.verbose ?? deployOpts.verbose,
}
);

result = await deploy.pollStatus(500, wait.seconds);

if (!deploy.id) {
Expand Down
Loading

0 comments on commit 6e272ae

Please sign in to comment.