@simplysf/simply-cicd 0.23.0 → 0.24.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.
Files changed (244) hide show
  1. package/README.md +40 -39
  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 -1
  31. package/lib/commands/simply/cicd/build/publish-utam-page-objects.js +1 -1
  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.create-scratch.md +1 -1
  87. package/oclif.manifest.json +2 -2
  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 -50
  129. package/lib/common/build/publishUtamPageObjects.js +0 -283
  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 -143
  147. package/lib/common/build/utamPageObjects.js +0 -245
  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,143 +0,0 @@
1
- import { type SfdxProject } from '@simplysf/simply-core';
2
- import { VersionTagFormat } from './versionTagFormat.js';
3
- /** The dotenv key `create-package-version` and `create-fallback-tag` both write their `04t` under. */
4
- export declare const SUBSCRIBER_PACKAGE_VERSION_ID_KEY = "SUBSCRIBER_PACKAGE_VERSION_ID";
5
- /** The dotenv keys this feature writes, for a downstream UI-test job to install by. */
6
- export declare const UTAM_PACKAGE_KEY = "UTAM_PAGE_OBJECTS_PACKAGE";
7
- export declare const UTAM_VERSION_KEY = "UTAM_PAGE_OBJECTS_VERSION";
8
- /** The compiler's own default mask, restated so the generated config never depends on it drifting. */
9
- export declare const PAGE_OBJECTS_FILE_MASK: string[];
10
- /** `plugins.simply.utam` in `sfdx-project.json`. Every field is optional. */
11
- export type UtamPluginConfig = {
12
- /** npm package name to publish under. Required unless `--npm-package-name` is passed. */
13
- packageName?: string;
14
- /** UTAM compiler type-alias map, passed through to the generated compiler config. */
15
- alias?: Record<string, string>;
16
- /** Peer dependencies to merge into the generated package, e.g. `salesforce-pageobjects`. */
17
- peerDependencies?: Record<string, string>;
18
- /** Path to a compiler config whose keys the command doesn't own (`profiles`, `lint`, …). */
19
- compilerConfig?: string;
20
- };
21
- /** @returns `plugins.simply.utam`, or an empty object when the project declares none. */
22
- export declare function readUtamPluginConfig(project: SfdxProject): UtamPluginConfig;
23
- /**
24
- * Reduce a git tag suffix to something semver accepts as a prerelease identifier.
25
- *
26
- * Semver's prerelease alphabet is `[0-9A-Za-z-]`; a branch name's `/` and `.` are the common
27
- * offenders, so each run of anything else collapses to a single hyphen.
28
- */
29
- export declare function sanitizePrereleaseId(raw: string): string;
30
- /** @returns The git tag `create-package-version` recorded this package version under. */
31
- export declare function toVersionTag(salesforceVersion: string, tagSuffix?: string, versionTagFormat?: VersionTagFormat): string;
32
- /**
33
- * Map a Salesforce package version onto a semver version.
34
- *
35
- * The build number becomes the first prerelease identifier and the git tag's suffix, if any, the
36
- * second — so `1.2.3.4` on a release branch is `1.2.3-4`, and the same version built from `beta`
37
- * is `1.2.3-4.beta`. This is the transformation `sfdx-project.json` already uses for a dependency
38
- * pin (`"package": "MyPackage@1.2.3-4"`), not a new convention.
39
- *
40
- * @throws {Error} If the version isn't `major.minor.patch.build`. Publishing a version derived
41
- * from something unrecognised is worse than failing the job.
42
- */
43
- export declare function toNpmVersion(salesforceVersion: string, tagSuffix?: string): string;
44
- /**
45
- * The npm dist-tag for a build: `latest` for a release-branch build, else the sanitized tag suffix,
46
- * so `npm install <pkg>@beta` reaches the newest build off the `beta` package branch.
47
- */
48
- export declare function toDistTag(tagSuffix?: string): string;
49
- /**
50
- * The `@utam/core` range the generated package declares as a peer, derived from the compiler that
51
- * actually produced the output rather than hardcoded — generated page objects import `@utam/core`
52
- * directly, and a consumer must resolve one copy of it across everything they load.
53
- */
54
- export declare function toUtamCoreRange(utamVersion: string): string;
55
- /** The one line identifying which package version produced this output, used as both description and file header. */
56
- export declare function buildProvenanceLine(packageName: string, salesforceVersion: string, subscriberPackageVersionId: string): string;
57
- export type PackageManifestOptions = {
58
- /** npm package name to publish under. */
59
- npmPackageName: string;
60
- /** The derived semver version. */
61
- version: string;
62
- /** The Salesforce package's name, for the provenance block. */
63
- salesforcePackageName: string;
64
- /** The Salesforce version, as `major.minor.patch.build`. */
65
- salesforceVersion: string;
66
- subscriberPackageVersionId: string;
67
- /** The git tag `create-package-version` recorded this version under. */
68
- versionTag: string;
69
- /** The commit this package version was built from — the package version's `Tag` field. */
70
- commitSha?: string;
71
- /** The pipeline that built it — the package version's `Description` field. */
72
- pipelineUrl?: string;
73
- /** The `@utam/core` peer range, from {@link toUtamCoreRange}. */
74
- utamCoreRange: string;
75
- /** Extra peers from `plugins.simply.utam.peerDependencies`. */
76
- projectPeerDependencies?: Record<string, string>;
77
- };
78
- /**
79
- * The `package.json` for the published page-object package.
80
- *
81
- * Shaped after `salesforce-pageobjects`, which is what every UTAM consumer already imports from:
82
- * ESM with a CJS fallback, page objects addressed by path (`<pkg>/pageObjects/<name>`), and the
83
- * source JSON shipped alongside. The one deliberate difference is that `@utam/core` is declared as
84
- * a peer here instead of being left to whatever the test's adapter drags in.
85
- */
86
- export declare function buildPackageManifest(options: PackageManifestOptions): Record<string, unknown>;
87
- export type CompilerConfigOptions = {
88
- /** Absolute path to the default package directory the page objects are authored under. */
89
- pageObjectsRootDir: string;
90
- /** Absolute path to the staging directory the compiler writes into. */
91
- stagingDir: string;
92
- npmPackageName: string;
93
- version: string;
94
- /** The provenance line, stamped as each generated file's header comment. */
95
- copyright: string;
96
- alias?: Record<string, string>;
97
- /** Parsed `plugins.simply.utam.compilerConfig`, whose keys this command doesn't own. */
98
- baseConfig?: Record<string, unknown>;
99
- };
100
- /**
101
- * The `utam.config.json` the compiler is invoked with.
102
- *
103
- * Generated per build rather than read from the repo because the compiler has no flag for
104
- * `version` — the only way to stamp the Salesforce version into the output is through the config
105
- * file, so it cannot be a static artifact. A project's own config is merged underneath: the command
106
- * owns the root, the masks, the output directories, `module`, `version`, and `copyright`; the
107
- * project keeps everything else (`profiles`, `lint`, `interruptCompilerOnError`, …).
108
- */
109
- export declare function buildCompilerConfig(options: CompilerConfigOptions): Record<string, unknown>;
110
- /**
111
- * Every `.utam.json` authored under `rootDir`, matching the compiler's own `__utam__` convention.
112
- *
113
- * Walks the tree rather than globbing so this package takes on no glob dependency for one lookup.
114
- *
115
- * @returns Absolute paths, sorted. Empty when `rootDir` doesn't exist — a project that hasn't
116
- * adopted UTAM is a skip, not an error.
117
- */
118
- export declare function findPageObjectSources(rootDir: string): Promise<string[]>;
119
- /** @returns The last value assigned to `key` in dotenv-shaped `content`, or `undefined`. */
120
- export declare function readEnvFileValue(content: string, key: string): string | undefined;
121
- export type ResolveSubscriberPackageVersionIdOptions = {
122
- /** `--subscriber-package-version-id`, if passed. */
123
- flagValue?: string;
124
- /** The environment to read `SUBSCRIBER_PACKAGE_VERSION_ID` from. Defaults to `process.env`. */
125
- env?: NodeJS.ProcessEnv;
126
- /** Dotenv file to fall back to — the one `create-package-version` wrote earlier in this job. */
127
- envFile: string;
128
- };
129
- /**
130
- * Find the `04t` this run should publish page objects for.
131
- *
132
- * Three sources, because the command is useful from two pipeline shapes and they surface the value
133
- * differently: an explicit flag; `SUBSCRIBER_PACKAGE_VERSION_ID` in the environment, which is how a
134
- * *separate* job receives `create-package-version`'s dotenv report artifact; and the dotenv file
135
- * itself, which is how the *same* job sees it, since a dotenv report only ever reaches other jobs.
136
- *
137
- * An explicit flag that isn't a `04t` throws — the caller asked for something specific and got it
138
- * wrong. A malformed value discovered rather than passed only warns, and the search continues.
139
- *
140
- * @returns The ID, or `undefined` when no source has one.
141
- * @throws {Error} If `flagValue` is not a subscriber package version ID.
142
- */
143
- export declare function resolveSubscriberPackageVersionId(options: ResolveSubscriberPackageVersionIdOptions): Promise<string | undefined>;
@@ -1,245 +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 path from 'node:path';
18
- import { getPluginConfig, isSubscriberPackageVersionId } from '@simplysf/simply-core';
19
- import { logger } from '../logger.js';
20
- import { DEFAULT_VERSION_TAG_FORMAT, VersionTagFormat } from './versionTagFormat.js';
21
- /** The dotenv key `create-package-version` and `create-fallback-tag` both write their `04t` under. */
22
- export const SUBSCRIBER_PACKAGE_VERSION_ID_KEY = 'SUBSCRIBER_PACKAGE_VERSION_ID';
23
- /** The dotenv keys this feature writes, for a downstream UI-test job to install by. */
24
- export const UTAM_PACKAGE_KEY = 'UTAM_PAGE_OBJECTS_PACKAGE';
25
- export const UTAM_VERSION_KEY = 'UTAM_PAGE_OBJECTS_VERSION';
26
- /** The compiler's own default mask, restated so the generated config never depends on it drifting. */
27
- export const PAGE_OBJECTS_FILE_MASK = ['**/__utam__/**/*.utam.json'];
28
- /** `sf package version report` returns `Version` as `major.minor.patch.build`, which is not semver. */
29
- const SALESFORCE_VERSION_PATTERN = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)\.(?<build>\d+)$/;
30
- /** @returns `plugins.simply.utam`, or an empty object when the project declares none. */
31
- export function readUtamPluginConfig(project) {
32
- return getPluginConfig(project, 'plugins.simply.utam') ?? {};
33
- }
34
- /**
35
- * Reduce a git tag suffix to something semver accepts as a prerelease identifier.
36
- *
37
- * Semver's prerelease alphabet is `[0-9A-Za-z-]`; a branch name's `/` and `.` are the common
38
- * offenders, so each run of anything else collapses to a single hyphen.
39
- */
40
- export function sanitizePrereleaseId(raw) {
41
- const cleaned = raw.replace(/[^0-9A-Za-z-]+/g, '-').replace(/^-+|-+$/g, '');
42
- // Semver forbids leading zeros in an all-numeric identifier, so a branch literally named `007`
43
- // would otherwise produce a version every registry rejects. Prefixing keeps it traceable.
44
- return /^0\d+$/.test(cleaned) ? `v${cleaned}` : cleaned;
45
- }
46
- /** @returns The git tag `create-package-version` recorded this package version under. */
47
- export function toVersionTag(salesforceVersion, tagSuffix, versionTagFormat = VersionTagFormat.parse(DEFAULT_VERSION_TAG_FORMAT)) {
48
- return versionTagFormat.render(salesforceVersion, tagSuffix);
49
- }
50
- /**
51
- * Map a Salesforce package version onto a semver version.
52
- *
53
- * The build number becomes the first prerelease identifier and the git tag's suffix, if any, the
54
- * second — so `1.2.3.4` on a release branch is `1.2.3-4`, and the same version built from `beta`
55
- * is `1.2.3-4.beta`. This is the transformation `sfdx-project.json` already uses for a dependency
56
- * pin (`"package": "MyPackage@1.2.3-4"`), not a new convention.
57
- *
58
- * @throws {Error} If the version isn't `major.minor.patch.build`. Publishing a version derived
59
- * from something unrecognised is worse than failing the job.
60
- */
61
- export function toNpmVersion(salesforceVersion, tagSuffix) {
62
- const match = SALESFORCE_VERSION_PATTERN.exec(salesforceVersion.trim());
63
- if (!match?.groups) {
64
- throw new Error(`Cannot derive an npm version from Salesforce package version "${salesforceVersion}": expected major.minor.patch.build.`);
65
- }
66
- const { major, minor, patch, build } = match.groups;
67
- const sanitizedSuffix = tagSuffix ? sanitizePrereleaseId(tagSuffix) : '';
68
- const prerelease = sanitizedSuffix ? `${build}.${sanitizedSuffix}` : build;
69
- return `${major}.${minor}.${patch}-${prerelease}`;
70
- }
71
- /**
72
- * The npm dist-tag for a build: `latest` for a release-branch build, else the sanitized tag suffix,
73
- * so `npm install <pkg>@beta` reaches the newest build off the `beta` package branch.
74
- */
75
- export function toDistTag(tagSuffix) {
76
- const sanitized = tagSuffix ? sanitizePrereleaseId(tagSuffix) : '';
77
- return sanitized.length > 0 ? sanitized : 'latest';
78
- }
79
- /**
80
- * The `@utam/core` range the generated package declares as a peer, derived from the compiler that
81
- * actually produced the output rather than hardcoded — generated page objects import `@utam/core`
82
- * directly, and a consumer must resolve one copy of it across everything they load.
83
- */
84
- export function toUtamCoreRange(utamVersion) {
85
- const match = /^(?<major>\d+)\.(?<minor>\d+)\./.exec(utamVersion.trim());
86
- if (!match?.groups) {
87
- throw new Error(`Could not read a major.minor version from the installed utam compiler: "${utamVersion}".`);
88
- }
89
- return `^${match.groups.major}.${match.groups.minor}.0`;
90
- }
91
- /** The one line identifying which package version produced this output, used as both description and file header. */
92
- export function buildProvenanceLine(packageName, salesforceVersion, subscriberPackageVersionId) {
93
- return `UTAM page objects for ${packageName} ${salesforceVersion} (${subscriberPackageVersionId})`;
94
- }
95
- /**
96
- * The `package.json` for the published page-object package.
97
- *
98
- * Shaped after `salesforce-pageobjects`, which is what every UTAM consumer already imports from:
99
- * ESM with a CJS fallback, page objects addressed by path (`<pkg>/pageObjects/<name>`), and the
100
- * source JSON shipped alongside. The one deliberate difference is that `@utam/core` is declared as
101
- * a peer here instead of being left to whatever the test's adapter drags in.
102
- */
103
- export function buildPackageManifest(options) {
104
- return {
105
- name: options.npmPackageName,
106
- version: options.version,
107
- description: buildProvenanceLine(options.salesforcePackageName, options.salesforceVersion, options.subscriberPackageVersionId),
108
- type: 'module',
109
- files: ['pageObjects', 'utils', 'source'],
110
- exports: {
111
- './package.json': './package.json',
112
- './*': {
113
- import: { types: './*.d.ts', default: './*.js' },
114
- require: { types: './*.d.cts', default: './*.cjs' },
115
- },
116
- },
117
- peerDependencies: {
118
- '@utam/core': options.utamCoreRange,
119
- ...options.projectPeerDependencies,
120
- },
121
- salesforce: {
122
- package: options.salesforcePackageName,
123
- versionNumber: options.salesforceVersion,
124
- subscriberPackageVersionId: options.subscriberPackageVersionId,
125
- tag: options.versionTag,
126
- ...(options.commitSha ? { commitSha: options.commitSha } : {}),
127
- ...(options.pipelineUrl ? { pipelineUrl: options.pipelineUrl } : {}),
128
- },
129
- };
130
- }
131
- /**
132
- * The `utam.config.json` the compiler is invoked with.
133
- *
134
- * Generated per build rather than read from the repo because the compiler has no flag for
135
- * `version` — the only way to stamp the Salesforce version into the output is through the config
136
- * file, so it cannot be a static artifact. A project's own config is merged underneath: the command
137
- * owns the root, the masks, the output directories, `module`, `version`, and `copyright`; the
138
- * project keeps everything else (`profiles`, `lint`, `interruptCompilerOnError`, …).
139
- */
140
- export function buildCompilerConfig(options) {
141
- return {
142
- ...options.baseConfig,
143
- pageObjectsRootDir: options.pageObjectsRootDir,
144
- pageObjectsFileMask: PAGE_OBJECTS_FILE_MASK,
145
- pageObjectsOutputDir: path.join(options.stagingDir, 'pageObjects'),
146
- extensionsOutputDir: path.join(options.stagingDir, 'utils'),
147
- moduleTarget: 'module',
148
- // The package's own name, so a page object can reference a sibling as
149
- // `<npm name>/pageObjects/<name>` and have the generated import resolve once installed.
150
- module: options.npmPackageName,
151
- version: options.version,
152
- copyright: [options.copyright],
153
- ...(options.alias ? { alias: options.alias } : {}),
154
- };
155
- }
156
- /**
157
- * Every `.utam.json` authored under `rootDir`, matching the compiler's own `__utam__` convention.
158
- *
159
- * Walks the tree rather than globbing so this package takes on no glob dependency for one lookup.
160
- *
161
- * @returns Absolute paths, sorted. Empty when `rootDir` doesn't exist — a project that hasn't
162
- * adopted UTAM is a skip, not an error.
163
- */
164
- export async function findPageObjectSources(rootDir) {
165
- let entries;
166
- try {
167
- entries = await fs.readdir(rootDir, { recursive: true, withFileTypes: true });
168
- }
169
- catch (error) {
170
- if (error.code === 'ENOENT') {
171
- return [];
172
- }
173
- throw error;
174
- }
175
- return entries
176
- .filter((entry) => entry.isFile() && entry.name.endsWith('.utam.json'))
177
- .map((entry) => path.join(entry.parentPath, entry.name))
178
- .filter((file) => path.relative(rootDir, file).split(/[\\/]/).includes('__utam__'))
179
- .sort();
180
- }
181
- /** @returns The last value assigned to `key` in dotenv-shaped `content`, or `undefined`. */
182
- export function readEnvFileValue(content, key) {
183
- let found;
184
- for (const line of content.split(/\r?\n/)) {
185
- const trimmed = line.trim();
186
- if (trimmed.length === 0 || trimmed.startsWith('#')) {
187
- continue;
188
- }
189
- const separator = trimmed.indexOf('=');
190
- if (separator !== -1 && trimmed.slice(0, separator).trim() === key) {
191
- // Last wins: the file is appended to, so a later line is the newer value.
192
- found = trimmed.slice(separator + 1).trim();
193
- }
194
- }
195
- return found;
196
- }
197
- /**
198
- * Find the `04t` this run should publish page objects for.
199
- *
200
- * Three sources, because the command is useful from two pipeline shapes and they surface the value
201
- * differently: an explicit flag; `SUBSCRIBER_PACKAGE_VERSION_ID` in the environment, which is how a
202
- * *separate* job receives `create-package-version`'s dotenv report artifact; and the dotenv file
203
- * itself, which is how the *same* job sees it, since a dotenv report only ever reaches other jobs.
204
- *
205
- * An explicit flag that isn't a `04t` throws — the caller asked for something specific and got it
206
- * wrong. A malformed value discovered rather than passed only warns, and the search continues.
207
- *
208
- * @returns The ID, or `undefined` when no source has one.
209
- * @throws {Error} If `flagValue` is not a subscriber package version ID.
210
- */
211
- export async function resolveSubscriberPackageVersionId(options) {
212
- const { flagValue, env = process.env, envFile } = options;
213
- if (flagValue) {
214
- if (!isSubscriberPackageVersionId(flagValue)) {
215
- throw new Error(`--subscriber-package-version-id must be a subscriber package version ID (04t), got "${flagValue}".`);
216
- }
217
- return flagValue;
218
- }
219
- const fromEnv = env[SUBSCRIBER_PACKAGE_VERSION_ID_KEY];
220
- if (fromEnv) {
221
- if (isSubscriberPackageVersionId(fromEnv)) {
222
- logger.info(`Using ${SUBSCRIBER_PACKAGE_VERSION_ID_KEY} from the environment: ${fromEnv}`);
223
- return fromEnv;
224
- }
225
- logger.warn(`Ignoring ${SUBSCRIBER_PACKAGE_VERSION_ID_KEY}="${fromEnv}" from the environment: not a 04t ID.`);
226
- }
227
- let content;
228
- try {
229
- content = await fs.readFile(envFile, 'utf8');
230
- }
231
- catch {
232
- return undefined;
233
- }
234
- const fromFile = readEnvFileValue(content, SUBSCRIBER_PACKAGE_VERSION_ID_KEY);
235
- if (!fromFile) {
236
- return undefined;
237
- }
238
- if (!isSubscriberPackageVersionId(fromFile)) {
239
- logger.warn(`Ignoring ${SUBSCRIBER_PACKAGE_VERSION_ID_KEY}="${fromFile}" in ${envFile}: not a 04t ID.`);
240
- return undefined;
241
- }
242
- logger.info(`Using ${SUBSCRIBER_PACKAGE_VERSION_ID_KEY} from ${envFile}: ${fromFile}`);
243
- return fromFile;
244
- }
245
- //# sourceMappingURL=utamPageObjects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utamPageObjects.js","sourceRoot":"","sources":["../../../src/common/build/utamPageObjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAoB,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAErF,sGAAsG;AACtG,MAAM,CAAC,MAAM,iCAAiC,GAAG,+BAA+B,CAAC;AAEjF,uFAAuF;AACvF,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAE5D,sGAAsG;AACtG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAErE,uGAAuG;AACvG,MAAM,0BAA0B,GAAG,8DAA8D,CAAC;AAclG,yFAAyF;AACzF,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACvD,OAAO,eAAe,CAAmB,OAAO,EAAE,qBAAqB,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CA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M,QAAQ,GAAG,gBAAgB,CAAC,OAAO,EAAE,iCAAiC,CAAC,CAAC;IAC9E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,YAAY,iCAAiC,KAAK,QAAQ,QAAQ,OAAO,iBAAiB,CAAC,CAAC;QACxG,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,SAAS,iCAAiC,SAAS,OAAO,KAAK,QAAQ,EAAE,CAAC,CAAC;IACvF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,57 +0,0 @@
1
- import { type SfdxProject } from '@simplysf/simply-core';
2
- /** The tag shape every `simply cicd build` command used before the format was configurable. */
3
- export declare const DEFAULT_VERSION_TAG_FORMAT = "v{MAJOR}.{MINOR}.{PATCH}.{BUILD}";
4
- /** Where in `sfdx-project.json` a project declares its own format. */
5
- export declare const VERSION_TAG_FORMAT_CONFIG_PATH = "plugins.simply.versionTagFormat";
6
- /** Overrides the project's format, in every command that reads it, when set to a non-empty value. */
7
- export declare const VERSION_TAG_FORMAT_ENV_VAR = "SIMPLY_CICD_VERSION_TAG_FORMAT";
8
- declare const PLACEHOLDERS: readonly ["MAJOR", "MINOR", "PATCH", "BUILD"];
9
- type Placeholder = (typeof PLACEHOLDERS)[number];
10
- /** A Salesforce package version's four numeric parts. */
11
- export type VersionParts = Record<Lowercase<Placeholder>, string>;
12
- /** Thrown for a format that can't be used, so callers that otherwise swallow errors can let it through. */
13
- export declare class VersionTagFormatError extends Error {
14
- constructor(format: string, problem: string, source?: string);
15
- }
16
- /** A tag split back into the version the format rendered and whatever was appended after it. */
17
- export type ParsedVersionTag = {
18
- /** The rendered version, exactly as it appears at the start of the tag. */
19
- versionTag: string;
20
- version: VersionParts;
21
- /** Everything after the rendered version, without its leading `-`; `''` when there is none. */
22
- rest: string;
23
- };
24
- /**
25
- * A validated version tag format. Every command that writes or reads a package version's git tag
26
- * goes through one of these, so they agree on the tag's shape.
27
- */
28
- export declare class VersionTagFormat {
29
- readonly format: string;
30
- private readonly segments;
31
- private readonly tagPattern;
32
- private constructor();
33
- /** @throws {VersionTagFormatError} If the format can't produce distinct, parseable, legal tags. */
34
- static parse(format: string): VersionTagFormat;
35
- /**
36
- * The format in `SIMPLY_CICD_VERSION_TAG_FORMAT` when it's set, otherwise the one declared under
37
- * `plugins.simply.versionTagFormat`, otherwise the default.
38
- *
39
- * @throws {VersionTagFormatError} If the chosen format is invalid.
40
- */
41
- static fromProject(project: SfdxProject | undefined): VersionTagFormat;
42
- /**
43
- * The tag for `salesforceVersion` (`major.minor.patch.build`), with `-<suffix>` appended when given.
44
- *
45
- * @throws {Error} If the version isn't four numeric parts.
46
- */
47
- render(salesforceVersion: string, suffix?: string): string;
48
- /**
49
- * A `git describe --match` / `git tag --list` glob for tags of the `major.minor.patch` that
50
- * `versionNumber` (e.g. `6.40.0.NEXT`) declares, with any build and suffix. Without a usable
51
- * `versionNumber`, any tag starting the way the format starts.
52
- */
53
- matchPattern(versionNumber?: string): string;
54
- /** Splits a tag this format rendered back into its version and suffix; `undefined` if it doesn't match. */
55
- parseTag(tag: string): ParsedVersionTag | undefined;
56
- }
57
- export {};
@@ -1,194 +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 { getPluginConfig } from '@simplysf/simply-core';
17
- /** The tag shape every `simply cicd build` command used before the format was configurable. */
18
- export const DEFAULT_VERSION_TAG_FORMAT = 'v{MAJOR}.{MINOR}.{PATCH}.{BUILD}';
19
- /** Where in `sfdx-project.json` a project declares its own format. */
20
- export const VERSION_TAG_FORMAT_CONFIG_PATH = 'plugins.simply.versionTagFormat';
21
- /** Overrides the project's format, in every command that reads it, when set to a non-empty value. */
22
- export const VERSION_TAG_FORMAT_ENV_VAR = 'SIMPLY_CICD_VERSION_TAG_FORMAT';
23
- const PLACEHOLDERS = ['MAJOR', 'MINOR', 'PATCH', 'BUILD'];
24
- /** `sf package version report` returns `Version` as `major.minor.patch.build`. */
25
- const SALESFORCE_VERSION_PATTERN = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)\.(?<build>\d+)$/;
26
- /** Thrown for a format that can't be used, so callers that otherwise swallow errors can let it through. */
27
- export class VersionTagFormatError extends Error {
28
- constructor(format, problem, source = VERSION_TAG_FORMAT_CONFIG_PATH) {
29
- super(`Invalid version tag format "${format}" (${source}): ${problem}`);
30
- this.name = 'VersionTagFormatError';
31
- }
32
- }
33
- /**
34
- * Why `tag` isn't a legal git tag name, or `undefined` when it is. Mirrors `git check-ref-format`'s
35
- * rules for `refs/tags/<tag>`, plus git's refusal of tag names starting with `-`.
36
- */
37
- function findRefNameProblem(tag) {
38
- if (tag.startsWith('-'))
39
- return 'a tag cannot start with "-"';
40
- // eslint-disable-next-line no-control-regex -- control characters are exactly what git refuses
41
- if (/[\x00-\x20\x7f~^:?*[\\]/.test(tag))
42
- return 'contains a space, a control character, or one of ~^:?*[\\';
43
- if (tag.includes('..'))
44
- return 'contains ".."';
45
- if (tag.includes('@{'))
46
- return 'contains "@{"';
47
- if (tag === '@')
48
- return 'cannot be "@"';
49
- if (tag.endsWith('.'))
50
- return 'cannot end with "."';
51
- if (tag.startsWith('/') || tag.endsWith('/') || tag.includes('//'))
52
- return 'has an empty "/"-separated component';
53
- if (tag.split('/').some((component) => component.startsWith('.') || component.endsWith('.lock'))) {
54
- return 'has a "/"-separated component starting with "." or ending with ".lock"';
55
- }
56
- return undefined;
57
- }
58
- function tokenize(format, source) {
59
- const segments = [];
60
- const placeholderPattern = /\{(?<name>[^{}]*)\}/g;
61
- let lastIndex = 0;
62
- for (const match of format.matchAll(placeholderPattern)) {
63
- const name = match.groups?.name ?? '';
64
- if (!PLACEHOLDERS.includes(name)) {
65
- throw new VersionTagFormatError(format, `unknown placeholder "{${name}}"; use {MAJOR}, {MINOR}, {PATCH}, and {BUILD}`, source);
66
- }
67
- if (match.index > lastIndex) {
68
- segments.push({ kind: 'literal', text: format.slice(lastIndex, match.index) });
69
- }
70
- segments.push({ kind: 'placeholder', name: name });
71
- lastIndex = match.index + match[0].length;
72
- }
73
- if (lastIndex < format.length) {
74
- segments.push({ kind: 'literal', text: format.slice(lastIndex) });
75
- }
76
- return segments;
77
- }
78
- function validate(format, segments, source) {
79
- if (segments.some((segment) => segment.kind === 'literal' && /[{}]/.test(segment.text))) {
80
- throw new VersionTagFormatError(format, 'contains an unmatched "{" or "}"', source);
81
- }
82
- for (const name of PLACEHOLDERS) {
83
- const count = segments.filter((segment) => segment.kind === 'placeholder' && segment.name === name).length;
84
- if (count !== 1) {
85
- throw new VersionTagFormatError(format, `{${name}} must appear exactly once, found ${count}`, source);
86
- }
87
- }
88
- segments.forEach((segment, index) => {
89
- const next = segments[index + 1];
90
- if (segment.kind === 'placeholder' && next?.kind === 'placeholder') {
91
- throw new VersionTagFormatError(format, `{${segment.name}}{${next.name}} must be separated by a non-digit`, source);
92
- }
93
- const following = segments[index + 2];
94
- if (segment.kind === 'placeholder' &&
95
- next?.kind === 'literal' &&
96
- following?.kind === 'placeholder' &&
97
- /^\d+$/.test(next.text)) {
98
- throw new VersionTagFormatError(format, `{${segment.name}} and {${following.name}} must be separated by a non-digit`, source);
99
- }
100
- });
101
- const problem = findRefNameProblem(renderSegments(segments, { major: '1', minor: '2', patch: '3', build: '4' }));
102
- if (problem) {
103
- throw new VersionTagFormatError(format, `the tags it produces aren't valid git tag names: ${problem}`, source);
104
- }
105
- }
106
- function renderSegments(segments, values, missing = '') {
107
- return segments
108
- .map((segment) => segment.kind === 'literal' ? segment.text : (values[segment.name.toLowerCase()] ?? missing))
109
- .join('');
110
- }
111
- function escapeRegExp(text) {
112
- return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
113
- }
114
- /**
115
- * A validated version tag format. Every command that writes or reads a package version's git tag
116
- * goes through one of these, so they agree on the tag's shape.
117
- */
118
- export class VersionTagFormat {
119
- format;
120
- segments;
121
- tagPattern;
122
- constructor(format, source) {
123
- this.format = format;
124
- this.segments = tokenize(format, source);
125
- validate(format, this.segments, source);
126
- const versionPattern = this.segments
127
- .map((segment) => segment.kind === 'literal' ? escapeRegExp(segment.text) : `(?<${segment.name.toLowerCase()}>\\d+)`)
128
- .join('');
129
- this.tagPattern = new RegExp(`^(?<versionTag>${versionPattern})(?:-(?<rest>.*))?$`);
130
- }
131
- /** @throws {VersionTagFormatError} If the format can't produce distinct, parseable, legal tags. */
132
- static parse(format) {
133
- return new VersionTagFormat(format);
134
- }
135
- /**
136
- * The format in `SIMPLY_CICD_VERSION_TAG_FORMAT` when it's set, otherwise the one declared under
137
- * `plugins.simply.versionTagFormat`, otherwise the default.
138
- *
139
- * @throws {VersionTagFormatError} If the chosen format is invalid.
140
- */
141
- static fromProject(project) {
142
- const override = process.env[VERSION_TAG_FORMAT_ENV_VAR];
143
- if (override) {
144
- return new VersionTagFormat(override, VERSION_TAG_FORMAT_ENV_VAR);
145
- }
146
- const declared = project ? getPluginConfig(project, VERSION_TAG_FORMAT_CONFIG_PATH) : undefined;
147
- if (declared === undefined || declared === null || declared === '') {
148
- return new VersionTagFormat(DEFAULT_VERSION_TAG_FORMAT);
149
- }
150
- if (typeof declared !== 'string') {
151
- throw new VersionTagFormatError(JSON.stringify(declared), 'must be a string');
152
- }
153
- return new VersionTagFormat(declared);
154
- }
155
- /**
156
- * The tag for `salesforceVersion` (`major.minor.patch.build`), with `-<suffix>` appended when given.
157
- *
158
- * @throws {Error} If the version isn't four numeric parts.
159
- */
160
- render(salesforceVersion, suffix) {
161
- const match = SALESFORCE_VERSION_PATTERN.exec(salesforceVersion.trim());
162
- if (!match?.groups) {
163
- throw new Error(`Cannot render a version tag for Salesforce package version "${salesforceVersion}": expected major.minor.patch.build.`);
164
- }
165
- const versionTag = renderSegments(this.segments, match.groups);
166
- return suffix ? `${versionTag}-${suffix}` : versionTag;
167
- }
168
- /**
169
- * A `git describe --match` / `git tag --list` glob for tags of the `major.minor.patch` that
170
- * `versionNumber` (e.g. `6.40.0.NEXT`) declares, with any build and suffix. Without a usable
171
- * `versionNumber`, any tag starting the way the format starts.
172
- */
173
- matchPattern(versionNumber) {
174
- const parts = versionNumber?.split('.') ?? [];
175
- if (parts.length >= 3) {
176
- const glob = renderSegments(this.segments, { major: parts[0], minor: parts[1], patch: parts[2] }, '*');
177
- return glob.endsWith('*') ? glob : `${glob}*`;
178
- }
179
- const first = this.segments[0];
180
- return `${first.kind === 'literal' ? first.text : ''}*`;
181
- }
182
- /** Splits a tag this format rendered back into its version and suffix; `undefined` if it doesn't match. */
183
- parseTag(tag) {
184
- const groups = this.tagPattern.exec(tag)?.groups;
185
- if (!groups)
186
- return undefined;
187
- return {
188
- versionTag: groups.versionTag,
189
- version: { major: groups.major, minor: groups.minor, patch: groups.patch, build: groups.build },
190
- rest: groups.rest ?? '',
191
- };
192
- }
193
- }
194
- //# sourceMappingURL=versionTagFormat.js.map