refactor: replace fs-extra with node:fs (#1772)

* spec: add devDependencies "tmp"
This commit is contained in:
エリス
2025-01-29 10:39:11 +09:00
committed by GitHub
parent b623311efa
commit e012478537
20 changed files with 188 additions and 164 deletions

View File

@@ -17,7 +17,7 @@
under the License.
*/
const fs = require('fs-extra');
const fs = require('node:fs');
const path = require('node:path');
const events = require('cordova-common').events;
@@ -41,7 +41,7 @@ class CordovaGradleConfigParser {
* @returns {Record<any, any>} The parsed JSON object representing the gradle config.
*/
_readConfig (configPath) {
return fs.readJSONSync(configPath, 'utf-8');
return JSON.parse(fs.readFileSync(configPath, 'utf-8') || '{}');
}
setPackageName (packageName) {
@@ -64,7 +64,7 @@ class CordovaGradleConfigParser {
*/
write () {
events.emit('verbose', '[Cordova Gradle Config] Saving File');
fs.writeJSONSync(this._cdvGradleConfigFilePath, this._cdvGradleConfig, 'utf-8');
fs.writeFileSync(this._cdvGradleConfigFilePath, JSON.stringify(this._cdvGradleConfig, null, 2), 'utf-8');
}
}