diff --git a/install/hooks/ios/after-plugin-install.js b/install/hooks/ios/after-plugin-install.js index dbd23df..f6591e5 100644 --- a/install/hooks/ios/after-plugin-install.js +++ b/install/hooks/ios/after-plugin-install.js @@ -7,7 +7,7 @@ module.exports = function(context) { // Require the iOS platform Api to get the Xcode .pbxproj path. var iosPlatformPath = path.join(context.opts.projectRoot, 'platforms', 'ios'); var iosAPI = require(path.join(iosPlatformPath, 'cordova', 'Api')); - var iosAPIInstance = new iosAPI(); + var iosAPIInstance = new iosAPI('ios', iosPlatformPath); var pbxprojPath = iosAPIInstance.locations.pbxproj; // Read the Xcode project and get the target. diff --git a/install/hooks/ios/before-plugin-install.js b/install/hooks/ios/before-plugin-install.js index bf9d705..ed30a50 100644 --- a/install/hooks/ios/before-plugin-install.js +++ b/install/hooks/ios/before-plugin-install.js @@ -1,5 +1,4 @@ var fs = require('fs'); -var targz2 = require('tar.gz2'); const nodeProjectFolder = 'www/nodejs-project'; const nodeMobileFolderPath = 'plugins/nodejs-mobile-cordova/libs/ios/nodemobile/'; @@ -17,16 +16,22 @@ module.exports = function(context) { return new Promise((resolve, reject) => { // Unzip and untar the libnode.Framework if (fs.existsSync(zipFilePath)) { - targz2().extract(zipFilePath, nodeMobileFolderPath, function(err) { - if (err) { - reject(err); - } else { - fs.unlinkSync(zipFilePath); - resolve(); - } - }); + + var tar = require('tar'); + tar.extract({ + cwd: nodeMobileFolderPath, + file: zipFilePath, + onwarn: (code,msg,err) => { + reject(err); + }, + }) + .then(_ => { + fs.unlinkSync(zipFilePath); + resolve(); + }); + } else if (!fs.existsSync(nodeMobileFilePath)) { - reject(new Error(nodeMobileFileName + ' is missing')); + reject(new Error(nodeMobileFileName + ' is missing')); } else { resolve(); } diff --git a/install/hooks/ios/before-plugin-uninstall.js b/install/hooks/ios/before-plugin-uninstall.js index 3b1d3f5..a950a2d 100644 --- a/install/hooks/ios/before-plugin-uninstall.js +++ b/install/hooks/ios/before-plugin-uninstall.js @@ -41,7 +41,7 @@ module.exports = function(context) { // Require the iOS platform Api to get the Xcode .pbxproj path. var iosPlatformPath = path.join(context.opts.projectRoot, 'platforms', 'ios'); var iosAPI = require(path.join(iosPlatformPath, 'cordova', 'Api')); - var iosAPIInstance = new iosAPI(); + var iosAPIInstance = new iosAPI('ios', iosPlatformPath); var pbxprojPath = iosAPIInstance.locations.pbxproj; // Read the Xcode project and get the target. diff --git a/install/hooks/ios/fix-xcframework-path.js b/install/hooks/ios/fix-xcframework-path.js index 98d43c0..54d2c84 100644 --- a/install/hooks/ios/fix-xcframework-path.js +++ b/install/hooks/ios/fix-xcframework-path.js @@ -5,7 +5,7 @@ module.exports = function(context) { // Require the iOS platform Api to get the Xcode .pbxproj path. var iosPlatformPath = path.join(context.opts.projectRoot, 'platforms', 'ios'); var iosAPI = require(path.join(iosPlatformPath, 'cordova', 'Api')); - var iosAPIInstance = new iosAPI(); + var iosAPIInstance = new iosAPI('ios', iosPlatformPath); var pbxprojPath = iosAPIInstance.locations.pbxproj; var rootIosProjDir = iosAPIInstance.locations.root; var cordovaProjPath = iosAPIInstance.locations.xcodeCordovaProj; diff --git a/package.json b/package.json index bba584c..6cd9e52 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "license": "MIT", "dependencies": { "nodejs-mobile-gyp": "^0.3.1", - "tar.gz2": "^1.0.0", + "tar": "^6.2.0", "xcode": "^2.0.0" }, "homepage": "https://code.janeasystems.com/nodejs-mobile",