github-advanced-security[bot] commented on code in PR #273: URL: https://github.com/apache/cordova-electron/pull/273#discussion_r1568270040
########## lib/PackageJsonParser.js: ########## @@ -17,15 +17,24 @@ under the License. */ -const fs = require('fs-extra'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); const { getPackageJson } = require('./util'); class PackageJsonParser { constructor (wwwDir, projectRootDir) { - // Electron App Package + // make sure www dir exists + if (!fs.existsSync(wwwDir)) { + fs.mkdirSync(wwwDir, { recursive: true }); + } + this.path = path.join(wwwDir, 'package.json'); - fs.ensureFileSync(this.path); + + if (!fs.existsSync(this.path)) { + fs.writeFileSync(this.path, '{}', 'utf8'); Review Comment: ## Potential file system race condition The file may have changed since it [was checked](1). [Show more details](https://github.com/apache/cordova-electron/security/code-scanning/1) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org