Skip to content

Commit f87e97a

Browse files
authored
Handle line endings correctly on Windows in build script for RN (#26727)
## Summary We added some post-processing in the build for RN in #26616 that broke for users on Windows due to how line endings were handled to the regular expression to insert some directives in the docblock. This fixes that problem, reported in #26697 as well. ## How did you test this change? Verified files are still built correctly on Mac/Linux. Will ask for help to test on Windows.
1 parent 25b99ef commit f87e97a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/rollup/packaging.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ function processGenerated(directory) {
148148
const originalContents = readFileSync(file, 'utf8');
149149
const contents = originalContents
150150
// Replace {@}format with {@}noformat
151-
.replace(/(\n\s*\*\s*)@format\b.*(\n)/, '$1@noformat$2')
151+
.replace(/(\r?\n\s*\*\s*)@format\b.*(\n)/, '$1@noformat$2')
152152
// Add {@}nolint and {@}generated
153-
.replace(' */\n', ` * @nolint\n * ${getSigningToken()}\n */\n`);
153+
.replace(/(\r?\n\s*\*)\//, `$1 @nolint$1 ${getSigningToken()}$1/`);
154154
const signedContents = signFile(contents);
155155
writeFileSync(file, signedContents, 'utf8');
156156
});

0 commit comments

Comments
 (0)