Skip to content

Commit

Permalink
Refactor use of requireCordovaModule for cordova-lib 9.0.0
Browse files Browse the repository at this point in the history
'requireCordovaModule' is now deprecated. See similiar issue and solution: GEDYSIntraWare/cordova-plugin-call-directory#13
  • Loading branch information
NiklasMerz authored and j3k0 committed Aug 13, 2019
1 parent ce53001 commit e1fcc02
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions hooks/iosAddTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ function getCordovaParameter(configXml, variableName) {

// Get the bundle id from config.xml
// function getBundleId(context, configXml) {
// var elementTree = context.requireCordovaModule('elementtree');
// var elementTree = require('elementtree');
// var etree = elementTree.parse(configXml);
// return etree.getroot().get('id');
// }

function parsePbxProject(context, pbxProjectPath) {
var xcode = context.requireCordovaModule('xcode');
var xcode = require('xcode');
console.log(' Parsing existing project at location: ' + pbxProjectPath + '...');
var pbxProject;
if (context.opts.cordova.project) {
Expand Down Expand Up @@ -212,7 +212,7 @@ console.log('Adding target "' + PLUGIN_ID + '/ShareExtension" to XCode project')

module.exports = function (context) {

var Q = context.requireCordovaModule('q');
var Q = require('q');
var deferral = new Q.defer();

// if (context.opts.cordova.platforms.indexOf('ios') < 0) {
Expand Down
2 changes: 1 addition & 1 deletion hooks/iosCopyShareExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function findXCodeproject(context, callback) {
}

module.exports = function(context) {
var Q = context.requireCordovaModule('q');
var Q = require('q');
var deferral = new Q.defer();

findXCodeproject(context, function(projectFolder, projectName) {
Expand Down
4 changes: 2 additions & 2 deletions hooks/iosRemoveTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function iosFolder(context) {
}

function parsePbxProject(context, pbxProjectPath) {
var xcode = context.requireCordovaModule('xcode');
var xcode = require('xcode');
console.log(' Parsing existing project at location: ' + pbxProjectPath + '...');
var pbxProject;
if (context.opts.cordova.project) {
Expand Down Expand Up @@ -125,7 +125,7 @@ console.log('Removing target "' + PLUGIN_ID + '/ShareExtension" to XCode project

module.exports = function (context) {

var Q = context.requireCordovaModule('q');
var Q = require('q');
var deferral = new Q.defer();

findXCodeproject(context, function(projectFolder, projectName) {
Expand Down
4 changes: 2 additions & 2 deletions hooks/npmInstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
const PLUGIN_ID = "cc.fovea.cordova.openwith";

module.exports = function (context) {
var child_process = context.requireCordovaModule('child_process');
var deferral = context.requireCordovaModule('q').defer();
var child_process = require('child_process');
var deferral = require('q').defer();

console.log('Installing "' + PLUGIN_ID + '" dependencies');
child_process.exec('npm install --production', {cwd:__dirname}, function (error) {
Expand Down

0 comments on commit e1fcc02

Please sign in to comment.