@salesforce/plugin-org 4.3.5 → 4.3.6-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/lib/commands/org/create/scratch.js +22 -14
- package/lib/commands/org/create/scratch.js.map +1 -1
- package/lib/commands/org/resume/scratch.js +14 -7
- package/lib/commands/org/resume/scratch.js.map +1 -1
- package/lib/components/spinner.d.ts +36 -0
- package/lib/components/spinner.js +55 -0
- package/lib/components/spinner.js.map +1 -0
- package/lib/components/stages.d.ts +29 -0
- package/lib/components/stages.js +122 -0
- package/lib/components/stages.js.map +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +14 -5
- package/lib/shared/scratchOrgOutput.d.ts +0 -9
- package/lib/shared/scratchOrgOutput.js +0 -36
- package/lib/shared/scratchOrgOutput.js.map +0 -1
package/README.md
CHANGED
|
@@ -229,7 +229,7 @@ FLAG DESCRIPTIONS
|
|
|
229
229
|
sandbox.
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
_See code: [src/commands/org/create/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
232
|
+
_See code: [src/commands/org/create/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/create/sandbox.ts)_
|
|
233
233
|
|
|
234
234
|
## `sf org create scratch`
|
|
235
235
|
|
|
@@ -383,7 +383,7 @@ FLAG DESCRIPTIONS
|
|
|
383
383
|
Omit this flag to have Salesforce generate a unique username for your org.
|
|
384
384
|
```
|
|
385
385
|
|
|
386
|
-
_See code: [src/commands/org/create/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
386
|
+
_See code: [src/commands/org/create/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/create/scratch.ts)_
|
|
387
387
|
|
|
388
388
|
## `sf org delete sandbox`
|
|
389
389
|
|
|
@@ -429,7 +429,7 @@ EXAMPLES
|
|
|
429
429
|
$ sf org delete sandbox --target-org my-sandbox --no-prompt
|
|
430
430
|
```
|
|
431
431
|
|
|
432
|
-
_See code: [src/commands/org/delete/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
432
|
+
_See code: [src/commands/org/delete/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/delete/sandbox.ts)_
|
|
433
433
|
|
|
434
434
|
## `sf org delete scratch`
|
|
435
435
|
|
|
@@ -473,7 +473,7 @@ EXAMPLES
|
|
|
473
473
|
$ sf org delete scratch --target-org my-scratch-org --no-prompt
|
|
474
474
|
```
|
|
475
475
|
|
|
476
|
-
_See code: [src/commands/org/delete/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
476
|
+
_See code: [src/commands/org/delete/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/delete/scratch.ts)_
|
|
477
477
|
|
|
478
478
|
## `sf org disable tracking`
|
|
479
479
|
|
|
@@ -512,7 +512,7 @@ EXAMPLES
|
|
|
512
512
|
$ sf org disable tracking
|
|
513
513
|
```
|
|
514
514
|
|
|
515
|
-
_See code: [src/commands/org/disable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
515
|
+
_See code: [src/commands/org/disable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/disable/tracking.ts)_
|
|
516
516
|
|
|
517
517
|
## `sf org display`
|
|
518
518
|
|
|
@@ -557,7 +557,7 @@ EXAMPLES
|
|
|
557
557
|
$ sf org display --target-org TestOrg1 --verbose
|
|
558
558
|
```
|
|
559
559
|
|
|
560
|
-
_See code: [src/commands/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
560
|
+
_See code: [src/commands/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/display.ts)_
|
|
561
561
|
|
|
562
562
|
## `sf org enable tracking`
|
|
563
563
|
|
|
@@ -599,7 +599,7 @@ EXAMPLES
|
|
|
599
599
|
$ sf org enable tracking
|
|
600
600
|
```
|
|
601
601
|
|
|
602
|
-
_See code: [src/commands/org/enable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
602
|
+
_See code: [src/commands/org/enable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/enable/tracking.ts)_
|
|
603
603
|
|
|
604
604
|
## `sf org list`
|
|
605
605
|
|
|
@@ -638,7 +638,7 @@ EXAMPLES
|
|
|
638
638
|
$ sf org list --clean
|
|
639
639
|
```
|
|
640
640
|
|
|
641
|
-
_See code: [src/commands/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
641
|
+
_See code: [src/commands/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/list.ts)_
|
|
642
642
|
|
|
643
643
|
## `sf org list metadata`
|
|
644
644
|
|
|
@@ -705,7 +705,7 @@ FLAG DESCRIPTIONS
|
|
|
705
705
|
Examples of metadata types that use folders are Dashboard, Document, EmailTemplate, and Report.
|
|
706
706
|
```
|
|
707
707
|
|
|
708
|
-
_See code: [src/commands/org/list/metadata.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
708
|
+
_See code: [src/commands/org/list/metadata.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/list/metadata.ts)_
|
|
709
709
|
|
|
710
710
|
## `sf org list metadata-types`
|
|
711
711
|
|
|
@@ -760,7 +760,7 @@ FLAG DESCRIPTIONS
|
|
|
760
760
|
Override the api version used for api requests made by this command
|
|
761
761
|
```
|
|
762
762
|
|
|
763
|
-
_See code: [src/commands/org/list/metadata-types.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
763
|
+
_See code: [src/commands/org/list/metadata-types.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/list/metadata-types.ts)_
|
|
764
764
|
|
|
765
765
|
## `sf org open`
|
|
766
766
|
|
|
@@ -832,7 +832,7 @@ EXAMPLES
|
|
|
832
832
|
$ sf org open --source-file force-app/main/default/flows/Hello.flow-meta.xml
|
|
833
833
|
```
|
|
834
834
|
|
|
835
|
-
_See code: [src/commands/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
835
|
+
_See code: [src/commands/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/open.ts)_
|
|
836
836
|
|
|
837
837
|
## `sf org refresh sandbox`
|
|
838
838
|
|
|
@@ -909,7 +909,7 @@ FLAG DESCRIPTIONS
|
|
|
909
909
|
By default, a sandbox auto-activates after a refresh. Use this flag to control sandbox activation manually.
|
|
910
910
|
```
|
|
911
911
|
|
|
912
|
-
_See code: [src/commands/org/refresh/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
912
|
+
_See code: [src/commands/org/refresh/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/refresh/sandbox.ts)_
|
|
913
913
|
|
|
914
914
|
## `sf org resume sandbox`
|
|
915
915
|
|
|
@@ -972,7 +972,7 @@ FLAG DESCRIPTIONS
|
|
|
972
972
|
returns the job ID. To resume checking the sandbox creation, rerun this command.
|
|
973
973
|
```
|
|
974
974
|
|
|
975
|
-
_See code: [src/commands/org/resume/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
975
|
+
_See code: [src/commands/org/resume/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/resume/sandbox.ts)_
|
|
976
976
|
|
|
977
977
|
## `sf org resume scratch`
|
|
978
978
|
|
|
@@ -1019,6 +1019,6 @@ FLAG DESCRIPTIONS
|
|
|
1019
1019
|
The job ID is valid for 24 hours after you start the scratch org creation.
|
|
1020
1020
|
```
|
|
1021
1021
|
|
|
1022
|
-
_See code: [src/commands/org/resume/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.
|
|
1022
|
+
_See code: [src/commands/org/resume/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.0/src/commands/org/resume/scratch.ts)_
|
|
1023
1023
|
|
|
1024
1024
|
<!-- commandsstop -->
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
import { Lifecycle, Messages, Org, scratchOrgCreate, scratchOrgLifecycleEventName, SfError, } from '@salesforce/core';
|
|
8
8
|
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
9
9
|
import { Duration } from '@salesforce/kit';
|
|
10
|
+
import { render } from 'ink';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { Status } from '../../../components/stages.js';
|
|
10
13
|
import { buildScratchOrgRequest } from '../../../shared/scratchOrgRequest.js';
|
|
11
|
-
import { buildStatus } from '../../../shared/scratchOrgOutput.js';
|
|
12
14
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
13
15
|
const messages = Messages.loadMessages('@salesforce/plugin-org', 'create_scratch');
|
|
14
16
|
const definitionFileHelpGroupName = 'Definition File Override';
|
|
@@ -149,36 +151,42 @@ export default class OrgCreateScratch extends SfCommand {
|
|
|
149
151
|
throw new SfError('No instance URL found for the dev hub');
|
|
150
152
|
}
|
|
151
153
|
const createCommandOptions = await buildScratchOrgRequest(flags, flags['client-id'] ? await this.secretPrompt({ message: messages.getMessage('prompt.secret') }) : undefined);
|
|
152
|
-
let
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
154
|
+
let scratchOrgLifecycleData;
|
|
155
|
+
const instance = !this.jsonEnabled() ? render(React.createElement(Status, { isAsync: flags.async, baseUrl: baseUrl })) : undefined;
|
|
156
|
+
lifecycle.on(scratchOrgLifecycleEventName, async (data) => {
|
|
157
|
+
scratchOrgLifecycleData = data;
|
|
158
|
+
instance?.rerender(React.createElement(Status, { isAsync: flags.async, data: data, baseUrl: baseUrl }));
|
|
159
|
+
if (data.stage === 'done') {
|
|
160
|
+
instance?.unmount();
|
|
161
|
+
}
|
|
162
|
+
return Promise.resolve();
|
|
163
|
+
});
|
|
162
164
|
try {
|
|
163
165
|
const { username, scratchOrgInfo, authFields, warnings } = await scratchOrgCreate(createCommandOptions);
|
|
164
|
-
this.spinner.stop(lastStatus);
|
|
165
166
|
if (!scratchOrgInfo) {
|
|
166
167
|
throw new SfError('The scratch org did not return with any information');
|
|
167
168
|
}
|
|
168
|
-
this.log();
|
|
169
169
|
if (flags.async) {
|
|
170
|
+
instance?.rerender(React.createElement(Status, { isAsync: true, data: { ...scratchOrgLifecycleData, stage: 'done', scratchOrgInfo }, baseUrl: baseUrl }));
|
|
171
|
+
instance?.unmount();
|
|
172
|
+
this.log();
|
|
170
173
|
this.info(messages.getMessage('action.resume', [this.config.bin, scratchOrgInfo.Id]));
|
|
171
174
|
}
|
|
172
175
|
else {
|
|
176
|
+
this.log();
|
|
173
177
|
this.logSuccess(messages.getMessage('success'));
|
|
174
178
|
}
|
|
175
179
|
return { username, scratchOrgInfo, authFields, warnings, orgId: authFields?.orgId };
|
|
176
180
|
}
|
|
177
181
|
catch (error) {
|
|
182
|
+
if (instance) {
|
|
183
|
+
instance.rerender(React.createElement(Status, { isAsync: flags.async, data: scratchOrgLifecycleData, error: error, baseUrl: baseUrl }));
|
|
184
|
+
instance.unmount();
|
|
185
|
+
}
|
|
178
186
|
if (error instanceof SfError && error.name === 'ScratchOrgInfoTimeoutError') {
|
|
179
|
-
this.spinner.stop(lastStatus);
|
|
180
187
|
const scratchOrgInfoId = error.data.scratchOrgInfoId;
|
|
181
188
|
const resumeMessage = messages.getMessage('action.resume', [this.config.bin, scratchOrgInfoId]);
|
|
189
|
+
this.log();
|
|
182
190
|
this.info(resumeMessage);
|
|
183
191
|
this.error('The scratch org did not complete within your wait time', { code: '69', exit: 69 });
|
|
184
192
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../../src/commands/org/create/scratch.
|
|
1
|
+
{"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../../src/commands/org/create/scratch.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,GAAG,EACH,gBAAgB,EAEhB,4BAA4B,EAC5B,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAG9E,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;AAEnF,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AAE/D,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,SAAgC;IACrE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,OAAO,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACjD,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IAExC,MAAM,CAAU,KAAK,GAAG;QAC7B,KAAK,EAAE,KAAK,CA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K,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;QACtF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,QAAQ,CACf,oBAAC,MAAM,IAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAc,EAAE,OAAO,EAAE,OAAO,GAAI,CACzG,CAAC;gBACF,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrB,CAAC;YAED,IAAI,KAAK,YAAY,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,4BAA4B,EAAE,CAAC;gBAC5E,MAAM,gBAAgB,GAAI,KAAK,CAAC,IAAqC,CAAC,gBAAgB,CAAC;gBACvF,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC;gBAEhG,IAAI,CAAC,GAAG,EAAE,CAAC;gBACX,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBACzB,IAAI,CAAC,KAAK,CAAC,wDAAwD,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACjG,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC"}
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
import { strict as assert } from 'node:assert';
|
|
8
8
|
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
9
9
|
import { Lifecycle, Messages, ScratchOrgCache, scratchOrgLifecycleEventName, scratchOrgResume, SfError, } from '@salesforce/core';
|
|
10
|
-
import {
|
|
10
|
+
import { render } from 'ink';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { Status } from '../../../components/stages.js';
|
|
11
13
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
14
|
const messages = Messages.loadMessages('@salesforce/plugin-org', 'resume_scratch');
|
|
13
15
|
export default class OrgResumeScratch extends SfCommand {
|
|
@@ -41,22 +43,27 @@ export default class OrgResumeScratch extends SfCommand {
|
|
|
41
43
|
// oclif doesn't know that the exactlyOne flag will ensure that one of these is set, and there we definitely have a jobID.
|
|
42
44
|
assert(jobId);
|
|
43
45
|
const hubBaseUrl = cache.get(jobId)?.hubBaseUrl;
|
|
44
|
-
let
|
|
46
|
+
let scratchOrgLifecycleData;
|
|
47
|
+
const instance = !this.jsonEnabled() ? render(React.createElement(Status, { baseUrl: hubBaseUrl })) : undefined;
|
|
45
48
|
lifecycle.on(scratchOrgLifecycleEventName, async (data) => {
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
scratchOrgLifecycleData = data;
|
|
50
|
+
instance?.rerender(React.createElement(Status, { data: data, baseUrl: hubBaseUrl }));
|
|
51
|
+
if (data.stage === 'done') {
|
|
52
|
+
instance?.unmount();
|
|
53
|
+
}
|
|
48
54
|
return Promise.resolve();
|
|
49
55
|
});
|
|
50
|
-
this.log();
|
|
51
|
-
this.spinner.start('Creating Scratch Org');
|
|
52
56
|
try {
|
|
53
57
|
const { username, scratchOrgInfo, authFields, warnings } = await scratchOrgResume(jobId);
|
|
54
|
-
this.spinner.stop(lastStatus);
|
|
55
58
|
this.log();
|
|
56
59
|
this.logSuccess(messages.getMessage('success'));
|
|
57
60
|
return { username, scratchOrgInfo, authFields, warnings, orgId: authFields?.orgId };
|
|
58
61
|
}
|
|
59
62
|
catch (e) {
|
|
63
|
+
if (instance) {
|
|
64
|
+
instance.rerender(React.createElement(Status, { data: scratchOrgLifecycleData, error: e, baseUrl: hubBaseUrl }));
|
|
65
|
+
instance.unmount();
|
|
66
|
+
}
|
|
60
67
|
if (cache.keys() && e instanceof Error && e.name === 'CacheMissError') {
|
|
61
68
|
// we have something in the cache, but it didn't match what the user passed in
|
|
62
69
|
throw messages.createError('error.jobIdMismatch', [jobId]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../../src/commands/org/resume/scratch.
|
|
1
|
+
{"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../../src/commands/org/resume/scratch.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EAEf,4BAA4B,EAC5B,gBAAgB,EAChB,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGvD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;AAEnF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,SAAgC;IACrE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,OAAO,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACjD,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IACxC,MAAM,CAAU,KAAK,GAAG;QAC7B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;YAC3B,IAAI,EAAE,GAAG;YACT,MAAM,EAAE,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gBACN,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type SpinnerName } from 'cli-spinners';
|
|
3
|
+
export type UseSpinnerProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Type of a spinner.
|
|
6
|
+
* See [cli-spinners](https://github.com/sindresorhus/cli-spinners) for available spinners.
|
|
7
|
+
*
|
|
8
|
+
* @default dots
|
|
9
|
+
*/
|
|
10
|
+
readonly type?: SpinnerName;
|
|
11
|
+
};
|
|
12
|
+
export type UseSpinnerResult = {
|
|
13
|
+
frame: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function useSpinner({ type }: UseSpinnerProps): UseSpinnerResult;
|
|
16
|
+
export type SpinnerProps = UseSpinnerProps & {
|
|
17
|
+
/**
|
|
18
|
+
* Label to show near the spinner.
|
|
19
|
+
*/
|
|
20
|
+
readonly label?: string;
|
|
21
|
+
readonly isBold?: boolean;
|
|
22
|
+
readonly labelPosition?: 'left' | 'right';
|
|
23
|
+
};
|
|
24
|
+
export declare function Spinner({ isBold, label, type, labelPosition }: SpinnerProps): React.ReactElement;
|
|
25
|
+
export declare function SpinnerOrError({ error, labelPosition, ...props }: SpinnerProps & {
|
|
26
|
+
readonly error?: Error;
|
|
27
|
+
}): React.ReactElement;
|
|
28
|
+
export declare function SpinnerOrErrorOrChildren({ children, error, ...props }: SpinnerProps & {
|
|
29
|
+
readonly children?: React.ReactNode;
|
|
30
|
+
readonly textStyle?: {
|
|
31
|
+
readonly color?: string;
|
|
32
|
+
readonly bold?: boolean;
|
|
33
|
+
};
|
|
34
|
+
readonly text?: string;
|
|
35
|
+
readonly error?: Error;
|
|
36
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024, salesforce.com, inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
8
|
+
import spinners from 'cli-spinners';
|
|
9
|
+
import { Box, Text } from 'ink';
|
|
10
|
+
export function useSpinner({ type = 'dots' }) {
|
|
11
|
+
const [frame, setFrame] = useState(0);
|
|
12
|
+
const spinner = spinners[type];
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const timer = setInterval(() => {
|
|
15
|
+
setFrame((previousFrame) => {
|
|
16
|
+
const isLastFrame = previousFrame === spinner.frames.length - 1;
|
|
17
|
+
return isLastFrame ? 0 : previousFrame + 1;
|
|
18
|
+
});
|
|
19
|
+
}, spinner.interval);
|
|
20
|
+
return () => {
|
|
21
|
+
clearInterval(timer);
|
|
22
|
+
};
|
|
23
|
+
}, [spinner]);
|
|
24
|
+
return {
|
|
25
|
+
frame: spinner.frames[frame] ?? '',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function Spinner({ isBold, label, type, labelPosition = 'right' }) {
|
|
29
|
+
const { frame } = useSpinner({ type });
|
|
30
|
+
return (React.createElement(Box, null,
|
|
31
|
+
label && labelPosition === 'left' && React.createElement(Text, null, label),
|
|
32
|
+
isBold ? (React.createElement(Text, { bold: true, color: "magenta" }, frame)) : (React.createElement(Text, { color: "magenta" },
|
|
33
|
+
frame,
|
|
34
|
+
" ")),
|
|
35
|
+
label && labelPosition === 'right' && React.createElement(Text, null, label)));
|
|
36
|
+
}
|
|
37
|
+
export function SpinnerOrError({ error, labelPosition = 'right', ...props }) {
|
|
38
|
+
if (error) {
|
|
39
|
+
return (React.createElement(Box, null,
|
|
40
|
+
props.label && labelPosition === 'left' && React.createElement(Text, null, props.label),
|
|
41
|
+
React.createElement(Text, { color: "red" }, "\u2716"),
|
|
42
|
+
props.label && labelPosition === 'right' && React.createElement(Text, null, props.label)));
|
|
43
|
+
}
|
|
44
|
+
return React.createElement(Spinner, { labelPosition: labelPosition, ...props });
|
|
45
|
+
}
|
|
46
|
+
export function SpinnerOrErrorOrChildren({ children, error, ...props }) {
|
|
47
|
+
if (children) {
|
|
48
|
+
return (React.createElement(Box, null,
|
|
49
|
+
props.label && props.labelPosition === 'left' && React.createElement(Text, null, props.label),
|
|
50
|
+
children,
|
|
51
|
+
props.label && props.labelPosition === 'right' && React.createElement(Text, null, props.label)));
|
|
52
|
+
}
|
|
53
|
+
return React.createElement(SpinnerOrError, { error: error, ...props });
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/components/spinner.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,QAA8B,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAgBhC,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,EAAmB;IAC3D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;YAC7B,QAAQ,CAAC,CAAC,aAAa,EAAE,EAAE;gBACzB,MAAM,WAAW,GAAG,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;gBAChE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,OAAO,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CAAC;IACJ,CAAC;IAED,OAAO,oBAAC,OAAO,IAAC,aAAa,EAAE,aAAa,KAAM,KAAK,GAAI,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,EACvC,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EAST;IACC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CACL,oBAAC,GAAG;YACD,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,aAAa,KAAK,MAAM,IAAI,oBAAC,IAAI,QAAE,KAAK,CAAC,KAAK,CAAQ;YAC3E,QAAQ;YACR,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,aAAa,KAAK,OAAO,IAAI,oBAAC,IAAI,QAAE,KAAK,CAAC,KAAK,CAAQ,CACzE,CACP,CAAC;IACJ,CAAC;IAED,OAAO,oBAAC,cAAc,IAAC,KAAK,EAAE,KAAK,KAAM,KAAK,GAAI,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ScratchOrgLifecycleEvent, SfError } from '@salesforce/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare function Divider({ title, width, padding, titlePadding, titleColor, dividerChar, dividerColor, }: {
|
|
4
|
+
readonly title?: string;
|
|
5
|
+
readonly width?: number | 'full';
|
|
6
|
+
readonly padding?: number;
|
|
7
|
+
readonly titleColor?: string;
|
|
8
|
+
readonly titlePadding?: number;
|
|
9
|
+
readonly dividerChar?: string;
|
|
10
|
+
readonly dividerColor?: string;
|
|
11
|
+
}): React.ReactNode;
|
|
12
|
+
export declare function Timer(props: {
|
|
13
|
+
readonly color?: string;
|
|
14
|
+
}): React.ReactNode;
|
|
15
|
+
export declare function Space({ repeat }: {
|
|
16
|
+
readonly repeat?: number;
|
|
17
|
+
}): React.ReactNode;
|
|
18
|
+
export declare function Stages(props: {
|
|
19
|
+
readonly currentStage: string;
|
|
20
|
+
readonly stages: string[] | readonly string[];
|
|
21
|
+
readonly title: string;
|
|
22
|
+
readonly error?: SfError | Error | undefined;
|
|
23
|
+
}): React.ReactNode;
|
|
24
|
+
export declare function Status(props: {
|
|
25
|
+
readonly data?: ScratchOrgLifecycleEvent;
|
|
26
|
+
readonly baseUrl: string;
|
|
27
|
+
readonly isAsync?: boolean;
|
|
28
|
+
readonly error?: SfError | Error | undefined;
|
|
29
|
+
}): React.ReactNode;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024, salesforce.com, inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
import { scratchOrgLifecycleStages } from '@salesforce/core';
|
|
8
|
+
import { Box, Text } from 'ink';
|
|
9
|
+
import { capitalCase } from 'change-case';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import terminalLink from 'terminal-link';
|
|
12
|
+
import { SpinnerOrError, SpinnerOrErrorOrChildren } from './spinner.js';
|
|
13
|
+
function round(value, decimals = 2) {
|
|
14
|
+
return Number(Math.round(Number(value + 'e' + decimals)) + 'e-' + decimals);
|
|
15
|
+
}
|
|
16
|
+
function timeInMostReadableFormat(time) {
|
|
17
|
+
// if time < 1000ms, return time in ms
|
|
18
|
+
if (time < 1000) {
|
|
19
|
+
return `${time}ms`;
|
|
20
|
+
}
|
|
21
|
+
// if time < 60s, return time in seconds
|
|
22
|
+
if (time < 60_000) {
|
|
23
|
+
return `${round(time / 1000)}s`;
|
|
24
|
+
}
|
|
25
|
+
// if time < 60m, return time in minutes
|
|
26
|
+
if (time < 3_600_000) {
|
|
27
|
+
return `${round(time / 60_000)}m`;
|
|
28
|
+
}
|
|
29
|
+
return time.toString();
|
|
30
|
+
}
|
|
31
|
+
function diff(start, end) {
|
|
32
|
+
if (!start || !end) {
|
|
33
|
+
return '0ms';
|
|
34
|
+
}
|
|
35
|
+
return timeInMostReadableFormat(end.getTime() - start.getTime());
|
|
36
|
+
}
|
|
37
|
+
const getSideDividerWidth = (width, titleWidth) => (width - titleWidth) / 2;
|
|
38
|
+
const getNumberOfCharsPerWidth = (char, width) => width / char.length;
|
|
39
|
+
const PAD = ' ';
|
|
40
|
+
export function Divider({ title = '', width = 50, padding = 1, titlePadding = 1, titleColor = 'white', dividerChar = '─', dividerColor = 'dim', }) {
|
|
41
|
+
const titleString = title ? `${PAD.repeat(titlePadding) + title + PAD.repeat(titlePadding)}` : '';
|
|
42
|
+
const titleWidth = titleString.length;
|
|
43
|
+
// width ??= process.stdout.columns ? process.stdout.columns - titlePadding : 80;
|
|
44
|
+
const terminalWidth = process.stdout.columns ?? 80;
|
|
45
|
+
const widthToUse = width === 'full' ? terminalWidth - titlePadding : width > terminalWidth ? terminalWidth : width;
|
|
46
|
+
const dividerWidth = getSideDividerWidth(widthToUse, titleWidth);
|
|
47
|
+
const numberOfCharsPerSide = getNumberOfCharsPerWidth(dividerChar, dividerWidth);
|
|
48
|
+
const dividerSideString = dividerChar.repeat(numberOfCharsPerSide);
|
|
49
|
+
const paddingString = PAD.repeat(padding);
|
|
50
|
+
return (React.createElement(Box, { flexDirection: "row" },
|
|
51
|
+
React.createElement(Text, null,
|
|
52
|
+
paddingString,
|
|
53
|
+
React.createElement(Text, { color: dividerColor }, dividerSideString),
|
|
54
|
+
React.createElement(Text, { color: titleColor }, titleString),
|
|
55
|
+
React.createElement(Text, { color: dividerColor }, dividerSideString),
|
|
56
|
+
paddingString)));
|
|
57
|
+
}
|
|
58
|
+
export function Timer(props) {
|
|
59
|
+
const [time, setTime] = React.useState(0);
|
|
60
|
+
const interval = 10;
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const intervalId = setInterval(() => {
|
|
63
|
+
setTime((prevTime) => prevTime + interval);
|
|
64
|
+
}, interval);
|
|
65
|
+
return () => {
|
|
66
|
+
clearInterval(intervalId);
|
|
67
|
+
};
|
|
68
|
+
}, [interval]);
|
|
69
|
+
return React.createElement(Text, { ...props }, timeInMostReadableFormat(time));
|
|
70
|
+
}
|
|
71
|
+
export function Space({ repeat = 1 }) {
|
|
72
|
+
return React.createElement(Text, null, ' '.repeat(repeat));
|
|
73
|
+
}
|
|
74
|
+
export function Stages(props) {
|
|
75
|
+
const [timings, setTimings] = React.useState(Object.fromEntries(props.stages.map((stage) => [stage, {}])));
|
|
76
|
+
return (React.createElement(Box, { flexDirection: "column", paddingTop: 1 },
|
|
77
|
+
React.createElement(Divider, { title: props.title }),
|
|
78
|
+
React.createElement(Box, { flexDirection: "column", paddingTop: 1, marginLeft: 1 }, props.stages.map((stage, stageIndex) => {
|
|
79
|
+
// current stage
|
|
80
|
+
if (props.currentStage === stage && stageIndex < props.stages.length - 1) {
|
|
81
|
+
if (!timings[stage].start) {
|
|
82
|
+
timings[stage].start = new Date();
|
|
83
|
+
setTimings({ ...timings });
|
|
84
|
+
}
|
|
85
|
+
return (React.createElement(Box, { key: stage },
|
|
86
|
+
React.createElement(SpinnerOrError, { error: props.error, type: "dots2", label: capitalCase(stage) }),
|
|
87
|
+
React.createElement(Space, null),
|
|
88
|
+
React.createElement(Timer, { color: "dim" })));
|
|
89
|
+
}
|
|
90
|
+
// completed stages
|
|
91
|
+
if (props.stages.indexOf(props.currentStage) >= stageIndex) {
|
|
92
|
+
if (!timings[stage].end) {
|
|
93
|
+
timings[stage].end = new Date();
|
|
94
|
+
setTimings({ ...timings });
|
|
95
|
+
}
|
|
96
|
+
return (React.createElement(Box, { key: stage },
|
|
97
|
+
React.createElement(Text, { color: "green" }, "\u2713 "),
|
|
98
|
+
React.createElement(Text, null,
|
|
99
|
+
capitalCase(stage),
|
|
100
|
+
" "),
|
|
101
|
+
React.createElement(Text, { color: "dim" }, diff(timings[stage].start, timings[stage].end))));
|
|
102
|
+
}
|
|
103
|
+
// future stage
|
|
104
|
+
return (React.createElement(Text, { key: stage, color: "dim" },
|
|
105
|
+
"\u25FC ",
|
|
106
|
+
capitalCase(stage)));
|
|
107
|
+
})),
|
|
108
|
+
React.createElement(Box, { paddingTop: 1, marginLeft: 1 },
|
|
109
|
+
React.createElement(Text, null, "Elapsed Time: "),
|
|
110
|
+
React.createElement(Timer, null))));
|
|
111
|
+
}
|
|
112
|
+
export function Status(props) {
|
|
113
|
+
if (!props.data)
|
|
114
|
+
return;
|
|
115
|
+
return (React.createElement(Box, { flexDirection: "column" },
|
|
116
|
+
React.createElement(Stages, { title: props.isAsync ? 'Creating Scratch Org (async)' : 'Creating Scratch Org', currentStage: props.data.stage, stages: props.isAsync ? ['prepare request', 'send request', 'done'] : scratchOrgLifecycleStages, error: props.error }),
|
|
117
|
+
React.createElement(Box, { flexDirection: "column", paddingTop: 1, marginLeft: 1 },
|
|
118
|
+
React.createElement(SpinnerOrErrorOrChildren, { label: "Request Id: ", labelPosition: "left", error: props.error, type: "arc" }, props.data?.scratchOrgInfo?.Id && (React.createElement(Text, { bold: true }, terminalLink(props.data?.scratchOrgInfo?.Id, `${props.baseUrl}/${props.data?.scratchOrgInfo?.Id}`)))),
|
|
119
|
+
React.createElement(SpinnerOrErrorOrChildren, { label: "OrgId: ", labelPosition: "left", error: props.error, type: "arc" }, props.data?.scratchOrgInfo?.ScratchOrg && (React.createElement(Text, { bold: true, color: "cyan" }, props.data?.scratchOrgInfo?.ScratchOrg))),
|
|
120
|
+
React.createElement(SpinnerOrErrorOrChildren, { label: "Username: ", labelPosition: "left", error: props.error, type: "arc" }, props.data?.scratchOrgInfo?.SignupUsername && (React.createElement(Text, { bold: true, color: "cyan" }, props.data?.scratchOrgInfo?.SignupUsername))))));
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=stages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stages.js","sourceRoot":"","sources":["../../src/components/stages.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA4B,yBAAyB,EAAW,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,GAAG,EAAE,IA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oBAAC,wBAAwB,IAAC,KAAK,EAAC,cAAc,EAAC,aAAa,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAC,KAAK,IAC/F,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,IAAI,CACjC,oBAAC,IAAI,IAAC,IAAI,UACP,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAC9F,CACR,CACwB;YAE3B,oBAAC,wBAAwB,IAAC,KAAK,EAAC,SAAS,EAAC,aAAa,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAC,KAAK,IAC1F,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,IAAI,CACzC,oBAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,IACpB,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAClC,CACR,CACwB;YAE3B,oBAAC,wBAAwB,IAAC,KAAK,EAAC,YAAY,EAAC,aAAa,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAC,KAAK,IAC7F,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,cAAc,IAAI,CAC7C,oBAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,IACpB,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,cAAc,CACtC,CACR,CACwB,CACvB,CACF,CACP,CAAC;AACJ,CAAC"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-org",
|
|
3
3
|
"description": "Commands to interact with Salesforce orgs",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.6-dev.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -12,15 +12,24 @@
|
|
|
12
12
|
"@salesforce/source-deploy-retrieve": "^12.0.1",
|
|
13
13
|
"ansis": "^3.2.0",
|
|
14
14
|
"change-case": "^5.4.4",
|
|
15
|
+
"cli-spinners": "^2",
|
|
16
|
+
"ink": "^5.0.1",
|
|
15
17
|
"is-wsl": "^3.1.0",
|
|
16
|
-
"open": "^10.1.0"
|
|
18
|
+
"open": "^10.1.0",
|
|
19
|
+
"react": "^18.3.1",
|
|
20
|
+
"terminal-link": "^3.0.0"
|
|
17
21
|
},
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"@oclif/plugin-command-snapshot": "^5.2.6",
|
|
20
24
|
"@salesforce/cli-plugins-testkit": "^5.3.15",
|
|
21
25
|
"@salesforce/dev-scripts": "^10.2.2",
|
|
22
|
-
"@salesforce/plugin-command-reference": "^3.1.
|
|
26
|
+
"@salesforce/plugin-command-reference": "^3.1.9",
|
|
23
27
|
"@salesforce/ts-sinon": "1.4.22",
|
|
28
|
+
"@types/react": "^18.3.3",
|
|
29
|
+
"eslint-config-xo": "^0.45.0",
|
|
30
|
+
"eslint-config-xo-react": "^0.27.0",
|
|
31
|
+
"eslint-plugin-react": "^7.34.3",
|
|
32
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
24
33
|
"eslint-plugin-sf-plugin": "^1.18.11",
|
|
25
34
|
"moment": "^2.30.1",
|
|
26
35
|
"oclif": "^4.13.9",
|
|
@@ -233,7 +242,7 @@
|
|
|
233
242
|
"exports": "./lib/index.js",
|
|
234
243
|
"type": "module",
|
|
235
244
|
"sfdx": {
|
|
236
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/4.3.
|
|
237
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/4.3.
|
|
245
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/4.3.6-dev.0.crt",
|
|
246
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/4.3.6-dev.0.sig"
|
|
238
247
|
}
|
|
239
248
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ScratchOrgLifecycleEvent } from '@salesforce/core';
|
|
2
|
-
export declare const buildStatus: (data: ScratchOrgLifecycleEvent, baseUrl: string) => string;
|
|
3
|
-
export declare const formatStage: (currentStage: ScratchOrgLifecycleEvent['stage']) => string;
|
|
4
|
-
export declare const formatRequest: (baseUrl: string, id?: string) => string;
|
|
5
|
-
export declare const formatUsername: (username?: string) => string;
|
|
6
|
-
export declare const formatOrgId: (id?: string) => string;
|
|
7
|
-
export declare const formatCurrentStage: (stage: string) => string;
|
|
8
|
-
export declare const formatCompletedStage: (stage: string) => string;
|
|
9
|
-
export declare const formatFutureStage: (stage: string) => string;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import { scratchOrgLifecycleStages } from '@salesforce/core';
|
|
8
|
-
import ansis from 'ansis';
|
|
9
|
-
import { capitalCase } from 'change-case';
|
|
10
|
-
import { StandardColors } from '@salesforce/sf-plugins-core';
|
|
11
|
-
const boldBlue = (input) => ansis.rgb(81, 176, 235).bold(input);
|
|
12
|
-
const boldPurple = (input) => ansis.rgb(157, 129, 221).bold(input);
|
|
13
|
-
export const buildStatus = (data, baseUrl) => `
|
|
14
|
-
RequestId: ${formatRequest(baseUrl, data.scratchOrgInfo?.Id)}
|
|
15
|
-
OrgId: ${formatOrgId(data.scratchOrgInfo?.ScratchOrg)}
|
|
16
|
-
Username: ${formatUsername(data.scratchOrgInfo?.SignupUsername)}
|
|
17
|
-
${formatStage(data.stage)}`;
|
|
18
|
-
export const formatStage = (currentStage) => scratchOrgLifecycleStages
|
|
19
|
-
.map((stage, stageIndex) => {
|
|
20
|
-
// current stage
|
|
21
|
-
if (currentStage === stage)
|
|
22
|
-
return formatCurrentStage(stage);
|
|
23
|
-
// completed stages
|
|
24
|
-
if (scratchOrgLifecycleStages.indexOf(currentStage) > stageIndex)
|
|
25
|
-
return formatCompletedStage(stage);
|
|
26
|
-
// future stage
|
|
27
|
-
return formatFutureStage(stage);
|
|
28
|
-
})
|
|
29
|
-
.join('\n');
|
|
30
|
-
export const formatRequest = (baseUrl, id) => `${id ? `${ansis.bold(id)} (${baseUrl}/${id})` : ''}`;
|
|
31
|
-
export const formatUsername = (username) => `${username ? `${boldBlue(username)} ` : ''}`;
|
|
32
|
-
export const formatOrgId = (id) => `${id ? `${boldBlue(id)} ` : ''}`;
|
|
33
|
-
export const formatCurrentStage = (stage) => boldPurple(capitalCase(stage));
|
|
34
|
-
export const formatCompletedStage = (stage) => StandardColors.success.bold(`✓ ${capitalCase(stage)}`);
|
|
35
|
-
export const formatFutureStage = (stage) => StandardColors.info(capitalCase(stage));
|
|
36
|
-
//# sourceMappingURL=scratchOrgOutput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratchOrgOutput.js","sourceRoot":"","sources":["../../src/shared/scratchOrgOutput.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA4B,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,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