Smartface CLI Tool
This Node.js CLI tool handles various tasks of the Smartface Framework, including the creating native iOS and Android projects from JavaScript code. You can use Ubuntu, Debian or Mac OSX to develop native mobile apps.
Requirements
Java SE Development Kit
You need to install Java 1.8 JDK to eject for Android.
You can find more information from its download page.
git
You must install git.
It should also be visible from your shell environment.
You can check this through your command line.
For Mac OSX or Linux
git --version
If you installed Git but do not see it when you use the command above, you need to make sure that you set its Environment variable correctly.
Node.js and yarn
Node.js version 4.4.5
or greater is required for the current release.
We recommend
Nvm can be used to install and manage multiple versions of Node.js on Mac OSX and Linux environments.
You need to make sure you add . ~/.nvm/nvm.sh
to ~/.bashrc
, ~/.profile
, or ~/.zshrc
file so that it would load when a terminal tab is opened. You can find more details from the link above.
You should also close and re-open the terminal after you installed nvm
.
Npm is used to install dependencies, any recent installation that includes Node.js version 4.4.5
should be sufficient.
You can install 4.4.5
with nvm
like this:
nvm install 4.4.5
npm install -g yarn
You can also set this version to be the default version
nvm alias default 4.4.5
which node
Something similar to ~/.nvm/versions/node/v4.4.5/bin/node
should be displayed.
Smartface Installation
yarn global add smartface
"Sudo" Issue When Installing Smartface
In Linux and Unix systems, when installing global modules for Node.js, you may run into a problem where you may be asked to install with super user privileges by using the sudo
command.
You can learn how to fix this issue from https://docs.npmjs.com/getting-started/fixing-npm-permissions.
Usage
This tool creates native Android/iOS projects from Smartface Cloud projects. The output is Android Stduio project for Android and Xcode project file for iOS.
You can get the help screen by executing the below command:
smfc -h
You will see the following screen:
Smartface Command-Line Interface, version 5.2.13
Usage: smfc [options]
Smartface Command-Line Interface
Options:
-h, --help General Help
-v, --version Print smfc's version.
-i, --interactive Smartface Command-Line Interface in interactive mode
--help=<options or tasks> General help
--task=<task> Task to execute
--projectRoot=<root path> Target project's root folder
--path=<plugin project path> Target plugin project's root folder
--licenseFile=<license file path> Your Smartface license file path
--androidPlayer=<player arm apk> Smartface Android Player zip
--iosPlayer=<ios player> Smartface iOS Player zip
--logLevel=<level> Log Level
--logFile=<file path> Log to a specific file.
--logStdOut=<status> Log to console.
--playerPath=<player path> It denotes the path of the android plugin apk or iOS player file.
You can get detailed information about a CLI parameter by running smfc --help=<PARAMETER>
.
On the other hand, you can run this command smfc --help=<TASK>
to check what parameters are used in which the task.
For example, you can run
smfc --help=task
And you will see the following screen:
Smartface Command-Line Interface, version 6.15.2
Option: --task
Task to execute
Example:
--task=export:iOS,Android
Description:
Task to execute
Another example, you can run
smfc --help=export
And you will see the following screen:
Smartface Command-Line Interface, version 6.15.2
Task: export
Export iOS and Android project
Required:
task Task to execute
Optional:
licenseFile Your Smartface license file path
iosPlayer Smartface iOS Player zip
androidPlayer Smartface Android Player zip
logLevel Log Level
logFile Log to a specific file.
logStdOut Log to console.
projectRoot Target project's root folder
Example:
smfc --task=export:android,ios
Advanced Example:
smfc --task=export:android,ios --projectRoot=./workspace
Description:
You can export for iOS, Android. If you want most details, you can contact us.
More detailed information is provided in the below sections on how to use the CLI parameters.
Advanced Usage
The CLI tool can be called with numerous parameters to control its input.
Required Parameters
If you want to publish your project, you must use these arguments
-
task
Task that will be run. Supported tasks are listed below.
- publish
- create_iOSPlugin
- generate_iOSPluginZip
Example task
--task=$(TASK) , --task=export:Android,iOS
Optional parameters
You can use optional parameters.
- projectRoot, path Your project root folder. You can also use relative paths.
Example projectRoot
--projectRoot=$(PROJECT_ROOT) , --projectRoot=../smfc-sample
- licenseFile Your license file path
Example licenseFile
--licenseFile=$(LICENSE) , --licenseFile=/home/Smartface/license.xml
- androidPlayer Smartface Player zip. You can set one of the players of Smartface.
Example androidPlayer
--androidPlayer=$(ANDROID_PLAYER) , --androidPlayer=/home/Smartface/SmartfacePlayer.zip
- iosPlayer Smartface Player zip file for iOS. You can set one of the iOS-players of Smartface.
Example inputZip
--iosPlayer=$(IOS_PLAYER) , --iosPlayer=/home/Smartface/SmartfacePlayer.zip
-
logLevel Verbosity level of logging
Available options are
ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
Example logLevel
--logLevel=$(LOG_LEVEL) , --logLevel=debug
- logFile You can log to a specific file. Relative paths can be used.
Example logFile
--logFile=$(LOG_FILE) , --logFile=../smfc-sample/log/some.log
-
logStdOut You can display logs on the console.
If
logLevel
is set toOFF
, there will be no output on the console.
Example logStdOut
--logStdOut=$(LOG_STDOUT) , --logStdOut=true
- playerPath It denotes the path of the android plugin apk or iOS player file.
Example playerPath
--playerPath=$(PLAYER_PATH)
Example Usages
export
smfc --task=export:Android,iOS
smfc --task=export:Android,iOS --projectRoot=../smfc-sample --logLevel=debug --logFile=../smfc-sample/log/ios.log --androidPlayer=./some/path/SmartfacePlayer.zip
create_iOSPlugin
smfc --task=create_iOSPlugin --path=../sample-plugin
smfc --task=create_iOSPlugin --path=../sample-plugin --playerPath=../../files/iOS_Player.zip
generate_iOSPluginZip
smfc --task=generate_iOSPluginZip
smfc --task=generate_iOSPluginZip --path=../sample-plugin
check_iOSConflict
only darwin platform
smfc --task=export:check_iOSConflict
checkProject
smfc --task=checkProject --projectRoot=/home/ubuntu/workspace/workspace