Skip to content

Commit a6b69fd

Browse files
committed
update add script
1 parent 823e2c1 commit a6b69fd

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/project_config/optimizely_config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,4 +484,4 @@ export function createOptimizelyConfig(configObj: ProjectConfig, datafile: strin
484484
return new OptimizelyConfig(configObj, datafile, logger);
485485
}
486486

487-
export const __platforms: Platform[] = ['__universal__'];
487+
export const __platforms: Platform[] = [ '__universal__' ];

scripts/add-platform-exports.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ function extractExistingPlatformExport(content, filePath) {
260260
linesToRemove.add(i);
261261
statementLines.push(lines[i]);
262262
}
263+
264+
// If the next line is whitespace, extract it as well
265+
if (endLine + 1 < lines.length && lines[endLine + 1].trim() === '') {
266+
linesToRemove.add(endLine + 1);
267+
}
268+
263269
exportStatement = statementLines.join('\n');
264270
}
265271
}
@@ -325,7 +331,13 @@ function processFile(filePath) {
325331
const extracted = extractExistingPlatformExport(content, filePath);
326332
content = extracted.restContent;
327333

328-
action = 'fixed';
334+
if (extracted.platformExportStatement) {
335+
// There was an existing export statement, we removed it
336+
// so we will be replacing it with a fixed one
337+
action = 'fixed';
338+
} else {
339+
action = 'added';
340+
}
329341
modified = true;
330342

331343
// Ensure Platform import exists

0 commit comments

Comments
 (0)