Skip to content
Permalink
Browse files
Get rid of hacky default.json file for init-defaults
  • Loading branch information
raphinesse committed Apr 15, 2019
1 parent ae2826f commit 1aedd1fd5e915242a698cdecc04100adb9127588
Showing 2 changed files with 6 additions and 10 deletions.
@@ -17,8 +17,6 @@
under the License.
*/

var fs = require('fs-extra');
var path = require('path');
var PluginInfo = require('cordova-common').PluginInfo;
var events = require('cordova-common').events;
const pify = require('pify');
@@ -39,13 +37,8 @@ function createPackageJson (plugin_path) {
platforms: pluginInfo.getPlatformsArray()
};

return fs.writeFile(path.join(__dirname, 'defaults.json'), JSON.stringify(defaults), 'utf8')
.then(_ => {
events.emit('verbose', 'defaults.json created from plugin.xml');

var initFile = require.resolve('./init-defaults');
return initPkgJson(plugin_path, initFile, {});
})
var initFile = require.resolve('./init-defaults');
return initPkgJson(plugin_path, initFile, defaults)
.then(_ => {
events.emit('verbose', 'Package.json successfully created');
});
@@ -17,6 +17,7 @@
under the License.
**/

/* global config */
/* global dirname */
/* global basename */
/* global yes */
@@ -29,7 +30,6 @@ const pkg = this.package;

var fs = require('fs-extra');
var path = require('path');
var defaults = require('./defaults.json');

function readDeps () {
return function (cb) {
@@ -57,6 +57,9 @@ function readDeps () {
};
}

// The defaults read from plugin.xml
const defaults = config.toJSON();

var name = pkg.name || defaults.id || basename;
exports.name = yes ? name : prompt('name', name);

0 comments on commit 1aedd1f

Please sign in to comment.