-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[TIMOB-25028] Fix issue where node-ios-device is not hoisted #9260
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -257,15 +257,31 @@ Packager.prototype.package = function (next) { | |
}.bind(this), | ||
// Now include all the pre-built node-ios-device bindings/binaries | ||
function (cb) { | ||
if (this.targetOS == 'osx') { | ||
exec('node bin/download-all.js', {cwd: path.join(this.zipSDKDir, 'node_modules', 'node-ios-device')}, function (err, stdout, stderr) { | ||
if (err) { | ||
console.log(stdout); | ||
console.error(stderr); | ||
return cb(err); | ||
} | ||
cb(); | ||
}); | ||
if (this.targetOS === 'osx') { | ||
console.log(path.join(this.zipSDKDir, 'node_modules', 'node-ios-device')); | ||
const hoistedPath = path.join(this.zipSDKDir, 'node_modules', 'node-ios-device'); | ||
const normalPath = path.join(this.zipSDKDir, 'node_modules', 'ioslib', 'node_modules', 'node-ios-device'); | ||
if (fs.existsSync(hoistedPath)) { | ||
exec('node bin/download-all.js', {cwd: hoistedPath}, function (err, stdout, stderr) { | ||
if (err) { | ||
console.log(stdout); | ||
console.error(stderr); | ||
return cb(err); | ||
} | ||
cb(); | ||
}); | ||
} else if (fs.existsSync(normalPath)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have a lot of duplicate code. It can be simplified: let dir = path.join(this.zipSDKDir, 'node_modules', 'node-ios-device');
if (!fs.existsSync(dir)) {
dir = path.join(this.zipSDKDir, 'node_modules', 'ioslib', 'node_modules', 'node-ios-device');
}
if (!fs.existsSync(dir)) {
return cb(new Error('Unable to find node-ios-device module'));
}
exec('node bin/download-all.js', { cwd: dir, stdio: 'inherit' }, cb); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah my bad I was thinking that it could be better as I wrote it, updated. I kept the exec usage similar to the others throughout the file, |
||
exec('node bin/download-all.js', {cwd: normalPath}, function (err, stdout, stderr) { | ||
if (err) { | ||
console.log(stdout); | ||
console.error(stderr); | ||
return cb(err); | ||
} | ||
cb(); | ||
}); | ||
} else { | ||
return cb(new Error('Unable to find node-ios-device module')) | ||
} | ||
} else { | ||
cb(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the
console.log()
debug? It should probably be removed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed