@simplysf/simply-cicd 0.3.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 +1621 -0
- package/lib/commands/simply/cicd/build/cleanup-scratch-orgs.d.ts +21 -0
- package/lib/commands/simply/cicd/build/cleanup-scratch-orgs.js +47 -0
- package/lib/commands/simply/cicd/build/cleanup-scratch-orgs.js.map +1 -0
- package/lib/commands/simply/cicd/build/create-fallback-tag.d.ts +25 -0
- package/lib/commands/simply/cicd/build/create-fallback-tag.js +63 -0
- package/lib/commands/simply/cicd/build/create-fallback-tag.js.map +1 -0
- package/lib/commands/simply/cicd/build/create-package-version.d.ts +32 -0
- package/lib/commands/simply/cicd/build/create-package-version.js +110 -0
- package/lib/commands/simply/cicd/build/create-package-version.js.map +1 -0
- package/lib/commands/simply/cicd/build/create-scratch.d.ts +25 -0
- package/lib/commands/simply/cicd/build/create-scratch.js +63 -0
- package/lib/commands/simply/cicd/build/create-scratch.js.map +1 -0
- package/lib/commands/simply/cicd/build/delete-scratch.d.ts +21 -0
- package/lib/commands/simply/cicd/build/delete-scratch.js +53 -0
- package/lib/commands/simply/cicd/build/delete-scratch.js.map +1 -0
- package/lib/commands/simply/cicd/build/determine-package-changes.d.ts +17 -0
- package/lib/commands/simply/cicd/build/determine-package-changes.js +44 -0
- package/lib/commands/simply/cicd/build/determine-package-changes.js.map +1 -0
- package/lib/commands/simply/cicd/build/generate-flexipage-diff.d.ts +20 -0
- package/lib/commands/simply/cicd/build/generate-flexipage-diff.js +47 -0
- package/lib/commands/simply/cicd/build/generate-flexipage-diff.js.map +1 -0
- package/lib/commands/simply/cicd/build/generate-flow-diff.d.ts +20 -0
- package/lib/commands/simply/cicd/build/generate-flow-diff.js +47 -0
- package/lib/commands/simply/cicd/build/generate-flow-diff.js.map +1 -0
- package/lib/commands/simply/cicd/build/install-dependencies.d.ts +18 -0
- package/lib/commands/simply/cicd/build/install-dependencies.js +58 -0
- package/lib/commands/simply/cicd/build/install-dependencies.js.map +1 -0
- package/lib/commands/simply/cicd/build/lwc-jest.d.ts +14 -0
- package/lib/commands/simply/cicd/build/lwc-jest.js +37 -0
- package/lib/commands/simply/cicd/build/lwc-jest.js.map +1 -0
- package/lib/commands/simply/cicd/build/push-scratch.d.ts +19 -0
- package/lib/commands/simply/cicd/build/push-scratch.js +57 -0
- package/lib/commands/simply/cicd/build/push-scratch.js.map +1 -0
- package/lib/commands/simply/cicd/build/test-scratch.d.ts +18 -0
- package/lib/commands/simply/cicd/build/test-scratch.js +58 -0
- package/lib/commands/simply/cicd/build/test-scratch.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/deploy-unpackaged.d.ts +29 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/deploy-unpackaged.js +36 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/deploy-unpackaged.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/deployment-close-out.d.ts +23 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/deployment-close-out.js +82 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/deployment-close-out.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/install-packaged.d.ts +21 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/install-packaged.js +57 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/install-packaged.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/post-deploy.d.ts +29 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/post-deploy.js +36 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/post-deploy.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/post-destructive.d.ts +29 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/post-destructive.js +36 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/post-destructive.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/pre-destructive.d.ts +29 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/pre-destructive.js +36 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/pre-destructive.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/tag-deployment.d.ts +28 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/tag-deployment.js +89 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/tag-deployment.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/validate.d.ts +15 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/validate.js +49 -0
- package/lib/commands/simply/cicd/deploy/happy-soup/validate.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/project/deploy-unpackaged.d.ts +28 -0
- package/lib/commands/simply/cicd/deploy/project/deploy-unpackaged.js +36 -0
- package/lib/commands/simply/cicd/deploy/project/deploy-unpackaged.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/project/install-packaged.d.ts +24 -0
- package/lib/commands/simply/cicd/deploy/project/install-packaged.js +69 -0
- package/lib/commands/simply/cicd/deploy/project/install-packaged.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/project/post-deploy.d.ts +28 -0
- package/lib/commands/simply/cicd/deploy/project/post-deploy.js +36 -0
- package/lib/commands/simply/cicd/deploy/project/post-deploy.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/project/post-destructive.d.ts +28 -0
- package/lib/commands/simply/cicd/deploy/project/post-destructive.js +36 -0
- package/lib/commands/simply/cicd/deploy/project/post-destructive.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/project/pre-destructive.d.ts +28 -0
- package/lib/commands/simply/cicd/deploy/project/pre-destructive.js +36 -0
- package/lib/commands/simply/cicd/deploy/project/pre-destructive.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/project/run-apex-tests.d.ts +26 -0
- package/lib/commands/simply/cicd/deploy/project/run-apex-tests.js +66 -0
- package/lib/commands/simply/cicd/deploy/project/run-apex-tests.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/project/validate.d.ts +14 -0
- package/lib/commands/simply/cicd/deploy/project/validate.js +51 -0
- package/lib/commands/simply/cicd/deploy/project/validate.js.map +1 -0
- package/lib/commands/simply/cicd/deploy/validate.d.ts +14 -0
- package/lib/commands/simply/cicd/deploy/validate.js +50 -0
- package/lib/commands/simply/cicd/deploy/validate.js.map +1 -0
- package/lib/commands/simply/cicd/notify/happy-soup.d.ts +32 -0
- package/lib/commands/simply/cicd/notify/happy-soup.js +193 -0
- package/lib/commands/simply/cicd/notify/happy-soup.js.map +1 -0
- package/lib/commands/simply/cicd/notify/project.d.ts +51 -0
- package/lib/commands/simply/cicd/notify/project.js +376 -0
- package/lib/commands/simply/cicd/notify/project.js.map +1 -0
- package/lib/commands/simply/cicd/notify/teams.d.ts +18 -0
- package/lib/commands/simply/cicd/notify/teams.js +77 -0
- package/lib/commands/simply/cicd/notify/teams.js.map +1 -0
- package/lib/commands/simply/cicd/sfdx-dependabot.d.ts +84 -0
- package/lib/commands/simply/cicd/sfdx-dependabot.js +469 -0
- package/lib/commands/simply/cicd/sfdx-dependabot.js.map +1 -0
- package/lib/common/build/cleanupScratchOrgs.d.ts +7 -0
- package/lib/common/build/cleanupScratchOrgs.js +91 -0
- package/lib/common/build/cleanupScratchOrgs.js.map +1 -0
- package/lib/common/build/createFallbackTag.d.ts +24 -0
- package/lib/common/build/createFallbackTag.js +96 -0
- package/lib/common/build/createFallbackTag.js.map +1 -0
- package/lib/common/build/createPackageVersion.d.ts +27 -0
- package/lib/common/build/createPackageVersion.js +164 -0
- package/lib/common/build/createPackageVersion.js.map +1 -0
- package/lib/common/build/createScratchOrg.d.ts +14 -0
- package/lib/common/build/createScratchOrg.js +191 -0
- package/lib/common/build/createScratchOrg.js.map +1 -0
- package/lib/common/build/deleteScratchOrg.d.ts +12 -0
- package/lib/common/build/deleteScratchOrg.js +58 -0
- package/lib/common/build/deleteScratchOrg.js.map +1 -0
- package/lib/common/build/determinePackageChanges.d.ts +13 -0
- package/lib/common/build/determinePackageChanges.js +98 -0
- package/lib/common/build/determinePackageChanges.js.map +1 -0
- package/lib/common/build/devHubs.d.ts +8 -0
- package/lib/common/build/devHubs.js +30 -0
- package/lib/common/build/devHubs.js.map +1 -0
- package/lib/common/build/flags.d.ts +36 -0
- package/lib/common/build/flags.js +120 -0
- package/lib/common/build/flags.js.map +1 -0
- package/lib/common/build/flexipageDelta.d.ts +31 -0
- package/lib/common/build/flexipageDelta.js +92 -0
- package/lib/common/build/flexipageDelta.js.map +1 -0
- package/lib/common/build/flowDelta.d.ts +30 -0
- package/lib/common/build/flowDelta.js +91 -0
- package/lib/common/build/flowDelta.js.map +1 -0
- package/lib/common/build/installDependencies.d.ts +7 -0
- package/lib/common/build/installDependencies.js +36 -0
- package/lib/common/build/installDependencies.js.map +1 -0
- package/lib/common/build/lwcJest.d.ts +9 -0
- package/lib/common/build/lwcJest.js +36 -0
- package/lib/common/build/lwcJest.js.map +1 -0
- package/lib/common/build/pushScratch.d.ts +8 -0
- package/lib/common/build/pushScratch.js +63 -0
- package/lib/common/build/pushScratch.js.map +1 -0
- package/lib/common/build/scratchOrgInfo.d.ts +10 -0
- package/lib/common/build/scratchOrgInfo.js +21 -0
- package/lib/common/build/scratchOrgInfo.js.map +1 -0
- package/lib/common/build/skipGuard.d.ts +8 -0
- package/lib/common/build/skipGuard.js +41 -0
- package/lib/common/build/skipGuard.js.map +1 -0
- package/lib/common/build/testScratch.d.ts +14 -0
- package/lib/common/build/testScratch.js +45 -0
- package/lib/common/build/testScratch.js.map +1 -0
- package/lib/common/deploy/deployCommon.d.ts +101 -0
- package/lib/common/deploy/deployCommon.js +361 -0
- package/lib/common/deploy/deployCommon.js.map +1 -0
- package/lib/common/deploy/deployHappySoup.d.ts +54 -0
- package/lib/common/deploy/deployHappySoup.js +143 -0
- package/lib/common/deploy/deployHappySoup.js.map +1 -0
- package/lib/common/deploy/deployProject.d.ts +24 -0
- package/lib/common/deploy/deployProject.js +114 -0
- package/lib/common/deploy/deployProject.js.map +1 -0
- package/lib/common/deploy/flags.d.ts +34 -0
- package/lib/common/deploy/flags.js +91 -0
- package/lib/common/deploy/flags.js.map +1 -0
- package/lib/common/deploy/runDeployStage.d.ts +16 -0
- package/lib/common/deploy/runDeployStage.js +65 -0
- package/lib/common/deploy/runDeployStage.js.map +1 -0
- package/lib/common/deploy/stageCommand.d.ts +106 -0
- package/lib/common/deploy/stageCommand.js +131 -0
- package/lib/common/deploy/stageCommand.js.map +1 -0
- package/lib/common/deploy/validate.d.ts +11 -0
- package/lib/common/deploy/validate.js +54 -0
- package/lib/common/deploy/validate.js.map +1 -0
- package/lib/common/env.d.ts +9 -0
- package/lib/common/env.js +47 -0
- package/lib/common/env.js.map +1 -0
- package/lib/common/exec/sfCli.d.ts +27 -0
- package/lib/common/exec/sfCli.js +50 -0
- package/lib/common/exec/sfCli.js.map +1 -0
- package/lib/common/flags/env.d.ts +44 -0
- package/lib/common/flags/env.js +81 -0
- package/lib/common/flags/env.js.map +1 -0
- package/lib/common/git.d.ts +19 -0
- package/lib/common/git.js +79 -0
- package/lib/common/git.js.map +1 -0
- package/lib/common/logger.d.ts +10 -0
- package/lib/common/logger.js +33 -0
- package/lib/common/logger.js.map +1 -0
- package/lib/common/notify/getCommitStories.d.ts +16 -0
- package/lib/common/notify/getCommitStories.js +69 -0
- package/lib/common/notify/getCommitStories.js.map +1 -0
- package/lib/common/notify/renderTemplate.d.ts +3 -0
- package/lib/common/notify/renderTemplate.js +24 -0
- package/lib/common/notify/renderTemplate.js.map +1 -0
- package/lib/common/notify/sendNotification.d.ts +2 -0
- package/lib/common/notify/sendNotification.js +50 -0
- package/lib/common/notify/sendNotification.js.map +1 -0
- package/lib/common/notify/templates.d.ts +11 -0
- package/lib/common/notify/templates.js +85 -0
- package/lib/common/notify/templates.js.map +1 -0
- package/lib/common/schemas/deployConfig.d.ts +25 -0
- package/lib/common/schemas/deployConfig.js +55 -0
- package/lib/common/schemas/deployConfig.js.map +1 -0
- package/lib/common/schemas/deployProgress.d.ts +10 -0
- package/lib/common/schemas/deployProgress.js +27 -0
- package/lib/common/schemas/deployProgress.js.map +1 -0
- package/lib/common/schemas/deployRules.d.ts +34 -0
- package/lib/common/schemas/deployRules.js +40 -0
- package/lib/common/schemas/deployRules.js.map +1 -0
- package/lib/common/sfApex.d.ts +22 -0
- package/lib/common/sfApex.js +158 -0
- package/lib/common/sfApex.js.map +1 -0
- package/lib/common/sfAuth.d.ts +30 -0
- package/lib/common/sfAuth.js +99 -0
- package/lib/common/sfAuth.js.map +1 -0
- package/lib/common/sfConfig.d.ts +6 -0
- package/lib/common/sfConfig.js +45 -0
- package/lib/common/sfConfig.js.map +1 -0
- package/lib/common/sfPackages.d.ts +12 -0
- package/lib/common/sfPackages.js +53 -0
- package/lib/common/sfPackages.js.map +1 -0
- package/lib/common/sfPlugins.d.ts +11 -0
- package/lib/common/sfPlugins.js +134 -0
- package/lib/common/sfPlugins.js.map +1 -0
- package/lib/common/sfdxDependabot/updater.d.ts +14 -0
- package/lib/common/sfdxDependabot/updater.js +94 -0
- package/lib/common/sfdxDependabot/updater.js.map +1 -0
- package/lib/common/vcs/gitlab.d.ts +21 -0
- package/lib/common/vcs/gitlab.js +208 -0
- package/lib/common/vcs/gitlab.js.map +1 -0
- package/lib/common/vcs/index.d.ts +4 -0
- package/lib/common/vcs/index.js +26 -0
- package/lib/common/vcs/index.js.map +1 -0
- package/lib/common/vcs/types.d.ts +69 -0
- package/lib/common/vcs/types.js +17 -0
- package/lib/common/vcs/types.js.map +1 -0
- package/lib/config/defaultDeploymentPlugins.d.ts +2 -0
- package/lib/config/defaultDeploymentPlugins.js +18 -0
- package/lib/config/defaultDeploymentPlugins.js.map +1 -0
- package/lib/config/trustedPlugins.d.ts +2 -0
- package/lib/config/trustedPlugins.js +18 -0
- package/lib/config/trustedPlugins.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +17 -0
- package/lib/index.js.map +1 -0
- package/messages/simply.cicd.build.cleanup-scratch-orgs.md +11 -0
- package/messages/simply.cicd.build.create-fallback-tag.md +21 -0
- package/messages/simply.cicd.build.create-package-version.md +49 -0
- package/messages/simply.cicd.build.create-scratch.md +21 -0
- package/messages/simply.cicd.build.delete-scratch.md +13 -0
- package/messages/simply.cicd.build.determine-package-changes.md +15 -0
- package/messages/simply.cicd.build.generate-flexipage-diff.md +11 -0
- package/messages/simply.cicd.build.generate-flow-diff.md +11 -0
- package/messages/simply.cicd.build.install-dependencies.md +17 -0
- package/messages/simply.cicd.build.lwc-jest.md +11 -0
- package/messages/simply.cicd.build.md +75 -0
- package/messages/simply.cicd.build.push-scratch.md +21 -0
- package/messages/simply.cicd.build.test-scratch.md +17 -0
- package/messages/simply.cicd.deploy.happy-soup.deploy-unpackaged.md +11 -0
- package/messages/simply.cicd.deploy.happy-soup.deployment-close-out.md +39 -0
- package/messages/simply.cicd.deploy.happy-soup.install-packaged.md +15 -0
- package/messages/simply.cicd.deploy.happy-soup.post-deploy.md +11 -0
- package/messages/simply.cicd.deploy.happy-soup.post-destructive.md +11 -0
- package/messages/simply.cicd.deploy.happy-soup.pre-destructive.md +11 -0
- package/messages/simply.cicd.deploy.happy-soup.tag-deployment.md +35 -0
- package/messages/simply.cicd.deploy.happy-soup.validate.md +25 -0
- package/messages/simply.cicd.deploy.md +75 -0
- package/messages/simply.cicd.deploy.project.deploy-unpackaged.md +11 -0
- package/messages/simply.cicd.deploy.project.install-packaged.md +23 -0
- package/messages/simply.cicd.deploy.project.post-deploy.md +11 -0
- package/messages/simply.cicd.deploy.project.post-destructive.md +11 -0
- package/messages/simply.cicd.deploy.project.pre-destructive.md +11 -0
- package/messages/simply.cicd.deploy.project.run-apex-tests.md +15 -0
- package/messages/simply.cicd.deploy.project.validate.md +25 -0
- package/messages/simply.cicd.deploy.validate.md +25 -0
- package/messages/simply.cicd.md +3 -0
- package/messages/simply.cicd.notify.happy-soup.md +73 -0
- package/messages/simply.cicd.notify.project.md +125 -0
- package/messages/simply.cicd.notify.teams.md +27 -0
- package/messages/simply.cicd.sfdx-dependabot.md +91 -0
- package/package.json +214 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps; Copyright (c) 2026 Salesforce, Inc.
|
|
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 { logger } from '../logger.js';
|
|
17
|
+
import { deployConfigSchema } from '../schemas/deployConfig.js';
|
|
18
|
+
import { deployRulesSchema } from '../schemas/deployRules.js';
|
|
19
|
+
import { determineDeployConfigFile, loadValidatedJsonFile } from './deployCommon.js';
|
|
20
|
+
async function validateFile(filePath, schema) {
|
|
21
|
+
try {
|
|
22
|
+
await loadValidatedJsonFile(filePath, schema);
|
|
23
|
+
logger.success(`Validation successful for ${filePath}`);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error.code === 'ENOENT') {
|
|
27
|
+
logger.warn(`Skipping validation for ${filePath} as it was not found.`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
logger.error(`Validation failed for ${filePath}: ${error.message}`);
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validates the deployment config and deployment rules files against their JSON schemas.
|
|
36
|
+
* Each is validated independently: a missing file is skipped (warned, not fatal), but a malformed
|
|
37
|
+
* or schema-invalid file throws.
|
|
38
|
+
*/
|
|
39
|
+
export async function validateDeployFiles(options) {
|
|
40
|
+
const resolvedDeployConfigFile = determineDeployConfigFile(options.sourceBranchName, options.deployConfigFile);
|
|
41
|
+
if (resolvedDeployConfigFile) {
|
|
42
|
+
await validateFile(resolvedDeployConfigFile, deployConfigSchema);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
logger.warn('No deployment config file specified or derivable from --source-branch-name. Skipping validation.');
|
|
46
|
+
}
|
|
47
|
+
if (options.deployRulesFile) {
|
|
48
|
+
await validateFile(options.deployRulesFile, deployRulesSchema);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
logger.warn('No deployment rules file specified. Skipping validation.');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/common/deploy/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAQrF,KAAK,UAAU,YAAY,CAAI,QAAgB,EAAE,MAAoB;IACnE,IAAI,CAAC;QACH,MAAM,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,OAAO,CAAC,6BAA6B,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,CAAC,IAAI,CAAC,2BAA2B,QAAQ,uBAAuB,CAAC,CAAC;YACxE,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,yBAAyB,QAAQ,KAAM,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/E,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAmC;IAC3E,MAAM,wBAAwB,GAAG,yBAAyB,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE/G,IAAI,wBAAwB,EAAE,CAAC;QAC7B,MAAM,YAAY,CAAC,wBAAwB,EAAE,kBAAkB,CAAC,CAAC;IACnE,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,kGAAkG,CAAC,CAAC;IAClH,CAAC;IAED,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,MAAM,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type EnvLogger = {
|
|
2
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
3
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Appends key-value pairs to a .env style file. If the file exists and its content doesn't end
|
|
7
|
+
* with a newline, a leading newline is added before appending. Creates the file if it doesn't exist.
|
|
8
|
+
*/
|
|
9
|
+
export declare function appendToEnvFile(filePath: string, variables: Record<string, string | undefined>, log?: EnvLogger): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps; Copyright (c) 2026 Salesforce, Inc.
|
|
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 fs from 'node:fs';
|
|
17
|
+
/**
|
|
18
|
+
* Appends key-value pairs to a .env style file. If the file exists and its content doesn't end
|
|
19
|
+
* with a newline, a leading newline is added before appending. Creates the file if it doesn't exist.
|
|
20
|
+
*/
|
|
21
|
+
export function appendToEnvFile(filePath, variables, log) {
|
|
22
|
+
const targetLogger = log ?? console;
|
|
23
|
+
const lines = Object.entries(variables)
|
|
24
|
+
.filter((entry) => entry[1] !== undefined)
|
|
25
|
+
.map(([key, value]) => `${key}=${value}`);
|
|
26
|
+
if (lines.length === 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const variablesToAppend = lines.join('\n') + '\n';
|
|
30
|
+
try {
|
|
31
|
+
let contentToAppend = variablesToAppend;
|
|
32
|
+
if (fs.existsSync(filePath)) {
|
|
33
|
+
const currentContent = fs.readFileSync(filePath, 'utf8');
|
|
34
|
+
if (currentContent && !currentContent.endsWith('\n')) {
|
|
35
|
+
contentToAppend = `\n${variablesToAppend}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
fs.appendFileSync(filePath, contentToAppend, 'utf8');
|
|
39
|
+
targetLogger.info(`Variables successfully appended to ${filePath}!`);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
const err = error;
|
|
43
|
+
targetLogger.error(`Error appending to ${filePath}: ${err.message}`);
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../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BAAsB,QAAQ,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACrE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ExecaChildProcess, type Options } from 'execa';
|
|
2
|
+
/**
|
|
3
|
+
* Run the Salesforce CLI.
|
|
4
|
+
*
|
|
5
|
+
* Everything this package does to an org ultimately shells out to `sf`, and each site was
|
|
6
|
+
* naming the binary itself. Options are forwarded only when a caller supplies them, so the
|
|
7
|
+
* underlying `execa()` call keeps the exact arity each site had.
|
|
8
|
+
*
|
|
9
|
+
* @param args - Arguments to pass to `sf`.
|
|
10
|
+
* @param options - Optional `execa` options, e.g. `{ stdio: 'inherit' }` to stream output
|
|
11
|
+
* straight into the job log.
|
|
12
|
+
* @returns The completed `execa` result.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runSf(args: string[], options?: Options): ExecaChildProcess;
|
|
15
|
+
/**
|
|
16
|
+
* Run the Salesforce CLI and parse its `--json` output.
|
|
17
|
+
*
|
|
18
|
+
* The caller still passes `--json` in `args` — this doesn't inject it, because which commands
|
|
19
|
+
* accept it and where it belongs in the argument list varies. What it does replace is the
|
|
20
|
+
* `JSON.parse(stdout) as SomeShape` written out at each call site.
|
|
21
|
+
*
|
|
22
|
+
* @param args - Arguments to pass to `sf`, including `--json`.
|
|
23
|
+
* @param options - Optional `execa` options.
|
|
24
|
+
* @returns The parsed payload, typed as the caller asserts.
|
|
25
|
+
* @throws {SyntaxError} If the command's output isn't valid JSON.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runSfJson<T>(args: string[], options?: Options): Promise<T>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps; Copyright (c) 2026 Salesforce, Inc.
|
|
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 { execa } from 'execa';
|
|
17
|
+
/** The `sf` executable, as resolved from `PATH` in the CI job. */
|
|
18
|
+
const SF_BINARY = 'sf';
|
|
19
|
+
/**
|
|
20
|
+
* Run the Salesforce CLI.
|
|
21
|
+
*
|
|
22
|
+
* Everything this package does to an org ultimately shells out to `sf`, and each site was
|
|
23
|
+
* naming the binary itself. Options are forwarded only when a caller supplies them, so the
|
|
24
|
+
* underlying `execa()` call keeps the exact arity each site had.
|
|
25
|
+
*
|
|
26
|
+
* @param args - Arguments to pass to `sf`.
|
|
27
|
+
* @param options - Optional `execa` options, e.g. `{ stdio: 'inherit' }` to stream output
|
|
28
|
+
* straight into the job log.
|
|
29
|
+
* @returns The completed `execa` result.
|
|
30
|
+
*/
|
|
31
|
+
export function runSf(args, options) {
|
|
32
|
+
return options ? execa(SF_BINARY, args, options) : execa(SF_BINARY, args);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Run the Salesforce CLI and parse its `--json` output.
|
|
36
|
+
*
|
|
37
|
+
* The caller still passes `--json` in `args` — this doesn't inject it, because which commands
|
|
38
|
+
* accept it and where it belongs in the argument list varies. What it does replace is the
|
|
39
|
+
* `JSON.parse(stdout) as SomeShape` written out at each call site.
|
|
40
|
+
*
|
|
41
|
+
* @param args - Arguments to pass to `sf`, including `--json`.
|
|
42
|
+
* @param options - Optional `execa` options.
|
|
43
|
+
* @returns The parsed payload, typed as the caller asserts.
|
|
44
|
+
* @throws {SyntaxError} If the command's output isn't valid JSON.
|
|
45
|
+
*/
|
|
46
|
+
export async function runSfJson(args, options) {
|
|
47
|
+
const { stdout } = await runSf(args, options);
|
|
48
|
+
return JSON.parse(stdout);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=sfCli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sfCli.js","sourceRoot":"","sources":["../../../src/common/exec/sfCli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAwC,MAAM,OAAO,CAAC;AAEpE,kEAAkE;AAClE,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,KAAK,CAAC,IAAc,EAAE,OAAiB;IACrD,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAI,IAAc,EAAE,OAAiB;IAClE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAM,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coerce a string or boolean to a boolean. `'true'`/`'false'` are recognised
|
|
3
|
+
* case- and whitespace-insensitively; anything else is `false`.
|
|
4
|
+
*
|
|
5
|
+
* Environment variables are always strings, unlike the boolean flags oclif parses natively, so
|
|
6
|
+
* any flag with an env-var fallback needs this on the env side.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The raw flag or environment value.
|
|
9
|
+
* @returns The coerced boolean.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseBooleanString(value: string | boolean): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a string setting with CLI flag > environment variable > fallback precedence.
|
|
14
|
+
*
|
|
15
|
+
* Several settings accept more than one environment variable — a `SIMPLY_CICD_`-prefixed name of
|
|
16
|
+
* our own plus whatever the CI provider already exports — so the env side takes a list, tried in
|
|
17
|
+
* order.
|
|
18
|
+
*
|
|
19
|
+
* @param flagValue - The parsed CLI flag, if the caller passed one.
|
|
20
|
+
* @param envVars - Candidate environment values, most specific first.
|
|
21
|
+
* @param fallback - Used when neither the flag nor any environment variable is set.
|
|
22
|
+
* @returns The resolved value.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveString(flagValue: string | undefined, envVars: Array<string | undefined>, fallback?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* {@link resolveString} for settings with no default, where "unset" is meaningful.
|
|
27
|
+
*
|
|
28
|
+
* @param flagValue - The parsed CLI flag, if the caller passed one.
|
|
29
|
+
* @param envVars - Candidate environment values, most specific first.
|
|
30
|
+
* @returns The resolved value, or `undefined` if nothing supplied one.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveOptionalString(flagValue: string | undefined, envVars: Array<string | undefined>): string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a boolean setting with CLI flag > environment variable > fallback precedence.
|
|
35
|
+
*
|
|
36
|
+
* The flag is checked for `undefined` rather than falsiness, so an explicit `--no-…` stays
|
|
37
|
+
* distinguishable from an unset flag and still beats the environment.
|
|
38
|
+
*
|
|
39
|
+
* @param flagValue - The parsed CLI flag, if the caller passed one.
|
|
40
|
+
* @param envVar - The environment value, coerced via {@link parseBooleanString}.
|
|
41
|
+
* @param fallback - Used when neither the flag nor the environment variable is set.
|
|
42
|
+
* @returns The resolved boolean.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveBoolean(flagValue: boolean | undefined, envVar: string | undefined, fallback: boolean): boolean;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps; Copyright (c) 2026 Salesforce, Inc.
|
|
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
|
+
/**
|
|
17
|
+
* Coerce a string or boolean to a boolean. `'true'`/`'false'` are recognised
|
|
18
|
+
* case- and whitespace-insensitively; anything else is `false`.
|
|
19
|
+
*
|
|
20
|
+
* Environment variables are always strings, unlike the boolean flags oclif parses natively, so
|
|
21
|
+
* any flag with an env-var fallback needs this on the env side.
|
|
22
|
+
*
|
|
23
|
+
* @param value - The raw flag or environment value.
|
|
24
|
+
* @returns The coerced boolean.
|
|
25
|
+
*/
|
|
26
|
+
export function parseBooleanString(value) {
|
|
27
|
+
if (typeof value === 'boolean') {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
const normalized = value.trim().toLowerCase();
|
|
31
|
+
if (normalized === 'true') {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (normalized === 'false') {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a string setting with CLI flag > environment variable > fallback precedence.
|
|
41
|
+
*
|
|
42
|
+
* Several settings accept more than one environment variable — a `SIMPLY_CICD_`-prefixed name of
|
|
43
|
+
* our own plus whatever the CI provider already exports — so the env side takes a list, tried in
|
|
44
|
+
* order.
|
|
45
|
+
*
|
|
46
|
+
* @param flagValue - The parsed CLI flag, if the caller passed one.
|
|
47
|
+
* @param envVars - Candidate environment values, most specific first.
|
|
48
|
+
* @param fallback - Used when neither the flag nor any environment variable is set.
|
|
49
|
+
* @returns The resolved value.
|
|
50
|
+
*/
|
|
51
|
+
export function resolveString(flagValue, envVars, fallback = '') {
|
|
52
|
+
return flagValue ?? envVars.find((value) => value !== undefined) ?? fallback;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* {@link resolveString} for settings with no default, where "unset" is meaningful.
|
|
56
|
+
*
|
|
57
|
+
* @param flagValue - The parsed CLI flag, if the caller passed one.
|
|
58
|
+
* @param envVars - Candidate environment values, most specific first.
|
|
59
|
+
* @returns The resolved value, or `undefined` if nothing supplied one.
|
|
60
|
+
*/
|
|
61
|
+
export function resolveOptionalString(flagValue, envVars) {
|
|
62
|
+
return flagValue ?? envVars.find((value) => value !== undefined);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Resolve a boolean setting with CLI flag > environment variable > fallback precedence.
|
|
66
|
+
*
|
|
67
|
+
* The flag is checked for `undefined` rather than falsiness, so an explicit `--no-…` stays
|
|
68
|
+
* distinguishable from an unset flag and still beats the environment.
|
|
69
|
+
*
|
|
70
|
+
* @param flagValue - The parsed CLI flag, if the caller passed one.
|
|
71
|
+
* @param envVar - The environment value, coerced via {@link parseBooleanString}.
|
|
72
|
+
* @param fallback - Used when neither the flag nor the environment variable is set.
|
|
73
|
+
* @returns The resolved boolean.
|
|
74
|
+
*/
|
|
75
|
+
export function resolveBoolean(flagValue, envVar, fallback) {
|
|
76
|
+
if (flagValue !== undefined) {
|
|
77
|
+
return flagValue;
|
|
78
|
+
}
|
|
79
|
+
return envVar !== undefined ? parseBooleanString(envVar) : fallback;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/common/flags/env.ts"],"names":[],"mappings":"AAAA;;;;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string;
|
|
4
|
+
slug: string;
|
|
5
|
+
ref?: string;
|
|
6
|
+
};
|
|
7
|
+
export type CloneRepoOptions = {
|
|
8
|
+
ciJobToken: string;
|
|
9
|
+
vcsHost: string;
|
|
10
|
+
vcsProvider: VcsProvider;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Clones a repository based on deployment metadata and options. If a specific branch or tag
|
|
14
|
+
* (ref) is not specified, it attempts to deduce the ref from package dependencies in
|
|
15
|
+
* `sfdx-project.json` in the current working directory.
|
|
16
|
+
*/
|
|
17
|
+
export declare function cloneRepo(deployment: Deployment, options: CloneRepoOptions): Promise<string>;
|
|
18
|
+
/** Adds a temporary authenticated git remote for CI push/tag operations. Returns the remote's alias. */
|
|
19
|
+
export declare function addGitRemote(ciPipelineId: string, accessToken: string, ciProjectPath: string, vcsHost: string, vcsProvider: VcsProvider): Promise<string>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps; Copyright (c) 2026 Salesforce, Inc.
|
|
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 { promises as fs } from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
import { execa } from 'execa';
|
|
19
|
+
import { getDefaultPackageDirectory, readSfdxProject } from '@simplysf/simply-core';
|
|
20
|
+
import { logger } from './logger.js';
|
|
21
|
+
/**
|
|
22
|
+
* Clones a repository based on deployment metadata and options. If a specific branch or tag
|
|
23
|
+
* (ref) is not specified, it attempts to deduce the ref from package dependencies in
|
|
24
|
+
* `sfdx-project.json` in the current working directory.
|
|
25
|
+
*/
|
|
26
|
+
export async function cloneRepo(deployment, options) {
|
|
27
|
+
const { name, slug } = deployment;
|
|
28
|
+
let { ref } = deployment;
|
|
29
|
+
if (!ref) {
|
|
30
|
+
try {
|
|
31
|
+
const defaultPackageDir = getDefaultPackageDirectory(await readSfdxProject());
|
|
32
|
+
if (defaultPackageDir?.dependencies) {
|
|
33
|
+
const dependency = defaultPackageDir.dependencies.find((dep) => dep.package?.startsWith(`${name}@`));
|
|
34
|
+
if (dependency?.package) {
|
|
35
|
+
const versionPart = dependency.package.split('@')[1];
|
|
36
|
+
if (versionPart) {
|
|
37
|
+
const transformedVersion = versionPart.replace(/^(?<version>\d+\.\d+\.\d+)-(?<build>\d+)$/, '$<version>.$<build>');
|
|
38
|
+
ref = `v${transformedVersion}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
const err = e;
|
|
45
|
+
if (err.code !== 'ENOENT') {
|
|
46
|
+
logger.warn(`Could not deduce ref from sfdx-project.json for ${name}: ${err.message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const repoUrl = options.vcsProvider.buildCiCloneUrl(options.vcsHost, options.ciJobToken, slug);
|
|
51
|
+
const targetDir = path.join(process.cwd(), name);
|
|
52
|
+
await fs.rm(targetDir, { recursive: true, force: true });
|
|
53
|
+
const refMessage = ref ? `#${ref}` : ' (default branch)';
|
|
54
|
+
logger.info(`Cloning ${slug}${refMessage} into ${name}`);
|
|
55
|
+
try {
|
|
56
|
+
const cloneArgs = ['clone', '--depth', '1'];
|
|
57
|
+
if (ref) {
|
|
58
|
+
cloneArgs.push('-b', ref);
|
|
59
|
+
}
|
|
60
|
+
cloneArgs.push(repoUrl, name);
|
|
61
|
+
await execa('git', cloneArgs);
|
|
62
|
+
return targetDir;
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
logger.error(`Failed to clone ${slug}${refMessage}.`);
|
|
66
|
+
throw e;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Adds a temporary authenticated git remote for CI push/tag operations. Returns the remote's alias. */
|
|
70
|
+
export async function addGitRemote(ciPipelineId, accessToken, ciProjectPath, vcsHost, vcsProvider) {
|
|
71
|
+
if (!accessToken) {
|
|
72
|
+
throw new Error('accessToken is required for Git remote operations.');
|
|
73
|
+
}
|
|
74
|
+
const remoteAlias = `GITREMOTE${ciPipelineId}`;
|
|
75
|
+
const remoteUrl = vcsProvider.buildAuthenticatedRemoteUrl(vcsHost, accessToken, ciProjectPath);
|
|
76
|
+
await execa('git', ['remote', 'add', remoteAlias, remoteUrl]);
|
|
77
|
+
return remoteAlias;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/common/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEpF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcrC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,UAAsB,EAAE,OAAyB;IAC/E,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;IAClC,IAAI,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC;IAEzB,IAAI,CAAC,GAAG,E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for consistent logging across the simply-cicd package's shared modules. */
|
|
2
|
+
export declare const logger: {
|
|
3
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
4
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
5
|
+
success: (message: string, ...args: unknown[]) => void;
|
|
6
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
7
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
8
|
+
log: (message: string, ...args: unknown[]) => void;
|
|
9
|
+
raw: (...args: unknown[]) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps; Copyright (c) 2026 Salesforce, Inc.
|
|
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
|
+
/* eslint-disable no-console -- this module is the sole intended console output surface for simply-cicd's shared modules */
|
|
17
|
+
import chalk from 'chalk';
|
|
18
|
+
import logSymbols from 'log-symbols';
|
|
19
|
+
chalk.level = 1;
|
|
20
|
+
const debugPrefix = chalk.yellow('[DEBUG]');
|
|
21
|
+
const logPrefix = chalk.yellow('[SIMPLY-CICD]');
|
|
22
|
+
const format = (message) => `${logPrefix} ${message}`;
|
|
23
|
+
/** A logger utility for consistent logging across the simply-cicd package's shared modules. */
|
|
24
|
+
export const logger = {
|
|
25
|
+
debug: (message, ...args) => console.log(`${logPrefix} ${debugPrefix} ${message}`, ...args),
|
|
26
|
+
info: (message, ...args) => console.log(logSymbols.info, format(message), ...args),
|
|
27
|
+
success: (message, ...args) => console.log(logSymbols.success, format(message), ...args),
|
|
28
|
+
warn: (message, ...args) => console.warn(logSymbols.warning, format(message), ...args),
|
|
29
|
+
error: (message, ...args) => console.error(logSymbols.error, format(message), ...args),
|
|
30
|
+
log: (message, ...args) => console.log(format(message), ...args),
|
|
31
|
+
raw: (...args) => console.log(...args),
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,2HAA2H;AAE3H,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;AAEhB,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AAEhD,MAAM,MAAM,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,GAAG,SAAS,IAAI,OAAO,EAAE,CAAC;AAEtE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,IAAI,WAAW,IAAI,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC;IACpH,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAC3G,OAAO,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IACjH,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAC/G,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAC/G,GAAG,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IACzF,GAAG,EAAE,CAAC,GAAG,IAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;CACxD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type CommitStories = {
|
|
2
|
+
stories: string;
|
|
3
|
+
storiesWithUrl: string;
|
|
4
|
+
};
|
|
5
|
+
export type GetCommitStoriesOptions = {
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
/** Base URL for linking a Jira issue key, e.g. `https://jira.example.com/browse`. Links are omitted if not provided. */
|
|
8
|
+
jiraBaseUrl?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves Jira story keys referenced in the commit logs between two tags/commits. Fetches the
|
|
12
|
+
* git history, parses commit messages between the two versions, identifies unique Jira keys
|
|
13
|
+
* based on configured prefixes, and builds both a plain string and (if `jiraBaseUrl` is provided)
|
|
14
|
+
* an HTML list with hyperlinks to Jira.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getCommitStories(previousVersion: string | undefined, targetVersion: string | undefined, jiraStoryPrefix: string | undefined, options?: GetCommitStoriesOptions): Promise<CommitStories>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps; Copyright (c) 2026 Salesforce, Inc.
|
|
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 { execa } from 'execa';
|
|
17
|
+
import { getJiraProjectKeys } from '../sfConfig.js';
|
|
18
|
+
import { logger } from '../logger.js';
|
|
19
|
+
const NOT_AVAILABLE = { stories: 'N/A', storiesWithUrl: 'N/A' };
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves Jira story keys referenced in the commit logs between two tags/commits. Fetches the
|
|
22
|
+
* git history, parses commit messages between the two versions, identifies unique Jira keys
|
|
23
|
+
* based on configured prefixes, and builds both a plain string and (if `jiraBaseUrl` is provided)
|
|
24
|
+
* an HTML list with hyperlinks to Jira.
|
|
25
|
+
*/
|
|
26
|
+
export async function getCommitStories(previousVersion, targetVersion, jiraStoryPrefix, options) {
|
|
27
|
+
if (!previousVersion ||
|
|
28
|
+
!targetVersion ||
|
|
29
|
+
previousVersion === 'N/A' ||
|
|
30
|
+
targetVersion === 'N/A' ||
|
|
31
|
+
previousVersion === targetVersion) {
|
|
32
|
+
return NOT_AVAILABLE;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
await execa('git', ['fetch', '--unshallow', '--prune', '--tags', '--quiet']);
|
|
36
|
+
const { stdout: commits } = await execa('git', [
|
|
37
|
+
'log',
|
|
38
|
+
'--pretty=oneline',
|
|
39
|
+
`${previousVersion}...${targetVersion}`,
|
|
40
|
+
]);
|
|
41
|
+
if (!commits) {
|
|
42
|
+
return NOT_AVAILABLE;
|
|
43
|
+
}
|
|
44
|
+
const prefixes = getJiraProjectKeys(jiraStoryPrefix);
|
|
45
|
+
if (prefixes.length === 0) {
|
|
46
|
+
return NOT_AVAILABLE;
|
|
47
|
+
}
|
|
48
|
+
const escapedPrefixes = prefixes.map((p) => p.replace(/[-/^$*+?.()|[\]{}]/g, '\\$&'));
|
|
49
|
+
const storyRegex = new RegExp(`(?:${escapedPrefixes.join('|')})-[0-9]+`, 'gi');
|
|
50
|
+
const stories = [...new Set(commits.toUpperCase().match(storyRegex) ?? [])].sort();
|
|
51
|
+
if (stories.length === 0) {
|
|
52
|
+
return NOT_AVAILABLE;
|
|
53
|
+
}
|
|
54
|
+
const storiesString = stories.join(', ');
|
|
55
|
+
const jiraBaseUrl = options?.jiraBaseUrl;
|
|
56
|
+
const storiesWithUrl = jiraBaseUrl
|
|
57
|
+
? stories.map((story) => `<a href='${jiraBaseUrl}/${story}'>${story}</a>`).join(', ')
|
|
58
|
+
: storiesString;
|
|
59
|
+
return { stories: storiesString, storiesWithUrl };
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
logger.error(`Error getting commit stories: ${error.message}`);
|
|
63
|
+
if (options?.debug) {
|
|
64
|
+
logger.error(String(error));
|
|
65
|
+
}
|
|
66
|
+
return NOT_AVAILABLE;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=getCommitStories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCommitStories.js","sourceRoot":"","sources":["../../../src/common/notify/getCommitStories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,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AI,CAAC,CAAC;QAC/E,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAEnF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,aAAa,CAAC;QACvB,CAAC;QAED,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,CAAC;QACzC,MAAM,cAAc,GAAG,WAAW;YAChC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,WAAW,IAAI,KAAK,KAAK,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACrF,CAAC,CAAC,aAAa,CAAC;QAElB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,iCAAkC,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1E,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps; Copyright (c) 2026 Salesforce, Inc.
|
|
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 Handlebars from 'handlebars';
|
|
17
|
+
import { NOTIFY_TEMPLATES } from './templates.js';
|
|
18
|
+
const handlebars = Handlebars.create();
|
|
19
|
+
/** Renders one of the built-in Teams notification card templates with the given data. */
|
|
20
|
+
export function renderNotifyTemplate(templateName, data) {
|
|
21
|
+
const template = handlebars.compile(NOTIFY_TEMPLATES[templateName]);
|
|
22
|
+
return template(data);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=renderTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderTemplate.js","sourceRoot":"","sources":["../../../src/common/notify/renderTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAA2B,MAAM,gBAAgB,CAAC;AAE3E,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;AAEvC,yFAAyF;AACzF,MAAM,UAAU,oBAAoB,CAAC,YAAgC,EAAE,IAA6B;IAClG,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;IACpE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
|