@simplysf/simply-cicd 0.22.1 → 0.23.1

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.
Files changed (244) hide show
  1. package/README.md +46 -43
  2. package/lib/commands/simply/cicd/build/check-permission-sets.d.ts +1 -1
  3. package/lib/commands/simply/cicd/build/check-permission-sets.js +1 -1
  4. package/lib/commands/simply/cicd/build/check-permission-sets.js.map +1 -1
  5. package/lib/commands/simply/cicd/build/cleanup-scratch-orgs.js +1 -2
  6. package/lib/commands/simply/cicd/build/cleanup-scratch-orgs.js.map +1 -1
  7. package/lib/commands/simply/cicd/build/create-fallback-tag.d.ts +1 -1
  8. package/lib/commands/simply/cicd/build/create-fallback-tag.js +1 -3
  9. package/lib/commands/simply/cicd/build/create-fallback-tag.js.map +1 -1
  10. package/lib/commands/simply/cicd/build/create-package-version.js +1 -3
  11. package/lib/commands/simply/cicd/build/create-package-version.js.map +1 -1
  12. package/lib/commands/simply/cicd/build/create-scratch.d.ts +1 -1
  13. package/lib/commands/simply/cicd/build/create-scratch.js +1 -3
  14. package/lib/commands/simply/cicd/build/create-scratch.js.map +1 -1
  15. package/lib/commands/simply/cicd/build/delete-scratch.js +1 -3
  16. package/lib/commands/simply/cicd/build/delete-scratch.js.map +1 -1
  17. package/lib/commands/simply/cicd/build/determine-package-changes.js +1 -2
  18. package/lib/commands/simply/cicd/build/determine-package-changes.js.map +1 -1
  19. package/lib/commands/simply/cicd/build/generate-flexipage-diff.d.ts +1 -1
  20. package/lib/commands/simply/cicd/build/generate-flexipage-diff.js +1 -1
  21. package/lib/commands/simply/cicd/build/generate-flexipage-diff.js.map +1 -1
  22. package/lib/commands/simply/cicd/build/generate-flow-diff.d.ts +1 -1
  23. package/lib/commands/simply/cicd/build/generate-flow-diff.js +1 -1
  24. package/lib/commands/simply/cicd/build/generate-flow-diff.js.map +1 -1
  25. package/lib/commands/simply/cicd/build/install-dependencies.js +1 -3
  26. package/lib/commands/simply/cicd/build/install-dependencies.js.map +1 -1
  27. package/lib/commands/simply/cicd/build/lwc-jest.d.ts +1 -1
  28. package/lib/commands/simply/cicd/build/lwc-jest.js +1 -1
  29. package/lib/commands/simply/cicd/build/lwc-jest.js.map +1 -1
  30. package/lib/commands/simply/cicd/build/publish-utam-page-objects.d.ts +1 -2
  31. package/lib/commands/simply/cicd/build/publish-utam-page-objects.js +1 -6
  32. package/lib/commands/simply/cicd/build/publish-utam-page-objects.js.map +1 -1
  33. package/lib/commands/simply/cicd/build/push-scratch.js +1 -3
  34. package/lib/commands/simply/cicd/build/push-scratch.js.map +1 -1
  35. package/lib/commands/simply/cicd/build/test-scratch.js +1 -3
  36. package/lib/commands/simply/cicd/build/test-scratch.js.map +1 -1
  37. package/lib/commands/simply/cicd/deploy/happy-soup/deploy-unpackaged.js +2 -2
  38. package/lib/commands/simply/cicd/deploy/happy-soup/deploy-unpackaged.js.map +1 -1
  39. package/lib/commands/simply/cicd/deploy/happy-soup/deployment-close-out.js +1 -1
  40. package/lib/commands/simply/cicd/deploy/happy-soup/deployment-close-out.js.map +1 -1
  41. package/lib/commands/simply/cicd/deploy/happy-soup/install-packaged.js +1 -1
  42. package/lib/commands/simply/cicd/deploy/happy-soup/install-packaged.js.map +1 -1
  43. package/lib/commands/simply/cicd/deploy/happy-soup/post-deploy.js +2 -2
  44. package/lib/commands/simply/cicd/deploy/happy-soup/post-deploy.js.map +1 -1
  45. package/lib/commands/simply/cicd/deploy/happy-soup/post-destructive.js +2 -2
  46. package/lib/commands/simply/cicd/deploy/happy-soup/post-destructive.js.map +1 -1
  47. package/lib/commands/simply/cicd/deploy/happy-soup/pre-destructive.js +2 -2
  48. package/lib/commands/simply/cicd/deploy/happy-soup/pre-destructive.js.map +1 -1
  49. package/lib/commands/simply/cicd/deploy/happy-soup/tag-deployment.js +1 -1
  50. package/lib/commands/simply/cicd/deploy/happy-soup/tag-deployment.js.map +1 -1
  51. package/lib/commands/simply/cicd/deploy/happy-soup/validate.js +1 -1
  52. package/lib/commands/simply/cicd/deploy/happy-soup/validate.js.map +1 -1
  53. package/lib/commands/simply/cicd/deploy/project/deploy-unpackaged.js +2 -2
  54. package/lib/commands/simply/cicd/deploy/project/deploy-unpackaged.js.map +1 -1
  55. package/lib/commands/simply/cicd/deploy/project/install-packaged.js +1 -1
  56. package/lib/commands/simply/cicd/deploy/project/install-packaged.js.map +1 -1
  57. package/lib/commands/simply/cicd/deploy/project/post-deploy.js +2 -2
  58. package/lib/commands/simply/cicd/deploy/project/post-deploy.js.map +1 -1
  59. package/lib/commands/simply/cicd/deploy/project/post-destructive.js +2 -2
  60. package/lib/commands/simply/cicd/deploy/project/post-destructive.js.map +1 -1
  61. package/lib/commands/simply/cicd/deploy/project/pre-destructive.js +2 -2
  62. package/lib/commands/simply/cicd/deploy/project/pre-destructive.js.map +1 -1
  63. package/lib/commands/simply/cicd/deploy/project/run-apex-tests.js +1 -1
  64. package/lib/commands/simply/cicd/deploy/project/run-apex-tests.js.map +1 -1
  65. package/lib/commands/simply/cicd/deploy/project/validate.js +1 -1
  66. package/lib/commands/simply/cicd/deploy/project/validate.js.map +1 -1
  67. package/lib/commands/simply/cicd/deploy/validate.js +1 -1
  68. package/lib/commands/simply/cicd/deploy/validate.js.map +1 -1
  69. package/lib/commands/simply/cicd/notify/build.d.ts +2 -3
  70. package/lib/commands/simply/cicd/notify/build.js +1 -3
  71. package/lib/commands/simply/cicd/notify/build.js.map +1 -1
  72. package/lib/commands/simply/cicd/notify/happy-soup.d.ts +2 -3
  73. package/lib/commands/simply/cicd/notify/happy-soup.js +4 -6
  74. package/lib/commands/simply/cicd/notify/happy-soup.js.map +1 -1
  75. package/lib/commands/simply/cicd/notify/project.d.ts +1 -2
  76. package/lib/commands/simply/cicd/notify/project.js +3 -5
  77. package/lib/commands/simply/cicd/notify/project.js.map +1 -1
  78. package/lib/commands/simply/cicd/notify/teams.js +1 -2
  79. package/lib/commands/simply/cicd/notify/teams.js.map +1 -1
  80. package/lib/commands/simply/cicd/sfdx-dependabot.d.ts +1 -2
  81. package/lib/commands/simply/cicd/sfdx-dependabot.js +1 -4
  82. package/lib/commands/simply/cicd/sfdx-dependabot.js.map +1 -1
  83. package/lib/common/deploy/stageCommand.d.ts +0 -49
  84. package/lib/common/deploy/stageCommand.js +0 -54
  85. package/lib/common/deploy/stageCommand.js.map +1 -1
  86. package/messages/simply.cicd.build.publish-utam-page-objects.md +4 -6
  87. package/oclif.manifest.json +4 -12
  88. package/package.json +3 -12
  89. package/lib/common/build/checkPermissionSets.d.ts +0 -22
  90. package/lib/common/build/checkPermissionSets.js +0 -102
  91. package/lib/common/build/checkPermissionSets.js.map +0 -1
  92. package/lib/common/build/cleanupScratchOrgs.d.ts +0 -6
  93. package/lib/common/build/cleanupScratchOrgs.js +0 -91
  94. package/lib/common/build/cleanupScratchOrgs.js.map +0 -1
  95. package/lib/common/build/createFallbackTag.d.ts +0 -24
  96. package/lib/common/build/createFallbackTag.js +0 -147
  97. package/lib/common/build/createFallbackTag.js.map +0 -1
  98. package/lib/common/build/createPackageVersion.d.ts +0 -42
  99. package/lib/common/build/createPackageVersion.js +0 -198
  100. package/lib/common/build/createPackageVersion.js.map +0 -1
  101. package/lib/common/build/createScratchOrg.d.ts +0 -14
  102. package/lib/common/build/createScratchOrg.js +0 -192
  103. package/lib/common/build/createScratchOrg.js.map +0 -1
  104. package/lib/common/build/deleteScratchOrg.d.ts +0 -13
  105. package/lib/common/build/deleteScratchOrg.js +0 -62
  106. package/lib/common/build/deleteScratchOrg.js.map +0 -1
  107. package/lib/common/build/deltaRunner.d.ts +0 -73
  108. package/lib/common/build/deltaRunner.js +0 -109
  109. package/lib/common/build/deltaRunner.js.map +0 -1
  110. package/lib/common/build/determinePackageChanges.d.ts +0 -11
  111. package/lib/common/build/determinePackageChanges.js +0 -90
  112. package/lib/common/build/determinePackageChanges.js.map +0 -1
  113. package/lib/common/build/devHubs.d.ts +0 -12
  114. package/lib/common/build/devHubs.js +0 -42
  115. package/lib/common/build/devHubs.js.map +0 -1
  116. package/lib/common/build/flexipageDelta.d.ts +0 -18
  117. package/lib/common/build/flexipageDelta.js +0 -35
  118. package/lib/common/build/flexipageDelta.js.map +0 -1
  119. package/lib/common/build/flowDelta.d.ts +0 -17
  120. package/lib/common/build/flowDelta.js +0 -34
  121. package/lib/common/build/flowDelta.js.map +0 -1
  122. package/lib/common/build/installDependencies.d.ts +0 -10
  123. package/lib/common/build/installDependencies.js +0 -39
  124. package/lib/common/build/installDependencies.js.map +0 -1
  125. package/lib/common/build/lwcJest.d.ts +0 -25
  126. package/lib/common/build/lwcJest.js +0 -126
  127. package/lib/common/build/lwcJest.js.map +0 -1
  128. package/lib/common/build/publishUtamPageObjects.d.ts +0 -51
  129. package/lib/common/build/publishUtamPageObjects.js +0 -284
  130. package/lib/common/build/publishUtamPageObjects.js.map +0 -1
  131. package/lib/common/build/pushScratch.d.ts +0 -9
  132. package/lib/common/build/pushScratch.js +0 -60
  133. package/lib/common/build/pushScratch.js.map +0 -1
  134. package/lib/common/build/scratchOrgAuth.d.ts +0 -18
  135. package/lib/common/build/scratchOrgAuth.js +0 -52
  136. package/lib/common/build/scratchOrgAuth.js.map +0 -1
  137. package/lib/common/build/scratchOrgInfo.d.ts +0 -14
  138. package/lib/common/build/scratchOrgInfo.js +0 -21
  139. package/lib/common/build/scratchOrgInfo.js.map +0 -1
  140. package/lib/common/build/skipGuard.d.ts +0 -8
  141. package/lib/common/build/skipGuard.js +0 -42
  142. package/lib/common/build/skipGuard.js.map +0 -1
  143. package/lib/common/build/testScratch.d.ts +0 -15
  144. package/lib/common/build/testScratch.js +0 -42
  145. package/lib/common/build/testScratch.js.map +0 -1
  146. package/lib/common/build/utamPageObjects.d.ts +0 -151
  147. package/lib/common/build/utamPageObjects.js +0 -259
  148. package/lib/common/build/utamPageObjects.js.map +0 -1
  149. package/lib/common/build/versionTagFormat.d.ts +0 -57
  150. package/lib/common/build/versionTagFormat.js +0 -194
  151. package/lib/common/build/versionTagFormat.js.map +0 -1
  152. package/lib/common/deploy/deployCommon.d.ts +0 -105
  153. package/lib/common/deploy/deployCommon.js +0 -358
  154. package/lib/common/deploy/deployCommon.js.map +0 -1
  155. package/lib/common/deploy/deployHappySoup.d.ts +0 -56
  156. package/lib/common/deploy/deployHappySoup.js +0 -160
  157. package/lib/common/deploy/deployHappySoup.js.map +0 -1
  158. package/lib/common/deploy/deployProject.d.ts +0 -27
  159. package/lib/common/deploy/deployProject.js +0 -114
  160. package/lib/common/deploy/deployProject.js.map +0 -1
  161. package/lib/common/deploy/runDeployStage.d.ts +0 -16
  162. package/lib/common/deploy/runDeployStage.js +0 -65
  163. package/lib/common/deploy/runDeployStage.js.map +0 -1
  164. package/lib/common/deploy/validate.d.ts +0 -11
  165. package/lib/common/deploy/validate.js +0 -54
  166. package/lib/common/deploy/validate.js.map +0 -1
  167. package/lib/common/env.d.ts +0 -9
  168. package/lib/common/env.js +0 -47
  169. package/lib/common/env.js.map +0 -1
  170. package/lib/common/exec/sfCli.d.ts +0 -27
  171. package/lib/common/exec/sfCli.js +0 -50
  172. package/lib/common/exec/sfCli.js.map +0 -1
  173. package/lib/common/flags/env.d.ts +0 -44
  174. package/lib/common/flags/env.js +0 -81
  175. package/lib/common/flags/env.js.map +0 -1
  176. package/lib/common/git.d.ts +0 -32
  177. package/lib/common/git.js +0 -106
  178. package/lib/common/git.js.map +0 -1
  179. package/lib/common/happySoup/resolveOriginProject.d.ts +0 -22
  180. package/lib/common/happySoup/resolveOriginProject.js +0 -61
  181. package/lib/common/happySoup/resolveOriginProject.js.map +0 -1
  182. package/lib/common/logger.d.ts +0 -10
  183. package/lib/common/logger.js +0 -33
  184. package/lib/common/logger.js.map +0 -1
  185. package/lib/common/notify/buildNotification.d.ts +0 -53
  186. package/lib/common/notify/buildNotification.js +0 -176
  187. package/lib/common/notify/buildNotification.js.map +0 -1
  188. package/lib/common/notify/getCommitStories.d.ts +0 -30
  189. package/lib/common/notify/getCommitStories.js +0 -70
  190. package/lib/common/notify/getCommitStories.js.map +0 -1
  191. package/lib/common/notify/getRemoteCommitStories.d.ts +0 -10
  192. package/lib/common/notify/getRemoteCommitStories.js +0 -45
  193. package/lib/common/notify/getRemoteCommitStories.js.map +0 -1
  194. package/lib/common/notify/happySoupNotification.d.ts +0 -26
  195. package/lib/common/notify/happySoupNotification.js +0 -139
  196. package/lib/common/notify/happySoupNotification.js.map +0 -1
  197. package/lib/common/notify/projectNotification.d.ts +0 -46
  198. package/lib/common/notify/projectNotification.js +0 -177
  199. package/lib/common/notify/projectNotification.js.map +0 -1
  200. package/lib/common/notify/renderTemplate.d.ts +0 -3
  201. package/lib/common/notify/renderTemplate.js +0 -24
  202. package/lib/common/notify/renderTemplate.js.map +0 -1
  203. package/lib/common/notify/sendNotification.d.ts +0 -2
  204. package/lib/common/notify/sendNotification.js +0 -50
  205. package/lib/common/notify/sendNotification.js.map +0 -1
  206. package/lib/common/notify/templates.d.ts +0 -13
  207. package/lib/common/notify/templates.js +0 -118
  208. package/lib/common/notify/templates.js.map +0 -1
  209. package/lib/common/schemas/deployConfig.d.ts +0 -25
  210. package/lib/common/schemas/deployConfig.js +0 -55
  211. package/lib/common/schemas/deployConfig.js.map +0 -1
  212. package/lib/common/schemas/deployProgress.d.ts +0 -33
  213. package/lib/common/schemas/deployProgress.js +0 -46
  214. package/lib/common/schemas/deployProgress.js.map +0 -1
  215. package/lib/common/schemas/deployRules.d.ts +0 -34
  216. package/lib/common/schemas/deployRules.js +0 -40
  217. package/lib/common/schemas/deployRules.js.map +0 -1
  218. package/lib/common/sfApex.d.ts +0 -22
  219. package/lib/common/sfApex.js +0 -169
  220. package/lib/common/sfApex.js.map +0 -1
  221. package/lib/common/sfAuth.d.ts +0 -19
  222. package/lib/common/sfAuth.js +0 -78
  223. package/lib/common/sfAuth.js.map +0 -1
  224. package/lib/common/sfConfig.d.ts +0 -23
  225. package/lib/common/sfConfig.js +0 -82
  226. package/lib/common/sfConfig.js.map +0 -1
  227. package/lib/common/sfPackages.d.ts +0 -31
  228. package/lib/common/sfPackages.js +0 -143
  229. package/lib/common/sfPackages.js.map +0 -1
  230. package/lib/common/sfPlugins.d.ts +0 -11
  231. package/lib/common/sfPlugins.js +0 -134
  232. package/lib/common/sfPlugins.js.map +0 -1
  233. package/lib/common/sfdxDependabot/dependabotRun.d.ts +0 -95
  234. package/lib/common/sfdxDependabot/dependabotRun.js +0 -287
  235. package/lib/common/sfdxDependabot/dependabotRun.js.map +0 -1
  236. package/lib/common/sfdxDependabot/updater.d.ts +0 -14
  237. package/lib/common/sfdxDependabot/updater.js +0 -94
  238. package/lib/common/sfdxDependabot/updater.js.map +0 -1
  239. package/lib/config/defaultDeploymentPlugins.d.ts +0 -2
  240. package/lib/config/defaultDeploymentPlugins.js +0 -18
  241. package/lib/config/defaultDeploymentPlugins.js.map +0 -1
  242. package/lib/config/trustedPlugins.d.ts +0 -2
  243. package/lib/config/trustedPlugins.js +0 -18
  244. package/lib/config/trustedPlugins.js.map +0 -1
