@simplysf/simply-cicd 0.10.3 → 0.11.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.
@@ -0,0 +1,277 @@
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 { determineVersionTag } from './createPackageVersion.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
+ /**
47
+ * The suffix `create-package-version` would append to this build's git tag, or `undefined` for a
48
+ * release-branch build that gets a bare `v<version>`.
49
+ *
50
+ * Derived by asking {@link determineVersionTag} for the tag and taking what it added, rather than
51
+ * re-deciding: the whole point of the mapping is that the npm version reads like the git tag, and
52
+ * two copies of the rule would eventually disagree.
53
+ */
54
+ export function determineTagSuffix(salesforceVersion, branchAttribute, ciCommitRefName, packageReleaseBranchPrefix) {
55
+ // Nothing to derive a suffix from. A build that passes neither is treated like a release build,
56
+ // which is the only reading that produces a usable version rather than `v1.2.3.4-undefined`.
57
+ if (!branchAttribute && !ciCommitRefName) {
58
+ return undefined;
59
+ }
60
+ const versionTag = determineVersionTag(salesforceVersion, branchAttribute, ciCommitRefName ?? '', packageReleaseBranchPrefix);
61
+ const suffix = versionTag.slice(`v${salesforceVersion}`.length + 1);
62
+ return suffix.length > 0 ? suffix : undefined;
63
+ }
64
+ /** @returns The git tag `create-package-version` recorded this package version under. */
65
+ export function toVersionTag(salesforceVersion, tagSuffix) {
66
+ return tagSuffix ? `v${salesforceVersion}-${tagSuffix}` : `v${salesforceVersion}`;
67
+ }
68
+ /**
69
+ * Map a Salesforce package version onto a semver version.
70
+ *
71
+ * The build number becomes the first prerelease identifier and the git tag's suffix, if any, the
72
+ * second — so `1.2.3.4` on a release branch is `1.2.3-4`, and the same version built from `beta`
73
+ * is `1.2.3-4.beta`. This is the transformation `sfdx-project.json` already uses for a dependency
74
+ * pin (`"package": "MyPackage@1.2.3-4"`), not a new convention.
75
+ *
76
+ * @throws {Error} If the version isn't `major.minor.patch.build`. Publishing a version derived
77
+ * from something unrecognised is worse than failing the job.
78
+ */
79
+ export function toNpmVersion(salesforceVersion, tagSuffix) {
80
+ const match = SALESFORCE_VERSION_PATTERN.exec(salesforceVersion.trim());
81
+ if (!match?.groups) {
82
+ throw new Error(`Cannot derive an npm version from Salesforce package version "${salesforceVersion}": expected major.minor.patch.build.`);
83
+ }
84
+ const { major, minor, patch, build } = match.groups;
85
+ const sanitizedSuffix = tagSuffix ? sanitizePrereleaseId(tagSuffix) : '';
86
+ const prerelease = sanitizedSuffix ? `${build}.${sanitizedSuffix}` : build;
87
+ return `${major}.${minor}.${patch}-${prerelease}`;
88
+ }
89
+ /**
90
+ * The npm dist-tag for a build: `latest` for a release-branch build, else the sanitized tag suffix,
91
+ * so `npm install <pkg>@beta` reaches the newest build off the `beta` package branch.
92
+ */
93
+ export function toDistTag(tagSuffix) {
94
+ const sanitized = tagSuffix ? sanitizePrereleaseId(tagSuffix) : '';
95
+ return sanitized.length > 0 ? sanitized : 'latest';
96
+ }
97
+ /**
98
+ * The `@utam/core` range the generated package declares as a peer, derived from the compiler that
99
+ * actually produced the output rather than hardcoded — generated page objects import `@utam/core`
100
+ * directly, and a consumer must resolve one copy of it across everything they load.
101
+ */
102
+ export function toUtamCoreRange(utamVersion) {
103
+ const match = /^(?<major>\d+)\.(?<minor>\d+)\./.exec(utamVersion.trim());
104
+ if (!match?.groups) {
105
+ throw new Error(`Could not read a major.minor version from the installed utam compiler: "${utamVersion}".`);
106
+ }
107
+ return `^${match.groups.major}.${match.groups.minor}.0`;
108
+ }
109
+ /** The one line identifying which package version produced this output, used as both description and file header. */
110
+ export function buildProvenanceLine(packageName, salesforceVersion, subscriberPackageVersionId) {
111
+ return `UTAM page objects for ${packageName} ${salesforceVersion} (${subscriberPackageVersionId})`;
112
+ }
113
+ /**
114
+ * The `package.json` for the published page-object package.
115
+ *
116
+ * Shaped after `salesforce-pageobjects`, which is what every UTAM consumer already imports from:
117
+ * ESM with a CJS fallback, page objects addressed by path (`<pkg>/pageObjects/<name>`), and the
118
+ * source JSON shipped alongside. The one deliberate difference is that `@utam/core` is declared as
119
+ * a peer here instead of being left to whatever the test's adapter drags in.
120
+ */
121
+ export function buildPackageManifest(options) {
122
+ return {
123
+ name: options.npmPackageName,
124
+ version: options.version,
125
+ description: buildProvenanceLine(options.salesforcePackageName, options.salesforceVersion, options.subscriberPackageVersionId),
126
+ type: 'module',
127
+ files: ['pageObjects', 'utils', 'source'],
128
+ exports: {
129
+ './package.json': './package.json',
130
+ './*': {
131
+ import: { types: './*.d.ts', default: './*.js' },
132
+ require: { types: './*.d.cts', default: './*.cjs' },
133
+ },
134
+ },
135
+ peerDependencies: {
136
+ '@utam/core': options.utamCoreRange,
137
+ ...options.projectPeerDependencies,
138
+ },
139
+ salesforce: {
140
+ package: options.salesforcePackageName,
141
+ versionNumber: options.salesforceVersion,
142
+ subscriberPackageVersionId: options.subscriberPackageVersionId,
143
+ tag: options.versionTag,
144
+ ...(options.commitSha ? { commitSha: options.commitSha } : {}),
145
+ ...(options.pipelineUrl ? { pipelineUrl: options.pipelineUrl } : {}),
146
+ },
147
+ };
148
+ }
149
+ /**
150
+ * The `utam.config.json` the compiler is invoked with.
151
+ *
152
+ * Generated per build rather than read from the repo because the compiler has no flag for
153
+ * `version` — the only way to stamp the Salesforce version into the output is through the config
154
+ * file, so it cannot be a static artifact. A project's own config is merged underneath: the command
155
+ * owns the root, the masks, the output directories, `module`, `version`, and `copyright`; the
156
+ * project keeps everything else (`profiles`, `lint`, `interruptCompilerOnError`, …).
157
+ */
158
+ export function buildCompilerConfig(options) {
159
+ return {
160
+ ...options.baseConfig,
161
+ pageObjectsRootDir: options.pageObjectsRootDir,
162
+ pageObjectsFileMask: PAGE_OBJECTS_FILE_MASK,
163
+ pageObjectsOutputDir: path.join(options.stagingDir, 'pageObjects'),
164
+ extensionsOutputDir: path.join(options.stagingDir, 'utils'),
165
+ moduleTarget: 'module',
166
+ // The package's own name, so a page object can reference a sibling as
167
+ // `<npm name>/pageObjects/<name>` and have the generated import resolve once installed.
168
+ module: options.npmPackageName,
169
+ version: options.version,
170
+ copyright: [options.copyright],
171
+ ...(options.alias ? { alias: options.alias } : {}),
172
+ };
173
+ }
174
+ /**
175
+ * Every `.utam.json` authored under `rootDir`, matching the compiler's own `__utam__` convention.
176
+ *
177
+ * Walks the tree rather than globbing so this package takes on no glob dependency for one lookup.
178
+ *
179
+ * @returns Absolute paths, sorted. Empty when `rootDir` doesn't exist — a project that hasn't
180
+ * adopted UTAM is a skip, not an error.
181
+ */
182
+ export async function findPageObjectSources(rootDir) {
183
+ let entries;
184
+ try {
185
+ entries = await fs.readdir(rootDir, { recursive: true, withFileTypes: true });
186
+ }
187
+ catch (error) {
188
+ if (error.code === 'ENOENT') {
189
+ return [];
190
+ }
191
+ throw error;
192
+ }
193
+ return entries
194
+ .filter((entry) => entry.isFile() && entry.name.endsWith('.utam.json'))
195
+ .map((entry) => path.join(entry.parentPath, entry.name))
196
+ .filter((file) => path.relative(rootDir, file).split(/[\\/]/).includes('__utam__'))
197
+ .sort();
198
+ }
199
+ /** @returns The last value assigned to `key` in dotenv-shaped `content`, or `undefined`. */
200
+ export function readEnvFileValue(content, key) {
201
+ let found;
202
+ for (const line of content.split(/\r?\n/)) {
203
+ const trimmed = line.trim();
204
+ if (trimmed.length === 0 || trimmed.startsWith('#')) {
205
+ continue;
206
+ }
207
+ const separator = trimmed.indexOf('=');
208
+ if (separator !== -1 && trimmed.slice(0, separator).trim() === key) {
209
+ // Last wins: the file is appended to, so a later line is the newer value.
210
+ found = trimmed.slice(separator + 1).trim();
211
+ }
212
+ }
213
+ return found;
214
+ }
215
+ /**
216
+ * Find the `04t` this run should publish page objects for.
217
+ *
218
+ * Three sources, because the command is useful from two pipeline shapes and they surface the value
219
+ * differently: an explicit flag; `SUBSCRIBER_PACKAGE_VERSION_ID` in the environment, which is how a
220
+ * *separate* job receives `create-package-version`'s dotenv report artifact; and the dotenv file
221
+ * itself, which is how the *same* job sees it, since a dotenv report only ever reaches other jobs.
222
+ *
223
+ * An explicit flag that isn't a `04t` throws — the caller asked for something specific and got it
224
+ * wrong. A malformed value discovered rather than passed only warns, and the search continues.
225
+ *
226
+ * @returns The ID, or `undefined` when no source has one.
227
+ * @throws {Error} If `flagValue` is not a subscriber package version ID.
228
+ */
229
+ export async function resolveSubscriberPackageVersionId(options) {
230
+ const { flagValue, env = process.env, envFile } = options;
231
+ if (flagValue) {
232
+ if (!isSubscriberPackageVersionId(flagValue)) {
233
+ throw new Error(`--subscriber-package-version-id must be a subscriber package version ID (04t), got "${flagValue}".`);
234
+ }
235
+ return flagValue;
236
+ }
237
+ const fromEnv = env[SUBSCRIBER_PACKAGE_VERSION_ID_KEY];
238
+ if (fromEnv) {
239
+ if (isSubscriberPackageVersionId(fromEnv)) {
240
+ logger.info(`Using ${SUBSCRIBER_PACKAGE_VERSION_ID_KEY} from the environment: ${fromEnv}`);
241
+ return fromEnv;
242
+ }
243
+ logger.warn(`Ignoring ${SUBSCRIBER_PACKAGE_VERSION_ID_KEY}="${fromEnv}" from the environment: not a 04t ID.`);
244
+ }
245
+ let content;
246
+ try {
247
+ content = await fs.readFile(envFile, 'utf8');
248
+ }
249
+ catch {
250
+ return undefined;
251
+ }
252
+ const fromFile = readEnvFileValue(content, SUBSCRIBER_PACKAGE_VERSION_ID_KEY);
253
+ if (!fromFile) {
254
+ return undefined;
255
+ }
256
+ if (!isSubscriberPackageVersionId(fromFile)) {
257
+ logger.warn(`Ignoring ${SUBSCRIBER_PACKAGE_VERSION_ID_KEY}="${fromFile}" in ${envFile}: not a 04t ID.`);
258
+ return undefined;
259
+ }
260
+ logger.info(`Using ${SUBSCRIBER_PACKAGE_VERSION_ID_KEY} from ${envFile}: ${fromFile}`);
261
+ return fromFile;
262
+ }
263
+ /**
264
+ * The `.npmrc` written into the staging directory when `--npm-token` is given.
265
+ *
266
+ * Auth lines only, deliberately: setting `registry=` here would also redirect the compiler's own
267
+ * `npm install utam@…`, which has no business going through a project-scoped package registry.
268
+ * Every command that must target the publish registry passes `--registry` explicitly instead.
269
+ */
270
+ export function buildNpmrc(token, registry) {
271
+ if (!registry) {
272
+ return `//registry.npmjs.org/:_authToken=${token}\n`;
273
+ }
274
+ const normalized = registry.endsWith('/') ? registry : `${registry}/`;
275
+ return `${normalized.replace(/^https?:/, '')}:_authToken=${token}\n`;
276
+ }
277
+ //# sourceMappingURL=utamPageObjects.js.map
@@ -0,0 +1 @@
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,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,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,C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QACd,OAAO,oCAAoC,KAAK,IAAI,CAAC;IACvD,CAAC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC;IAEtE,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,eAAe,KAAK,IAAI,CAAC;AACvE,CAAC"}
@@ -0,0 +1,85 @@
1
+ # summary
2
+
3
+ Compile the project's UTAM page objects for a package version and publish them to an npm registry.
4
+
5
+ # description
6
+
7
+ Gives every Salesforce Unlocked Package version a matching npm package of compiled UTAM page objects, so a UI-test suite can install exactly the page objects that describe the package version it is testing against.
8
+
9
+ Runs after `build create-package-version`, whose `04t` it takes as input — from `--subscriber-package-version-id`, from `SUBSCRIBER_PACKAGE_VERSION_ID` in the environment (how a separate job receives that command's dotenv report), or from the dotenv file itself (how a later step in the same job sees it). It compiles every `**/__utam__/**/*.utam.json` under the default package directory with the UTAM compiler, in a staging directory outside the repo, and publishes the result.
10
+
11
+ The npm version is derived from the Salesforce version number the same way `sfdx-project.json` writes a dependency pin: `1.2.3.4` becomes `1.2.3-4`, with the git tag's suffix carried as a second prerelease identifier and as the dist-tag, so `1.2.3.4` built from a `beta` package branch is `1.2.3-4.beta` at `beta`, and a release build is `1.2.3-4` at `latest`.
12
+
13
+ The compiler is installed at run time rather than shipped with this plugin, so nothing is downloaded unless the command actually runs.
14
+
15
+ Skips (without failing) when `PACKAGE_CHANGED=FALSE` is set in the environment (see `build determine-package-changes`), when `--disabled` is passed, when no package version ID can be found, when the project authors no page objects, or when this exact version is already on the registry — which is what makes retrying a job that died after publishing succeed rather than fail on a version conflict. Any other failure fails the job: a missing page-object package would silently break every UI test pinned to that version.
16
+
17
+ On success, appends `UTAM_PAGE_OBJECTS_PACKAGE` and `UTAM_PAGE_OBJECTS_VERSION` to `--out`, so a downstream job can install the package without knowing the mapping rule.
18
+
19
+ Configure the package name, the compiler's type aliases, extra peer dependencies, and a project-owned compiler config under `plugins.simply.utam` in `sfdx-project.json`.
20
+
21
+ # flags.packaging-devhub.summary
22
+
23
+ Alias of the Dev Hub that owns the package version. Must already be authenticated.
24
+
25
+ # flags.subscriber-package-version-id.summary
26
+
27
+ Subscriber package version ID (04t) to publish page objects for. Falls back to SUBSCRIBER_PACKAGE_VERSION_ID in the environment, then to the same key in --env-file.
28
+
29
+ # flags.npm-package-name.summary
30
+
31
+ npm package name to publish the page objects under. Required unless `plugins.simply.utam.packageName` is set in sfdx-project.json; the flag wins when both are present.
32
+
33
+ # flags.npm-registry.summary
34
+
35
+ Registry to publish to. Defaults to whatever npm itself is configured to use.
36
+
37
+ # flags.npm-token.summary
38
+
39
+ Auth token for the registry. Written to an .npmrc inside the staging directory only — the repo's own .npmrc is never touched.
40
+
41
+ # flags.npm-access.summary
42
+
43
+ Passed through to npm publish --access. Needed on npmjs.com to publish a scoped package publicly.
44
+
45
+ # flags.npm-dist-tag.summary
46
+
47
+ Dist-tag to publish under, overriding the one derived from the git tag's suffix.
48
+
49
+ # flags.ci-commit-ref-name.summary
50
+
51
+ Git branch or ref name being built. With --package-release-branch-prefix, reproduces the suffix `create-package-version` put on the git tag, so the npm version mirrors it.
52
+
53
+ # flags.package-release-branch-prefix.summary
54
+
55
+ Prefix identifying release branches. Determines whether the npm version and dist-tag carry a branch suffix.
56
+
57
+ # flags.utam-version.summary
58
+
59
+ npm version spec of the UTAM compiler to install and compile with.
60
+
61
+ # flags.dry-run.summary
62
+
63
+ Compile and pack the package without publishing it, copying the tarball into the project directory.
64
+
65
+ # flags.out.summary
66
+
67
+ Dotenv file to append the published package name and version to.
68
+
69
+ # flags.env-file.summary
70
+
71
+ Dotenv file to read SUBSCRIBER_PACKAGE_VERSION_ID from when it isn't passed as a flag or set in the environment.
72
+
73
+ # examples
74
+
75
+ - Publish page objects for the version this pipeline just created, reading its ID from the dotenv file:
76
+
77
+ <%= config.bin %> <%= command.id %> --packaging-devhub my-packaging-devhub
78
+
79
+ - Publish to a GitLab project registry on a release-branch build:
80
+
81
+ <%= config.bin %> <%= command.id %> --packaging-devhub my-packaging-devhub --ci-commit-ref-name release/1.2 --package-release-branch-prefix release/ --npm-registry https://gitlab.example.com/api/v4/projects/42/packages/npm/ --npm-token $CI_JOB_TOKEN
82
+
83
+ - Compile and pack without publishing, to inspect what would be produced:
84
+
85
+ <%= config.bin %> <%= command.id %> --packaging-devhub my-packaging-devhub --subscriber-package-version-id 04tXXXXXXXXXXXXXXX --dry-run
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplysf/simply-cicd",
3
3
  "description": "Commands for Salesforce CI/CD pipelines",
4
- "version": "0.10.3",
4
+ "version": "0.11.0",
5
5
  "author": "@ClayChipps",
6
6
  "homepage": "https://github.com/SimplySF/simply-plugins",
7
7
  "bugs": "https://github.com/SimplySF/simply-plugins/issues",
@@ -203,5 +203,5 @@
203
203
  "output": []
204
204
  }
205
205
  },
206
- "gitHead": "f2dd860c0a40aab95ed01ec8ff075507f9ad75a6"
206
+ "gitHead": "ab1ad8ef1f91725af22b063371bbed8a0ae5d115"
207
207
  }