forceios 11.0.1 → 12.0.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 +1 -1
- package/shared/constants.js +7 -7
- package/shared/createHelper.js +42 -49
- package/shared/utils.js +8 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forceios",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Utilities for creating mobile apps based on the Salesforce Mobile SDK for iOS",
|
|
5
5
|
"keywords": [ "mobilesdk", "ios", "salesforce", "mobile", "sdk" ],
|
|
6
6
|
"homepage": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS",
|
package/shared/constants.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
var path = require('path'),
|
|
29
29
|
shelljs = require('shelljs');
|
|
30
30
|
|
|
31
|
-
var VERSION= '
|
|
31
|
+
var VERSION= '12.0.0';
|
|
32
32
|
|
|
33
33
|
module.exports = {
|
|
34
34
|
version: VERSION,
|
|
@@ -64,13 +64,13 @@ module.exports = {
|
|
|
64
64
|
minVersion: '12.0.0',
|
|
65
65
|
pluginRepoUri: 'salesforce-mobilesdk-cordova-plugin@v' + VERSION, // GA
|
|
66
66
|
platformVersion: {
|
|
67
|
-
ios: '
|
|
68
|
-
android: '
|
|
67
|
+
ios: '7.1.0',
|
|
68
|
+
android: '12.0.1'
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
|
|
72
|
-
checkCmd: '
|
|
73
|
-
minVersion: '
|
|
71
|
+
sf: {
|
|
72
|
+
checkCmd: 'sf -v',
|
|
73
|
+
minVersion: '2.0.0'
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
|
|
@@ -117,7 +117,7 @@ module.exports = {
|
|
|
117
117
|
purpose: 'a hybrid mobile application',
|
|
118
118
|
dir: 'hybrid',
|
|
119
119
|
platforms: ['ios', 'android'],
|
|
120
|
-
toolNames: ['git', 'node', 'npm', 'cordova', '
|
|
120
|
+
toolNames: ['git', 'node', 'npm', 'cordova', 'sf'],
|
|
121
121
|
appTypes: ['hybrid_local', 'hybrid_remote', 'hybrid_lwc'],
|
|
122
122
|
appTypesToPath: {
|
|
123
123
|
'hybrid_local': 'HybridLocalTemplate',
|
package/shared/createHelper.js
CHANGED
|
@@ -90,7 +90,7 @@ function createHybridApp(config) {
|
|
|
90
90
|
// Merge files from template into it
|
|
91
91
|
if (utils.dirExists(path.join(webDir, SERVER_PROJECT_DIR))) {
|
|
92
92
|
config.serverDir = path.join(config.projectDir, SERVER_PROJECT_DIR)
|
|
93
|
-
utils.runProcessThrowError('
|
|
93
|
+
utils.runProcessThrowError('sf force project create -n ' + SERVER_PROJECT_DIR, config.projectDir);
|
|
94
94
|
|
|
95
95
|
// Copy cordova js to static resources
|
|
96
96
|
for (var platform of config.platform.split(',')) {
|
|
@@ -110,50 +110,19 @@ function createHybridApp(config) {
|
|
|
110
110
|
utils.runProcessThrowError('cordova prepare', config.projectDir);
|
|
111
111
|
|
|
112
112
|
if (config.platform.split(',').indexOf('ios') != -1) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
113
|
+
fixPods(config, path.join('platforms', 'ios'));
|
|
114
|
+
|
|
115
|
+
// Remove libCordova.a from build
|
|
116
|
+
utils.logInfo('Updating xcode project file');
|
|
117
|
+
var xcodeProjectFile = path.join(config.projectDir,'platforms', 'ios', config.appname + '.xcodeproj', 'project.pbxproj')
|
|
118
|
+
var xcodeProjectFileContent = fs.readFileSync(xcodeProjectFile, 'utf8');
|
|
119
|
+
var newXcodeProjectFileContent = xcodeProjectFileContent.split('\n').filter(line => line.indexOf('libCordova.a in Frameworks') == -1).join('\n');
|
|
120
|
+
fs.writeFileSync(xcodeProjectFile, newXcodeProjectFileContent);
|
|
121
|
+
utils.logInfo('Updated xcode project file');
|
|
130
122
|
}
|
|
131
123
|
|
|
132
124
|
// Done
|
|
133
125
|
return prepareResult;
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//
|
|
138
|
-
// Use legacy build system in XCode
|
|
139
|
-
//
|
|
140
|
-
function useLegacyBuild(config, iosSubDir) {
|
|
141
|
-
var xcSettingsDir = path.join(config.projectDir, iosSubDir, config.appname + '.xcworkspace', 'xcshareddata')
|
|
142
|
-
var xcSettingsFile = path.join(xcSettingsDir, 'WorkspaceSettings.xcsettings');
|
|
143
|
-
var plistFileContent = '<?xml version="1.0" encoding="UTF-8"?>\n' +
|
|
144
|
-
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n' +
|
|
145
|
-
'<plist version="1.0">\n' +
|
|
146
|
-
'<dict>\n' +
|
|
147
|
-
'<key>BuildSystemType</key>\n' +
|
|
148
|
-
'<string>Original</string>\n' +
|
|
149
|
-
'<key>DisableBuildSystemDeprecationDiagnostic</key>\n' +
|
|
150
|
-
'<true/>\n' +
|
|
151
|
-
'</dict>\n' +
|
|
152
|
-
'</plist>\n';
|
|
153
|
-
utils.logInfo('Creating WorkspaceSettings.xcsettings for project. Setting the BuildSystemType to original in ' + xcSettingsFile);
|
|
154
|
-
utils.mkDirIfNeeded(xcSettingsDir)
|
|
155
|
-
fs.writeFileSync(xcSettingsFile,plistFileContent,'utf8');
|
|
156
|
-
utils.logInfo('Created WorkspaceSettings.xcsettings for project ' + config.appname);
|
|
157
126
|
}
|
|
158
127
|
|
|
159
128
|
//
|
|
@@ -239,9 +208,30 @@ function printNextSteps(ide, projectPath, result) {
|
|
|
239
208
|
'Before you ship, make sure to plug your OAuth Client ID and Callback URI,',
|
|
240
209
|
'and OAuth Scopes into ' + bootconfigFile,
|
|
241
210
|
]);
|
|
242
|
-
|
|
243
211
|
};
|
|
244
212
|
|
|
213
|
+
//
|
|
214
|
+
// Print next steps for Native Login
|
|
215
|
+
//
|
|
216
|
+
function printNextStepsForNativeLogin(ide, projectPath, result) {
|
|
217
|
+
var workspacePath = path.join(projectPath, result.workspacePath);
|
|
218
|
+
var bootconfigFile = path.join(projectPath, result.bootconfigFile);
|
|
219
|
+
var entryFile = (ide === 'XCode') ? 'SceneDelegate' : 'MainApplication';
|
|
220
|
+
|
|
221
|
+
// Printing out next steps
|
|
222
|
+
utils.logParagraph(['Next steps' + (result.platform ? ' for ' + result.platform : '') + ':',
|
|
223
|
+
'',
|
|
224
|
+
'Your application project is ready in ' + projectPath + '.',
|
|
225
|
+
'To use your new application in ' + ide + ', do the following:',
|
|
226
|
+
' - open ' + workspacePath + ' in ' + ide,
|
|
227
|
+
' - Update the OAuth Client ID, Callback URI, and Community URL in ' + entryFile + ' class.',
|
|
228
|
+
' - build and run',
|
|
229
|
+
'Before you ship, make sure to plug your OAuth Client ID and Callback URI,',
|
|
230
|
+
'and OAuth Scopes into ' + bootconfigFile + ', since it is still used for',
|
|
231
|
+
'authentication if we fallback on the webview.'
|
|
232
|
+
]);
|
|
233
|
+
}
|
|
234
|
+
|
|
245
235
|
//
|
|
246
236
|
// Print next steps for server project if present
|
|
247
237
|
//
|
|
@@ -254,15 +244,13 @@ function printNextStepsForServerProjectIfNeeded(projectPath) {
|
|
|
254
244
|
'Make sure to deploy it to your org before running your application.',
|
|
255
245
|
'',
|
|
256
246
|
'From ' + projectPath + ' do the following to setup a scratch org, push the server code:',
|
|
257
|
-
' -
|
|
247
|
+
' - sf force org create -f server/config/project-scratch-def.json -a MyOrg',
|
|
258
248
|
' - cd server',
|
|
259
|
-
' -
|
|
249
|
+
' - sf force source push -u MyOrg',
|
|
260
250
|
'You also need a password to login to the scratch org from the mobile app:',
|
|
261
|
-
' -
|
|
251
|
+
' - sf force user password generate -u MyOrg'
|
|
262
252
|
]);
|
|
263
253
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
254
|
}
|
|
267
255
|
|
|
268
256
|
//
|
|
@@ -272,7 +260,7 @@ function checkTools(toolNames) {
|
|
|
272
260
|
try {
|
|
273
261
|
utils.log("Checking tools");
|
|
274
262
|
for (var toolName of toolNames) {
|
|
275
|
-
utils.checkToolVersion(SDK.tools[toolName].checkCmd, SDK.tools[toolName].minVersion, SDK.tools[toolName].maxVersion);
|
|
263
|
+
utils.checkToolVersion(SDK.tools[toolName].checkCmd, SDK.tools[toolName].minVersion, SDK.tools[toolName].maxVersion, toolName);
|
|
276
264
|
}
|
|
277
265
|
}
|
|
278
266
|
catch (error) {
|
|
@@ -388,7 +376,12 @@ function actuallyCreateApp(forcecli, config) {
|
|
|
388
376
|
if (!(results instanceof Array)) { results = [results] };
|
|
389
377
|
for (var result of results) {
|
|
390
378
|
var ide = SDK.ides[result.platform || config.platform.split(',')[0]];
|
|
391
|
-
|
|
379
|
+
|
|
380
|
+
if (config.templatepath != undefined && config.templatepath.includes('NativeLogin')) {
|
|
381
|
+
printNextStepsForNativeLogin(ide, config.projectPath, result);
|
|
382
|
+
} else {
|
|
383
|
+
printNextSteps(ide, config.projectPath, result);
|
|
384
|
+
}
|
|
392
385
|
}
|
|
393
386
|
printNextStepsForServerProjectIfNeeded(config.projectPath);
|
|
394
387
|
|
package/shared/utils.js
CHANGED
|
@@ -90,23 +90,24 @@ function getVersionNumberFromString(versionString) {
|
|
|
90
90
|
* @param {String} cmd Command to run to get the tool version
|
|
91
91
|
* @param {String} minVersionRequired Minimum version required
|
|
92
92
|
* @param {String} maxVersionSupported Maximum version supported
|
|
93
|
+
* @param {String} toolName Name of tool
|
|
93
94
|
*
|
|
94
95
|
* @throws {Error} if tool not found or version too low
|
|
95
96
|
*/
|
|
96
|
-
function checkToolVersion(cmd, minVersionRequired, maxVersionSupported) {
|
|
97
|
+
function checkToolVersion(cmd, minVersionRequired, maxVersionSupported, toolName) {
|
|
97
98
|
var toolVersionNum = getToolVersion(cmd);
|
|
98
99
|
var minVersionRequiredNum = getVersionNumberFromString(minVersionRequired);
|
|
99
100
|
|
|
100
101
|
if (toolVersionNum < minVersionRequiredNum) {
|
|
101
|
-
throw new Error('Installed ' + toolName + '
|
|
102
|
-
+ minVersionRequired + ')
|
|
102
|
+
throw new Error('Installed ' + toolName + ' is less than the minimum required version ('
|
|
103
|
+
+ minVersionRequired + ').\nPlease upgrade your version of ' + toolName + '.');
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
if (maxVersionSupported) {
|
|
106
107
|
var maxVersionSupportedNum = getVersionNumberFromString(maxVersionSupported);
|
|
107
108
|
if (toolVersionNum > maxVersionSupportedNum) {
|
|
108
|
-
throw new Error('Installed ' + toolName + '
|
|
109
|
-
+ maxVersionSupported + ')
|
|
109
|
+
throw new Error('Installed ' + toolName + ' is more than the maximum supported version ('
|
|
110
|
+
+ maxVersionSupported + ').\nPlease downgrade your version of ' + toolName + '.');
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
}
|
|
@@ -122,7 +123,8 @@ function getToolVersion(cmd) {
|
|
|
122
123
|
var toolVersion;
|
|
123
124
|
try {
|
|
124
125
|
var result = runProcessThrowError(cmd, null, true /* return output */);
|
|
125
|
-
|
|
126
|
+
// Remove @salesforce/cli/ from the beginning of sf cli version.
|
|
127
|
+
toolVersion = result.replace(/\r?\n|\r/, '').replace(/[^0-9\.]*/, '').replace('@salesforce/cli/', '');
|
|
126
128
|
}
|
|
127
129
|
catch (error) {
|
|
128
130
|
throw new Error(toolName + ' is required but could not be found. Please install ' + toolName + '.');
|