-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathcheckReactCompiler.ts
37 lines (28 loc) · 1.09 KB
/
checkReactCompiler.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* eslint-disable @typescript-eslint/naming-convention */
import * as core from '@actions/core';
type ReactCompilerOutput = {
success: string[];
failure: string[];
};
const run = function (): Promise<void> {
const oldList = JSON.parse(core.getInput('OLD_LIST', {required: true})) as ReactCompilerOutput;
const newList = JSON.parse(core.getInput('NEW_LIST', {required: true})) as ReactCompilerOutput;
const errors: string[] = [];
oldList.success.forEach((file) => {
if (newList.success.includes(file) || !newList.failure.includes(file)) {
return;
}
errors.push(file);
});
if (errors.length > 0) {
errors.forEach((error) => console.error(error));
throw new Error(
'Some files could be compiled with react-compiler before successfully, but now they can not be compiled. Check https://github.com/Expensify/App/blob/main/contributingGuides/REACT_COMPILER.md documentation to see how you can fix this.',
);
}
return Promise.resolve();
};
if (require.main === module) {
run();
}
export default run;