@@ -1,192 +0,0 @@
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 { promises as fs } from 'node:fs';
17
- import { getDefaultPackageDirectory, readSfdxProject } from '@simplysf/simply-core';
18
- import { runSf, runSfJson } from '../exec/sfCli.js';
19
- import { logger } from '../logger.js';
20
- import { resolveDevHubs } from './devHubs.js';
21
- async function assignPermissionSets(permissionSets) {
22
- if (permissionSets.length === 0) {
23
- return;
24
- }
25
- logger.info('Assigning permission sets...');
26
- const args = ['org', 'assign', 'permset', '--json', ...permissionSets.flatMap((ps) => ['--name', ps])];
27
- try {
28
- const result = await runSfJson(args);
29
- if (result.status !== 0) {
30
- throw new Error(`Permission set assignment failed: ${JSON.stringify(result.failures)}`);
31
- }
32
- logger.success('Permission sets assigned successfully.');
33
- }
34
- catch (e) {
35
- logger.error('Error assigning permission sets:', e.message);
36
- throw e;
37
- }
38
- }
39
- async function assignPermissionSetLicenses(licenses) {
40
- if (licenses.length === 0) {
41
- return;
42
- }
43
- logger.info('Assigning permission set licenses...');
44
- const args = ['org', 'assign', 'permset-license', '--json', ...licenses.flatMap((psl) => ['--name', psl])];
45
- try {
46
- const result = await runSfJson(args);
47
- if (result.status !== 0) {
48
- throw new Error(`Permission set license assignment failed: ${JSON.stringify(result.failures)}`);
49
- }
50
- logger.success('Permission set licenses assigned successfully.');
51
- }
52
- catch (e) {
53
- logger.error('Error assigning permission set licenses:', e.message);
54
- throw e;
55
- }
56
- }
57
- async function assignPermissions(sfdxProjectJson) {
58
- const defaultPackageDir = getDefaultPackageDirectory(sfdxProjectJson);
59
- const access = defaultPackageDir?.packageMetadataAccess;
60
- if (!access) {
61
- return;
62
- }
63
- await assignPermissionSets(access.permissionSets ?? []);
64
- await assignPermissionSetLicenses(access.permissionSetLicenses ?? []);
65
- }
66
- async function checkHubRemainingScratchOrgs(hubUsername) {
67
- const limits = await runSfJson([
68
- 'org',
69
- 'list',
70
- 'limits',
71
- '--target-org',
72
- hubUsername,
73
- '--json',
74
- ]);
75
- return limits.result.find((l) => l.name === 'DailyScratchOrgs')?.remaining;
76
- }
77
- async function trySetDefaultCountry() {
78
- try {
79
- await runSf(['data', 'query', '--query', 'SELECT CountryCode FROM User', '--json']);
80
- logger.info('State/Country picklists detected. Setting default country for user...');
81
- await runSf([
82
- 'data',
83
- 'update',
84
- 'record',
85
- '--sobject',
86
- 'User',
87
- '--where',
88
- "Name='User User'",
89
- '--values',
90
- "CountryCode='US'",
91
- ]);
92
- logger.success('Default country set.');
93
- }
94
- catch {
95
- logger.info('State/Country picklists not detected. Skipping default country update.');
96
- }
97
- }
98
- async function attemptScratchOrgCreation(hub, definitionFile, duration) {
99
- const remaining = await checkHubRemainingScratchOrgs(hub.username);
100
- if (remaining === undefined || remaining <= 0) {
101
- logger.warn(`Dev Hub ${hub.alias} has no remaining scratch orgs. Skipping.`);
102
- return undefined;
103
- }
104
- logger.info(`Attempting to create scratch org with Dev Hub ${hub.alias} (${remaining} remaining).`);
105
- const { stdout } = await runSf([
106
- 'org',
107
- 'create',
108
- 'scratch',
109
- '--target-dev-hub',
110
- hub.username,
111
- '--duration-days',
112
- duration,
113
- '--definition-file',
114
- definitionFile,
115
- '--wait',
116
- '20',
117
- '--set-default',
118
- '--json',
119
- ]);
120
- const createResult = JSON.parse(stdout).result;
121
- await fs.writeFile('SCRATCH_ORG_INFO.json', JSON.stringify(createResult, null, 2));
122
- logger.success(`Scratch org created successfully using Dev Hub ${hub.alias}.`);
123
- return createResult;
124
- }
125
- function isScratchOrgLimitError(message) {
126
- return (message.includes('The signup request failed because this organization has reached its daily scratch org signup limit') || message.includes('LIMIT_EXCEEDED'));
127
- }
128
- function extractScratchOrgErrorMessage(error) {
129
- const err = error;
130
- let errorMessage = err.message;
131
- if (err.stdout) {
132
- try {
133
- const errorResult = JSON.parse(err.stdout);
134
- errorMessage = errorResult.message ?? errorMessage;
135
- logger.error(errorMessage);
136
- if (errorResult.stack) {
137
- logger.error(errorResult.stack);
138
- }
139
- }
140
- catch {
141
- logger.error(err.stdout);
142
- }
143
- }
144
- else {
145
- logger.error(err.message);
146
- }
147
- return errorMessage;
148
- }
149
- /**
150
- * Creates a scratch org, trying each Dev Hub in order until one has remaining daily capacity.
151
- * Writes `SCRATCH_ORG_INFO.json`, best-effort sets a default country, and assigns permission
152
- * sets/licenses declared in the default package directory's `packageMetadataAccess`.
153
- *
154
- * Every Dev Hub alias passed in must already be authenticated by the calling pipeline.
155
- */
156
- export async function createScratchOrg(options, devHubAliases) {
157
- const devHubs = await resolveDevHubs(devHubAliases);
158
- const sfdxProjectJson = await readSfdxProject();
159
- const defaultPackageDir = getDefaultPackageDirectory(sfdxProjectJson);
160
- const definitionFile = defaultPackageDir?.definitionFile ?? options.scratchDefinitionFile;
161
- if (!definitionFile) {
162
- throw new Error('You must specify a definitionFile in the default package directory in sfdx-project.json');
163
- }
164
- const duration = options.scratchDurationDays ?? '1';
165
- for (const hub of devHubs) {
166
- try {
167
- // eslint-disable-next-line no-await-in-loop -- each Dev Hub is only attempted after the previous one is exhausted
168
- const createResult = await attemptScratchOrgCreation(hub, definitionFile, duration);
169
- if (!createResult) {
170
- continue;
171
- }
172
- // eslint-disable-next-line no-await-in-loop
173
- await trySetDefaultCountry();
174
- // eslint-disable-next-line no-await-in-loop
175
- await assignPermissions(sfdxProjectJson);
176
- return createResult;
177
- }
178
- catch (error) {
179
- logger.error(`Scratch org creation failed with Dev Hub ${hub.alias}:`);
180
- const errorMessage = extractScratchOrgErrorMessage(error);
181
- if (isScratchOrgLimitError(errorMessage)) {
182
- logger.warn(`Dev Hub ${hub.alias} reached its daily limit. Trying next Dev Hub...`);
183
- continue;
184
- }
185
- throw new Error(`Scratch org creation failed with a non-recoverable error using Dev Hub ${hub.alias}.`, {
186
- cause: error,
187
- });
188
- }
189
- }
190
- throw new Error('Scratch org creation failed for all available Dev Hubs.');
191
- }
192
- //# sourceMappingURL=createScratchOrg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createScratchOrg.js","sourceRoot":"","sources":["../../../src/common/build/createScratchOrg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAoB,MAAM,uBAAuB,CAAC;AACtG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AAIn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AiB,EAAE,cAAc,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAC1F,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,yFAAyF,CAAC,CAAC;IAC7G,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,mBAAmB,IAAI,GAAG,CAAC;IAEpD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,kHAAkH;YAClH,MAAM,YAAY,GAAG,MAAM,yBAAyB,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;YACpF,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,SAAS;YACX,CAAC;YACD,4CAA4C;YAC5C,MAAM,oBAAoB,EAAE,CAAC;YAC7B,4CAA4C;YAC5C,MAAM,iBAAiB,CAAC,eAAe,CAAC,CAAC;YACzC,OAAO,YAAY,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,4CAA4C,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;YACvE,MAAM,YAAY,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;YAC1D,IAAI,sBAAsB,CAAC,YAAY,CAAC,EAAE,CAAC;gBACzC,MAAM,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,KAAK,kDAAkD,CAAC,CAAC;gBACpF,SAAS;YACX,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,0EAA0E,GAAG,CAAC,KAAK,GAAG,EAAE;gBACtG,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;AAC7E,CAAC"}
@@ -1,13 +0,0 @@
1
- export type DeleteScratchOrgOptions = {
2
- /** Required only when the Dev Hub and/or scratch org were JWT-authenticated (no refresh token available). */
3
- jwtKeyFile?: string;
4
- debug?: boolean;
5
- };
6
- /**
7
- * Authenticates to the Dev Hub that owns the scratch org and deletes it.
8
- *
9
- * `devHubAlias` must already be authenticated by the calling pipeline. Deletion failures are
10
- * logged, not thrown, matching the original behavior: a scratch org that fails to delete just
11
- * needs manual cleanup later, and shouldn't fail an otherwise-successful pipeline run.
12
- */
13
- export declare function deleteScratchOrg(options: DeleteScratchOrgOptions, devHubAlias: string): Promise<void>;
@@ -1,62 +0,0 @@
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 { runSf } from '../exec/sfCli.js';
17
- import { logger } from '../logger.js';
18
- import { authenticateOrg } from '../sfAuth.js';
19
- import { resolveDevHubs } from './devHubs.js';
20
- import { ensureScratchOrgSession } from './scratchOrgAuth.js';
21
- import { readScratchOrgInfo } from './scratchOrgInfo.js';
22
- /**
23
- * Authenticates to the Dev Hub that owns the scratch org and deletes it.
24
- *
25
- * `devHubAlias` must already be authenticated by the calling pipeline. Deletion failures are
26
- * logged, not thrown, matching the original behavior: a scratch org that fails to delete just
27
- * needs manual cleanup later, and shouldn't fail an otherwise-successful pipeline run.
28
- */
29
- export async function deleteScratchOrg(options, devHubAlias) {
30
- logger.info('Deleting scratch org...');
31
- try {
32
- const scratchOrgInfo = await readScratchOrgInfo();
33
- const [hub] = await resolveDevHubs([devHubAlias]);
34
- if (hub.username !== scratchOrgInfo.authFields.devHubUsername) {
35
- throw new Error(`--dev-hub ${devHubAlias} (${hub.username}) does not match the Dev Hub that created this scratch org (${scratchOrgInfo.authFields.devHubUsername ?? 'unknown'}).`);
36
- }
37
- if (hub.privateKeyFile) {
38
- // JWT-authenticated Dev Hub: no refresh token exists, so re-mint a session explicitly.
39
- // A refresh-token-authenticated Dev Hub needs no action here — @salesforce/core refreshes
40
- // its already-persisted session automatically.
41
- await authenticateOrg({
42
- username: hub.username,
43
- clientId: hub.clientId,
44
- instanceUrl: hub.instanceUrl,
45
- jwtKeyFile: hub.privateKeyFile,
46
- setDefaultDevHub: true,
47
- debug: options.debug,
48
- });
49
- }
50
- await ensureScratchOrgSession(scratchOrgInfo.authFields, {
51
- jwtKeyFile: options.jwtKeyFile,
52
- setDefault: true,
53
- debug: options.debug,
54
- });
55
- await runSf(['org', 'delete', 'scratch', '--no-prompt'], { stdio: 'inherit' });
56
- logger.success('Scratch org deleted.');
57
- }
58
- catch (e) {
59
- logger.error('Failed to delete scratch org. It may need to be deleted manually.', e.message);
60
- }
61
- }
62
- //# sourceMappingURL=deleteScratchOrg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteScratchOrg.js","sourceRoot":"","sources":["../../../src/common/build/deleteScratchOrg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAQzD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAgC,EAAE,WAAmB;IAC1F,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,MAAM,kBAAkB,EAAE,CAAC;QAClD,MAAM,CAAC,GAAG,CAAC,G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Each ships a diff binary plus one
4
- * reporter binary per platform, named `<binary>-<provider kind>`.
5
- */
6
- export type DeltaTool = {
7
- /** The diff binary, e.g. `flow-delta`. */
8
- binary: string;
9
- /** Glob the diff binary scans. */
10
- path: string;
11
- /** Output directory used when the caller doesn't name one. */
12
- defaultOut: string;
13
- /** Sentence-case label for log lines, e.g. `Flow`. */
14
- label: string;
15
- };
16
- export declare const FLOW_DELTA: DeltaTool;
17
- export declare const FLEXIPAGE_DELTA: DeltaTool;
18
- /**
19
- * Pipeline context handed to the reporter. Everything is optional: each reporter falls back to its
20
- * platform's own CI environment variables, which the child process inherits, for anything we don't
21
- * pass explicitly.
22
- */
23
- export type DeltaReporterContext = {
24
- /** Which platform's reporter to run. Defaults to `gitlab`. */
25
- vcsProvider?: VcsProviderKind;
26
- /** Hostname of the VCS instance, used to derive the reporter's `--api-url`. */
27
- vcsHost?: string;
28
- /** Token the reporter authenticates with when posting the diff. */
29
- projectAccessToken?: string;
30
- commitSha?: string;
31
- /** GitLab: numeric project ID. */
32
- ciProjectId?: string;
33
- /** GitLab: merge request internal ID. */
34
- ciMergeRequestIid?: string;
35
- /** GitHub: `owner/repo`. */
36
- ciRepository?: string;
37
- /** GitHub: pull request number. */
38
- ciPullRequestNumber?: string;
39
- /** GitHub: Actions run ID, used to build artifact links. */
40
- ciRunId?: string;
41
- /** GitHub: server URL, for non-github.com instances. */
42
- ciServerUrl?: string;
43
- };
44
- export type RunDeltaOptions = DeltaReporterContext & {
45
- from: string;
46
- to: string;
47
- out?: string;
48
- debug?: boolean;
49
- };
50
- /**
51
- * Builds the reporter argv for the selected platform. The two reporters take different context
52
- * flags — GitLab addresses a merge request by project ID and IID, GitHub a pull request by
53
- * `owner/repo` and number — which is the whole reason this is routed through the VCS choice.
54
- */
55
- export declare function buildReporterArgs(kind: VcsProviderKind, out: string, context: DeltaReporterContext): string[];
56
- /**
57
- * Runs a delta tool: the diff binary over the `from..to` range, then the reporter binary for the
58
- * selected platform to post the result back to the change request. Does not catch its own errors;
59
- * callers decide how to handle them.
60
- */
61
- export declare function runDelta(tool: DeltaTool, options: RunDeltaOptions): Promise<void>;
62
- export type GenerateDiffOptions = RunDeltaOptions & {
63
- disabled?: boolean;
64
- };
65
- export type GenerateDiffResult = {
66
- skipped: boolean;
67
- success: boolean;
68
- };
69
- /**
70
- * Action-handler wrapper around `runDelta`: checks the job-level skip flag, then runs the delta and
71
- * logs (rather than throws) on failure, since a diff-posting step shouldn't fail the build.
72
- */
73
- export declare function generateDiff(tool: DeltaTool, options: GenerateDiffOptions): Promise<GenerateDiffResult>;
@@ -1,109 +0,0 @@
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 { execa } from 'execa';
17
- import { createVcsProvider } from '@simplysf/simply-cicd-core';
18
- import { logger } from '../logger.js';
19
- import { installFlowDeltaPlugin } from '../sfPlugins.js';
20
- export const FLOW_DELTA = {
21
- binary: 'flow-delta',
22
- path: '**/*.flow-meta.xml',
23
- defaultOut: 'flow-delta-out',
24
- label: 'Flow',
25
- };
26
- export const FLEXIPAGE_DELTA = {
27
- binary: 'flexipage-delta',
28
- path: '**/*.flexipage-meta.xml',
29
- defaultOut: 'flexipage-delta-out',
30
- label: 'Flexipage',
31
- };
32
- /** Appends `--flag value` only when a value is present, so the reporter's env fallbacks still apply. */
33
- function pushIfPresent(args, flag, value) {
34
- if (value) {
35
- args.push(flag, value);
36
- }
37
- }
38
- /**
39
- * Builds the reporter argv for the selected platform. The two reporters take different context
40
- * flags — GitLab addresses a merge request by project ID and IID, GitHub a pull request by
41
- * `owner/repo` and number — which is the whole reason this is routed through the VCS choice.
42
- */
43
- export function buildReporterArgs(kind, out, context) {
44
- const args = ['--in', out];
45
- pushIfPresent(args, '--token', context.projectAccessToken);
46
- pushIfPresent(args, '--commit-sha', context.commitSha);
47
- // Ask the provider where its API lives rather than rebuilding the URL here.
48
- if (context.projectAccessToken) {
49
- const { apiUrl } = createVcsProvider(kind, { host: context.vcsHost, token: context.projectAccessToken });
50
- args.push('--api-url', apiUrl);
51
- }
52
- if (kind === 'github') {
53
- pushIfPresent(args, '--repo', context.ciRepository);
54
- pushIfPresent(args, '--pr', context.ciPullRequestNumber);
55
- pushIfPresent(args, '--run-id', context.ciRunId);
56
- pushIfPresent(args, '--server-url', context.ciServerUrl);
57
- }
58
- else {
59
- pushIfPresent(args, '--project-id', context.ciProjectId);
60
- pushIfPresent(args, '--mr-iid', context.ciMergeRequestIid);
61
- }
62
- return args;
63
- }
64
- /**
65
- * Runs a delta tool: the diff binary over the `from..to` range, then the reporter binary for the
66
- * selected platform to post the result back to the change request. Does not catch its own errors;
67
- * callers decide how to handle them.
68
- */
69
- export async function runDelta(tool, options) {
70
- const { from, to, out = tool.defaultOut, debug = false, vcsProvider = 'gitlab' } = options;
71
- if (!from || !to) {
72
- throw new Error('Missing "from" or "to" commit SHA. Provide --from/--to arguments.');
73
- }
74
- await installFlowDeltaPlugin(debug);
75
- await execa(tool.binary, ['--repo', '.', '--from', from, '--to', to, '--path', tool.path, '--changed-only', '--out', out, '--json'], { stdio: 'inherit' });
76
- await execa(`${tool.binary}-${vcsProvider}`, buildReporterArgs(vcsProvider, out, options), { stdio: 'inherit' });
77
- }
78
- function extractErrorMessage(error, tool) {
79
- if (error instanceof Error && error.message) {
80
- return error.message;
81
- }
82
- if (typeof error === 'string') {
83
- return error;
84
- }
85
- return `Unknown error running ${tool.binary}`;
86
- }
87
- /**
88
- * Action-handler wrapper around `runDelta`: checks the job-level skip flag, then runs the delta and
89
- * logs (rather than throws) on failure, since a diff-posting step shouldn't fail the build.
90
- */
91
- export async function generateDiff(tool, options) {
92
- const lowerLabel = tool.label.toLowerCase();
93
- if (options.disabled) {
94
- logger.info(`${tool.label} diff generation is disabled. Skipping.`);
95
- return { skipped: true, success: false };
96
- }
97
- logger.info(`Generating ${lowerLabel} diff using ${tool.binary}...`);
98
- try {
99
- await runDelta(tool, options);
100
- logger.success(`${tool.label} diff generation completed.`);
101
- return { skipped: false, success: true };
102
- }
103
- catch (error) {
104
- logger.error(`${tool.label} diff generation failed.`);
105
- logger.error(extractErrorMessage(error, tool));
106
- return { skipped: false, success: false };
107
- }
108
- }
109
- //# sourceMappingURL=deltaRunner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deltaRunner.js","sourceRoot":"","sources":["../../../src/common/build/deltaRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAwB,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAiBzD,MAAM,CAAC,MAAM,UAAU,GAAc;IACnC,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,oBAAoB;IAC1B,UAAU,EAAE,gBAAgB;IAC5B,KAAK,EAAE,MAAM;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAc;IACxC,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,yBAAyB;IAC/B,UAAU,EAAE,qBAAqB;IACjC,KAAK,EAAE,WAAW;CACnB,CAAC;AAoCF,wGAAwG;AACxG,SAAS,aAAa,CAAC,IAAc,EAAE,IAAY,EAAE,KAAyB;IAC5E,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;AACH,CAAC;AAED;;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IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,yCAAyC,CAAC,CAAC;QACpE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,cAAc,UAAU,eAAe,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IACrE,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,6BAA6B,CAAC,CAAC;QAC3D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,0BAA0B,CAAC,CAAC;QACtD,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAC/C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -1,11 +0,0 @@
1
- export type DeterminePackageChangesOptions = {
2
- out?: string;
3
- debug?: boolean;
4
- };
5
- /**
6
- * Detects whether any files under the default package directory (or `sfdx-project.json` itself)
7
- * have changed since the last release tag, and writes the result as a dotenv file. Any failure
8
- * during detection (missing/invalid sfdx-project.json, git errors) defaults to `PACKAGE_CHANGED=TRUE`
9
- * so a build never silently skips work it should have done.
10
- */
11
- export declare function determinePackageChanges(options: DeterminePackageChangesOptions): Promise<void>;
@@ -1,90 +0,0 @@
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 { promises as fs } from 'node:fs';
17
- import { execa } from 'execa';
18
- import { getDefaultPackageDirectory, readSfdxProject } from '@simplysf/simply-core';
19
- import { logger } from '../logger.js';
20
- import { VersionTagFormat } from './versionTagFormat.js';
21
- async function resolveLastTag(tagMatchPattern) {
22
- try {
23
- const { stdout } = await execa('git', ['describe', '--tags', '--abbrev=0', '--match', tagMatchPattern]);
24
- return stdout.trim();
25
- }
26
- catch {
27
- logger.info(`No previous release tag (${tagMatchPattern}) found. A full package build is required.`);
28
- return '';
29
- }
30
- }
31
- async function detectChangesSincePackagePath(packagePath, lastTag) {
32
- logger.info(`Running git diff on path: "${packagePath}" and "sfdx-project.json"`);
33
- const { stdout: diffOutput } = await execa('git', [
34
- 'diff',
35
- '--name-only',
36
- lastTag,
37
- 'HEAD',
38
- '--',
39
- packagePath,
40
- 'sfdx-project.json',
41
- ]);
42
- if (diffOutput.trim().length > 0) {
43
- logger.info(`Changes detected in package directory or project config:\n${diffOutput}`);
44
- return true;
45
- }
46
- logger.success('No changes detected in package directory or project config.');
47
- return false;
48
- }
49
- async function detectPackageChanges() {
50
- const projectJson = await readSfdxProject();
51
- const defaultDir = getDefaultPackageDirectory(projectJson);
52
- if (!defaultDir?.path) {
53
- logger.warn('No default package directory found in sfdx-project.json. Defaulting to PACKAGE_CHANGED=FALSE.');
54
- return { packageChanged: false, lastTag: '' };
55
- }
56
- logger.info('Fetching remote tags...');
57
- await execa('git', ['fetch', '--tags']);
58
- const tagMatchPattern = VersionTagFormat.fromProject(projectJson).matchPattern(defaultDir.versionNumber);
59
- const lastTag = await resolveLastTag(tagMatchPattern);
60
- if (!lastTag) {
61
- return { packageChanged: true, lastTag: '' };
62
- }
63
- logger.info(`Last package tag found: ${lastTag}`);
64
- const packageChanged = await detectChangesSincePackagePath(defaultDir.path, lastTag);
65
- return { packageChanged, lastTag };
66
- }
67
- /**
68
- * Detects whether any files under the default package directory (or `sfdx-project.json` itself)
69
- * have changed since the last release tag, and writes the result as a dotenv file. Any failure
70
- * during detection (missing/invalid sfdx-project.json, git errors) defaults to `PACKAGE_CHANGED=TRUE`
71
- * so a build never silently skips work it should have done.
72
- */
73
- export async function determinePackageChanges(options) {
74
- logger.info('Determining package changes...');
75
- const outFile = options.out ?? 'changes.env';
76
- let packageChanged;
77
- let lastTag;
78
- try {
79
- ({ packageChanged, lastTag } = await detectPackageChanges());
80
- }
81
- catch (err) {
82
- logger.error(`Error during change detection: ${err.message}. Defaulting to full build.`);
83
- packageChanged = true;
84
- lastTag = '';
85
- }
86
- const envContent = `PACKAGE_CHANGED=${packageChanged ? 'TRUE' : 'FALSE'}\nLAST_TAG=${lastTag}\n`;
87
- await fs.writeFile(outFile, envContent, 'utf-8');
88
- logger.success(`Wrote change detection results to ${outFile}`);
89
- }
90
- //# sourceMappingURL=determinePackageChanges.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"determinePackageChanges.js","sourceRoot":"","sources":["../../../src/common/build/determinePackageChanges.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,KAAK,UAAU,cAAc,CAAC,eAAuB;IACnD,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,SA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,CAAC,CAAC;AACjE,CAAC"}
@@ -1,12 +0,0 @@
1
- export type ResolvedDevHub = {
2
- /** The alias (or username) the caller passed in. */
3
- alias: string;
4
- /** The Dev Hub's canonical username, resolved from the alias. */
5
- username: string;
6
- instanceUrl: string;
7
- clientId?: string;
8
- /** Only present when the Dev Hub was JWT-authenticated. */
9
- privateKeyFile?: string;
10
- };
11
- /** Resolves multiple Dev Hub aliases in parallel. Each must already be authenticated. */
12
- export declare function resolveDevHubs(aliases: string[]): Promise<ResolvedDevHub[]>;
@@ -1,42 +0,0 @@
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 { AuthInfo } from '@salesforce/core';
17
- /**
18
- * Resolves a Dev Hub alias to its already-authenticated config. `simply-cicd` never authenticates
19
- * Dev Hubs itself — the alias must already be authenticated (by the calling pipeline, however it
20
- * chooses to do that: JWT, web, SFDX auth-url, or Client Credentials) before this runs.
21
- *
22
- * `clientId`/`instanceUrl`/`privateKey` are all stored in plaintext in a Dev Hub's `AuthInfo` (only
23
- * token/password/secret-named fields are encrypted at rest), so no decryption is needed to read them.
24
- *
25
- * @throws {SfError} `NamedOrgNotFoundError` if the alias hasn't already been authenticated.
26
- */
27
- async function resolveDevHub(alias) {
28
- const authInfo = await AuthInfo.create({ username: alias });
29
- const fields = authInfo.getFields();
30
- return {
31
- alias,
32
- username: authInfo.getUsername(),
33
- instanceUrl: fields.instanceUrl ?? '',
34
- clientId: fields.clientId,
35
- privateKeyFile: fields.privateKey,
36
- };
37
- }
38
- /** Resolves multiple Dev Hub aliases in parallel. Each must already be authenticated. */
39
- export async function resolveDevHubs(aliases) {
40
- return Promise.all(aliases.map(resolveDevHub));
41
- }
42
- //# sourceMappingURL=devHubs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"devHubs.js","sourceRoot":"","sources":["../../../src/common/build/devHubs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAa5C;;;;;;;;;GASG;AACH,KAAK,UAAU,aAAa,CAAC,KAAa;IACxC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;IAEpC,OAAO;QACL,KAAK;QACL,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE;QAChC,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;QACrC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,cAAc,EAAE,MAAM,CAAC,UAAU;KAClC,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAiB;IACpD,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;AACjD,CAAC"}