Skip to content

Commit 0a2a582

Browse files
committed
Revert "Merge pull request #1123 from salesforcecli/mdonnalley/ink"
This reverts commit c4f1cff, reversing changes made to 2098219.
1 parent 784aaf9 commit 0a2a582

File tree

11 files changed

+173
-586
lines changed

11 files changed

+173
-586
lines changed

messages/retrieve.start.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,18 @@ 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+
148160
# error.Conflicts
149161

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

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
88
"@oclif/core": "^4.0.18",
9-
"@oclif/multi-stage-output": "^0.3.1",
109
"@salesforce/apex-node": "^8.1.3",
1110
"@salesforce/core": "^8.4.0",
1211
"@salesforce/kit": "^3.2.1",

src/commands/project/delete/source.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
requiredOrgFlagWithDeprecations,
3434
SfCommand,
3535
} from '@salesforce/sf-plugins-core';
36-
import { DeployStages } from '../../../utils/deployStages.js';
3736
import { writeConflictTable } from '../../../utils/conflicts.js';
3837
import { isNonDecomposedCustomLabel, isNonDecomposedCustomLabelsOrCustomLabel } from '../../../utils/metadataTypes.js';
3938
import { getFileResponseSuccessProps, tableHeader } from '../../../utils/output.js';
@@ -42,6 +41,7 @@ import { getPackageDirs, getSourceApiVersion } from '../../../utils/project.js';
4241
import { resolveApi, validateTests } from '../../../utils/deploy.js';
4342
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
4443
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,14 +244,8 @@ 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-
253247
const isRest = (await resolveApi()) === API['REST'];
254-
stages.update({ message: `Deleting with ${isRest ? 'REST' : 'SOAP'} API` });
248+
this.log(`*** Deleting with ${isRest ? 'REST' : 'SOAP'} API ***`);
255249

256250
const deploy = await this.componentSet.deploy({
257251
usernameOrConnection: this.org.getUsername() as string,
@@ -263,7 +257,7 @@ export class Source extends SfCommand<DeleteSourceJson> {
263257
},
264258
});
265259

