Skip to content

Commit 6e272ae

Browse files
Merge pull request #1155 from salesforcecli/prerelease/beta
feat: multi-stage output
2 parents 8e68494 + a4ed4a3 commit 6e272ae

File tree

13 files changed

+669
-241
lines changed

13 files changed

+669
-241
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ FLAG DESCRIPTIONS
141141
If you specify this parameter, don’t specify --metadata or --source-dir.
142142
```
143143

144-
_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)_
144+
_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)_
145145

146146
## `sf project convert source`
147147

@@ -214,7 +214,7 @@ FLAG DESCRIPTIONS
214214
Override the api version used for api requests made by this command
215215
```
216216

217-
_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)_
217+
_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)_
218218

219219
## `sf project convert source-behavior`
220220

@@ -272,7 +272,7 @@ EXAMPLES
272272
$ sf project convert source-behavior --behavior decomposePermissionSetBeta --dry-run --preserve-temp-dir
273273
```
274274

275-
_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)_
275+
_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)_
276276

277277
## `sf project delete source`
278278

@@ -412,7 +412,7 @@ FLAG DESCRIPTIONS
412412
- Separate the test names with spaces: --tests Test1 Test2 "Test With Space"
413413
```
414414

415-
_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)_
415+
_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)_
416416

417417
## `sf project delete tracking`
418418

@@ -449,7 +449,7 @@ EXAMPLES
449449
$ sf project delete tracking --target-org my-scratch
450450
```
451451

452-
_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)_
452+
_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)_
453453

454454
## `sf project deploy cancel`
455455

@@ -521,7 +521,7 @@ FLAG DESCRIPTIONS
521521
project deploy report".
522522
```
523523

524-
_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)_
524+
_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)_
525525

526526
## `sf project deploy preview`
527527

@@ -604,7 +604,7 @@ FLAG DESCRIPTIONS
604604
All child components are included. If you specify this flag, don’t specify --metadata or --source-dir.
605605
```
606606

607-
_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)_
607+
_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)_
608608

609609
## `sf project deploy quick`
610610

@@ -688,7 +688,7 @@ FLAG DESCRIPTIONS
688688
deploy report".
689689
```
690690

691-
_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)_
691+
_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)_
692692

693693
## `sf project deploy report`
694694

@@ -780,7 +780,7 @@ FLAG DESCRIPTIONS
780780
--coverage-formatters lcov --coverage-formatters clover
781781
```
782782

783-
_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)_
783+
_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)_
784784

785785
## `sf project deploy resume`
786786

@@ -865,7 +865,7 @@ FLAG DESCRIPTIONS
865865
--coverage-formatters lcov --coverage-formatters clover
866866
```
867867

868-
_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)_
868+
_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)_
869869

870870
## `sf project deploy start`
871871

@@ -1101,7 +1101,7 @@ FLAG DESCRIPTIONS
11011101
--coverage-formatters lcov --coverage-formatters clover
11021102
```
11031103

1104-
_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)_
1104+
_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)_
11051105

11061106
## `sf project deploy validate`
11071107

@@ -1274,7 +1274,7 @@ FLAG DESCRIPTIONS
12741274
--coverage-formatters lcov --coverage-formatters clover
12751275
```
12761276

1277-
_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)_
1277+
_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)_
12781278

12791279
## `sf project generate manifest`
12801280

@@ -1351,7 +1351,7 @@ EXAMPLES
13511351
$ sf project generate manifest --from-org [email protected] --include-packages unlocked
13521352
```
13531353

1354-
_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)_
1354+
_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)_
13551355

13561356
## `sf project list ignored`
13571357

@@ -1393,7 +1393,7 @@ EXAMPLES
13931393
$ sf project list ignored --source-dir package.xml
13941394
```
13951395

1396-
_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)_
1396+
_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)_
13971397

13981398
## `sf project reset tracking`
13991399

@@ -1442,7 +1442,7 @@ EXAMPLES
14421442
$ sf project reset tracking --revision 30
14431443
```
14441444

1445-
_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)_
1445+
_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)_
14461446

14471447
## `sf project retrieve preview`
14481448

@@ -1496,7 +1496,7 @@ FLAG DESCRIPTIONS
14961496
production orgs.
14971497
```
14981498

1499-
_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)_
1499+
_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)_
15001500

15011501
## `sf project retrieve start`
15021502

