Skip to content

Commit 5ad0309

Browse files
committed
fix: use sf-plugins-core
1 parent f7fbab6 commit 5ad0309

File tree

4 files changed

+57
-255
lines changed

4 files changed

+57
-255
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
88
"@oclif/core": "^4.0.16",
9-
"@oclif/multi-stage-output": "^0.2.0",
109
"@salesforce/core": "^8.2.7",
1110
"@salesforce/kit": "^3.2.0",
12-
"@salesforce/sf-plugins-core": "^11.3.0",
11+
"@salesforce/sf-plugins-core": "^11.3.3-dev.2",
1312
"@salesforce/source-deploy-retrieve": "^12.1.12",
1413
"ansis": "^3.2.0",
1514
"change-case": "^5.4.4",

src/commands/org/create/scratch.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
1919
import { Duration } from '@salesforce/kit';
2020
import terminalLink from 'terminal-link';
21-
import { MultiStageOutput } from '@oclif/multi-stage-output';
2221
import { buildScratchOrgRequest } from '../../../shared/scratchOrgRequest.js';
2322
import { ScratchCreateResponse } from '../../../shared/orgTypes.js';
2423

@@ -171,10 +170,9 @@ export default class OrgCreateScratch extends SfCommand<ScratchCreateResponse> {
171170
flags['client-id'] ? await this.secretPrompt({ message: messages.getMessage('prompt.secret') }) : undefined
172171
);
173172

174-
const ms = new MultiStageOutput<ScratchOrgLifecycleEvent & { alias: string | undefined }>({
173+
const stager = this.initStager<ScratchOrgLifecycleEvent & { alias: string | undefined }>({
175174
stages: flags.async ? ['prepare request', 'send request', 'done'] : scratchOrgLifecycleStages,
176175
title: flags.async ? 'Creating Scratch Org (async)' : 'Creating Scratch Org',
177-
jsonEnabled: this.jsonEnabled(),
178176
data: { alias: flags.alias },
179177
postStagesBlock: [
180178
{
@@ -207,9 +205,9 @@ export default class OrgCreateScratch extends SfCommand<ScratchCreateResponse> {
207205
});
208206

209207
lifecycle.on<ScratchOrgLifecycleEvent>(scratchOrgLifecycleEventName, async (data): Promise<void> => {
210-
ms.goto(data.stage, data);
208+
stager.goto(data.stage, data);
211209
if (data.stage === 'done') {
212-
ms.stop();
210+
stager.stop();
213211
}
214212
return Promise.resolve();
215213
});
@@ -222,16 +220,16 @@ export default class OrgCreateScratch extends SfCommand<ScratchCreateResponse> {
222220
}
223221

224222
if (flags.async) {
225-
ms.goto('done', { scratchOrgInfo });
226-
ms.stop();
223+
stager.goto('done', { scratchOrgInfo });
224+
stager.stop();
227225
this.info(messages.getMessage('action.resume', [this.config.bin, scratchOrgInfo.Id]));
228226
} else {
229227
this.logSuccess(messages.getMessage('success'));
230228
}
231229

232230
return { username, scratchOrgInfo, authFields, warnings, orgId: authFields?.orgId };
233231
} catch (error) {
234-
ms.stop(error as Error);
232+
stager.stop(error as Error);
235233
if (error instanceof SfError && error.name === 'ScratchOrgInfoTimeoutError') {
236234
const scratchOrgInfoId = (error.data as { scratchOrgInfoId: string }).scratchOrgInfoId;
237235
const resumeMessage = messages.getMessage('action.resume', [this.config.bin, scratchOrgInfoId]);

src/commands/org/resume/scratch.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
SfError,
2020
} from '@salesforce/core';
2121
import terminalLink from 'terminal-link';
22-
import { MultiStageOutput } from '@oclif/multi-stage-output';
2322
import { ScratchCreateResponse } from '../../../shared/orgTypes.js';
2423

2524
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
@@ -60,10 +59,9 @@ export default class OrgResumeScratch extends SfCommand<ScratchCreateResponse> {
6059
const cached = cache.get(jobId);
6160
const hubBaseUrl = cached?.hubBaseUrl;
6261

63-
const ms = new MultiStageOutput<ScratchOrgLifecycleEvent & { alias: string | undefined }>({
62+
const stager = this.initStager<ScratchOrgLifecycleEvent & { alias: string | undefined }>({
6463
stages: scratchOrgLifecycleStages,
6564
title: 'Resuming Scratch Org',
66-
jsonEnabled: this.jsonEnabled(),
6765
data: { alias: cached?.alias },
6866
postStagesBlock: [
6967
{
@@ -96,9 +94,9 @@ export default class OrgResumeScratch extends SfCommand<ScratchCreateResponse> {
9694
});
9795

9896
lifecycle.on<ScratchOrgLifecycleEvent>(scratchOrgLifecycleEventName, async (data): Promise<void> => {
99-
ms.goto(data.stage, data);
97+
stager.goto(data.stage, data);
10098
if (data.stage === 'done') {
101-
ms.stop();
99+
stager.stop();
102100
}
103101
return Promise.resolve();
104102
});
@@ -109,7 +107,7 @@ export default class OrgResumeScratch extends SfCommand<ScratchCreateResponse> {
109107
this.logSuccess(messages.getMessage('success'));
110108
return { username, scratchOrgInfo, authFields, warnings, orgId: authFields?.orgId };
111109
} catch (e) {
112-
ms.stop(e as Error);
110+
stager.stop(e as Error);
113111

114112
if (cache.keys() && e instanceof Error && e.name === 'CacheMissError') {
115113
// we have something in the cache, but it didn't match what the user passed in

0 commit comments

Comments
 (0)