@salesforce/plugin-org 5.2.42 → 5.4.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 +55 -27
- package/lib/commands/org/create/sandbox.js +9 -10
- package/lib/commands/org/create/sandbox.js.map +1 -1
- package/lib/commands/org/create/scratch.d.ts +1 -0
- package/lib/commands/org/create/scratch.js +10 -0
- package/lib/commands/org/create/scratch.js.map +1 -1
- package/lib/commands/org/refresh/sandbox.js +8 -5
- package/lib/commands/org/refresh/sandbox.js.map +1 -1
- package/lib/commands/org/resume/sandbox.js +9 -6
- package/lib/commands/org/resume/sandbox.js.map +1 -1
- package/lib/shared/sandboxCommandBase.d.ts +9 -9
- package/lib/shared/sandboxCommandBase.js +38 -58
- package/lib/shared/sandboxCommandBase.js.map +1 -1
- package/lib/shared/sandboxStages.d.ts +17 -0
- package/lib/shared/sandboxStages.js +64 -0
- package/lib/shared/sandboxStages.js.map +1 -0
- package/lib/shared/scratchOrgRequest.js +1 -0
- package/lib/shared/scratchOrgRequest.js.map +1 -1
- package/messages/create_scratch.md +27 -6
- package/messages/sandboxbase.md +2 -3
- package/oclif.manifest.json +578 -554
- package/package.json +3 -3
- package/lib/shared/sandboxProgress.d.ts +0 -33
- package/lib/shared/sandboxProgress.js +0 -98
- package/lib/shared/sandboxProgress.js.map +0 -1
- package/lib/shared/sandboxReporter.d.ts +0 -11
- package/lib/shared/sandboxReporter.js +0 -36
- package/lib/shared/sandboxReporter.js.map +0 -1
- package/lib/shared/stagedProgress.d.ts +0 -33
- package/lib/shared/stagedProgress.js +0 -98
- package/lib/shared/stagedProgress.js.map +0 -1
- package/lib/shared/timeUtils.d.ts +0 -10
- package/lib/shared/timeUtils.js +0 -31
- package/lib/shared/timeUtils.js.map +0 -1
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
import os from 'node:os';
|
|
8
8
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
9
9
|
import { AuthInfo, Lifecycle, Messages, SandboxEvents, SandboxRequestCache, } from '@salesforce/core';
|
|
10
|
-
import {
|
|
10
|
+
import { SandboxStages } from './sandboxStages.js';
|
|
11
11
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
12
|
const messages = Messages.loadMessages('@salesforce/plugin-org', 'sandboxbase');
|
|
13
13
|
export class SandboxCommandBase extends SfCommand {
|
|
14
|
-
|
|
14
|
+
stages;
|
|
15
15
|
latestSandboxProgressObj;
|
|
16
16
|
sandboxAuth;
|
|
17
17
|
prodOrg;
|
|
@@ -26,10 +26,9 @@ export class SandboxCommandBase extends SfCommand {
|
|
|
26
26
|
this.action =
|
|
27
27
|
this.constructor.name === 'RefreshSandbox'
|
|
28
28
|
? 'Refresh'
|
|
29
|
-
: this.constructor.name
|
|
29
|
+
: ['CreateSandbox', 'ResumeSandbox'].includes(this.constructor.name)
|
|
30
30
|
? 'Create'
|
|
31
31
|
: 'Create/Refresh';
|
|
32
|
-
this.sandboxProgress = new SandboxProgress({ action: this.action });
|
|
33
32
|
}
|
|
34
33
|
async getSandboxRequestConfig() {
|
|
35
34
|
if (!this.sandboxRequestConfig) {
|
|
@@ -60,59 +59,58 @@ export class SandboxCommandBase extends SfCommand {
|
|
|
60
59
|
// default for Dev/DevPro when prod org has feature enabled for sandboxes
|
|
61
60
|
return true;
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
registerLifecycleListenersAndMSO(lifecycle, options) {
|
|
63
|
+
this.stages = new SandboxStages({
|
|
64
|
+
refresh: options.mso.refresh ?? false,
|
|
65
|
+
jsonEnabled: this.jsonEnabled(),
|
|
66
|
+
title: options.isAsync ? `${options.mso.title} (async)` : options.mso.title,
|
|
67
|
+
});
|
|
68
|
+
this.stages.start();
|
|
64
69
|
lifecycle.on('POLLING_TIME_OUT', async () => {
|
|
65
70
|
this.pollingTimeOut = true;
|
|
71
|
+
this.stages.stop();
|
|
66
72
|
return Promise.resolve(this.updateSandboxRequestData());
|
|
67
73
|
});
|
|
68
74
|
lifecycle.on(SandboxEvents.EVENT_RESUME, async (results) => {
|
|
75
|
+
this.stages.start();
|
|
69
76
|
this.latestSandboxProgressObj = results;
|
|
70
|
-
this.
|
|
77
|
+
this.stages.update(this.latestSandboxProgressObj);
|
|
71
78
|
return Promise.resolve(this.updateSandboxRequestData());
|
|
72
79
|
});
|
|
73
80
|
lifecycle.on(SandboxEvents.EVENT_ASYNC_RESULT, async (results) => {
|
|
74
|
-
this
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (this.latestSandboxProgressObj) {
|
|
81
|
-
const progress = this.sandboxProgress.getSandboxProgress({
|
|
82
|
-
sandboxProcessObj: this.latestSandboxProgressObj,
|
|
83
|
-
sandboxRes: undefined,
|
|
84
|
-
});
|
|
85
|
-
const currentStage = progress.status;
|
|
86
|
-
this.sandboxProgress.markPreviousStagesAsCompleted(currentStage);
|
|
87
|
-
this.updateStage(currentStage, 'inProgress');
|
|
88
|
-
this.updateProgress({ sandboxProcessObj: this.latestSandboxProgressObj, sandboxRes: undefined }, options.isAsync);
|
|
81
|
+
// this event is fired by commands on poll timeout without any payload,
|
|
82
|
+
// we want to make sure to only update state if there's payload (event from sfdx-core).
|
|
83
|
+
if (results) {
|
|
84
|
+
this.latestSandboxProgressObj = results;
|
|
85
|
+
this.stages.update(this.latestSandboxProgressObj);
|
|
86
|
+
this.updateSandboxRequestData();
|
|
89
87
|
}
|
|
88
|
+
this.stages.stop('async');
|
|
90
89
|
if (this.pollingTimeOut) {
|
|
91
90
|
this.warn(messages.getMessage('warning.ClientTimeoutWaitingForSandboxProcess', [this.action.toLowerCase()]));
|
|
92
91
|
}
|
|
93
|
-
this.log(this.sandboxProgress.formatProgressStatus(false));
|
|
94
92
|
return Promise.resolve(this.info(messages.getMessage('checkSandboxStatus', this.getCheckSandboxStatusParams())));
|
|
95
93
|
});
|
|
96
94
|
lifecycle.on(SandboxEvents.EVENT_STATUS, async (results) => {
|
|
95
|
+
// this starts MSO for:
|
|
96
|
+
// * org create/create sandbox
|
|
97
|
+
this.stages.start();
|
|
97
98
|
this.latestSandboxProgressObj = results.sandboxProcessObj;
|
|
98
99
|
this.updateSandboxRequestData();
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.updateStage(currentStage, 'inProgress');
|
|
102
|
-
return Promise.resolve(this.updateProgress(results, options.isAsync));
|
|
100
|
+
this.stages.update(this.latestSandboxProgressObj);
|
|
101
|
+
return Promise.resolve();
|
|
103
102
|
});
|
|
104
103
|
lifecycle.on(SandboxEvents.EVENT_AUTH, async (results) => {
|
|
104
|
+
this.sandboxUsername = results.authUserName;
|
|
105
|
+
this.stages.auth();
|
|
105
106
|
this.sandboxAuth = results;
|
|
106
107
|
return Promise.resolve();
|
|
107
108
|
});
|
|
108
109
|
lifecycle.on(SandboxEvents.EVENT_RESULT, async (results) => {
|
|
109
110
|
this.latestSandboxProgressObj = results.sandboxProcessObj;
|
|
111
|
+
this.sandboxUsername = results.sandboxRes.authUserName;
|
|
110
112
|
this.updateSandboxRequestData();
|
|
111
|
-
this.
|
|
112
|
-
this.updateProgress(results, options.isAsync);
|
|
113
|
-
if (!options.isAsync) {
|
|
114
|
-
this.progress.stop();
|
|
115
|
-
}
|
|
113
|
+
this.stages.update(results.sandboxProcessObj);
|
|
116
114
|
if (results.sandboxRes?.authUserName) {
|
|
117
115
|
const authInfo = await AuthInfo.create({ username: results.sandboxRes?.authUserName });
|
|
118
116
|
await authInfo.handleAliasAndDefaultSettings({
|
|
@@ -122,8 +120,8 @@ export class SandboxCommandBase extends SfCommand {
|
|
|
122
120
|
setTracksSource: await this.calculateTrackingSetting(options.tracksSource),
|
|
123
121
|
});
|
|
124
122
|
}
|
|
123
|
+
this.stages.stop();
|
|
125
124
|
this.removeSandboxProgressConfig();
|
|
126
|
-
this.updateProgress(results, options.isAsync);
|
|
127
125
|
this.reportResults(results);
|
|
128
126
|
});
|
|
129
127
|
lifecycle.on(SandboxEvents.EVENT_MULTIPLE_SBX_PROCESSES, async (results) => {
|
|
@@ -142,35 +140,11 @@ export class SandboxCommandBase extends SfCommand {
|
|
|
142
140
|
});
|
|
143
141
|
}
|
|
144
142
|
reportResults(results) {
|
|
145
|
-
this.log();
|
|
146
|
-
this.styledHeader(`Sandbox Org ${this.action} Status`);
|
|
147
|
-
this.log(this.sandboxProgress.formatProgressStatus(false));
|
|
148
143
|
this.logSuccess([
|
|
149
|
-
messages.getMessage('sandboxSuccess'
|
|
150
|
-
messages.getMessages('sandboxSuccess.actions', [
|
|
151
|
-
results.sandboxRes?.authUserName,
|
|
152
|
-
this.config.bin,
|
|
153
|
-
results.sandboxRes?.authUserName,
|
|
154
|
-
]),
|
|
144
|
+
messages.getMessage('sandboxSuccess'),
|
|
145
|
+
messages.getMessages('sandboxSuccess.actions', [this.config.bin, results.sandboxRes?.authUserName]),
|
|
155
146
|
].join(os.EOL));
|
|
156
147
|
}
|
|
157
|
-
updateProgress(event, isAsync) {
|
|
158
|
-
const sandboxProgress = this.sandboxProgress.getSandboxProgress(event);
|
|
159
|
-
this.sandboxUsername = event.sandboxRes?.authUserName;
|
|
160
|
-
this.sandboxProgress.statusData = {
|
|
161
|
-
sandboxUsername: this.sandboxUsername,
|
|
162
|
-
sandboxProgress,
|
|
163
|
-
sandboxProcessObj: event.sandboxProcessObj,
|
|
164
|
-
};
|
|
165
|
-
if (!isAsync) {
|
|
166
|
-
this.spinner.status = this.sandboxProgress.formatProgressStatus();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
updateStage(stage, state) {
|
|
170
|
-
if (stage) {
|
|
171
|
-
this.sandboxProgress.transitionStages(stage, state);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
148
|
updateSandboxRequestData() {
|
|
175
149
|
if (this.sandboxRequestData && this.latestSandboxProgressObj) {
|
|
176
150
|
this.sandboxRequestData.sandboxProcessObject = this.latestSandboxProgressObj;
|
|
@@ -207,6 +181,12 @@ export class SandboxCommandBase extends SfCommand {
|
|
|
207
181
|
}
|
|
208
182
|
return { ...this.latestSandboxProgressObj, SandboxUsername: sbxUsername };
|
|
209
183
|
}
|
|
184
|
+
catch(error) {
|
|
185
|
+
if (this.stages) {
|
|
186
|
+
this.stages.stop('failed');
|
|
187
|
+
}
|
|
188
|
+
return super.catch(error);
|
|
189
|
+
}
|
|
210
190
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
211
191
|
async finally(_) {
|
|
212
192
|
const lifecycle = Lifecycle.getInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandboxCommandBase.js","sourceRoot":"","sources":["../../src/shared/sandboxCommandBase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"sandboxCommandBase.js","sourceRoot":"","sources":["../../src/shared/sandboxCommandBase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EAGR,aAAa,EAEb,mBAAmB,GAIpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC;AAMhF,MAAM,OAAgB,kBAAsB,SAAQ,SAAY;IACpD,MAAM,CAAiB;IACvB,wBAAwB,CAAwB;IAChD,WAAW,CAA2B;IACtC,OAAO,CAAO;IACd,cAAc,GAAG,KAAK,CAAC;IACjC,mCAAmC;IACzB,oBAAoB,CAAuB;IAC3C,kBAAkB,CAAuC;IACzD,MAAM,CAA0C;IAChD,eAAe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EAAE,CAAC;QAC1C,SAAS,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;QACjD,SAAS,CAAC,kBAAkB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QACzD,SAAS,CAAC,kBAAkB,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;QAC/D,SAAS,CAAC,kBAAkB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QACzD,SAAS,CAAC,kBAAkB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACvD,SAAS,CAAC,kBAAkB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QACzD,SAAS,CAAC,kBAAkB,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;QAEzE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAEO,2BAA2B;QACjC,IAAI,IAAI,CAAC,wBAAwB,EAAE,WAAW,EAAE,CAAC;YAC/C,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;YAC3E,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC;QACxC,CAAC;IACH,CAAC;CAGF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SandboxProcessObject } from '@salesforce/core';
|
|
2
|
+
import { StageStatus } from 'node_modules/@oclif/multi-stage-output/lib/stage-tracker.js';
|
|
3
|
+
type Options = {
|
|
4
|
+
title: string;
|
|
5
|
+
jsonEnabled: boolean;
|
|
6
|
+
refresh: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class SandboxStages {
|
|
9
|
+
private mso;
|
|
10
|
+
private refresh;
|
|
11
|
+
constructor({ title, jsonEnabled, refresh }: Options);
|
|
12
|
+
start(): void;
|
|
13
|
+
auth(): void;
|
|
14
|
+
update(data: SandboxProcessObject): void;
|
|
15
|
+
stop(finalStatus?: StageStatus): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, 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 { MultiStageOutput } from '@oclif/multi-stage-output';
|
|
8
|
+
export class SandboxStages {
|
|
9
|
+
mso;
|
|
10
|
+
refresh;
|
|
11
|
+
constructor({ title, jsonEnabled, refresh = false }) {
|
|
12
|
+
this.refresh = refresh;
|
|
13
|
+
this.mso = new MultiStageOutput({
|
|
14
|
+
stages: ['Creating new sandbox', 'Refreshing org', 'Authenticating'],
|
|
15
|
+
title,
|
|
16
|
+
jsonEnabled,
|
|
17
|
+
stageSpecificBlock: [
|
|
18
|
+
{
|
|
19
|
+
get: (data) => data?.SandboxName,
|
|
20
|
+
stage: 'Creating new sandbox',
|
|
21
|
+
label: 'Name',
|
|
22
|
+
type: 'dynamic-key-value',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
get: (data) => data?.Id,
|
|
26
|
+
stage: 'Creating new sandbox',
|
|
27
|
+
label: 'ID',
|
|
28
|
+
type: 'dynamic-key-value',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
postStagesBlock: [
|
|
32
|
+
{
|
|
33
|
+
label: 'Status',
|
|
34
|
+
get: (data) => data?.Status,
|
|
35
|
+
type: 'dynamic-key-value',
|
|
36
|
+
bold: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Copy progress',
|
|
40
|
+
get: (data) => `${data?.CopyProgress ?? 0}%`,
|
|
41
|
+
type: 'dynamic-key-value',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
start() {
|
|
47
|
+
if (this.refresh) {
|
|
48
|
+
this.mso.skipTo('Refreshing org');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.mso.goto('Creating new sandbox');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
auth() {
|
|
55
|
+
this.mso.goto('Authenticating');
|
|
56
|
+
}
|
|
57
|
+
update(data) {
|
|
58
|
+
this.mso.updateData(data);
|
|
59
|
+
}
|
|
60
|
+
stop(finalStatus) {
|
|
61
|
+
this.mso.stop(finalStatus);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=sandboxStages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandboxStages.js","sourceRoot":"","sources":["../../src/shared/sandboxStages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAU7D,MAAM,OAAO,aAAa;IAChB,GAAG,CAAyC;IAC5C,OAAO,CAAU;IAEzB,YAAmB,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,KAAK,EAAW;QACjE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,IAAI,gBAAgB,CAAuB;YACpD,MAAM,EAAE,CAAC,sBAAsB,EAAE,gBAAgB,EAAE,gBAAgB,CAAC;YACpE,KAAK;YACL,WAAW;YACX,kBAAkB,EAAE;gBAClB;oBACE,GAAG,EAAE,CAAC,IAAI,EAAsB,EAAE,CAAC,IAAI,EAAE,WAAW;oBACpD,KAAK,EAAE,sBAAsB;oBAC7B,KAAK,EAAE,MAAM;oBACb,IAAI,EAAE,mBAAmB;iBAC1B;gBACD;oBACE,GAAG,EAAE,CAAC,IAAI,EAAsB,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC3C,KAAK,EAAE,sBAAsB;oBAC7B,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,mBAAmB;iBAC1B;aACF;YACD,eAAe,EAAE;gBACf;oBACE,KAAK,EAAE,QAAQ;oBACf,GAAG,EAAE,CAAC,IAAI,EAAsB,EAAE,CAAC,IAAI,EAAE,MAAM;oBAC/C,IAAI,EAAE,mBAAmB;oBACzB,IAAI,EAAE,IAAI;iBACX;gBACD;oBACE,KAAK,EAAE,eAAe;oBACtB,GAAG,EAAE,CAAC,IAAI,EAAsB,EAAE,CAAC,GAAG,IAAI,EAAE,YAAY,IAAI,CAAC,GAAG;oBAChE,IAAI,EAAE,mBAAmB;iBAC1B;aACF;SACF,CAAC,CAAC;IACL,CAAC;IAEM,KAAK;QACV,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAEM,IAAI;QACT,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAClC,CAAC;IAEM,MAAM,CAAC,IAA0B;QACtC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEM,IAAI,CAAC,WAAyB;QACnC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -16,6 +16,7 @@ export const buildScratchOrgRequest = async (flags, clientSecret) => {
|
|
|
16
16
|
? JSON.parse(await fs.promises.readFile(flags['definition-file'], 'utf-8'))
|
|
17
17
|
: {}),
|
|
18
18
|
...(flags.edition ? { edition: flags.edition } : {}),
|
|
19
|
+
...(flags.snapshot ? { snapshot: flags.snapshot } : {}),
|
|
19
20
|
...(flags.username ? { username: flags.username } : {}),
|
|
20
21
|
...(flags.description ? { description: flags.description } : {}),
|
|
21
22
|
...(flags.name ? { orgName: flags.name } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scratchOrgRequest.js","sourceRoot":"","sources":["../../src/shared/scratchOrgRequest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"scratchOrgRequest.js","sourceRoot":"","sources":["../../src/shared/scratchOrgRequest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C;;;GAGG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,KAA8D,EAC9D,YAAqB,EACa,EAAE;IACpC,MAAM,SAAS,GAAG;QAChB,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC;YAC1B,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAA6B;YACxG,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,GAAG,CAAC,KAAK,CAA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-
There are
|
|
7
|
+
There are four ways to create a scratch org:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
* Specify a definition file that contains the scratch org options.
|
|
10
|
+
* Use the --edition flag to specify the one required option; this method doesn't require a defintion file.
|
|
11
|
+
* Use the --snapshot flag to create a scratch org from a snapshot. Snapshots are a point-in-time copy of a scratch org; you create a snapshot with the "sf org create snapshot" command.
|
|
12
|
+
* Use the --source-org flag to create a scratch org from an org shape. Org shapes mimic the baseline setup of a source org without the extraneous data and metadata; you create an org shape with the "sf org create shape" command.
|
|
13
|
+
|
|
14
|
+
The --edition, --snapshot, and --source-org flags are mutually exclusive, which means if you specify one, you can't also specify the others.
|
|
15
|
+
|
|
16
|
+
For any of the methods, you can also use these flags; if you use them with --definition-file, they override their equivalent option in the scratch org definition file:
|
|
10
17
|
|
|
11
18
|
* --description
|
|
12
19
|
* --name (equivalent to the "orgName" option)
|
|
13
20
|
* --username
|
|
14
21
|
* --release
|
|
15
|
-
* --edition
|
|
16
22
|
* --admin-email (equivalent to the "adminEmail" option)
|
|
17
|
-
* --source-org (equivalent to the "sourceOrg" option)
|
|
18
23
|
|
|
19
|
-
If you want to set options
|
|
24
|
+
If you want to set options such as org features or settings, you must use a definition file.
|
|
20
25
|
|
|
21
26
|
You must specify a Dev Hub to create a scratch org, either with the --target-dev-hub flag or by setting your default Dev Hub with the target-dev-hub configuration variable.
|
|
22
27
|
|
|
@@ -34,6 +39,10 @@ You must specify a Dev Hub to create a scratch org, either with the --target-dev
|
|
|
34
39
|
|
|
35
40
|
<%= config.bin %> <%= command.id %> --edition enterprise --alias my-scratch-org --target-dev-hub MyHub --release preview
|
|
36
41
|
|
|
42
|
+
- Create a scratch org from a snapshot called "NightlyBranch"; be sure you specify the same Dev Hub org associated with the snapshot. We recommend you increase the --wait time because creating a scratch org from a snapshot can take a while:
|
|
43
|
+
|
|
44
|
+
<%= config.bin %> <%= command.id %> --alias my-scratch-org --target-dev-hub MyHub --snapshot NightlyBranch --wait 10
|
|
45
|
+
|
|
37
46
|
# flags.target-dev-hub.summary
|
|
38
47
|
|
|
39
48
|
Username or alias of the Dev Hub org.
|
|
@@ -62,6 +71,14 @@ Don't include second-generation managed package (2GP) ancestors in the scratch o
|
|
|
62
71
|
|
|
63
72
|
Salesforce edition of the scratch org. Overrides the value of the "edition" option in the definition file, if set.
|
|
64
73
|
|
|
74
|
+
# flags.snapshot.summary
|
|
75
|
+
|
|
76
|
+
Name of the snapshot to use when creating this scratch org. Overrides the value of the "snapshot" option in the defintion file, if set.
|
|
77
|
+
|
|
78
|
+
# flags.snapshot.description
|
|
79
|
+
|
|
80
|
+
To view the names of the available snapshots for a given Dev Hub org, run the "sf org list snapshot" command.
|
|
81
|
+
|
|
65
82
|
# flags.async.summary
|
|
66
83
|
|
|
67
84
|
Request the org, but don't wait for it to complete.
|
|
@@ -92,7 +109,11 @@ Email address that will be applied to the org's admin user. Overrides the value
|
|
|
92
109
|
|
|
93
110
|
# flags.source-org.summary
|
|
94
111
|
|
|
95
|
-
15-character ID of the org
|
|
112
|
+
15-character ID of the org shape that the new scratch org is based on. Overrides the value of the "sourceOrg" option in the definition file, if set.
|
|
113
|
+
|
|
114
|
+
# flags.source-org.description
|
|
115
|
+
|
|
116
|
+
To view the names of the available org shapes for a given Dev Hub org, run the "sf org list shape" command.
|
|
96
117
|
|
|
97
118
|
# flags.wait.summary
|
|
98
119
|
|
package/messages/sandboxbase.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# sandboxSuccess
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Your sandbox is ready.
|
|
4
4
|
|
|
5
5
|
# sandboxSuccess.actions
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
You can open the org by running "%s org open -o %s"
|
|
7
|
+
You can open it by running "%s org open -o %s"
|
|
9
8
|
|
|
10
9
|
# checkSandboxStatus
|
|
11
10
|
|