@@ -1665,6 +1665,6 @@ FLAG DESCRIPTIONS
16651665
If you specify this parameter, don’t specify --metadata or --source-dir.
16661666
```
16671667

1668-
_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)_
1668+
_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)_
16691669

16701670
<!-- commandsstop -->

messages/retrieve.start.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,6 @@ Extract all files from the retrieved zip file.
145145

146146
File name to use for the retrieved zip file.
147147

148-
# spinner.start
149-
150-
Preparing retrieve request
151-
152-
# spinner.sending
153-
154-
Sending request to org
155-
156-
# spinner.polling
157-
158-
Waiting for the org to respond
159-
160148
# error.Conflicts
161149

162150
There are changes in your local files that conflict with the org changes you're trying to retrieve.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "@salesforce/plugin-deploy-retrieve",
33
"description": "deploy and retrieve commands for sf",
4-
"version": "3.13.1",
4+
"version": "3.13.2-beta.1",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
88
"@oclif/core": "^4.0.28",
9+
"@oclif/multi-stage-output": "^0.7.7",
910
"@salesforce/apex-node": "^8.1.9",
1011
"@salesforce/core": "^8.6.1",
1112
"@salesforce/kit": "^3.2.3",
@@ -14,7 +15,8 @@
1415
"@salesforce/source-deploy-retrieve": "^12.7.4",
1516
"@salesforce/source-tracking": "^7.1.16",
1617
"@salesforce/ts-types": "^2.0.12",
17-
"ansis": "^3.3.2"
18+
"ansis": "^3.3.2",
19+
"terminal-link": "^3.0.0"
1820
},
1921
"devDependencies": {
2022
"@oclif/plugin-command-snapshot": "^5.2.17",

src/commands/project/delete/source.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
requiredOrgFlagWithDeprecations,
3434
SfCommand,
3535
} from '@salesforce/sf-plugins-core';
36+
import { DeployStages } from '../../../utils/deployStages.js';
3637
import { writeConflictTable } from '../../../utils/conflicts.js';
3738
import { isNonDecomposedCustomLabel, isNonDecomposedCustomLabelsOrCustomLabel } from '../../../utils/metadataTypes.js';
3839
import { getFileResponseSuccessProps, tableHeader } from '../../../utils/output.js';
@@ -41,7 +42,6 @@ import { getPackageDirs, getSourceApiVersion } from '../../../utils/project.js';
4142
import { resolveApi, validateTests } from '../../../utils/deploy.js';
4243
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
4344
import { DeleteResultFormatter } from '../../../formatters/deleteResultFormatter.js';
44-
import { DeployProgress } from '../../../utils/progressBar.js';
4545
import { DeployCache } from '../../../utils/deployCache.js';
4646
import { testLevelFlag, testsFlag } from '../../../utils/flags.js';
4747
const testFlags = 'Test';
@@ -244,8 +244,14 @@ export class Source extends SfCommand<DeleteSourceJson> {
244244

245245
// fire predeploy event for the delete
246246
await Lifecycle.getInstance().emit('predeploy', this.components);
247+
248+
const stages = new DeployStages({
249+
title: 'Deleting Metadata',
250+
jsonEnabled: this.jsonEnabled(),
251+
});
252+
247253
const isRest = (await resolveApi()) === API['REST'];
248-
this.log(`*** Deleting with ${isRest ? 'REST' : 'SOAP'} API ***`);
254+
stages.update({ message: `Deleting with ${isRest ? 'REST' : 'SOAP'} API` });
249255

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

260-
new DeployProgress(deploy, this.jsonEnabled()).start();
266+
stages.start({ deploy, username: this.org.getUsername() });
261267
this.deployResult = await deploy.pollStatus({ timeout: this.flags.wait });
262268
if (!deploy.id) {
269+
stages.error();
263270
throw new SfError('The deploy id is not available.');
264271
}
265272
await DeployCache.update(deploy.id, { status: this.deployResult.response.status });

src/commands/project/deploy/report.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import { Messages, Org, SfProject } from '@salesforce/core';
99
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
1010
import { ComponentSet, DeployResult, MetadataApiDeploy, RequestStatus } from '@salesforce/source-deploy-retrieve';
11+
import { DeployStages } from '../../../utils/deployStages.js';
1112
import { buildComponentSet } from '../../../utils/deploy.js';
12-
import { DeployProgress } from '../../../utils/progressBar.js';
1313
import { DeployCache } from '../../../utils/deployCache.js';
1414
import { DeployReportResultFormatter } from '../../../formatters/deployReportResultFormatter.js';
1515
import { API, DeployResultJson } from '../../../utils/types.js';
@@ -70,7 +70,7 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
7070
const jobId = cache.resolveLatest(flags['use-most-recent'], flags['job-id'], false);
7171

7272
const deployOpts = cache.maybeGet(jobId);
73-
const wait = flags['wait'];
73+
const { wait } = flags;
7474
const org = deployOpts?.['target-org']
7575
? await Org.create({ aliasOrUsername: deployOpts['target-org'] })
7676
: flags['target-org'];
@@ -124,7 +124,10 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
124124
if (wait) {
125125
// poll for deploy results
126126
try {
127-
new DeployProgress(mdapiDeploy, this.jsonEnabled()).start();
127+
new DeployStages({
128+
title: 'Deploying Metadata',
129+
jsonEnabled: this.jsonEnabled(),
130+
}).start({ deploy: mdapiDeploy, username: org.getUsername() });
128131
result = await mdapiDeploy.pollStatus(500, wait.seconds);
129132
} catch (error) {
130133
if (error instanceof Error && error.message.includes('The client has timed out')) {

src/commands/project/deploy/resume.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8-
import ansis from 'ansis';
98
import { EnvironmentVariable, Messages, Org, SfError } from '@salesforce/core';
109
import { SfCommand, toHelpSection, Flags } from '@salesforce/sf-plugins-core';
1110
import { DeployResult, MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
1211
import { Duration } from '@salesforce/kit';
12+
import { DeployStages } from '../../../utils/deployStages.js';
1313
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
14-
import { DeployProgress } from '../../../utils/progressBar.js';
1514
import { API, DeployResultJson } from '../../../utils/types.js';
1615
import {
1716
buildComponentSet,
@@ -131,11 +130,21 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
131130
this.project,
132131
jobId
133132
);
134-
135-
this.log(`Deploy ID: ${ansis.bold(jobId)}`);
136133
this.deployUrl = buildDeployUrl(org, jobId);
137-
this.log(`Deploy URL: ${ansis.bold(this.deployUrl)}`);
138-
new DeployProgress(deploy, this.jsonEnabled()).start();
134+
new DeployStages({
135+
title: 'Resuming Deploy',
136+
jsonEnabled: this.jsonEnabled(),
137+
}).start(
138+
{
139+
deploy,
140+
username: deployOpts['target-org'],
141+
},
142+
{
143+
deployUrl: this.deployUrl,
144+
verbose: flags.verbose ?? deployOpts.verbose,
145+
}
146+
);
147+
139148
result = await deploy.pollStatus(500, wait.seconds);
140149

141150
if (!deploy.id) {

0 commit comments

Comments
 (0)