266-
stages.start({ deploy, username: this.org.getUsername() });
260+
new DeployProgress(deploy, this.jsonEnabled()).start();
267261
this.deployResult = await deploy.pollStatus({ timeout: this.flags.wait });
268262
if (!deploy.id) {
269263
throw new SfError('The deploy id is not available.');

src/commands/project/deploy/report.ts

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

src/commands/project/deploy/resume.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
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';
89
import { EnvironmentVariable, Messages, Org, SfError } from '@salesforce/core';
910
import { SfCommand, toHelpSection, Flags } from '@salesforce/sf-plugins-core';
1011
import { DeployResult, MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
1112
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';
1415
import { API, DeployResultJson } from '../../../utils/types.js';
1516
import { buildComponentSet, determineExitCode, executeDeploy, isNotResumable } from '../../../utils/deploy.js';
1617
import { DeployCache } from '../../../utils/deployCache.js';
@@ -123,11 +124,8 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
123124
jobId
124125
);
125126

126-
new DeployStages({
127-
title: 'Resuming Deploy',
128-
jsonEnabled: this.jsonEnabled(),
129-
}).start({ deploy, username: deployOpts['target-org'] });
130-
127+
this.log(`Deploy ID: ${ansis.bold(jobId)}`);
128+
new DeployProgress(deploy, this.jsonEnabled()).start();
131129
result = await deploy.pollStatus(500, wait.seconds);
132130

133131
if (!deploy.id) {

src/commands/project/deploy/start.ts

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
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 { MultiStageOutput } from '@oclif/multi-stage-output';
8+
import ansis from 'ansis';
99
import { EnvironmentVariable, Lifecycle, Messages, OrgConfigProperties, SfError } from '@salesforce/core';
10-
import { DeployVersionData, MetadataApiDeployStatus } from '@salesforce/source-deploy-retrieve';
10+
import { DeployVersionData } from '@salesforce/source-deploy-retrieve';
1111
import { Duration } from '@salesforce/kit';
1212
import { SfCommand, toHelpSection, Flags } from '@salesforce/sf-plugins-core';
13-
import { SourceConflictError, SourceMemberPollingEvent } from '@salesforce/source-tracking';
14-
import { DeployStages } from '../../../utils/deployStages.js';
13+
import { SourceConflictError } from '@salesforce/source-tracking';
1514
import { AsyncDeployResultFormatter } from '../../../formatters/asyncDeployResultFormatter.js';
1615
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
16+
import { DeployProgress } from '../../../utils/progressBar.js';
1717
import { DeployResultJson, TestLevel } from '../../../utils/types.js';
1818
import { executeDeploy, resolveApi, validateTests, determineExitCode } from '../../../utils/deploy.js';
1919
import { DeployCache } from '../../../utils/deployCache.js';
@@ -176,16 +176,6 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
176176

177177
public static errorCodes = toHelpSection('ERROR CODES', DEPLOY_STATUS_CODES_DESCRIPTIONS);
178178

179-
protected ms!: MultiStageOutput<{
180-
mdapiDeploy: MetadataApiDeployStatus;
181-
sourceMemberPolling: SourceMemberPollingEvent;
182-
status: string;
183-
apiData: DeployVersionData;
184-
targetOrg: string;
185-
}>;
186-
187-
protected stages!: DeployStages;
188-
189179
public async run(): Promise<DeployResultJson> {
190180
const { flags } = await this.parse(DeployMetadata);
191181
const project = await getOptionalProject();
@@ -207,30 +197,23 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
207197

208198
const api = await resolveApi(this.configAggregator);
209199
const username = flags['target-org'].getUsername();
210-
const title = flags['dry-run'] ? 'Deploying Metadata (dry-run)' : 'Deploying Metadata';
200+
const action = flags['dry-run'] ? 'Deploying (dry-run)' : 'Deploying';
211201

212-
this.stages = new DeployStages({
213-
title,
214-
jsonEnabled: this.jsonEnabled(),
202+
// eslint-disable-next-line @typescript-eslint/require-await
203+
Lifecycle.getInstance().on('apiVersionDeploy', async (apiData: DeployVersionData) => {
204+
this.log(
205+
messages.getMessage('apiVersionMsgDetailed', [
206+
action,
207+
// technically manifestVersion can be undefined, but only on raw mdapi deployments.
208+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
209+
flags['metadata-dir'] ? '<version specified in manifest>' : `v${apiData.manifestVersion}`,
210+
username,
211+
apiData.apiVersion,
212+
apiData.webService,
213+
])
214+
);
215215
});
216216

217-
const lifecycle = Lifecycle.getInstance();
218-
lifecycle.on('apiVersionDeploy', async (apiData: DeployVersionData) =>
219-
Promise.resolve(
220-
this.stages.update({
221-
message: messages.getMessage('apiVersionMsgDetailed', [
222-
flags['dry-run'] ? 'Deploying (dry-run)' : 'Deploying',
223-
// technically manifestVersion can be undefined, but only on raw mdapi deployments.
224-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
225-
flags['metadata-dir'] ? '<version specified in manifest>' : `v${apiData.manifestVersion}`,
226-
username,
227-
apiData.apiVersion,
228-
apiData.webService,
229-
]),
230-
})
231-
)
232-
);
233-
234217
const { deploy } = await executeDeploy(
235218
{
236219
...flags,
@@ -241,20 +224,16 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
241224
);
242225

243226
if (!deploy) {
244-
this.stages.stop();
245227
this.log('No changes to deploy');
246228
return { status: 'Nothing to deploy', files: [] };
247229
}
248230

249231
if (!deploy.id) {
250232
throw new SfError('The deploy id is not available.');
251233
}
252-
253-
this.stages.start({ username, deploy });
234+
this.log(`Deploy ID: ${ansis.bold(deploy.id)}`);
254235

255236
if (flags.async) {
256-
this.stages.done({ status: 'Queued', username });
257-
this.stages.stop();
258237
if (flags['coverage-formatters']) {
259238
this.warn(messages.getMessage('asyncCoverageJunitWarning'));
260239
}
@@ -263,6 +242,8 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
263242
return asyncFormatter.getJson();
264243
}
265244

245+
new DeployProgress(deploy, this.jsonEnabled()).start();
246+
266247
const result = await deploy.pollStatus({ timeout: flags.wait });
267248
process.exitCode = determineExitCode(result);
268249
const formatter = new DeployResultFormatter(result, flags);
@@ -280,8 +261,6 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
280261
protected catch(error: Error | SfError): Promise<never> {
281262
if (error instanceof SourceConflictError && error.data) {
282263
if (!this.jsonEnabled()) {
283-
this.stages.update({ status: 'Failed' });
284-
this.stages.stop(error);
285264
writeConflictTable(error.data);
286265
// set the message and add plugin-specific actions
287266
return super.catch({

src/commands/project/deploy/validate.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { EnvironmentVariable, Lifecycle, Messages, OrgConfigProperties, SfError
1111
import { CodeCoverageWarnings, DeployVersionData, RequestStatus } from '@salesforce/source-deploy-retrieve';
1212
import { Duration, ensureArray } from '@salesforce/kit';
1313
import { SfCommand, toHelpSection, Flags } from '@salesforce/sf-plugins-core';
14-
import { DeployStages } from '../../../utils/deployStages.js';
1514
import { AsyncDeployResultFormatter } from '../../../formatters/asyncDeployResultFormatter.js';
1615
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
16+
import { DeployProgress } from '../../../utils/progressBar.js';
1717
import { DeployResultJson, TestLevel } from '../../../utils/types.js';
1818
import { executeDeploy, resolveApi, determineExitCode, validateTests } from '../../../utils/deploy.js';
1919
import { DEPLOY_STATUS_CODES_DESCRIPTIONS } from '../../../utils/errorCodes.js';
@@ -195,18 +195,15 @@ export default class DeployMetadataValidate extends SfCommand<DeployResultJson>
195195
if (!deploy.id) {
196196
throw new SfError('The deploy id is not available.');
197197
}
198+
this.log(`Deploy ID: ${ansis.bold(deploy.id)}`);
198199

199200
if (flags.async) {
200-
this.log(`Deploy ID: ${ansis.bold(deploy.id)}`);
201201
const asyncFormatter = new AsyncDeployResultFormatter(deploy.id);
202202
if (!this.jsonEnabled()) asyncFormatter.display();
203203
return asyncFormatter.getJson();
204204
}
205205

206-
new DeployStages({
207-
title: 'Validating Deployment',
208-
jsonEnabled: this.jsonEnabled(),
209-
}).start({ deploy, username });
206+
new DeployProgress(deploy, this.jsonEnabled()).start();
210207

211208
const result = await deploy.pollStatus(500, flags.wait?.seconds);
212209
process.exitCode = determineExitCode(result);

0 commit comments

Comments
 (0)