1.2.2 • Published 1 year ago
usf-cli v1.2.2
Develop UOS Func Stateless with usf-cli
Install usf-cli
npm install -g usf-cliCreate project
mkdir stateless-function
cd stateless-functionInit project
usf-cli -i
# or
npm initCreat function
# create default function
usf-cli -c --f=helloWorld
# or create function with crud template
usf-cli -c --f=helloCrud --t=crud_mysqlEdit function & event data
vim ./helloWorld/index.js
# or open it in IDEvim ./.uos_test/helloWorld_event.json
# or open it in IDEInstall Dependency (If necessary)
npm install .Run function locally
# with default event data json(./uos_test/helloWorld_event.json)
usf-cli -r --f=helloWorld
# or with specified event data json(e.g. you have created a test.json in your project dir)
usf-cli -r --f=helloWorld --e=./test.jsonDeploy function
# before delpoying function, you should set app id and service secret for this project (used for generating auth token)
usf-cli -a --id=<app-id> --secret=<service-secret>
# and then you can deploy it
usf-cli -d
# Func Stateless also support install dependency online, so that if the size of your project is larger than 50MB, you can set 'installDenpendency'
usf-cli -d --installDependencyCI Script
# test usf-cli with ci script (shell)
vim @usf-cli/ci.sh # set APPID & APPSECRET
chmod +x @usf-cli/ci.sh
@usf-cli/ci.sh