Skip to content

Commit

Permalink
Create warnings JS file for Meta
Browse files Browse the repository at this point in the history
  • Loading branch information
kassens committed Dec 4, 2023
1 parent a523132 commit f6902a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ jobs:
- setup_node_modules
- run:
command: |
mkdir -p ./build
mkdir -p ./build/__test_utils__
node ./scripts/print-warnings/print-warnings.js > build/WARNINGS
node ./scripts/print-warnings/print-warnings.js --js > build/__test_utils__/ReactAllWarnings.js
- persist_to_workspace:
root: .
paths:
Expand Down
18 changes: 13 additions & 5 deletions scripts/print-warnings/print-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,19 @@ gs([
'!**/node_modules/**/*.js',
]).pipe(
through.obj(transform, cb => {
process.stdout.write(
Array.from(warnings, warning => JSON.stringify(warning))
.sort()
.join('\n') + '\n'
);
if (process.argv[2] === '--js') {
const warningsArray = Array.from(warnings);
warningsArray.sort();
process.stdout.write(
`export default ${JSON.stringify(warningsArray, null, 2)};\n`
);
} else {
process.stdout.write(
Array.from(warnings, warning => JSON.stringify(warning))
.sort()
.join('\n') + '\n'
);
}
cb();
})
);

0 comments on commit f6902a0

Please sign in to comment.