-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
check if plugin is configured #145
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
const files = fs.readdirSync(dirPath); | ||
let found = false; | ||
|
||
files.forEach((file) => { |
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 will iterate over all files in the package. Using some will break the loop once a file with the search string was found.
|
||
const searchInFile = (filePath: string, searchString: string) => { | ||
const content = fs.readFileSync(filePath, "utf8"); | ||
return content.includes(searchString); |
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 will also find the searchString if it is in a comment (and therefore never executed). I believe a more sophisticated approach is needed here like a regex. Keep in mind that it could be a line comment (//), a multiline comment (/*) or even a jsdoc comment (/**).
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 are stripped out in the build process, the upload command uploads your dist folder not source
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.
Not everyone uses a build process that removes all comments. And especially in debug builds comments have a valid use case.
cap.mp4
/claim #144