Skip to content

Commit

Permalink
Handle line endings correctly on Windows in build script for RN (#26727)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
rubennorte authored Apr 25, 2023
1 parent 25b99ef commit f87e97a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/rollup/packaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ function processGenerated(directory) {
const originalContents = readFileSync(file, 'utf8');
const contents = originalContents
// Replace {@}format with {@}noformat
.replace(/(\n\s*\*\s*)@format\b.*(\n)/, '$1@noformat$2')
.replace(/(\r?\n\s*\*\s*)@format\b.*(\n)/, '$1@noformat$2')
// Add {@}nolint and {@}generated
.replace(' */\n', ` * @nolint\n * ${getSigningToken()}\n */\n`);
.replace(/(\r?\n\s*\*)\//, `$1 @nolint$1 ${getSigningToken()}$1/`);
const signedContents = signFile(contents);
writeFileSync(file, signedContents, 'utf8');
});
Expand Down

0 comments on commit f87e97a

Please sign in to comment.