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: multi-stage output #1155

Merged
merged 30 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8ed9430
Merge pull request #1123 from salesforcecli/mdonnalley/ink
WillieRuemmele Aug 21, 2024
c4195cd
fix: prevent NaN in stage output (#1139)
mdonnalley Aug 22, 2024
922c085
fix: compilation errors
mdonnalley Sep 4, 2024
6fb7327
chore(release): 3.12.3-dev.0 [skip ci]
svc-cli-bot Sep 4, 2024
3be3278
fix: human readable output (#1140)
mdonnalley Sep 4, 2024
aafdc25
Merge branch 'main' into prerelease/beta
mdonnalley Sep 4, 2024
793cc97
chore(release): 3.12.3-dev.1 [skip ci]
svc-cli-bot Sep 4, 2024
4f9fe02
fix: bump mso
mdonnalley Sep 6, 2024
c028459
chore(release): 3.12.3-dev.2 [skip ci]
svc-cli-bot Sep 6, 2024
b2ca56e
Merge branch 'main' into prerelease/beta
mdonnalley Sep 11, 2024
81c944f
fix: bump mso
mdonnalley Sep 11, 2024
574de72
chore(release): 3.12.8-dev.0 [skip ci]
svc-cli-bot Sep 11, 2024
de0dd8b
Merge branch 'main' into prerelease/beta
mdonnalley Sep 18, 2024
691a1e6
chore(release): 3.12.11-dev.0 [skip ci]
svc-cli-bot Sep 18, 2024
c7d169a
Merge branch 'main' into prerelease/beta
mdonnalley Sep 25, 2024
dc27005
chore(release): 3.12.12-dev.0 [skip ci]
svc-cli-bot Sep 25, 2024
b1c75ab
Merge branch 'main' into prerelease/beta
mdonnalley Sep 30, 2024
7d558b6
chore(release): 3.12.15-dev.0 [skip ci]
svc-cli-bot Sep 30, 2024
6d092eb
Merge branch 'main' into prerelease/beta
mdonnalley Oct 7, 2024
7e60874
fix: upgrade mso
mdonnalley Oct 7, 2024
e7d3356
chore(release): 3.12.18-dev.0 [skip ci]
svc-cli-bot Oct 7, 2024
33e585a
Merge branch 'main' into prerelease/beta
mdonnalley Oct 14, 2024
906db75
chore(release): 3.12.20-dev.0 [skip ci]
svc-cli-bot Oct 14, 2024
1a7c3aa
fix: bump @oclif/multi-stage-output
mdonnalley Oct 14, 2024
4591008
chore(release): 3.12.20-dev.1 [skip ci]
svc-cli-bot Oct 14, 2024
33b4f9f
Merge branch 'main' into prerelease/beta
mdonnalley Oct 15, 2024
0c13053
feat: incorporate deploy url
mdonnalley Oct 15, 2024
839b84f
chore(release): 3.13.2-dev.0 [skip ci]
svc-cli-bot Oct 15, 2024
36b380c
fix: change prerelease tag
mdonnalley Oct 15, 2024
a4ed4a3
chore(release): 3.13.2-beta.1 [skip ci]
svc-cli-bot Oct 15, 2024
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
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