forceios 12.1.0 → 12.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 +1 -1
- package/shared/constants.js +16 -4
- package/shared/createHelper.js +46 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forceios",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.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= '12.
|
|
31
|
+
var VERSION= '12.2.0';
|
|
32
32
|
|
|
33
33
|
module.exports = {
|
|
34
34
|
version: VERSION,
|
|
@@ -268,7 +268,17 @@ module.exports = {
|
|
|
268
268
|
required: false,
|
|
269
269
|
type: 'string',
|
|
270
270
|
hidden: true
|
|
271
|
-
}
|
|
271
|
+
},
|
|
272
|
+
sdkDependencies: {
|
|
273
|
+
name: 'sdkdependencies',
|
|
274
|
+
description: 'override sdk dependencies',
|
|
275
|
+
'char': 'd',
|
|
276
|
+
error: cli => val => 'Invalid value for sdk dependencies: \'' + val + '\'.',
|
|
277
|
+
validate: cli => val => /.*/.test(val),
|
|
278
|
+
required: false,
|
|
279
|
+
type: 'string',
|
|
280
|
+
hidden: true
|
|
281
|
+
},
|
|
272
282
|
},
|
|
273
283
|
|
|
274
284
|
commands: {
|
|
@@ -282,7 +292,8 @@ module.exports = {
|
|
|
282
292
|
cli.appTypes.indexOf('hybrid_remote') >=0 ? 'startPage' : null,
|
|
283
293
|
'outputDir',
|
|
284
294
|
'verbose',
|
|
285
|
-
cli.name === 'forcehybrid' ? 'pluginRepoUri' : null
|
|
295
|
+
cli.name === 'forcehybrid' ? 'pluginRepoUri' : null,
|
|
296
|
+
'sdkDependencies'
|
|
286
297
|
].filter(x=>x!=null),
|
|
287
298
|
description: cli => 'create ' + cli.purpose,
|
|
288
299
|
longDescription: cli => 'Create ' + cli.purpose + '.',
|
|
@@ -298,7 +309,8 @@ module.exports = {
|
|
|
298
309
|
cli.appTypes.indexOf('hybrid_remote') >=0 ? 'startPage' : null,
|
|
299
310
|
'outputDir',
|
|
300
311
|
'verbose',
|
|
301
|
-
cli.name === 'forcehybrid' ? 'pluginRepoUri' : null
|
|
312
|
+
cli.name === 'forcehybrid' ? 'pluginRepoUri' : null,
|
|
313
|
+
'sdkDependencies'
|
|
302
314
|
].filter(x=>x!=null),
|
|
303
315
|
description: cli => 'create ' + cli.purpose + ' from a template',
|
|
304
316
|
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
|
|