forceios 9.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.
@@ -0,0 +1,329 @@
1
+ /*
2
+ * Copyright (c) 2016-present, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Redistribution and use of this software in source and binary forms, with or
5
+ * without modification, are permitted provided that the following conditions
6
+ * are met:
7
+ * - Redistributions of source code must retain the above copyright notice, this
8
+ * list of conditions and the following disclaimer.
9
+ * - Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ * - Neither the name of salesforce.com, inc. nor the names of its contributors
13
+ * may be used to endorse or promote products derived from this software without
14
+ * specific prior written permission of salesforce.com, inc.
15
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ * POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ var path = require('path'),
29
+ shelljs = require('shelljs');
30
+
31
+ var VERSION= '9.2.0';
32
+
33
+ module.exports = {
34
+ version: VERSION,
35
+
36
+ tools: {
37
+ git: {
38
+ checkCmd: 'git --version',
39
+ minVersion: '2.13'
40
+ },
41
+ node: {
42
+ checkCmd: 'node --version',
43
+ minVersion: '6.9'
44
+ },
45
+ npm: {
46
+ checkCmd: 'npm -v',
47
+ minVersion: '3.10'
48
+ },
49
+ yarn: {
50
+ checkCmd: 'yarn -v',
51
+ minVersion: '1.22'
52
+ },
53
+ tsc: {
54
+ checkCmd: 'tsc -v',
55
+ minVersion: '4.1.2'
56
+ },
57
+ pod: {
58
+ checkCmd: 'pod --version',
59
+ minVersion: '1.8.0'
60
+ },
61
+ cordova: {
62
+ checkCmd: 'cordova -v',
63
+ // pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#dev', // dev
64
+ minVersion: '10.0.0',
65
+ pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#v' + VERSION, // GA
66
+ platformVersion: {
67
+ ios: '6.2.0',
68
+ android: '10.1.0'
69
+ }
70
+ },
71
+ sfdx: {
72
+ checkCmd: 'sfdx -v',
73
+ minVersion: '6.0.0'
74
+ }
75
+ },
76
+
77
+ ides: {
78
+ ios: 'XCode',
79
+ android: 'Android Studio'
80
+ },
81
+
82
+ // templatesRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-Templates#dev', // dev
83
+ templatesRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-Templates#v' + VERSION, // GA
84
+
85
+ forceclis: {
86
+ forceios: {
87
+ name: 'forceios',
88
+ topic: 'ios',
89
+ purpose: 'an iOS native mobile application',
90
+ dir: 'ios',
91
+ platforms: ['ios'],
92
+ toolNames: ['git', 'node', 'npm', 'pod'],
93
+ appTypes: ['native_swift', 'native'],
94
+ appTypesToPath: {
95
+ 'native': 'iOSNativeTemplate',
96
+ 'native_swift': 'iOSNativeSwiftTemplate'
97
+ },
98
+ commands: ['create', 'createwithtemplate', 'version', 'listtemplates', 'checkconfig']
99
+ },
100
+ forcedroid: {
101
+ name: 'forcedroid',
102
+ topic: 'android',
103
+ purpose: 'an Android native mobile application',
104
+ dir: 'android',
105
+ platforms: ['android'],
106
+ toolNames: ['git', 'node', 'npm'],
107
+ appTypes: ['native_kotlin', 'native'],
108
+ appTypesToPath: {
109
+ 'native': 'AndroidNativeTemplate',
110
+ 'native_kotlin': 'AndroidNativeKotlinTemplate'
111
+ },
112
+ commands: ['create', 'createwithtemplate', 'version', 'listtemplates', 'checkconfig']
113
+ },
114
+ forcehybrid: {
115
+ name: 'forcehybrid',
116
+ topic: 'hybrid',
117
+ purpose: 'a hybrid mobile application',
118
+ dir: 'hybrid',
119
+ platforms: ['ios', 'android'],
120
+ toolNames: ['git', 'node', 'npm', 'cordova', 'sfdx'],
121
+ appTypes: ['hybrid_local', 'hybrid_remote', 'hybrid_lwc'],
122
+ appTypesToPath: {
123
+ 'hybrid_local': 'HybridLocalTemplate',
124
+ 'hybrid_remote': 'HybridRemoteTemplate',
125
+ 'hybrid_lwc': 'HybridLwcTemplate'
126
+ },
127
+ commands: ['create', 'createwithtemplate', 'version', 'listtemplates', 'checkconfig']
128
+ },
129
+ forcereact: {
130
+ name: 'forcereact',
131
+ topic: 'reactnative',
132
+ purpose: 'a React Native mobile application',
133
+ dir: 'react',
134
+ platforms: ['ios', 'android'],
135
+ toolNames: ['git', 'node', 'yarn', 'tsc', 'pod'],
136
+ appTypes: ['react_native_typescript', 'react_native'],
137
+ appTypesToPath: {
138
+ 'react_native': 'ReactNativeTemplate',
139
+ 'react_native_typescript': 'ReactNativeTypeScriptTemplate'
140
+ },
141
+ commands: ['create', 'createwithtemplate', 'version', 'listtemplates', 'checkconfig']
142
+ }
143
+ },
144
+
145
+ args: {
146
+ platform: {
147
+ name: 'platform',
148
+ 'char': 'p',
149
+ description: cli => 'comma-separated list of platforms (' + cli.platforms.join(', ') + ')',
150
+ longDescription: cli => 'A comma-separated list of one or more platforms you support. The script creates a project for each platform you select. Available options are ' + cli.platforms.join(', ') + '.',
151
+ prompt: cli => 'Enter the target platform(s) separated by commas (' + cli.platforms.join(', ') + '):',
152
+ error: cli => val => 'Platform(s) must be in ' + cli.platforms.join(', '),
153
+ validate: cli => val => !val.split(",").some(p=>cli.platforms.indexOf(p) == -1),
154
+ type: 'string'
155
+ },
156
+ appType: {
157
+ name:'apptype',
158
+ 'char':'t',
159
+ description: cli => 'application type (' + cli.appTypes.join(' or ') + ', leave empty for ' + cli.appTypes[0] + ')',
160
+ longDescription: cli => 'You can choose one of the following types of applications: ' + cli.appTypes.join(', ') + '.',
161
+ prompt: cli => 'Enter your application type (' + cli.appTypes.join(' or ') + ', leave empty for ' + cli.appTypes[0] + '):',
162
+ error: cli => val => 'App type must be ' + cli.appTypes.join(' or ') + '.',
163
+ validate: cli => val => val === undefined || val === '' || cli.appTypes.indexOf(val) >=0,
164
+ required: false,
165
+ type: 'string'
166
+ },
167
+ templateRepoUri: {
168
+ name:'templaterepouri',
169
+ 'char': 'r',
170
+ description:'template repo URI or Mobile SDK template name',
171
+ longDescription: 'The URI of a repository that contains the template application to be used as the basis of your new app or simply the name of a Mobile SDK template.',
172
+ prompt: 'Enter URI of repo containing template application or a Mobile SDK template name:',
173
+ error: cli => val => 'Invalid value for template repo uri: \'' + val + '\'.',
174
+ validate: cli => val => /^\S+$/.test(val),
175
+ type: 'string'
176
+ },
177
+ appName: {
178
+ name: 'appname',
179
+ 'char': 'n',
180
+ description: 'application name',
181
+ longDescription: 'A name for the app that conforms to the naming requirements for the platform.',
182
+ prompt: 'Enter your application name:',
183
+ error: cli => val => 'Invalid value for application name: \'' + val + '\'.',
184
+ validate: cli => val => (cli.platforms.indexOf('ios') != -1 ? /^[^\s-]+$/ : /^\S+$/).test(val),
185
+ type: 'string'
186
+ },
187
+ packageName: {
188
+ name: 'packagename',
189
+ 'char': 'k',
190
+ description: 'app package identifier (e.g. com.mycompany.myapp)',
191
+ longDescription: 'A string in reverse internet domain format that identifies your app\'s package or bundle. For example, "com.mycompany.myapp".',
192
+ prompt: 'Enter your package name:',
193
+ error: cli => val => '\'' + val + '\' is not a valid package name.',
194
+ validate: cli => val => /^[a-z]+[a-z0-9_]*(\.[a-z]+[a-z0-9_-]*)*$/.test(val),
195
+ type: 'string'
196
+ },
197
+ organization: {
198
+ name: 'organization',
199
+ 'char': 'o',
200
+ description: 'organization name (your company\'s/organization\'s name)',
201
+ longDescription: 'The name of your company or organization. This string is user-defined and may contain spaces and punctuation.',
202
+ prompt: 'Enter your organization name (Acme, Inc.):',
203
+ error: cli => val => 'Invalid value for organization: \'' + val + '\'.',
204
+ validate: cli => val => /\S+/.test(val),
205
+ type: 'string'
206
+ },
207
+ outputDir: {
208
+ name:'outputdir',
209
+ 'char':'d',
210
+ description:'output directory (leave empty for current directory)',
211
+ longDescription: 'The local path for your new project. If this path points to an existing directory, that directory must be empty. If you don\'t specify a value, the script creates the app in the current directory.',
212
+ prompt: 'Enter output directory for your app (leave empty for the current directory):',
213
+ error: cli => val => 'Invalid value for output directory (directory must not already exist): \'' + val + '\'.',
214
+ validate: cli => val => val === undefined || val === '' || !shelljs.test('-e', path.resolve(val)),
215
+ required:false,
216
+ type: 'string'
217
+ },
218
+ startPage: {
219
+ name:'startpage',
220
+ 'char':'s',
221
+ description:'app start page (the start page of your remote app; required for hybrid_remote apps only)',
222
+ longDescription: 'For hybrid remote apps only, specify the relative server path to your Visualforce start page. This relative path always discards the Salesforce instance and domain name and starts with "apex/".',
223
+ prompt: 'Enter the start page for your app:',
224
+ error: cli => val => 'Invalid value for start page: \'' + val + '\'.',
225
+ validate: cli => val => /\S+/.test(val),
226
+ required: false,
227
+ promptIf: otherArgs => otherArgs.apptype === 'hybrid_remote',
228
+ type: 'string'
229
+ },
230
+ configPath: {
231
+ name:'configpath',
232
+ 'char': 'p',
233
+ description:'path to store or syncs config to validate',
234
+ longDescription:'Path to the store or syncs config file to validate.',
235
+ error: cli => val => 'Config file not found: \'' + val + '\'.',
236
+ prompt: 'Enter the path of the store or syncs config to validate:',
237
+ validate: cli => val => shelljs.test('-e', path.resolve(val)),
238
+ required: true,
239
+ type: 'string'
240
+ },
241
+ configType: {
242
+ name:'configtype',
243
+ 'char': 't',
244
+ description:'type of config to validate (store or syncs)',
245
+ longDescription:'Type of config to validate (store or syncs).',
246
+ error: cli => val => 'Invalid config type: \'' + val + '\'.',
247
+ prompt: 'Enter the type of the config to validate (store or syncs):',
248
+ validate: cli => val => val === 'store' || val === 'syncs',
249
+ required: true,
250
+ type: 'string'
251
+ },
252
+ // Private args
253
+ verbose: {
254
+ name: 'verbose',
255
+ 'char': 'v',
256
+ description: 'increase information output',
257
+ hasValue: false,
258
+ required: false,
259
+ type: 'boolean',
260
+ hidden: true
261
+ },
262
+ pluginRepoUri: {
263
+ name: 'pluginrepouri',
264
+ description: 'supply a plugin repository uri',
265
+ 'char': 'v',
266
+ error: cli => val => 'Invalid value for plugin repo uri: \'' + val + '\'.',
267
+ validate: cli => val => /.*/.test(val),
268
+ required: false,
269
+ type: 'string',
270
+ hidden: true
271
+ }
272
+ },
273
+
274
+ commands: {
275
+ create: {
276
+ name: 'create',
277
+ args: cli => [cli.platforms.length > 1 ? 'platform' : null,
278
+ cli.appTypes.length > 1 ? 'appType' : null,
279
+ 'appName',
280
+ 'packageName',
281
+ 'organization',
282
+ cli.appTypes.indexOf('hybrid_remote') >=0 ? 'startPage' : null,
283
+ 'outputDir',
284
+ 'verbose',
285
+ cli.name === 'forcehybrid' ? 'pluginRepoUri' : null
286
+ ].filter(x=>x!=null),
287
+ description: cli => 'create ' + cli.purpose,
288
+ longDescription: cli => 'Create ' + cli.purpose + '.',
289
+ help: 'This command initiates creation of a new app based on the standard Mobile SDK template.'
290
+ },
291
+ createwithtemplate: {
292
+ name: 'createwithtemplate',
293
+ args: cli => [cli.platforms.length > 1 ? 'platform' : null,
294
+ 'templateRepoUri',
295
+ 'appName',
296
+ 'packageName',
297
+ 'organization',
298
+ cli.appTypes.indexOf('hybrid_remote') >=0 ? 'startPage' : null,
299
+ 'outputDir',
300
+ 'verbose',
301
+ cli.name === 'forcehybrid' ? 'pluginRepoUri' : null
302
+ ].filter(x=>x!=null),
303
+ description: cli => 'create ' + cli.purpose + ' from a template',
304
+ longDescription: cli => 'Create ' + cli.purpose + ' from a template.',
305
+ help: 'This command initiates creation of a new app based on the Mobile SDK template that you specify. The template can be a specialized app for your app type that Mobile SDK provides, or your own custom app that you\'ve configured to use as a template. See https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/ios_new_project_template.htm for information on custom templates.'
306
+ },
307
+ version: {
308
+ name: 'version',
309
+ args: [],
310
+ description: 'show version of Mobile SDK',
311
+ longDescription: 'Show version of Mobile SDK.',
312
+ help: 'This command displays to the console the version of Mobile SDK that the script uses to create apps.'
313
+ },
314
+ listtemplates: {
315
+ name: 'listtemplates',
316
+ args: [],
317
+ description: cli => 'list available Mobile SDK templates to create ' + cli.purpose,
318
+ longDescription: cli => 'List available Mobile SDK templates to create ' + cli.purpose + '.',
319
+ help: 'This command displays the list of available Mobile SDK templates. You can copy repo paths from the output for use with the createwithtemplate command.'
320
+ },
321
+ checkconfig: {
322
+ name: 'checkconfig',
323
+ args: ['configPath', 'configType'],
324
+ description: 'validate store or syncs configuration',
325
+ longDescription: 'Validate store or syncs configuration against their JSON schema.',
326
+ help: 'This command checks whether the given store or syncs configuration is valid according to its JSON schema.'
327
+ }
328
+ }
329
+ };