forcereact
Advanced tools
Comparing version 6.1.0 to 6.2.0
{ | ||
"name": "forcereact", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"description": "Utilities for creating react native mobile apps based on the Salesforce Mobile SDK for iOS and Android", | ||
@@ -5,0 +5,0 @@ "keywords": [ "mobilesdk", "ios", "android", "react", "salesforce", "mobile", "sdk" ], |
@@ -56,2 +56,7 @@ # Salesforce Mobile SDK for React Native Package | ||
# list available Mobile SDK templates | ||
forcereact listtemplates | ||
OR | ||
# show version of Mobile SDK | ||
@@ -58,0 +63,0 @@ forcereact version |
@@ -34,4 +34,6 @@ /* | ||
commandLineUtils = require('./commandLineUtils'), | ||
logInfo = require('./utils').logInfo; | ||
logInfo = require('./utils').logInfo, | ||
getTemplates = require('./templateHelper').getTemplates; | ||
function applyCli(f, cli) { | ||
@@ -90,2 +92,6 @@ return typeof f === 'function' ? f(cli): f; | ||
break; | ||
case SDK.commands.listtemplates.name: | ||
listTemplates(cli); | ||
process.exit(0); | ||
break; | ||
default: | ||
@@ -109,2 +115,15 @@ usage(cli); | ||
function listTemplates(cli) { | ||
var cliName = cli.name; | ||
var applicableTemplates = getTemplates(cli); | ||
logInfo('\nAvailable templates:\n', COLOR.cyan); | ||
for (var i=0; i<applicableTemplates.length; i++) { | ||
var template = applicableTemplates[i]; | ||
logInfo((i+1) + ') ' + template.description, COLOR.cyan); | ||
logInfo(cliName + ' ' + SDK.commands.createwithtemplate.name + ' --' + SDK.args.templateRepoUri.name + '=' + template.url, COLOR.magenta); | ||
} | ||
logInfo(''); | ||
} | ||
function usage(cli) { | ||
@@ -111,0 +130,0 @@ var cliName = cli.name; |
@@ -31,3 +31,3 @@ /* | ||
var VERSION = '6.1.0'; | ||
var VERSION = '6.2.0'; | ||
@@ -42,2 +42,7 @@ module.exports = { | ||
}, | ||
node: { | ||
checkCmd: 'node --version', | ||
minVersion: '6.9', | ||
maxVersion: '8.11', | ||
}, | ||
npm: { | ||
@@ -49,8 +54,9 @@ checkCmd: 'npm -v', | ||
checkCmd: 'pod --version', | ||
minVersion: '1.2' | ||
minVersion: '1.2', | ||
maxVersion: '1.4', | ||
}, | ||
cordova: { | ||
checkCmd: 'cordova -v', | ||
minVersion: '7.0.0', | ||
//pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#dev', // dev | ||
minVersion: '8.0.0', | ||
pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#v' + VERSION, // GA | ||
@@ -79,3 +85,3 @@ platformVersion: { | ||
platforms: ['ios'], | ||
toolNames: ['git', 'npm', 'pod'], | ||
toolNames: ['git', 'node', 'npm', 'pod'], | ||
appTypes: ['native', 'native_swift'], | ||
@@ -86,3 +92,3 @@ appTypesToPath: { | ||
}, | ||
commands: ['create', 'createwithtemplate', 'version'] | ||
commands: ['create', 'createwithtemplate', 'version', 'listtemplates'] | ||
}, | ||
@@ -95,3 +101,3 @@ forcedroid: { | ||
platforms: ['android'], | ||
toolNames: ['git', 'npm'], | ||
toolNames: ['git', 'node', 'npm'], | ||
appTypes: ['native', 'native_kotlin'], | ||
@@ -102,3 +108,3 @@ appTypesToPath: { | ||
}, | ||
commands: ['create', 'createwithtemplate', 'version'] | ||
commands: ['create', 'createwithtemplate', 'version', 'listtemplates'] | ||
}, | ||
@@ -111,3 +117,3 @@ forcehybrid: { | ||
platforms: ['ios', 'android'], | ||
toolNames: ['git', 'npm', 'cordova'], | ||
toolNames: ['git', 'node', 'npm', 'cordova'], | ||
appTypes: ['hybrid_local', 'hybrid_remote'], | ||
@@ -118,3 +124,3 @@ appTypesToPath: { | ||
}, | ||
commands: ['create', 'createwithtemplate', 'version'] | ||
commands: ['create', 'createwithtemplate', 'version', 'listtemplates'] | ||
}, | ||
@@ -127,3 +133,3 @@ forcereact: { | ||
platforms: ['ios', 'android'], | ||
toolNames: ['git', 'npm', 'pod'], | ||
toolNames: ['git', 'node', 'npm', 'pod'], | ||
appTypes: ['react_native'], | ||
@@ -133,3 +139,3 @@ appTypesToPath: { | ||
}, | ||
commands: ['create', 'createwithtemplate', 'version'] | ||
commands: ['create', 'createwithtemplate', 'version', 'listtemplates'] | ||
} | ||
@@ -267,4 +273,11 @@ }, | ||
help: 'This command displays to the console the version of Mobile SDK that the script uses to create apps.' | ||
}, | ||
listtemplates: { | ||
name: 'listtemplates', | ||
args: [], | ||
description: cli => 'list available Mobile SDK templates to create ' + cli.purpose, | ||
longDescription: cli => 'List available Mobile SDK templates to create ' + cli.purpose + '.', | ||
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.' | ||
} | ||
} | ||
}; |
@@ -33,17 +33,5 @@ /* | ||
configHelper = require('./configHelper'), | ||
COLOR = require('./outputColors'); | ||
prepareTemplate = require('./templateHelper').prepareTemplate; | ||
// | ||
// Helper to prepare template | ||
// | ||
function prepareTemplate(config, templateDir) { | ||
var template = require(path.join(templateDir, 'template.js')); | ||
return utils.runFunctionThrowError( | ||
function() { | ||
return template.prepare(config, utils.replaceInFiles, utils.moveFile, utils.removeFile); | ||
}, | ||
templateDir); | ||
} | ||
// | ||
// Helper for native application creation | ||
@@ -160,3 +148,3 @@ // | ||
for (var toolName of toolNames) { | ||
utils.checkToolVersion(SDK.tools[toolName].checkCmd, SDK.tools[toolName].minVersion); | ||
utils.checkToolVersion(SDK.tools[toolName].checkCmd, SDK.tools[toolName].minVersion, SDK.tools[toolName].maxVersion); | ||
} | ||
@@ -279,5 +267,4 @@ } | ||
module.exports = { | ||
createApp | ||
}; |
@@ -89,6 +89,7 @@ /* | ||
* @param {String} minVersionRequired Minimum version required | ||
* @param {String} maxVersionSupported Maximum version supported | ||
* | ||
* @throws {Error} if tool not found or version too low | ||
*/ | ||
function checkToolVersion(cmd, minVersionRequired) { | ||
function checkToolVersion(cmd, minVersionRequired, maxVersionSupported) { | ||
var toolName = cmd.split(' ')[0]; | ||
@@ -111,2 +112,10 @@ var toolVersion; | ||
} | ||
if (maxVersionSupported) { | ||
var maxVersionSupportedNum = getVersionNumberFromString(maxVersionSupported); | ||
if (toolVersionNum > maxVersionSupportedNum) { | ||
throw new Error('Installed ' + toolName + ' version (' + toolVersion + ') is more than the maximum supported version (' | ||
+ maxVersionSupported + '). Please downgrade your version of ' + toolName + '.'); | ||
} | ||
} | ||
} | ||
@@ -113,0 +122,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
66785
10
1384
116
5