mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-04 00:02:03 +08:00
refactor: replace fs-extra with node:fs (#1772)
* spec: add devDependencies "tmp"
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user