Last active
August 26, 2021 14:21
-
-
Save joekrump/067a6c6600b82a2aaf5369f066720075 to your computer and use it in GitHub Desktop.
Get the paths to files that have webpack compile errors
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
# Combined commands (See below for descriptions about what each one is doing): | |
yarn run build | awk '$0~/ERROR in/' | sed -e 's/ERROR in //' -e 's/:[0-9]:[0-9]//' -e 's/:[0-9][0-9]:[0-9]//' -e 's/:[0-9][0-9]:[0-9][0-9]//' > file_paths.txt | |
# yarn run build > build_output.txt # Direct stdout to a file. yarn run build runs `webpack` | |
# awk '$0~/ERROR in/' build_output.txt > files_with_errors.txt # Get the lines that start with the string "ERROR in" and print them to the file, files_with_errors.txt | |
# sed -e 's/ERROR in //' -e 's/:[0-9]:[0-9]//' -e 's/:[0-9][0-9]:[0-9]//' -e 's/:[0-9][0-9]:[0-9][0-9]//' files_with_errors.txt > paths_without_line_numbers.txt # Find and replace instances of "ERROR in " with nothing, run several matchers to remove trailing line and column numbers on the path strings that take like something like "/path/to/some/file.ts:10:11". |
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
# Run a transform on all the files that have been listed in paths_without_line_numbers.txt after running the script above. | |
# This runs a transform using jscodeshift. Docs: https://github.com/facebook/jscodeshift | |
jscodeshift --stdin < ./paths_without_line_numbers.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment