Skip to content

Commit 223db40

Browse files
authored
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.
1 parent f391cda commit 223db40

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.circleci/config.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ jobs:
106106
- setup_node_modules
107107
- run:
108108
command: |
109-
mkdir -p ./build
109+
mkdir -p ./build/__test_utils__
110110
node ./scripts/print-warnings/print-warnings.js > build/WARNINGS
111+
node ./scripts/print-warnings/print-warnings.js --js > build/__test_utils__/ReactAllWarnings.js
111112
- persist_to_workspace:
112113
root: .
113114
paths:

scripts/print-warnings/print-warnings.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,19 @@ gs([
7575
'!**/node_modules/**/*.js',
7676
]).pipe(
7777
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+
}
8391
cb();
8492
})
8593
);

0 commit comments

Comments
 (0)