Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | #!/usr/bin/env node
/**
* SCS (Static Content Service) Release Script
*
* Phase 0 – Seed:
* Clones (or refreshes) the target branch of aura/slds-scs and syncs its
* release-state directories (slds/, scs/, tnrp/, package.json) into the
* monorepo's packages/slds-scs/. This ensures Phase A starts from the
* real state of the downstream repo rather than stale monorepo data.
*
* Phase A – Assemble:
* Copies versioned CSS files from SLDS1 and SLDS2 dist outputs into
* packages/slds-scs/slds/ (including slds-plus, scoped-slds-plus, and
* slds-plus-theme-layer), runs FileParser to update scs/files.json with
* version retention, bumps the package version, and optionally updates
* the scs-client JAR.
* CSS files are gitignored in the monorepo (build artifacts only) —
* only files.json, package.json, and tnrp/ are committed here.
*
* Phase B – Export:
* Resets the clone to the target branch, syncs the assembled state from
* packages/slds-scs/ into it, and creates a PR targeting a core-XXX-patch
* production branch so the existing SFCI pipeline can build and publish.
*
* Configuration sources (in priority order):
* 1. CLI arguments (--key=value)
* 2. Environment variables
* 3. .release-config (versions, WI)
* 4. .distrc.json (nexusCreds)
* 5. Interactive prompts
*
* Usage:
* yarn workspace @salesforce-ux/design-system scs
* yarn workspace @salesforce-ux/design-system scs -- --wi W-9925295 --case=29996318
* yarn workspace @salesforce-ux/design-system scs -- --skip-seed # preserve local slds-scs edits
*
* Prerequisites:
* - TMP Auth (for Nexus scs-client lookup)
* - Push access to git.soma.salesforce.com:aura/slds-scs
* - .distrc.json with nexusCreds (or provide via CLI/prompt)
* - .release-config with version info (or provide via CLI/prompt)
*/
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import process from 'node:process';
import fs from 'fs-extra';
import execa from 'execa';
import enquirer from 'enquirer';
const { prompt } = enquirer;
import { FileParser } from './file-parser.js';
import { loadConfig } from './config-loader.js';
import * as autoVersion from './version-utils.js';
import { captureBaseline } from '../validation/capture-baseline-core.js';
// ------------------------------------------------------------------
// Path setup
// ------------------------------------------------------------------
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// packages/design-system (two levels up from scripts/scs/)
const packageRoot = path.resolve(__dirname, '../..');
const rootPath = (...args) => path.resolve(packageRoot, ...args);
// Monorepo root (two levels up from packages/design-system)
const monorepoRoot = path.resolve(packageRoot, '../..');
// packages/slds-scs — in-monorepo sub-package, seeded from the target branch
const scsPackageDir = path.resolve(monorepoRoot, 'packages/slds-scs');
const SCS_REPO = 'git@git.soma.salesforce.com:aura/slds-scs.git';
const SCS_CLONE_DIR = path.join(monorepoRoot, '.scs-clone');
// ------------------------------------------------------------------
// Configuration
// ------------------------------------------------------------------
const config = loadConfig(packageRoot);
// Source paths resolved locally within the monorepo
const SLDS1_DIST_PATH = rootPath('dist');
const SLDS2_DIST_PATH = rootPath('../design-system-2/dist');
// Read SLDS1 version from dist package.json
let slds1DistVersion = null;
try {
slds1DistVersion = autoVersion.getVersion(path.join(SLDS1_DIST_PATH, 'package.json'));
} catch { /* dist not built yet — will prompt */ }
// Read SLDS2 version from design-system-2 package.json
let slds2DistVersion = null;
try {
slds2DistVersion = autoVersion.getVersion(rootPath('../design-system-2/package.json'));
} catch { /* dist not built yet — will prompt */ }
// Derive default core branch from the monorepo's salesforce-version.id
let defaultCoreBranch = null;
try {
const rootPkg = JSON.parse(
fs.readFileSync(path.join(monorepoRoot, 'package.json'), 'utf8'),
);
const releaseId = rootPkg['salesforce-version']?.id;
if (releaseId) {
defaultCoreBranch = `core-${releaseId}-patch`;
}
} catch { /* salesforce-version not set */ }
// ------------------------------------------------------------------
// Interactive prompts (fills in anything not provided via config)
// ------------------------------------------------------------------
async function ask() {
return prompt([
config.nexusCreds || {
type: 'input',
name: 'nexusCreds',
message: 'Please provide your Nexus token in user:pass format\n ',
result(creds) {
return creds;
},
},
config.wi || {
type: 'input',
name: 'wi',
message: 'GUS Work Item Number?\n ',
result(wiNumber) {
return wiNumber;
},
},
config.case || {
type: 'input',
name: 'case',
message: 'GUS Change Case Number?\n ',
result(caseNumber) {
return caseNumber;
},
},
config.sldsVersion || {
type: 'input',
name: 'sldsVersion',
message: `SLDS1 Version?\n `,
initial: slds1DistVersion || '',
result(version) {
return version;
},
},
config.slds2Version || {
type: 'input',
name: 'slds2Version',
message: `SLDS2 Version (for slds-plus files)?\n `,
initial: slds2DistVersion || '',
result(version) {
return version;
},
},
config.doPR || {
type: 'toggle',
name: 'doPR',
message: 'Do you want to create the PR on aura/slds-scs?\n ',
enabled: 'Yep',
disabled: 'Nope',
},
config.coreBranch || {
type: 'input',
name: 'coreBranch',
message: 'Target core branch on slds-scs?\n ',
initial: defaultCoreBranch || '',
},
]).catch(console.error);
}
// ------------------------------------------------------------------
// Helpers
// ------------------------------------------------------------------
const gitInMonorepo = (cmd) =>
execa.commandSync(cmd, { cwd: monorepoRoot });
const scsPath = (...segments) => path.join(scsPackageDir, ...segments);
const gitAdd = (filePath) => {
const relPath = path.join('packages/slds-scs', filePath);
gitInMonorepo(`git add -f ${relPath}`);
console.log(` staged ${relPath}`);
};
// ------------------------------------------------------------------
// Main
// ------------------------------------------------------------------
ask().then(async (answers) => {
const nexusCredentials = config.nexusCreds || answers['nexusCreds'];
const workItemId = config.wi || answers['wi'];
const gusChangeCase = config.case || answers['case'];
const sldsVersion = config.sldsVersion || answers['sldsVersion'];
const sldsVersionSemver = autoVersion.toSemver(sldsVersion);
const slds2Version = config.slds2Version || answers['slds2Version'];
const slds2VersionSemver = autoVersion.toSemver(slds2Version);
const coreBranch = config.coreBranch || answers['coreBranch'];
console.log(`\nSLDS1: ${sldsVersion} → ${sldsVersionSemver}`);
console.log(`SLDS2: ${slds2Version} → ${slds2VersionSemver}`);
console.log(`Target branch: ${coreBranch}`);
const prBody = `[GUS](https://gus.my.salesforce.com/apex/ADM_WorkLocator?bugorworknumber=${workItemId})
GUS Case Object:
@gus-change-case: ${gusChangeCase}@`;
// ================================================================
// Phase 0 — Seed packages/slds-scs/ from the target branch
// ================================================================
// Clone (or refresh) the target branch of aura/slds-scs and sync its
// release-state directories into packages/slds-scs/ so that Phase A
// starts from the real state of the downstream repo, not whatever
// happens to be committed (or left on disk) in the monorepo.
// Skipped with --skip-seed to preserve local edits for incremental updates.
if (config.skipSeed) {
console.log('\n── Phase 0: Skipped (--skip-seed) ──');
console.log(' Using local packages/slds-scs/ state as-is');
} else {
console.log(`\n── Phase 0: Seed from ${coreBranch} ──`);
if (!fs.existsSync(SCS_CLONE_DIR)) {
execa.commandSync(
`git clone --depth=1 --branch=${coreBranch} ${SCS_REPO} ${SCS_CLONE_DIR}`,
{ cwd: monorepoRoot },
);
} else {
execa.commandSync(`git fetch origin ${coreBranch}`, { cwd: SCS_CLONE_DIR });
execa.commandSync(`git checkout ${coreBranch}`, { cwd: SCS_CLONE_DIR });
execa.commandSync(`git reset --hard origin/${coreBranch}`, { cwd: SCS_CLONE_DIR });
}
const seedDirs = ['slds', 'scs', 'tnrp'];
for (const dir of seedDirs) {
const src = path.join(SCS_CLONE_DIR, dir) + '/';
const dest = scsPath(dir) + '/';
if (fs.existsSync(src)) {
fs.ensureDirSync(dest);
execa.sync('rsync', ['-a', '--delete', src, dest], { cwd: monorepoRoot });
console.log(` seeded ${dir}/`);
}
}
fs.copySync(
path.join(SCS_CLONE_DIR, 'package.json'),
scsPath('package.json'),
);
console.log(' seeded package.json');
// Capture a validation baseline from the seeded (target-branch) state
// so that compare-output can later diff against the assembled output.
await captureBaseline(
{ config: path.join(packageRoot, '.validation/scs.js') },
{ cwd: packageRoot },
);
}
// ================================================================
// Phase A — Assemble new slds-scs version in the monorepo
// ================================================================
console.log('\n── Phase A: Assemble ──');
// ------------------------------------------------------------------
// CSS file mappings — write directly into packages/slds-scs/slds/
// ------------------------------------------------------------------
const scsSldsDir = scsPath('slds');
const srcDir = SLDS1_DIST_PATH;
const scsFiles = [
{
src: path.join(srcDir, 'assets/styles/salesforce-lightning-design-system_touch.css'),
dest: scsSldsDir,
filename: `slds-touch-${sldsVersionSemver}.css`,
},
{
src: path.join(srcDir, 'assets/styles/salesforce-lightning-design-system.css'),
dest: scsSldsDir,
filename: `slds-${sldsVersionSemver}.css`,
},
{
src: path.join(srcDir, 'assets/styles/salesforce-lightning-design-system-legacy.css'),
dest: scsSldsDir,
filename: `slds-legacy-${sldsVersionSemver}.css`,
},
{
src: path.join(srcDir, 'assets/styles/salesforce-lightning-design-system-offline.css'),
dest: scsSldsDir,
filename: `slds-offline-${sldsVersionSemver}.css`,
},
{
src: path.join(SLDS2_DIST_PATH, 'css/bundled/slds2.cosmos.css'),
dest: scsSldsDir,
filename: `slds-plus-${slds2VersionSemver}.css`,
},
{
src: path.join(SLDS2_DIST_PATH, 'css/bundled/slds2.scoped.cosmos.css'),
dest: scsSldsDir,
filename: `scoped-slds-plus-${slds2VersionSemver}.css`,
},
{
src: path.join(
SLDS2_DIST_PATH,
'css/theme-layer/bundled/slds2.theme-layer.cosmos.css',
),
dest: scsSldsDir,
filename: `slds-plus-theme-layer-${slds2VersionSemver}.css`,
},
];
console.log('\nCopying CSS files into packages/slds-scs/slds/');
const copyResults = { ok: [], failed: [] };
scsFiles.forEach(({ src, dest, filename }) => {
try {
fs.copySync(src, path.join(dest, filename));
copyResults.ok.push(filename);
} catch {
copyResults.failed.push({ filename, src });
}
});
copyResults.ok.forEach((f) => console.log(` ✓ ${f}`));
copyResults.failed.forEach(({ filename, src }) =>
console.log(` ✗ ${filename}\n source missing: ${src}`),
);
console.log(` ${copyResults.ok.length} copied, ${copyResults.failed.length} failed`);
if (copyResults.failed.length) {
const slds2Missing = copyResults.failed.filter(({ src }) => src.includes('design-system-2'));
const slds1Missing = copyResults.failed.filter(({ src }) => !src.includes('design-system-2'));
console.error(`\nError: ${copyResults.failed.length} CSS source file(s) not found.`);
if (slds2Missing.length) {
console.error(
`\n SLDS2 (slds-plus) files missing — the design-system-2 package likely hasn't been built.\n` +
' Run: yarn workspace @salesforce-ux/design-system-2 build:production',
);
}
if (slds1Missing.length) {
console.error(
`\n SLDS1 files missing — the design-system dist has not been built.\n` +
' Run: yarn workspace @salesforce-ux/design-system build',
);
}
process.exit(1);
}
// CSS files in slds/ are gitignored in the monorepo (they are build
// artifacts tracked only in the downstream slds-scs repo). No git add
// here — Phase B syncs them to the clone independently.
// ------------------------------------------------------------------
// Update scs/files.json
// ------------------------------------------------------------------
const lwrMappedVersion =
autoVersion.parse(autoVersion.getVersion(path.join(srcDir, 'package.json'))).minor - 14;
const filesJsonPath = scsPath('scs', 'files.json');
const filesJsonString = fs.readFileSync(filesJsonPath, 'utf8');
const jsonData = JSON.parse(filesJsonString);
const [updatedFiles, rejectFiles] = FileParser(
sldsVersionSemver,
lwrMappedVersion,
jsonData,
[],
[3, 3, 3],
slds2VersionSemver,
);
fs.writeFileSync(filesJsonPath, JSON.stringify(updatedFiles, null, 2));
const entryCount = updatedFiles.files?.length ?? 0;
console.log(`\nUpdated scs/files.json — ${entryCount} entries (SLDS1 ${sldsVersionSemver}, SLDS2 ${slds2VersionSemver})`);
gitAdd('scs/files.json');
if (rejectFiles.length) {
console.log(`\nRetention policy: removing ${rejectFiles.length} old file(s)`);
rejectFiles
.map((f) => f.filePath)
.forEach((filePath) => {
fs.removeSync(scsPath(filePath));
console.log(` ✗ ${filePath}`);
});
}
// ------------------------------------------------------------------
// Bump slds-scs package version (from latest published on Nexus)
// ------------------------------------------------------------------
const NEXUS_NPM_REGISTRY = 'https://nexus-proxy.repo.local.sfdc.net/nexus/content/repositories/npmjs-internal/';
const scsPackageName = 'slds-modules';
let packageVersion;
try {
const { stdout } = execa.commandSync(
`npm view ${scsPackageName} version --registry=${NEXUS_NPM_REGISTRY}`,
{ cwd: monorepoRoot },
);
packageVersion = stdout.trim();
console.log(`\nLatest ${scsPackageName} on Nexus: ${packageVersion}`);
} catch {
packageVersion = autoVersion.getVersion(scsPackageDir);
console.log(`\nCould not reach Nexus — using seeded version: ${packageVersion}`);
}
const newPackageVersion = autoVersion.patch(packageVersion);
autoVersion.setVersion(newPackageVersion, scsPackageDir);
gitAdd('package.json');
console.log(`Bumped slds-scs: ${packageVersion} → ${newPackageVersion}`);
// ------------------------------------------------------------------
// SCS Client — check for updates
// ------------------------------------------------------------------
console.log('\nChecking scs-client JAR version...');
const cmdListScsClientVersion = `ls ${scsPath('tnrp')}/scs* | sed -E "s/..*([[:digit:]]\\.[[:digit:]]\\.[[:digit:]]{1,3})..*/\\1/g"`;
const { stdout: scsClientVersion } = execa.sync('sh', ['-c', cmdListScsClientVersion]);
const cmdLatestScsClientVersion = `curl -L -u '${nexusCredentials}' -X GET "https://nexus-dev.data.sfdc.net/nexus/service/rest/v1/search/assets?sort=version&repository=releases&maven.groupId=com.salesforce.armada&maven.artifactId=scs-client&maven.classifier=&maven.extension=jar&direction=desc" -H "accept: application/json" | jq -r ".items[0]"`;
const { stdout: scsClientLatestVersionStdOut } = execa.sync('sh', ['-c', cmdLatestScsClientVersion]);
const scsClientLatestVersionData = JSON.parse(scsClientLatestVersionStdOut);
const scsClientLatestVersion = scsClientLatestVersionData.maven2.version;
if (scsClientVersion === scsClientLatestVersion) {
console.log(` scs-client ${scsClientVersion} is up to date`);
} else {
console.log(` scs-client ${scsClientVersion} → ${scsClientLatestVersion} (updating)`);
const jarDest = scsPath('tnrp', `scs-client-${scsClientLatestVersion}.jar`);
execa.sync('curl', ['-k', '-o', jarDest, '-u', nexusCredentials, scsClientLatestVersionData.downloadUrl]);
gitAdd(`tnrp/scs-client-${scsClientLatestVersion}.jar`);
const tnrpPackagePath = scsPath('tnrp', 'package');
const scsClientRegex = `s/(scs-client-)[[:digit:]]\\.[[:digit:]]\\.[[:digit:]]{1,3}(\\.jar)/\\1${scsClientLatestVersion}\\2/`;
execa.sync('sed', ['-i', '', '-E', scsClientRegex, tnrpPackagePath]);
gitAdd('tnrp');
console.log(` updated tnrp/package to scs-client-${scsClientLatestVersion}.jar`);
}
// ------------------------------------------------------------------
// Commit in monorepo
// ------------------------------------------------------------------
const branchName = `release-${newPackageVersion}-slds-${sldsVersion}-slds-plus-${slds2Version}`;
gitInMonorepo('git add packages/slds-scs/');
// Format staged JSON files before committing.
execa.commandSync(
'npx prettier --write packages/slds-scs/package.json packages/slds-scs/scs/files.json',
{ cwd: monorepoRoot },
);
gitInMonorepo('git add packages/slds-scs/package.json packages/slds-scs/scs/files.json');
// --no-verify skips the pre-commit hook (which triggers a full gulp build).
// Formatting is already handled above; the hook is for developer commits.
const { stdout: diffIndex } = execa.commandSync(
'git diff --cached --name-only',
{ cwd: monorepoRoot },
);
if (diffIndex.trim()) {
execa.sync('git', [
'commit',
'--no-verify',
'-m',
`update SLDS files [${sldsVersion}] in ${newPackageVersion}`,
], { cwd: monorepoRoot });
console.log('Committed in monorepo');
} else {
console.log('No changes to commit in monorepo (already up to date)');
}
// ================================================================
// Phase B — Export to aura/slds-scs and create PR
// ================================================================
const cliDoPR = config.doPR === true || config.doPR === 'true';
if (cliDoPR || answers['doPR']) {
console.log(`\n── Phase B: Export to aura/slds-scs (${coreBranch}) ──`);
// 1. Reset clone back to target branch (reuses the clone from Phase 0)
execa.commandSync(`git checkout ${coreBranch}`, { cwd: SCS_CLONE_DIR });
execa.commandSync(`git reset --hard origin/${coreBranch}`, { cwd: SCS_CLONE_DIR });
// 2. Sync assembled packages/slds-scs/ → clone (full state replacement)
execa.sync('rsync', ['-a', '--delete', '--exclude=.git', '--exclude=.gitignore', '--exclude=.strata.yml', `${scsPackageDir}/`, `${SCS_CLONE_DIR}/`], { cwd: monorepoRoot });
console.log(' synced packages/slds-scs/ → .scs-clone/');
// 3. Detect existing remote branch and/or PR
let remoteBranchExists = false;
let existingPrUrl = null;
try {
const { stdout: lsRemote } = execa.commandSync(
`git ls-remote --heads origin ${branchName}`,
{ cwd: SCS_CLONE_DIR },
);
remoteBranchExists = lsRemote.trim().length > 0;
} catch { /* ls-remote failed — assume no remote branch */ }
if (remoteBranchExists) {
try {
const { stdout: prList } = execa.sync(
'gh', ['pr', 'list', '-R', 'git.soma.salesforce.com/aura/slds-scs', '--head', branchName, '-B', coreBranch, '--json', 'url', '-q', '.[0].url'],
{ cwd: SCS_CLONE_DIR },
);
if (prList.trim()) existingPrUrl = prList.trim();
} catch { /* gh pr list failed — PR detection unavailable */ }
}
if (remoteBranchExists || existingPrUrl) {
console.log('\n ⚠ Existing release artifacts detected:');
if (remoteBranchExists) console.log(` branch: ${branchName}`);
if (existingPrUrl) console.log(` PR: ${existingPrUrl}`);
// Allowlist: only the literal `true` (boolean) or string `'true'` opts in.
// Anything else (false, 'false', 'no', '0', null, undefined) falls back to
// the interactive prompt, which defaults to abort.
const forcePush = config.forcePush != null
? config.forcePush === true || config.forcePush === 'true'
: (await prompt({
type: 'toggle',
name: 'forcePush',
message: 'Force-push over the existing branch (and update the PR)?',
enabled: 'Yes, overwrite',
disabled: 'No, abort',
initial: false,
})).forcePush;
if (!forcePush) {
console.log(' Aborted Phase B — existing branch/PR left untouched.');
process.exit(0);
}
}
// 4. Create release branch, commit, push
try {
execa.commandSync(`git show-ref --quiet refs/heads/${branchName}`, { cwd: SCS_CLONE_DIR });
execa.commandSync(`git branch -D ${branchName}`, { cwd: SCS_CLONE_DIR });
console.log(` cleaned up stale local branch ${branchName}`);
} catch {
// Branch doesn't exist locally — expected
}
execa.commandSync(`git checkout -b ${branchName}`, { cwd: SCS_CLONE_DIR });
execa.commandSync('git add -A', { cwd: SCS_CLONE_DIR });
execa.sync('git', [
'commit',
'-m',
`update SLDS files [${sldsVersion}] in ${newPackageVersion}`,
], { cwd: SCS_CLONE_DIR });
console.log(` committed on ${branchName}`);
const pushFlag = remoteBranchExists ? '--force' : '--force-with-lease';
try {
execa.sync('git', ['push', pushFlag, 'origin', branchName], { cwd: SCS_CLONE_DIR });
console.log(` pushed to aura/slds-scs (${pushFlag})`);
} catch (err) {
console.error(` push failed: ${err.shortMessage || err.message}`);
}
// 5. Create PR if one doesn't already exist
if (existingPrUrl) {
console.log(` PR already open — force-push updated it: ${existingPrUrl}`);
} else {
try {
const prTitle = `@${workItemId} bumped to ${newPackageVersion} with SLDS ${sldsVersion}, SLDS2/+ ${slds2Version}`;
const { stdout: prUrl } = execa.sync(
'gh', ['pr', 'create', '-t', prTitle, '-b', prBody, '-R', 'git.soma.salesforce.com/aura/slds-scs', '--head', branchName, '-B', coreBranch],
{ cwd: SCS_CLONE_DIR },
);
console.log(` PR created: ${prUrl.trim()}`);
} catch (err) {
const prMatch = err.stderr?.match(/https:\/\/\S+\/pull\/\d+/);
if (prMatch) {
console.log(` PR already exists: ${prMatch[0]}`);
} else {
console.error(` Failed to create PR: ${err.shortMessage || err.message}`);
}
}
}
}
});
|