From d9865e366fa63bc50c10f057fa4a8d4bbcd43f40 Mon Sep 17 00:00:00 2001 From: scriptPilot Date: Mon, 3 Jul 2017 23:23:26 +0200 Subject: [PATCH] fixes #626 --- CHANGELOG.md | 3 ++- scripts/cordova.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 841d9486..57f28d4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Version 1.9.13 +## Version 1.9.14 Released on 2017-07-03 @@ -13,6 +13,7 @@ Released on 2017-07-03 - [x] [#346 - Error on npm run ftp without proper FTP server data](https://github.com/scriptPilot/app-framework/issues/346) - [x] [#592 - npm run android failed - Float types not allowed for versionCode](https://github.com/scriptPilot/app-framework/issues/592) - [x] [#620 - Snapshot is created at initial installation](https://github.com/scriptPilot/app-framework/issues/620) +- [x] [#626 - npm run ios fails with "cannot read property 'replace' of undefined"](https://github.com/scriptPilot/app-framework/issues/626) ## Version 1.9.10 diff --git a/scripts/cordova.js b/scripts/cordova.js index e98a027d..91c50407 100644 --- a/scripts/cordova.js +++ b/scripts/cordova.js @@ -366,7 +366,20 @@ let addCordovaPlatforms = function (callback) { alert('Cordova platform installation ongoing - please wait ...') if (env.arg.ios === true || env.arg.xcode === true) { cmd(binDir, 'cordova platform add ios', function () { + // workaround: #626 - npm run ios fails with + try { + const filename = path.resolve(binDir, 'platforms/ios/cordova/node_modules/ios-sim/src/lib.js') + const string = 'list.push(util.format(\'%s, %s\', name_id_map[ deviceName ].replace(/^com.apple.CoreSimulator.SimDeviceType./, \'\'), runtime.replace(/^iOS /, \'\')));' + const wrapper = 'if (name_id_map[deviceName] && runtime) { ' + string + ' }' + let filecontent = fs.readFileSync(filename, 'utf8') + filecontent = filecontent.replace(string, wrapper) + fs.writeFileSync(filename, filecontent) + } catch (err) { + alert('Failed to apply workaround #626.') + } + // Alert alert('Cordova platform installation done for Android.') + // Callback callback() }, function () { alert('Cordova platform installation failed for iOS.', 'issue')