forceios 12.1.1 → 13.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 +18 -7
- package/shared/createHelper.js +46 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forceios",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.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= '13.0.0';
|
|
32
32
|
|
|
33
33
|
module.exports = {
|
|
34
34
|
version: VERSION,
|
|
@@ -118,11 +118,10 @@ module.exports = {
|
|
|
118
118
|
dir: 'hybrid',
|
|
119
119
|
platforms: ['ios', 'android'],
|
|
120
120
|
toolNames: ['git', 'node', 'npm', 'cordova', 'sf'],
|
|
121
|
-
appTypes: ['hybrid_local', 'hybrid_remote'
|
|
121
|
+
appTypes: ['hybrid_local', 'hybrid_remote'],
|
|
122
122
|
appTypesToPath: {
|
|
123
123
|
'hybrid_local': 'HybridLocalTemplate',
|
|
124
|
-
'hybrid_remote': 'HybridRemoteTemplate'
|
|
125
|
-
'hybrid_lwc': 'HybridLwcTemplate'
|
|
124
|
+
'hybrid_remote': 'HybridRemoteTemplate'
|
|
126
125
|
},
|
|
127
126
|
commands: ['create', 'createwithtemplate', 'version', 'listtemplates', 'checkconfig']
|
|
128
127
|
},
|
|
@@ -268,7 +267,17 @@ module.exports = {
|
|
|
268
267
|
required: false,
|
|
269
268
|
type: 'string',
|
|
270
269
|
hidden: true
|
|
271
|
-
}
|
|
270
|
+
},
|
|
271
|
+
sdkDependencies: {
|
|
272
|
+
name: 'sdkdependencies',
|
|
273
|
+
description: 'override sdk dependencies',
|
|
274
|
+
'char': 'd',
|
|
275
|
+
error: cli => val => 'Invalid value for sdk dependencies: \'' + val + '\'.',
|
|
276
|
+
validate: cli => val => /.*/.test(val),
|
|
277
|
+
required: false,
|
|
278
|
+
type: 'string',
|
|
279
|
+
hidden: true
|
|
280
|
+
},
|
|
272
281
|
},
|
|
273
282
|
|
|
274
283
|
commands: {
|
|
@@ -282,7 +291,8 @@ module.exports = {
|
|
|
282
291
|
cli.appTypes.indexOf('hybrid_remote') >=0 ? 'startPage' : null,
|
|
283
292
|
'outputDir',
|
|
284
293
|
'verbose',
|
|
285
|
-
cli.name === 'forcehybrid' ? 'pluginRepoUri' : null
|
|
294
|
+
cli.name === 'forcehybrid' ? 'pluginRepoUri' : null,
|
|
295
|
+
'sdkDependencies'
|
|
286
296
|
].filter(x=>x!=null),
|
|
287
297
|
description: cli => 'create ' + cli.purpose,
|
|
288
298
|
longDescription: cli => 'Create ' + cli.purpose + '.',
|
|
@@ -298,7 +308,8 @@ module.exports = {
|
|
|
298
308
|
cli.appTypes.indexOf('hybrid_remote') >=0 ? 'startPage' : null,
|
|
299
309
|
'outputDir',
|
|
300
310
|
'verbose',
|
|
301
|
-
cli.name === 'forcehybrid' ? 'pluginRepoUri' : null
|
|
311
|
+
cli.name === 'forcehybrid' ? 'pluginRepoUri' : null,
|
|
312
|
+
'sdkDependencies'
|
|
302
313
|
].filter(x=>x!=null),
|
|
303
314
|
description: cli => 'create ' + cli.purpose + ' from a template',
|
|
304
315
|
longDescription: cli => 'Create ' + cli.purpose + ' from a template.',
|
package/shared/createHelper.js
CHANGED
|
@@ -109,56 +109,10 @@ function createHybridApp(config) {
|
|
|
109
109
|
// Run cordova prepare
|
|
110
110
|
utils.runProcessThrowError('cordova prepare', config.projectDir);
|
|
111
111
|
|
|
112
|
-
if (config.platform.split(',').indexOf('ios') != -1) {
|
|
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');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
112
|
// Done
|
|
125
113
|
return prepareResult;
|
|
126
114
|
}
|
|
127
115
|
|
|
128
|
-
//
|
|
129
|
-
// Patch pod file for hybrid apps on xcode 14
|
|
130
|
-
//
|
|
131
|
-
function fixPods(config, iosSubDir) {
|
|
132
|
-
var iosDir = path.join(config.projectDir, iosSubDir)
|
|
133
|
-
var podfilePath = path.join(iosDir, 'Podfile');
|
|
134
|
-
var originalPodfileContent = fs.readFileSync(podfilePath, 'utf8');
|
|
135
|
-
var preInstallCode = "\n" +
|
|
136
|
-
"$dynamic_framework = ['SalesforceAnalytics', 'SalesforceSDKCore', 'SalesforceSDKCommon', 'SmartStore', 'FMDB', 'SQLCipher', 'MobileSync']\n" +
|
|
137
|
-
"pre_install do |installer|\n" +
|
|
138
|
-
" installer.pod_targets.each do |pod|\n" +
|
|
139
|
-
" if $dynamic_framework.include?(pod.name)\n" +
|
|
140
|
-
" def pod.build_type\n" +
|
|
141
|
-
" Pod::BuildType.dynamic_framework\n" +
|
|
142
|
-
" end\n" +
|
|
143
|
-
" end\n" +
|
|
144
|
-
" end\n" +
|
|
145
|
-
"end" +
|
|
146
|
-
"\n" +
|
|
147
|
-
"post_install do |installer|\n" +
|
|
148
|
-
" installer.pods_project.targets.each do |target|\n" +
|
|
149
|
-
" if target.deployment_target.to_i < 9\n" +
|
|
150
|
-
" target.build_configurations.each do |config|\n" +
|
|
151
|
-
" config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'\n" +
|
|
152
|
-
" end\n" +
|
|
153
|
-
" end\n" +
|
|
154
|
-
" end\n" +
|
|
155
|
-
"end"
|
|
156
|
-
|
|
157
|
-
utils.logInfo('Updating Podfile for project ' + config.appname);
|
|
158
|
-
fs.writeFileSync(podfilePath, originalPodfileContent.replace("use_frameworks!","") + preInstallCode);
|
|
159
|
-
utils.runProcessThrowError('pod update', iosDir);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
116
|
//
|
|
163
117
|
// Print details
|
|
164
118
|
//
|
|
@@ -179,6 +133,10 @@ function printDetails(config) {
|
|
|
179
133
|
}
|
|
180
134
|
|
|
181
135
|
|
|
136
|
+
if (config.sdkdependencies) {
|
|
137
|
+
details = details.concat([' sdk dependencies: ' + config.sdkdependencies]);
|
|
138
|
+
}
|
|
139
|
+
|
|
182
140
|
// Hybrid extra details
|
|
183
141
|
if (config.apptype.indexOf('hybrid') >= 0) {
|
|
184
142
|
if (config.apptype === 'hybrid_remote') {
|
|
@@ -298,6 +256,43 @@ function createApp(forcecli, config) {
|
|
|
298
256
|
}
|
|
299
257
|
}
|
|
300
258
|
|
|
259
|
+
//
|
|
260
|
+
// Override sdk dependencies in package.json
|
|
261
|
+
//
|
|
262
|
+
function overrideSdkDependencies(packageJsonPath, sdkDependenciesString) {
|
|
263
|
+
try {
|
|
264
|
+
console.log("packageJsonPath =>" + packageJsonPath);
|
|
265
|
+
|
|
266
|
+
// Parse sdkDependencies
|
|
267
|
+
let sdkDependencies = JSON.parse(sdkDependenciesString)
|
|
268
|
+
|
|
269
|
+
// Read the package.json file
|
|
270
|
+
let originalContent = fs.readFileSync(packageJsonPath, 'utf8');
|
|
271
|
+
console.log("original content =>" + originalContent);
|
|
272
|
+
let packageJson = JSON.parse(originalContent)
|
|
273
|
+
|
|
274
|
+
// Ensure "sdkDependencies" exists in the package.json
|
|
275
|
+
if (!packageJson.sdkDependencies) {
|
|
276
|
+
packageJson.sdkDependencies = {};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Merge the sdkDependencies argument into the packageJson.sdkDependencies
|
|
280
|
+
packageJson.sdkDependencies = {
|
|
281
|
+
...packageJson.sdkDependencies,
|
|
282
|
+
...sdkDependencies
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
// Write the updated package.json back to file
|
|
286
|
+
let updatedContent = JSON.stringify(packageJson, null, 2);
|
|
287
|
+
console.log("updated content =>" + updatedContent);
|
|
288
|
+
fs.writeFileSync(packageJsonPath, updatedContent, 'utf8');
|
|
289
|
+
|
|
290
|
+
} catch (err) {
|
|
291
|
+
console.error(`Failed to override sdk dependencies in package.json: ${err}`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
|
|
301
296
|
//
|
|
302
297
|
// Actually create app
|
|
303
298
|
//
|
|
@@ -353,6 +348,11 @@ function actuallyCreateApp(forcecli, config) {
|
|
|
353
348
|
var repoDir = utils.cloneRepo(tmpDir, config.templaterepouri);
|
|
354
349
|
config.templateLocalPath = path.join(repoDir, config.templatepath);
|
|
355
350
|
|
|
351
|
+
// Override sdk dependencies in package.json if any were provided
|
|
352
|
+
if (config.sdkdependencies) {
|
|
353
|
+
overrideSdkDependencies(path.join(config.templateLocalPath, 'package.json'), config.sdkdependencies);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
356
|
// Getting apptype from template
|
|
357
357
|
config.apptype = require(path.join(config.templateLocalPath, 'template.js')).appType;
|
|
358
358
|
|