forceios 10.1.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
- "name": "forceios",
3
- "version": "10.1.0",
4
- "description": "Utilities for creating mobile apps based on the Salesforce Mobile SDK for iOS",
5
- "keywords": [ "mobilesdk", "ios", "salesforce", "mobile", "sdk" ],
6
- "homepage": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS",
7
- "bugs": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS/issues",
8
- "licenses" : [
9
- { "type": "Salesforce.com Mobile SDK License", "url": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS/blob/master/LICENSE.md" }
10
- ],
11
- "os" : [ "darwin" ],
2
+ "name": "forceios",
3
+ "version": "10.2.0",
4
+ "description": "Utilities for creating mobile apps based on the Salesforce Mobile SDK for iOS",
5
+ "keywords": [ "mobilesdk", "ios", "salesforce", "mobile", "sdk" ],
6
+ "homepage": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS",
7
+ "bugs": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS/issues",
8
+ "licenses" : [
9
+ { "type": "Salesforce.com Mobile SDK License", "url": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS/blob/master/LICENSE.md" }
10
+ ],
11
+ "os" : [ "darwin" ],
12
12
  "engines": {
13
13
  "node": ">=7.0.0"
14
14
  },
15
- "bin" : { "forceios" : "forceios.js" },
15
+ "bin" : { "forceios" : "forceios.js" },
16
16
  "dependencies": {
17
- "shelljs": "0.8.4",
18
- "ajv": "^6.10.2",
19
- "jsonlint": "^1.6.3"
17
+ "shelljs": "0.8.5",
18
+ "ajv": "^8.11.0",
19
+ "jsonlint": "^1.6.3"
20
20
  },
21
- "repository": {
22
- "type" : "git",
23
- "url" : "https://github.com/forcedotcom/SalesforceMobileSDK-Package.git"
24
- },
25
- "author": { "name": "Kevin Hawkins", "email": "khawkins@salesforce.com" },
26
- "contributors": [
21
+ "repository": {
22
+ "type" : "git",
23
+ "url" : "https://github.com/forcedotcom/SalesforceMobileSDK-Package.git"
24
+ },
25
+ "author": { "name": "Kevin Hawkins", "email": "khawkins@salesforce.com" },
26
+ "contributors": [
27
27
  { "name": "Wolfgang Mathurin", "email": "wmathurin@salesforce.com" },
28
28
  { "name": "Bharath Hariharan", "email": "bhariharan@salesforce.com" }
29
29
  ]
@@ -28,7 +28,7 @@
28
28
  var path = require('path'),
29
29
  shelljs = require('shelljs');
30
30
 
31
- var VERSION= '10.1.0';
31
+ var VERSION= '10.2.0';
32
32
 
33
33
  module.exports = {
34
34
  version: VERSION,
@@ -62,10 +62,10 @@ module.exports = {
62
62
  checkCmd: 'cordova -v',
63
63
  // pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#dev', // dev
64
64
  minVersion: '11.0.0',
65
- pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#v' + VERSION, // GA
65
+ pluginRepoUri: 'salesforce-mobilesdk-cordova-plugin@v' + VERSION, // GA
66
66
  platformVersion: {
67
67
  ios: '6.2.0',
68
- android: '10.1.1'
68
+ android: '11.0.0'
69
69
  }
70
70
  },
71
71
  sfdx: {
@@ -48,11 +48,6 @@ function createNativeApp(config) {
48
48
  // Run prepare function of template
49
49
  var prepareResult = prepareTemplate(config, config.projectDir);
50
50
 
51
- if (config.platform === 'ios' && config.apptype === 'react_native') {
52
- // Use legacy build
53
- useLegacyBuild(config, 'ios');
54
- }
55
-
56
51
  // Cleanup
57
52
  utils.removeFile(path.join(config.projectDir, 'template.js'));
58
53
 
@@ -67,7 +62,7 @@ function createHybridApp(config) {
67
62
 
68
63
  // Create app with cordova
69
64
  utils.runProcessThrowError('cordova create "' + config.projectDir + '" ' + config.packagename + ' ' + config.appname);
70
- utils.runProcessThrowError('npm install shelljs@0.8.4', config.projectDir);
65
+ utils.runProcessThrowError('npm install shelljs@0.8.5', config.projectDir);
71
66
 
72
67
  for (var platform of config.platform.split(',')) {
73
68
  utils.runProcessThrowError('cordova platform add ' + platform + '@' + SDK.tools.cordova.platformVersion[platform], config.projectDir);
@@ -115,16 +110,23 @@ function createHybridApp(config) {
115
110
  utils.runProcessThrowError('cordova prepare', config.projectDir);
116
111
 
117
112
  if (config.platform === 'ios') {
118
- // Use legacy build
119
- useLegacyBuild(config, path.join('platforms', 'ios'));
120
-
121
- // Removing libCordova.a from build (it causes issues e.g. CDVWKWebViewEngine won't register as plugin because it won't be recognized as a kind of CDVPlugin)
122
- utils.logInfo('Updating xcode project file');
123
- var xcodeProjectFile = path.join(config.projectDir,'platforms', 'ios', config.appname + '.xcodeproj', 'project.pbxproj')
124
- var xcodeProjectFileContent = fs.readFileSync(xcodeProjectFile, 'utf8');
125
- var newXcodeProjectFileContent = xcodeProjectFileContent.split('\n').filter(line => line.indexOf('libCordova.a in Frameworks') == -1).join('\n');
126
- fs.writeFileSync(xcodeProjectFile, newXcodeProjectFileContent);
127
- utils.logInfo('Updated xcode project file');
113
+ if (utils.getToolVersion('xcodebuild -version') < 14000000) {
114
+ // Use legacy build for xcode 13 and older
115
+ useLegacyBuild(config, path.join('platforms', 'ios'));
116
+
117
+ // Removing libCordova.a from build (it causes issues e.g. CDVWKWebViewEngine won't register as plugin because it won't be recognized as a kind of CDVPlugin)
118
+ utils.logInfo('Updating xcode project file');
119
+ var xcodeProjectFile = path.join(config.projectDir,'platforms', 'ios', config.appname + '.xcodeproj', 'project.pbxproj')
120
+ var xcodeProjectFileContent = fs.readFileSync(xcodeProjectFile, 'utf8');
121
+ var newXcodeProjectFileContent = xcodeProjectFileContent.split('\n').filter(line => line.indexOf('libCordova.a in Frameworks') == -1).join('\n');
122
+ fs.writeFileSync(xcodeProjectFile, newXcodeProjectFileContent);
123
+ utils.logInfo('Updated xcode project file');
124
+
125
+ } else {
126
+ // Patch podfile for xcode 14
127
+ fixPods(config, path.join('platforms', 'ios'));
128
+ }
129
+
128
130
  }
129
131
 
130
132
  // Done
@@ -154,6 +156,31 @@ function useLegacyBuild(config, iosSubDir) {
154
156
  utils.logInfo('Created WorkspaceSettings.xcsettings for project ' + config.appname);
155
157
  }
156
158
 
159
+ //
160
+ // Patch pod file for hybrid apps on xcode 14
161
+ //
162
+ function fixPods(config, iosSubDir) {
163
+ var iosDir = path.join(config.projectDir, iosSubDir)
164
+ var podfilePath = path.join(iosDir, 'Podfile');
165
+ var originalPodfileContent = fs.readFileSync(podfilePath, 'utf8');
166
+ var preInstallCode = "\n" +
167
+ "$dynamic_framework = ['SalesforceAnalytics', 'SalesforceSDKCore', 'SalesforceSDKCommon', 'SmartStore', 'FMDB', 'SQLCipher', 'MobileSync']\n" +
168
+ "pre_install do |installer|\n" +
169
+ " installer.pod_targets.each do |pod|\n" +
170
+ " if $dynamic_framework.include?(pod.name)\n" +
171
+ " def pod.build_type\n" +
172
+ " Pod::BuildType.dynamic_framework\n" +
173
+ " end\n" +
174
+ " end\n" +
175
+ " end\n" +
176
+ "end"
177
+
178
+
179
+ utils.logInfo('Updating Podfile for project ' + config.appname);
180
+ fs.writeFileSync(podfilePath, originalPodfileContent.replace("use_frameworks!","") + preInstallCode);
181
+ utils.runProcessThrowError('pod update', iosDir);
182
+ }
183
+
157
184
  //
158
185
  // Print details
159
186
  //
package/shared/utils.js CHANGED
@@ -85,7 +85,7 @@ function getVersionNumberFromString(versionString) {
85
85
  }
86
86
 
87
87
  /**
88
- * Checks the the version of a tool by running the given command
88
+ * Checks the version of a tool by running the given command
89
89
  *
90
90
  * @param {String} cmd Command to run to get the tool version
91
91
  * @param {String} minVersionRequired Minimum version required
@@ -94,17 +94,7 @@ function getVersionNumberFromString(versionString) {
94
94
  * @throws {Error} if tool not found or version too low
95
95
  */
96
96
  function checkToolVersion(cmd, minVersionRequired, maxVersionSupported) {
97
- var toolName = cmd.split(' ')[0];
98
- var toolVersion;
99
- try {
100
- var result = runProcessThrowError(cmd, null, true /* return output */);
101
- toolVersion = result.replace(/\r?\n|\r/, '').replace(/[^0-9\.]*/, '');
102
- }
103
- catch (error) {
104
- throw new Error(toolName + ' is required but could not be found. Please install ' + toolName + '.');
105
- }
106
-
107
- var toolVersionNum = getVersionNumberFromString(toolVersion);
97
+ var toolVersionNum = getToolVersion(cmd);
108
98
  var minVersionRequiredNum = getVersionNumberFromString(minVersionRequired);
109
99
 
110
100
  if (toolVersionNum < minVersionRequiredNum) {
@@ -121,6 +111,27 @@ function checkToolVersion(cmd, minVersionRequired, maxVersionSupported) {
121
111
  }
122
112
  }
123
113
 
114
+ /**
115
+ * Returns the version of a tool as a number by running the given command
116
+ *
117
+ * @param {String} cmd Command to run to get the tool version
118
+ * @return {Number} The numeric version number, or 0 if the version string isn't a valid format.
119
+ */
120
+ function getToolVersion(cmd) {
121
+ var toolName = cmd.split(' ')[0];
122
+ var toolVersion;
123
+ try {
124
+ var result = runProcessThrowError(cmd, null, true /* return output */);
125
+ toolVersion = result.replace(/\r?\n|\r/, '').replace(/[^0-9\.]*/, '');
126
+ }
127
+ catch (error) {
128
+ throw new Error(toolName + ' is required but could not be found. Please install ' + toolName + '.');
129
+ }
130
+
131
+ var toolVersionNum = getVersionNumberFromString(toolVersion);
132
+ return toolVersionNum;
133
+ }
134
+
124
135
 
125
136
  /**
126
137
  * Replaces text in a file
@@ -432,6 +443,7 @@ module.exports = {
432
443
  cloneRepo,
433
444
  copyFile,
434
445
  dirExists,
446
+ getToolVersion,
435
447
  getVersionNumberFromString,
436
448
  log,
437
449
  logDebug,