-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EuiIcon] Add generated file comment #5210
Conversation
@@ -15,7 +15,7 @@ function pascalCase(x) { | |||
|
|||
const iconFiles = glob.sync('**/*.svg', { cwd: iconsDir, realpath: true }); | |||
|
|||
iconFiles.forEach(async filePath => { | |||
iconFiles.forEach(async (filePath) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a Prettier autofix on save
const comment = '// THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY\n\n'; | ||
fs.writeFileSync(outputFilePath, comment + jsxSource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments in ast are a bit of a headache apparently (you have to pass in a custom preserveComments
option, and then you have to use template.smart()
instead of the template.ast
shortcut, etc.) so I opted for the path of least resistance and just threw in the comment directly into the writeFile 🙃
Preview documentation changes for this PR: https://eui.elastic.co/pr_5210/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just threw in the comment directly into the writeFile
I like it!
🐇 Goin' down that rabbit hole: I'll look at .tsx for icons in a follow up PR! |
Summary
Per @thompsongl's comments in #5204 (comment), we should add a comment to note that our icon
.js
files are generated files and shouldn't be modified (I had previously thought the.svg
files were the ones that were for reference/archival and shouldn't be touched 🙃)Checklist
N/A, internal/dev-only change