This script just doesn't work. Here are some of the fixes:
- Set bash to exit on failure
- Fix the array of files creation/appending
- Use an absolute path for the find root so the script can be run from anywhere
- Only search in src/ to not override the node_modules files
- Use proper quoting to prevent globbing expansion issues in the file names
- Rewrite the array loop so it actually runs on each element, not only the first one
- Build the @generated mark in a variable so the script is not marked as generated
- Use proper indentation
- Add the missing newline at the end of the file
- Make sed compatible with BSD/OSX variant
- Remove the unnecessary function
- Remove the unnecessary exit code
The file being no longer marked as generated, this will let the linter do its magic and help preventing new issues from being introduced.
Ref T2030.