diff --git a/plugin.xml b/plugin.xml index 6b9c3ed..08d4926 100644 --- a/plugin.xml +++ b/plugin.xml @@ -24,9 +24,9 @@ - - - + + + diff --git a/scripts/replaceWindowsWrapperFiles.js b/scripts/replaceWindowsWrapperFiles.js index 042a1d7..3441b4e 100644 --- a/scripts/replaceWindowsWrapperFiles.js +++ b/scripts/replaceWindowsWrapperFiles.js @@ -82,10 +82,16 @@ module.exports = function (context) { return; } - etree = context.requireCordovaModule('cordova-lib/node_modules/elementtree'); + etree = require('elementtree'); // move contents of the assets folder to the windows platform dir - var Q = context.requireCordovaModule('q'); + try{ + Q = require('q'); + }catch(e){ + e.message = 'Unable to load node module dependency \'q\': '+e.message; + log(e.message); + throw e; + } var filename = "wrapper"; diff --git a/scripts/rollbackWindowsWrapperFiles.js b/scripts/rollbackWindowsWrapperFiles.js index 5af2170..790745c 100644 --- a/scripts/rollbackWindowsWrapperFiles.js +++ b/scripts/rollbackWindowsWrapperFiles.js @@ -44,13 +44,13 @@ function configureParser(context) { var cordova_util = context.requireCordovaModule('cordova-lib/src/cordova/util'); var ConfigParser; try { - ConfigParser = context.requireCordovaModule('cordova-lib/node_modules/cordova-common').ConfigParser; + ConfigParser = require('cordova-common').ConfigParser; } catch (err) { // Fallback to old location of config parser (old versions of cordova-lib) - ConfigParser = context.requireCordovaModule('cordova-lib/src/configparser/ConfigParser'); + ConfigParser = require('cordova-common/src/ConfigParser'); } - etree = context.requireCordovaModule('cordova-lib/node_modules/elementtree'); + etree = require('elementtree'); var xml = cordova_util.projectConfig(context.opts.projectRoot); config = createConfigParser(xml, etree, ConfigParser); @@ -70,7 +70,13 @@ module.exports = function (context) { return; } - Q = context.requireCordovaModule('q'); + try{ + Q = require('q'); + }catch(e){ + e.message = 'Unable to load node module dependency \'q\': '+e.message; + log(e.message); + throw e; + } var task = Q.defer(); var destPath = path.join(projectRoot, "platforms", "windows", "www", "wrapper.html"); diff --git a/scripts/test/updateConfigurationBeforePrepare.js b/scripts/test/updateConfigurationBeforePrepare.js index f3d6ffb..de3ee64 100644 --- a/scripts/test/updateConfigurationBeforePrepare.js +++ b/scripts/test/updateConfigurationBeforePrepare.js @@ -47,12 +47,12 @@ function initializeContext(testDir) { return require('cordova-lib/node_modules/cordova-common'); } - if (moduleName === 'cordova-lib/src/configparser/ConfigParser') { - return require('cordova-lib/src/configparser/ConfigParser'); + if (moduleName === 'node_modules/cordova-common/src/ConfigParser') { + return require('node_modules/cordova-common/src/ConfigParser'); } - if (moduleName === 'cordova-lib/node_modules/elementtree') { - return require('cordova-lib/node_modules/elementtree'); + if (moduleName === 'elementtree') { + return require('elementtree'); } if (requireCordovaModule) { diff --git a/scripts/updateConfigurationAfterPrepare.js b/scripts/updateConfigurationAfterPrepare.js index befa015..51f2ba5 100644 --- a/scripts/updateConfigurationAfterPrepare.js +++ b/scripts/updateConfigurationAfterPrepare.js @@ -23,13 +23,13 @@ function configureParser(context) { var cordova_util = context.requireCordovaModule('cordova-lib/src/cordova/util'); var ConfigParser; try { - ConfigParser = context.requireCordovaModule('cordova-lib/node_modules/cordova-common').ConfigParser; + ConfigParser = require('cordova-common').ConfigParser; } catch (err) { // Fallback to old location of config parser (old versions of cordova-lib) - ConfigParser = context.requireCordovaModule('cordova-lib/src/configparser/ConfigParser'); + ConfigParser = require('cordova-common/src/ConfigParser'); } - etree = context.requireCordovaModule('cordova-lib/node_modules/elementtree'); + etree = require('elementtree'); var xml = cordova_util.projectConfig(projectRoot); config = createConfigParser(xml, etree, ConfigParser); diff --git a/scripts/updateConfigurationBeforePrepare.js b/scripts/updateConfigurationBeforePrepare.js index 7f3e212..27f4636 100644 --- a/scripts/updateConfigurationBeforePrepare.js +++ b/scripts/updateConfigurationBeforePrepare.js @@ -114,13 +114,13 @@ function configureParser(context) { var cordova_util = context.requireCordovaModule('cordova-lib/src/cordova/util'); var ConfigParser; try { - ConfigParser = context.requireCordovaModule('cordova-lib/node_modules/cordova-common').ConfigParser; + ConfigParser = require('cordova-common').ConfigParser; } catch (err) { // Fallback to old location of config parser (old versions of cordova-lib) - ConfigParser = context.requireCordovaModule('cordova-lib/src/configparser/ConfigParser'); + ConfigParser = require('cordova-common/src/ConfigParser'); } - etree = context.requireCordovaModule('cordova-lib/node_modules/elementtree'); + etree = require('elementtree'); var xml = cordova_util.projectConfig(projectRoot); config = createConfigParser(xml, etree, ConfigParser); @@ -572,7 +572,13 @@ function processWindowsPhoneIcons(manifestIcons, manifestSplashScreens) { module.exports = function (context) { logger.log('Updating Cordova configuration from W3C manifest...'); - Q = context.requireCordovaModule('q'); + try{ + Q = require('q'); + }catch(e){ + e.message = 'Unable to load node module dependency \'q\': '+e.message; + log(e.message); + throw e; + } // Get base path for default icons defaultIconsBaseDir = 'plugins/' + context.opts.plugin.id + '/assets/defaultImages';