Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios: fix to support newer [email protected], use tar instead of tar.gz2 #5

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install/hooks/ios/after-plugin-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 15 additions & 10 deletions install/hooks/ios/before-plugin-install.js
Original file line number Diff line number Diff line change
@@ -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/';
Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion install/hooks/ios/before-plugin-uninstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion install/hooks/ios/fix-xcframework-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down