Skip to content

Commit a207ab8

Browse files
authored
Merge pull request #45915 from margelo/feat/react-compiler-ci-check
compiler: `--json` option to healthcheck CLI
2 parents 6bd5dc4 + b480223 commit a207ab8

2 files changed

+73
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
diff --git a/node_modules/react-compiler-healthcheck/dist/index.js b/node_modules/react-compiler-healthcheck/dist/index.js
2+
index 4bf23db..f7dfdf6 100755
3+
--- a/node_modules/react-compiler-healthcheck/dist/index.js
4+
+++ b/node_modules/react-compiler-healthcheck/dist/index.js
5+
@@ -69154,16 +69154,28 @@ var reactCompilerCheck = {
6+
compile(source, path);
7+
}
8+
},
9+
- report(verbose) {
10+
+ report(verbose, json) {
11+
const totalComponents =
12+
SucessfulCompilation.length +
13+
countUniqueLocInEvents(OtherFailures) +
14+
countUniqueLocInEvents(ActionableFailures);
15+
- console.log(
16+
- chalk.green(
17+
- `Successfully compiled ${SucessfulCompilation.length} out of ${totalComponents} components.`
18+
- )
19+
- );
20+
+ if (!json) {
21+
+ console.log(
22+
+ chalk.green(
23+
+ `Successfully compiled ${SucessfulCompilation.length} out of ${totalComponents} components.`
24+
+ )
25+
+ );
26+
+ }
27+
+
28+
+ if (json) {
29+
+ const extractFileName = (output) => output.fnLoc.filename;
30+
+ const successfulFiles = SucessfulCompilation.map(extractFileName);
31+
+ const unsuccessfulFiles = [...new Set([...OtherFailures, ...ActionableFailures].map(extractFileName))];
32+
+ console.log({
33+
+ success: successfulFiles,
34+
+ failure: unsuccessfulFiles,
35+
+ });
36+
+ }
37+
38+
if (verbose) {
39+
for (const compilation of [...SucessfulCompilation, ...ActionableFailures, ...OtherFailures]) {
40+
@@ -69250,10 +69262,17 @@ function main() {
41+
default: false,
42+
alias: 'v',
43+
})
44+
+ .option('json', {
45+
+ description: 'print a list of compiled/not-compiled files as JSON',
46+
+ type: 'boolean',
47+
+ default: false,
48+
+ alias: 'j',
49+
+ })
50+
.parseSync();
51+
const spinner = ora("Checking").start();
52+
let src = argv.src;
53+
let verbose = argv.verbose;
54+
+ let json = argv.json;
55+
const globOptions = {
56+
onlyFiles: true,
57+
ignore: [
58+
@@ -69273,9 +69292,12 @@ function main() {
59+
libraryCompatCheck.run(source, path);
60+
}
61+
spinner.stop();
62+
- reactCompilerCheck.report(verbose);
63+
- strictModeCheck.report();
64+
- libraryCompatCheck.report();
65+
+ reactCompilerCheck.report(verbose, json);
66+
+ // using json option we only want to get list of files
67+
+ if (!json) {
68+
+ strictModeCheck.report();
69+
+ libraryCompatCheck.report();
70+
+ }
71+
});
72+
}
73+
main();

0 commit comments

Comments
 (0)