-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
feat: enable noOverwriteGlobs for templates based on react engine #1234
feat: enable noOverwriteGlobs for templates based on react engine #1234
Conversation
🦋 Changeset detectedLatest commit: 4a1f332 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
Updates added. Suggestions resolved. |
await writeFile(testFilePath, testContent); | ||
const fileContentBefore = await readFile(testFilePath, 'utf8'); | ||
// Check if the file was created | ||
expect(fileContentBefore).toBe(testContent); |
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.
do we really need line 68-70? seems like we are testing here not generator code but just the FS write function 🤔
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.
I would think so? The purpose of should ignore specified files with noOverwriteGlobs
test is to make sure that the files specified by noOverwriteGlobs
is not overwritten. Thus we need to check the file content after the generation.
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.
Thus we need to check the file content after the generation.
exactly, and this is what lines 82-84 are for, where you check if content is still there after generation
in line 68-70 you basically test fs
, if writeFile
was successful, which I don't think is necessary
Quality Gate passedIssues Measures |
/rtm |
Description
Description
add noOverwriteGlobs parameters to methods saveContentToFile and saveRenderedReactContent
pass this.noOverwriteGlobs to saveContentToFile
check the name of file to be written against the noOverwriteGlobs to determine whether it should be actually written to the target directory
add additional comments to relevant codes in the codebase so they are easier for future maintainers and contributors to understand.
Related issue(s)
Fixes #1128