-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45915 from margelo/feat/react-compiler-ci-check
compiler: `--json` option to healthcheck CLI
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
73 changes: 73 additions & 0 deletions
73
patches/react-compiler-healthcheck+0.0.0-experimental-b130d5f-20240625+001+json.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
diff --git a/node_modules/react-compiler-healthcheck/dist/index.js b/node_modules/react-compiler-healthcheck/dist/index.js | ||
index 4bf23db..f7dfdf6 100755 | ||
--- a/node_modules/react-compiler-healthcheck/dist/index.js | ||
+++ b/node_modules/react-compiler-healthcheck/dist/index.js | ||
@@ -69154,16 +69154,28 @@ var reactCompilerCheck = { | ||
compile(source, path); | ||
} | ||
}, | ||
- report(verbose) { | ||
+ report(verbose, json) { | ||
const totalComponents = | ||
SucessfulCompilation.length + | ||
countUniqueLocInEvents(OtherFailures) + | ||
countUniqueLocInEvents(ActionableFailures); | ||
- console.log( | ||
- chalk.green( | ||
- `Successfully compiled ${SucessfulCompilation.length} out of ${totalComponents} components.` | ||
- ) | ||
- ); | ||
+ if (!json) { | ||
+ console.log( | ||
+ chalk.green( | ||
+ `Successfully compiled ${SucessfulCompilation.length} out of ${totalComponents} components.` | ||
+ ) | ||
+ ); | ||
+ } | ||
+ | ||
+ if (json) { | ||
+ const extractFileName = (output) => output.fnLoc.filename; | ||
+ const successfulFiles = SucessfulCompilation.map(extractFileName); | ||
+ const unsuccessfulFiles = [...new Set([...OtherFailures, ...ActionableFailures].map(extractFileName))]; | ||
+ console.log({ | ||
+ success: successfulFiles, | ||
+ failure: unsuccessfulFiles, | ||
+ }); | ||
+ } | ||
|
||
if (verbose) { | ||
for (const compilation of [...SucessfulCompilation, ...ActionableFailures, ...OtherFailures]) { | ||
@@ -69250,10 +69262,17 @@ function main() { | ||
default: false, | ||
alias: 'v', | ||
}) | ||
+ .option('json', { | ||
+ description: 'print a list of compiled/not-compiled files as JSON', | ||
+ type: 'boolean', | ||
+ default: false, | ||
+ alias: 'j', | ||
+ }) | ||
.parseSync(); | ||
const spinner = ora("Checking").start(); | ||
let src = argv.src; | ||
let verbose = argv.verbose; | ||
+ let json = argv.json; | ||
const globOptions = { | ||
onlyFiles: true, | ||
ignore: [ | ||
@@ -69273,9 +69292,12 @@ function main() { | ||
libraryCompatCheck.run(source, path); | ||
} | ||
spinner.stop(); | ||
- reactCompilerCheck.report(verbose); | ||
- strictModeCheck.report(); | ||
- libraryCompatCheck.report(); | ||
+ reactCompilerCheck.report(verbose, json); | ||
+ // using json option we only want to get list of files | ||
+ if (!json) { | ||
+ strictModeCheck.report(); | ||
+ libraryCompatCheck.report(); | ||
+ } | ||
}); | ||
} | ||
main(); |