@simplysf/simply-cicd-core 0.5.0 → 0.9.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 +10 -10
- package/lib/build/createPackageVersion.js +20 -44
- package/lib/build/createPackageVersion.js.map +1 -1
- package/lib/build/createScratchOrg.d.ts +2 -1
- package/lib/build/createScratchOrg.js +25 -41
- package/lib/build/createScratchOrg.js.map +1 -1
- package/lib/build/deleteScratchOrg.js +3 -2
- package/lib/build/deleteScratchOrg.js.map +1 -1
- package/lib/build/pushScratch.js +40 -19
- package/lib/build/pushScratch.js.map +1 -1
- package/lib/deploy/deployProject.js +15 -14
- package/lib/deploy/deployProject.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/sfApex.js +39 -34
- package/lib/sfApex.js.map +1 -1
- package/lib/sfAuth.d.ts +8 -1
- package/lib/sfAuth.js +65 -46
- package/lib/sfAuth.js.map +1 -1
- package/lib/sfDeploy.d.ts +34 -0
- package/lib/sfDeploy.js +77 -0
- package/lib/sfDeploy.js.map +1 -0
- package/lib/sfOrg.d.ts +36 -0
- package/lib/sfOrg.js +62 -1
- package/lib/sfOrg.js.map +1 -1
- package/lib/sfPackages.d.ts +27 -1
- package/lib/sfPackages.js +45 -1
- package/lib/sfPackages.js.map +1 -1
- package/package.json +6 -3
package/lib/sfApex.js
CHANGED
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { promises as fs } from 'node:fs';
|
|
17
17
|
import path from 'node:path';
|
|
18
|
-
import {
|
|
18
|
+
import { Duration } from '@salesforce/kit';
|
|
19
|
+
import { runApexTestsWithResults } from '@simplysf/simply-apex-core';
|
|
19
20
|
import { readSfdxProject } from '@simplysf/simply-core';
|
|
20
|
-
import { runSf } from './exec/sfCli.js';
|
|
21
21
|
import { logger } from './logger.js';
|
|
22
|
+
import { getOrgConnection } from './sfOrg.js';
|
|
22
23
|
/**
|
|
23
24
|
* Checks if there are any Apex test classes defined in the package directories, by reading
|
|
24
25
|
* `sfdx-project.json` to identify the package directories and searching each recursively
|
|
@@ -38,24 +39,40 @@ export async function hasApexTests(options) {
|
|
|
38
39
|
for (const dir of packageDirs) {
|
|
39
40
|
try {
|
|
40
41
|
// eslint-disable-next-line no-await-in-loop -- stops at the first directory with a match
|
|
41
|
-
await
|
|
42
|
-
|
|
42
|
+
if (await directoryHasApexTests(dir)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
if (options?.debugMode) {
|
|
46
|
+
logger.log(`No Apex tests found in ${dir}.`);
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
49
|
catch (error) {
|
|
45
50
|
if (options?.debugMode) {
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
logger.log(`No Apex tests found in ${dir} or an error occurred during search.`, error.message);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
/** What `grep -q -r -i --include=*.cls '@isTest\b' <dir>` checked, without depending on grep. */
|
|
58
|
+
async function directoryHasApexTests(dir) {
|
|
59
|
+
const entries = await fs.readdir(dir, { recursive: true, withFileTypes: true });
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
if (entry.isFile() && entry.name.endsWith('.cls')) {
|
|
62
|
+
// eslint-disable-next-line no-await-in-loop -- stops at the first match
|
|
63
|
+
const source = await fs.readFile(path.join(entry.parentPath, entry.name), 'utf-8');
|
|
64
|
+
if (/@isTest\b/i.test(source)) {
|
|
65
|
+
return true;
|
|
48
66
|
}
|
|
49
67
|
}
|
|
50
68
|
}
|
|
51
69
|
return false;
|
|
52
70
|
}
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
|
|
56
|
-
async function executeTestRun(args) {
|
|
71
|
+
/** Runs the tests, swallowing any failure so the run's artifacts (namely the test run ID file) can
|
|
72
|
+
* still be inspected afterward to distinguish an execution failure from a genuine test failure. */
|
|
73
|
+
async function executeTestRun(alias, options) {
|
|
57
74
|
try {
|
|
58
|
-
await
|
|
75
|
+
await runApexTestsWithResults({ ...options, connection: await getOrgConnection(alias) });
|
|
59
76
|
return undefined;
|
|
60
77
|
}
|
|
61
78
|
catch (e) {
|
|
@@ -70,7 +87,7 @@ async function resolveTestRunId(testRunIdFile, execError) {
|
|
|
70
87
|
}
|
|
71
88
|
catch (readIdError) {
|
|
72
89
|
if (execError) {
|
|
73
|
-
logger.error('Apex test run failed.', execError.
|
|
90
|
+
logger.error('Apex test run failed.', execError.message);
|
|
74
91
|
throw execError;
|
|
75
92
|
}
|
|
76
93
|
logger.error(`Failed to read test run ID from ${testRunIdFile}.`, readIdError.message);
|
|
@@ -134,28 +151,16 @@ export async function runApexTests(options) {
|
|
|
134
151
|
logger.info('Running Apex tests...');
|
|
135
152
|
const testResultsDir = './test-results/apex';
|
|
136
153
|
await fs.mkdir(testResultsDir, { recursive: true });
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
wait,
|
|
148
|
-
];
|
|
149
|
-
if (alias) {
|
|
150
|
-
args.push('--target-org', alias);
|
|
151
|
-
}
|
|
152
|
-
if (testSuite) {
|
|
153
|
-
args.push('--suite-names', testSuite);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
args.push('--test-level', testLevel);
|
|
157
|
-
}
|
|
158
|
-
const execError = await executeTestRun(args);
|
|
154
|
+
// What `sf apex test run --code-coverage --result-format junit --output-dir <dir> --wait <wait>
|
|
155
|
+
// [--suite-names <suite> | --test-level <level>]` ran and wrote.
|
|
156
|
+
const execError = await executeTestRun(alias, {
|
|
157
|
+
codeCoverage: true,
|
|
158
|
+
outputDir: testResultsDir,
|
|
159
|
+
wait: Duration.minutes(Number(wait)),
|
|
160
|
+
...(testSuite
|
|
161
|
+
? { suiteNames: [testSuite] }
|
|
162
|
+
: { testLevel: testLevel }),
|
|
163
|
+
});
|
|
159
164
|
const testRunId = await resolveTestRunId(path.join(testResultsDir, 'test-run-id.txt'), execError);
|
|
160
165
|
let testRunOutcome;
|
|
161
166
|
if (testRunId) {
|
package/lib/sfApex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sfApex.js","sourceRoot":"","sources":["../src/sfApex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sfApex.js","sourceRoot":"","sources":["../src/sfApex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAuC,MAAM,4BAA4B,CAAC;AAC1G,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAmB9C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAA6B;IAC9D,IAAI,WAAW,GAAG,CAAC,WAAW,CAAC,CAAC;IAChC,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,MAAM,eAAe,EAAE,CAAC;QAChD,WAAW,GAAG,eAAe,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CA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,SAAS,EAAE,cAAc;QACzB,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,GAAG,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,SAAS,CAAC,EAAE;YAC7B,CAAC,CAAC,EAAE,SAAS,EAAE,SAAwD,EAAE,CAAC;KAC7E,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,iBAAiB,CAAC,EAAE,SAAS,CAAC,CAAC;IAElG,IAAI,cAAkC,CAAC;IACvC,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,SAAS,OAAO,CAAC,CAAC;QAClF,cAAc,GAAG,MAAM,kBAAkB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC;IAED,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
package/lib/sfAuth.d.ts
CHANGED
|
@@ -12,8 +12,15 @@ export type AuthenticateOrgOptions = {
|
|
|
12
12
|
export type AuthenticateOrgResult = {
|
|
13
13
|
success: boolean;
|
|
14
14
|
username?: string;
|
|
15
|
+
/** The saved auth fields, as `sf org login … --json` returned them (tokens decrypted). */
|
|
15
16
|
result?: unknown;
|
|
16
17
|
message?: string;
|
|
17
18
|
};
|
|
18
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Authenticates to a Salesforce org using either a JWT flow or an SFDX auth URL, in-process via
|
|
21
|
+
* `@salesforce/core`. The auth, alias and default-org settings are written to the same `~/.sf`
|
|
22
|
+
* state `sf org login jwt` / `sf org login sfdx-url` write, so later `sf` processes see them.
|
|
23
|
+
*
|
|
24
|
+
* @throws If authentication fails; the failure is logged first.
|
|
25
|
+
*/
|
|
19
26
|
export declare function authenticateOrg(options: AuthenticateOrgOptions): Promise<AuthenticateOrgResult>;
|
package/lib/sfAuth.js
CHANGED
|
@@ -13,61 +13,80 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import { tmpdir } from 'node:os';
|
|
18
|
-
import { join } from 'node:path';
|
|
19
|
-
import { runSf } from './exec/sfCli.js';
|
|
16
|
+
import { AuthInfo, AuthRemover, SfdcUrl, SfError, SfProject } from '@salesforce/core';
|
|
20
17
|
import { logger } from './logger.js';
|
|
21
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Where a JWT login goes: the given instance URL, else the project's `sfdcLoginUrl`, else
|
|
20
|
+
* production — the same resolution `sf org login jwt` applies, including its refusal of a
|
|
21
|
+
* Lightning domain (`*.lightning.force.com`), which can't serve OAuth.
|
|
22
|
+
*/
|
|
23
|
+
async function resolveLoginUrl(instanceUrl) {
|
|
24
|
+
let loginUrl = instanceUrl;
|
|
25
|
+
if (!loginUrl) {
|
|
26
|
+
try {
|
|
27
|
+
const projectJson = await (await SfProject.resolve()).resolveProjectConfig();
|
|
28
|
+
loginUrl = typeof projectJson.sfdcLoginUrl === 'string' ? projectJson.sfdcLoginUrl : SfdcUrl.PRODUCTION;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
loginUrl = SfdcUrl.PRODUCTION;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const url = new SfdcUrl(loginUrl);
|
|
35
|
+
if (url.isLightningDomain() || (url.isInternalUrl() && url.origin.includes('.lightning.'))) {
|
|
36
|
+
throw new SfError('Use the "My Domain" URL (.my.salesforce.com) as the instance URL, not the Lightning domain (.lightning.force.com).', 'LightningDomain');
|
|
37
|
+
}
|
|
38
|
+
return loginUrl;
|
|
39
|
+
}
|
|
40
|
+
/** JWT bearer login, as `sf org login jwt`: an existing auth file for the user is replaced. */
|
|
41
|
+
async function loginWithJwt(username, oauth2Options) {
|
|
42
|
+
try {
|
|
43
|
+
return await AuthInfo.create({ username, oauth2Options });
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (error.name !== 'AuthInfoOverwriteError') {
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
await (await AuthRemover.create()).removeAuth(username);
|
|
50
|
+
return AuthInfo.create({ username, oauth2Options });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Authenticates to a Salesforce org using either a JWT flow or an SFDX auth URL, in-process via
|
|
55
|
+
* `@salesforce/core`. The auth, alias and default-org settings are written to the same `~/.sf`
|
|
56
|
+
* state `sf org login jwt` / `sf org login sfdx-url` write, so later `sf` processes see them.
|
|
57
|
+
*
|
|
58
|
+
* @throws If authentication fails; the failure is logged first.
|
|
59
|
+
*/
|
|
22
60
|
export async function authenticateOrg(options) {
|
|
23
61
|
const { alias, authUrl, clientId, instanceUrl, jwtKeyFile, username, setDefault, setDefaultDevHub, debug } = options;
|
|
24
62
|
const authEntity = alias ?? username ?? 'unknown org';
|
|
25
63
|
logger.info(`Authenticating to org: ${authEntity}`);
|
|
26
64
|
try {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
jwtKeyFile ?? '',
|
|
43
|
-
'--client-id',
|
|
44
|
-
clientId ?? '',
|
|
45
|
-
'--instance-url',
|
|
46
|
-
instanceUrl ?? '',
|
|
47
|
-
'--json',
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
if (alias) {
|
|
51
|
-
authArgs.push('--alias', alias);
|
|
52
|
-
}
|
|
53
|
-
if (setDefault) {
|
|
54
|
-
authArgs.push('--set-default');
|
|
55
|
-
}
|
|
56
|
-
if (setDefaultDevHub) {
|
|
57
|
-
authArgs.push('--set-default-dev-hub');
|
|
58
|
-
}
|
|
59
|
-
const { stdout } = await runSf(authArgs);
|
|
65
|
+
const authInfo = authUrl
|
|
66
|
+
? await AuthInfo.create({ oauth2Options: AuthInfo.parseSfdxAuthUrl(authUrl) })
|
|
67
|
+
: await loginWithJwt(username ?? '', {
|
|
68
|
+
clientId,
|
|
69
|
+
privateKeyFile: jwtKeyFile,
|
|
70
|
+
loginUrl: await resolveLoginUrl(instanceUrl),
|
|
71
|
+
});
|
|
72
|
+
await authInfo.save();
|
|
73
|
+
await authInfo.handleAliasAndDefaultSettings({
|
|
74
|
+
alias,
|
|
75
|
+
setDefault: setDefault ?? false,
|
|
76
|
+
setDefaultDevHub: setDefaultDevHub ?? false,
|
|
77
|
+
});
|
|
78
|
+
const fields = authUrl ? { clientSecret: '', ...authInfo.getFields(true) } : authInfo.getFields(true);
|
|
79
|
+
await AuthInfo.identifyPossibleScratchOrgs(fields, authInfo);
|
|
60
80
|
if (debug) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return { success: false, message: authResult.message, username };
|
|
81
|
+
// Only identifying fields: the CLI's --json output this used to print included live tokens.
|
|
82
|
+
logger.debug('Authenticated:', {
|
|
83
|
+
username: fields.username,
|
|
84
|
+
orgId: fields.orgId,
|
|
85
|
+
instanceUrl: fields.instanceUrl,
|
|
86
|
+
});
|
|
68
87
|
}
|
|
69
88
|
logger.success(`Successfully authenticated to org: ${authEntity}`);
|
|
70
|
-
return { success: true, username, result:
|
|
89
|
+
return { success: true, username: fields.username ?? username, result: fields };
|
|
71
90
|
}
|
|
72
91
|
catch (error) {
|
|
73
92
|
logger.error(`Authentication failed for ${authEntity}`);
|
package/lib/sfAuth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sfAuth.js","sourceRoot":"","sources":["../src/sfAuth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AAK;YAC/B,gBAAgB,EAAE,gBAAgB,IAAI,KAAK;SAC5C,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACtG,MAAM,QAAQ,CAAC,2BAA2B,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAE7D,IAAI,KAAK,EAAE,CAAC;YACV,4FAA4F;YAC5F,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE;gBAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC;QACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAClF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,6BAA6B,UAAU,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5B,MAAM,KAAK,CAAC,CAAC,kDAAkD;IACjE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Duration } from '@salesforce/kit';
|
|
2
|
+
import { RequestStatus } from '@salesforce/source-deploy-retrieve';
|
|
3
|
+
export type DeployProjectSourceOptions = {
|
|
4
|
+
/** The org to deploy to. Omit to use the default target org. */
|
|
5
|
+
aliasOrUsername?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Deploy these directories instead of the tracked local changes (`--source-dir`). Source tracking
|
|
8
|
+
* still records what was deployed.
|
|
9
|
+
*/
|
|
10
|
+
sourceDirs?: string[];
|
|
11
|
+
/** `--ignore-warnings`: don't fail the deploy on warnings. */
|
|
12
|
+
ignoreWarnings?: boolean;
|
|
13
|
+
/** How long to wait for the deploy to finish. */
|
|
14
|
+
wait: Duration;
|
|
15
|
+
};
|
|
16
|
+
export type DeployProjectSourceResult = {
|
|
17
|
+
/** `undefined` when there were no local changes to deploy. */
|
|
18
|
+
deployId?: string;
|
|
19
|
+
status: RequestStatus | 'NothingToDeploy';
|
|
20
|
+
componentCount: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Deploys project source to an org with source tracking, as
|
|
24
|
+
* `sf project deploy start --ignore-conflicts [--source-dir …] [--ignore-warnings] --wait <wait>` does:
|
|
25
|
+
* without `sourceDirs`, it deploys the tracked local changes (deletes included), and nothing to
|
|
26
|
+
* deploy is not an error; with `sourceDirs`, it deploys those, and an empty set is.
|
|
27
|
+
*
|
|
28
|
+
* Remote conflicts are ignored and tracking is updated after the deploy, as `--ignore-conflicts`
|
|
29
|
+
* does. Anything short of a full success (partial success, failure, cancellation, or still running
|
|
30
|
+
* at `wait`) throws, as the CLI exits non-zero for each of them.
|
|
31
|
+
*
|
|
32
|
+
* @throws {SfError} `NothingToDeploy` for empty `sourceDirs`; `DeployFailed` for any non-success.
|
|
33
|
+
*/
|
|
34
|
+
export declare function deployProjectSource(options: DeployProjectSourceOptions): Promise<DeployProjectSourceResult>;
|
package/lib/sfDeploy.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Org, SfError, SfProject } from '@salesforce/core';
|
|
17
|
+
import { ComponentSet, ComponentSetBuilder, ComponentStatus, RequestStatus } from '@salesforce/source-deploy-retrieve';
|
|
18
|
+
import { SourceTracking } from '@salesforce/source-tracking';
|
|
19
|
+
import { logger } from './logger.js';
|
|
20
|
+
/**
|
|
21
|
+
* Deploys project source to an org with source tracking, as
|
|
22
|
+
* `sf project deploy start --ignore-conflicts [--source-dir …] [--ignore-warnings] --wait <wait>` does:
|
|
23
|
+
* without `sourceDirs`, it deploys the tracked local changes (deletes included), and nothing to
|
|
24
|
+
* deploy is not an error; with `sourceDirs`, it deploys those, and an empty set is.
|
|
25
|
+
*
|
|
26
|
+
* Remote conflicts are ignored and tracking is updated after the deploy, as `--ignore-conflicts`
|
|
27
|
+
* does. Anything short of a full success (partial success, failure, cancellation, or still running
|
|
28
|
+
* at `wait`) throws, as the CLI exits non-zero for each of them.
|
|
29
|
+
*
|
|
30
|
+
* @throws {SfError} `NothingToDeploy` for empty `sourceDirs`; `DeployFailed` for any non-success.
|
|
31
|
+
*/
|
|
32
|
+
export async function deployProjectSource(options) {
|
|
33
|
+
const { aliasOrUsername, sourceDirs, ignoreWarnings = false, wait } = options;
|
|
34
|
+
const org = await Org.create({ aliasOrUsername });
|
|
35
|
+
const project = await SfProject.resolve();
|
|
36
|
+
const tracking = await SourceTracking.create({ org, project, subscribeSDREvents: true, ignoreConflicts: true });
|
|
37
|
+
const componentSet = sourceDirs?.length
|
|
38
|
+
? await ComponentSetBuilder.build({
|
|
39
|
+
sourcepath: sourceDirs,
|
|
40
|
+
sourceapiversion: project.getSfProjectJson().getContents().sourceApiVersion,
|
|
41
|
+
projectDir: tracking.projectPath,
|
|
42
|
+
})
|
|
43
|
+
: ((await tracking.localChangesAsComponentSet(false))[0] ?? new ComponentSet(undefined, tracking.registry));
|
|
44
|
+
if (componentSet.size === 0) {
|
|
45
|
+
if (sourceDirs?.length) {
|
|
46
|
+
throw new SfError(`No local changes to deploy in ${sourceDirs.join(', ')}.`, 'NothingToDeploy');
|
|
47
|
+
}
|
|
48
|
+
logger.info('No local changes to deploy.');
|
|
49
|
+
return { status: 'NothingToDeploy', componentCount: 0 };
|
|
50
|
+
}
|
|
51
|
+
logger.info(`Deploying ${componentSet.size} components...`);
|
|
52
|
+
const deploy = await componentSet.deploy({
|
|
53
|
+
usernameOrConnection: org.getConnection(),
|
|
54
|
+
apiOptions: { checkOnly: false, ignoreWarnings, rest: false, rollbackOnError: true, purgeOnDelete: false },
|
|
55
|
+
});
|
|
56
|
+
let lastProgress = '';
|
|
57
|
+
deploy.onUpdate((response) => {
|
|
58
|
+
const progress = `Deploy ${response.id}: ${response.status} (${response.numberComponentsDeployed}/${response.numberComponentsTotal} components, ${response.numberTestsCompleted}/${response.numberTestsTotal} tests)`;
|
|
59
|
+
if (progress !== lastProgress) {
|
|
60
|
+
lastProgress = progress;
|
|
61
|
+
logger.info(progress);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const result = await deploy.pollStatus({ timeout: wait });
|
|
65
|
+
const { status } = result.response;
|
|
66
|
+
if (status !== RequestStatus.Succeeded) {
|
|
67
|
+
const failures = result.getFileResponses().filter((file) => file.state === ComponentStatus.Failed);
|
|
68
|
+
for (const failure of failures) {
|
|
69
|
+
const reason = 'error' in failure ? failure.error : '';
|
|
70
|
+
logger.error(`${failure.type} ${failure.fullName}: ${reason}`);
|
|
71
|
+
}
|
|
72
|
+
const errorMessage = result.response.errorMessage ? ` ${result.response.errorMessage}` : '';
|
|
73
|
+
throw new SfError(`Deploy ${deploy.id ?? ''} finished with status ${status} (${failures.length} component failures).${errorMessage}`, 'DeployFailed');
|
|
74
|
+
}
|
|
75
|
+
return { deployId: deploy.id, status, componentCount: componentSet.size };
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=sfDeploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sfDeploy.js","sourceRoot":"","sources":["../src/sfDeploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACvH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAuBrC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAmC;IAC3E,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAC9E,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,OAAO,EAAE,CAAC;IAC1C,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhH,MAAM,YAAY,GAAG,UAAU,EAAE,MAAM;QACrC,CAAC,CAAC,MAAM,mBAAmB,CAAC,KAAK,CAAC;YAC9B,UAAU,EAAE,UAAU;YACtB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,WAAW,EAAE,CAAC,gBAAgB;YAC3E,UAAU,EAAE,QAAQ,CAAC,WAAW;SACjC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SetNames: string[], alias
|
|
|
48
48
|
* @throws {AssignmentError} If any assignment failed; the others are still attempted.
|
|
49
49
|
*/
|
|
50
50
|
export declare function assignPermissionSetLicenses(licenseNames: string[], aliasOrUsername?: string): Promise<void>;
|
|
51
|
+
/** What `sf org create scratch --json` returns: the fields `SCRATCH_ORG_INFO.json` is written from. */
|
|
52
|
+
export type CreatedScratchOrg = {
|
|
53
|
+
username?: string;
|
|
54
|
+
scratchOrgInfo?: Record<string, unknown>;
|
|
55
|
+
authFields?: Record<string, unknown>;
|
|
56
|
+
warnings: string[];
|
|
57
|
+
orgId?: string;
|
|
58
|
+
};
|
|
59
|
+
export type CreateScratchOrgOnHubOptions = {
|
|
60
|
+
/** Path to the scratch org definition file. */
|
|
61
|
+
definitionFile: string;
|
|
62
|
+
durationDays: number;
|
|
63
|
+
/** Minutes to wait for the org to be ready. */
|
|
64
|
+
waitMinutes: number;
|
|
65
|
+
/** Make the new org the default target org (`--set-default`). */
|
|
66
|
+
setDefault?: boolean;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Creates a scratch org from a Dev Hub, as `sf org create scratch --definition-file … --json` does,
|
|
70
|
+
* and returns the same result shape. The org is authenticated and source tracking is enabled, as
|
|
71
|
+
* the CLI's defaults.
|
|
72
|
+
*
|
|
73
|
+
* @param hubAliasOrUsername - The Dev Hub. Must already be authenticated.
|
|
74
|
+
* @throws {SfError} If signup fails or doesn't finish within the wait.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createScratchOrgOnHub(hubAliasOrUsername: string, options: CreateScratchOrgOnHubOptions): Promise<CreatedScratchOrg>;
|
|
77
|
+
/**
|
|
78
|
+
* Deletes a scratch org, as `sf org delete scratch --no-prompt` does: refuses a non-scratch org,
|
|
79
|
+
* treats an already-deleted org as success, and removes the local auth for one whose domain no
|
|
80
|
+
* longer resolves.
|
|
81
|
+
*
|
|
82
|
+
* @param aliasOrUsername - The scratch org. Omit to use the default target org.
|
|
83
|
+
* @returns The deleted org's username.
|
|
84
|
+
* @throws {SfError} If the org isn't a scratch org, or the Dev Hub rejects the delete.
|
|
85
|
+
*/
|
|
86
|
+
export declare function deleteTargetScratchOrg(aliasOrUsername?: string): Promise<string>;
|
package/lib/sfOrg.js
CHANGED
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { promises as fs } from 'node:fs';
|
|
17
|
+
import { AuthInfo, AuthRemover, Org, scratchOrgCreate, SfError, User } from '@salesforce/core';
|
|
18
|
+
import { Duration } from '@salesforce/kit';
|
|
17
19
|
import { escapeSoqlLiteral } from '@simplysf/simply-core';
|
|
18
20
|
import { logger } from './logger.js';
|
|
19
21
|
/**
|
|
@@ -134,4 +136,63 @@ export async function assignPermissionSetLicenses(licenseNames, aliasOrUsername)
|
|
|
134
136
|
throw new AssignmentError('Permission set license assignment failed', failures);
|
|
135
137
|
}
|
|
136
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Creates a scratch org from a Dev Hub, as `sf org create scratch --definition-file … --json` does,
|
|
141
|
+
* and returns the same result shape. The org is authenticated and source tracking is enabled, as
|
|
142
|
+
* the CLI's defaults.
|
|
143
|
+
*
|
|
144
|
+
* @param hubAliasOrUsername - The Dev Hub. Must already be authenticated.
|
|
145
|
+
* @throws {SfError} If signup fails or doesn't finish within the wait.
|
|
146
|
+
*/
|
|
147
|
+
export async function createScratchOrgOnHub(hubAliasOrUsername, options) {
|
|
148
|
+
const hubOrg = await Org.create({ aliasOrUsername: hubAliasOrUsername });
|
|
149
|
+
const orgConfig = JSON.parse(await fs.readFile(options.definitionFile, 'utf-8'));
|
|
150
|
+
const { username, scratchOrgInfo, authFields, warnings } = await scratchOrgCreate({
|
|
151
|
+
hubOrg,
|
|
152
|
+
orgConfig,
|
|
153
|
+
durationDays: options.durationDays,
|
|
154
|
+
wait: Duration.minutes(options.waitMinutes),
|
|
155
|
+
setDefault: options.setDefault ?? false,
|
|
156
|
+
tracksSource: true,
|
|
157
|
+
});
|
|
158
|
+
if (!scratchOrgInfo) {
|
|
159
|
+
throw new SfError('The scratch org did not return with any information');
|
|
160
|
+
}
|
|
161
|
+
// Round-trip through JSON so the result is exactly what the CLI serialized (dates as strings, no
|
|
162
|
+
// class instances), since callers persist it as SCRATCH_ORG_INFO.json.
|
|
163
|
+
return JSON.parse(JSON.stringify({ username, scratchOrgInfo, authFields, warnings, orgId: authFields?.orgId }));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Deletes a scratch org, as `sf org delete scratch --no-prompt` does: refuses a non-scratch org,
|
|
167
|
+
* treats an already-deleted org as success, and removes the local auth for one whose domain no
|
|
168
|
+
* longer resolves.
|
|
169
|
+
*
|
|
170
|
+
* @param aliasOrUsername - The scratch org. Omit to use the default target org.
|
|
171
|
+
* @returns The deleted org's username.
|
|
172
|
+
* @throws {SfError} If the org isn't a scratch org, or the Dev Hub rejects the delete.
|
|
173
|
+
*/
|
|
174
|
+
export async function deleteTargetScratchOrg(aliasOrUsername) {
|
|
175
|
+
const org = await Org.create({ aliasOrUsername });
|
|
176
|
+
const username = org.getUsername() ?? '';
|
|
177
|
+
const { isScratch } = (await AuthInfo.create({ username })).getFields();
|
|
178
|
+
if (!isScratch) {
|
|
179
|
+
throw new SfError(`The target org (${username}) is not a scratch org.`, 'NotAScratchOrgError');
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
await org.delete();
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
const name = error.name;
|
|
186
|
+
if (name === 'DomainNotFoundError') {
|
|
187
|
+
await (await AuthRemover.create()).removeAuth(username);
|
|
188
|
+
}
|
|
189
|
+
else if (name === 'ScratchOrgNotFound') {
|
|
190
|
+
logger.info(`Scratch org ${username} was already deleted.`);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return username;
|
|
197
|
+
}
|
|
137
198
|
//# sourceMappingURL=sfOrg.js.map
|
package/lib/sfOrg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sfOrg.js","sourceRoot":"","sources":["../src/sfOrg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAmB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"sfOrg.js","sourceRoot":"","sources":["../src/sfOrg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAmB,MAAM,kBAAkB,CAAC;AAChH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,eAAwB;IAC9D,gGAAgG;IAChG,+DAA+D;IAC/D,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,eAAe,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;IACxG,OAAO,GAAG,CAAC,aAAa,EAAE,CAAC,WAAW,CAAC;AACzC,CAAC;AAID;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,kBAA0B;IAC3E,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,CAAC,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AAC,CAAC;QAC1D,CAAC;aAAM,IAAI,IAAI,KAAK,oBAAoB,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,eAAe,QAAQ,uBAAuB,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/lib/sfPackages.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PackageInstallType, type PackageInstallUpgradeType, type PackageToInstall } from '@simplysf/simply-package-core';
|
|
2
|
-
import { type PackageVersionReportResult } from '@salesforce/packaging';
|
|
2
|
+
import { type PackageVersionCreateRequestResult, type PackageVersionReportResult } from '@salesforce/packaging';
|
|
3
3
|
import type { UpgradedPackage } from './schemas/deployProgress.js';
|
|
4
4
|
export type { PackageInstallUpgradeType, PackageToInstall };
|
|
5
5
|
export type InstallPackageDependenciesConfig = {
|
|
@@ -54,6 +54,32 @@ export type InstalledPackage = {
|
|
|
54
54
|
* @param aliasOrUsername - The org to inspect. Must already be authenticated.
|
|
55
55
|
*/
|
|
56
56
|
export declare function listInstalledPackages(aliasOrUsername: string): Promise<InstalledPackage[]>;
|
|
57
|
+
export type { PackageVersionCreateRequestResult };
|
|
58
|
+
export type RequestPackageVersionCreateOptions = {
|
|
59
|
+
/** The packaging Dev Hub. Must already be authenticated. */
|
|
60
|
+
devHubAliasOrUsername: string;
|
|
61
|
+
/** The package's alias in `packageAliases` (or its `0Ho` ID). */
|
|
62
|
+
packageId: string;
|
|
63
|
+
definitionFile: string;
|
|
64
|
+
versionDescription: string;
|
|
65
|
+
tag: string;
|
|
66
|
+
branch?: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Starts a package version create and returns its request (`08c`) without waiting: what
|
|
70
|
+
* `sf package version create --code-coverage --installation-key-bypass --wait 0` does, run from the
|
|
71
|
+
* SFDX project in the current directory. Poll it with {@link getPackageVersionCreateStatus}.
|
|
72
|
+
*
|
|
73
|
+
* Like the CLI, this applies `sfdx-project.json` string replacements while converting source
|
|
74
|
+
* (`SF_APPLY_REPLACEMENTS_ON_CONVERT`).
|
|
75
|
+
*/
|
|
76
|
+
export declare function requestPackageVersionCreate(options: RequestPackageVersionCreateOptions): Promise<PackageVersionCreateRequestResult>;
|
|
77
|
+
/**
|
|
78
|
+
* The current state of a package version create request: what
|
|
79
|
+
* `sf package version create report --package-create-request-id <08c> --json` returned (as its one
|
|
80
|
+
* array element). `Error` lists the request's error messages.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getPackageVersionCreateStatus(createRequestId: string, devHubAliasOrUsername: string): Promise<PackageVersionCreateRequestResult>;
|
|
57
83
|
/**
|
|
58
84
|
* For every package an {@link installPackageDependencies} run upgraded, fetches the previous and
|
|
59
85
|
* target version's `sf package version report` (for the origin commit SHA and pipeline URL). A
|