Skip to content

Commit

Permalink
Create warnings JS file for Meta (facebook#27786)
Browse files Browse the repository at this point in the history
The `WARNINGS` file isn't picked up by the test dependency analyzer,
this creates a JS version of the file that I think should work.
  • Loading branch information
kassens authored and AndyPengc12 committed Apr 15, 2024
1 parent 3185b89 commit 8dc216b
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 8dc216b

Please sign in to comment.