@samitouri / QOS-React-1 / commits / 223db40d5a

Create warnings JS file for Meta (#27786)

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.

Jan Kassens committed Dec 4, 2023 at 13:33 UTC 223db40d5a04dc3311f963f5296675f7f43139e8
2 files changed +15 -6
.circleci/config.yml
+2 -1
@@ -106,8 +106,9 @@ jobs:
106 - setup_node_modules
107 - run:
108 command: |
109 - mkdir -p ./build
109 + mkdir -p ./build/__test_utils__
110 node ./scripts/print-warnings/print-warnings.js > build/WARNINGS
111 + node ./scripts/print-warnings/print-warnings.js --js > build/__test_utils__/ReactAllWarnings.js
112 - persist_to_workspace:
113 root: .
114 paths:
scripts/print-warnings/print-warnings.js
+13 -5
@@ -75,11 +75,19 @@ gs([
75 '!**/node_modules/**/*.js',
76 ]).pipe(
77 through.obj(transform, cb => {
78 - process.stdout.write(
79 - Array.from(warnings, warning => JSON.stringify(warning))
80 - .sort()
81 - .join('\n') + '\n'
82 - );
78 + if (process.argv[2] === '--js') {
79 + const warningsArray = Array.from(warnings);
80 + warningsArray.sort();
81 + process.stdout.write(
82 + `export default ${JSON.stringify(warningsArray, null, 2)};\n`
83 + );
84 + } else {
85 + process.stdout.write(
86 + Array.from(warnings, warning => JSON.stringify(warning))
87 + .sort()
88 + .join('\n') + '\n'
89 + );
90 + }
91 cb();
92 })
93 );