Skip to content

Commit bbb340c

Browse files
aboseclaude
andcommitted
fix: make patchElectronStageBranding idempotent
The previous "did we change anything" check inferred regex match failure from `patched === builderYml`, which also fires when the productName line is already the target value — so a second run (or any prod build, since the committed default is already `phoenix-code`) threw "Could not find productName line". Test the regex directly instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9ea3249 commit bbb340c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src-build/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ export function patchElectronStageBranding(electronDir, productName) {
125125

126126
const builderPath = path.join(electronDir, 'electron-builder.yml');
127127
const builderYml = fs.readFileSync(builderPath, 'utf8');
128-
const patched = builderYml.replace(/^productName:.*$/m, `productName: ${appId}`);
129-
if (patched === builderYml) {
128+
const productNameRegex = /^productName:.*$/m;
129+
if (!productNameRegex.test(builderYml)) {
130130
throw new Error(`Could not find productName line in ${builderPath}`);
131131
}
132-
fs.writeFileSync(builderPath, patched);
132+
fs.writeFileSync(builderPath, builderYml.replace(productNameRegex, `productName: ${appId}`));
133133
}
134134

135135
export function patchTauriConfigWithMetricsHTML(tauriConf, useClonedPhoenix) {

0 commit comments

Comments
 (0)