The developer tools provide two interfaces, command line and HTTP service, for external calls. Developers may order the tool to implement operations such as login, preview, upload, through the command line or HTTP request.
Tools installed through calling command line can execute files to complete operations such as login, preview, upload, and automated testing. Calling a return code of 0 means normal, and -1 for error.
Location of command line tools
1. Command line launch tool
-o, --open [projectpath]: Opening the tool without projectpath will only open the tool itself, while opening with projectpath will open the project within the path. It will automatically refresh the compilations each time it runs, and will automatically open the simulator and debugger. Projectpath cannot be a relative path. The project path must contain project.config.json in the correct format, in which are the appid and projectname fields.
# Open the tool cli -o # Open the project under the path /Users/username/demo cli -o /Users/username/demo
2. Login from command line
The command line provides two login methods: one is to convert the login QR code into base64 and send it to the user, and the user will integrate it into their own system; and the other is to print the QR code in the command line.
-l, --login: Enable login logic.
--login-qr-output [format[@path]]: Specify the QR code output method. Available values for format include terminal (command line output), base64 and image. If a path is entered, the result will be output to the file of the specified path. If the path is not entered, the result will be output to the command line. If you do not use this option or use it without entering the format, the default is to print on the command line.
# Login, print the login QR code in Terminal cli -l # Login, print the QR code in base64 format in Terminal cli -l --login-qr-output base64 # Login, convert the QR code into base64, and save it to /Users/username/code.txt cli -l --login-qr-output base64@/Users/username/code.txt
3. Preview of command line before submission
The "Logged In" status is required for the preview. If you are not logged in, you will be prompted to log in first. The QR code preview can be printed with command line or converted to base64. Project configurations such as ES6 are read from project.config.json.
-p, --preview <project_root>: Preview code, project_root specifies the project root path.
--preview-qr-output [format[@path]]: Specify the QR code output method, the semantics are the same as the login option --login-qr-output.
--preview-info-ouput <path>: When specified, additional information from this preview, such as code package size and sub-package size information, will be output in json format to the specified path.
# Preview, print the login QR code in Terminal cli -p /Users/username/demo # Preview, convert the QR code into base64, and save it to /Users/username/code.txt cli -p /Users/username/demo --preview-qr-output base64@/Users/username/code.txt # Preview and save information such as the size of the preview code package to /Users/username/info.json cli -p /Users/username/demo --preview-info-output /Users/username/info.json
4. Upload code via command line
You must be logged in when uploading the code. If you are not logged in, you will be prompted to log in first.
Information required to upload the code includes the project root directory, version number, and available version notes.
-u, --upload <version@project_root>: Upload code, version specified version number, and project_root specified project root path.
--upload-desc <desc>: Notes when uploading code.
--upload-info-ouput <path>: When specified, additional information from this upload, such as code package size and sub-package size information, will be output in json format to the specified path.
# Projects under the upload path /Users/username/demo have a specified version number of 1.0.0, and the version note is initial release. cli -u 1.0.0@/Users/username/demo --upload-desc 'initial release' # Upload and save information such as the size of the code package to /Users/username/info.json cli -u 1.0.0@/Users/username/demo --upload-desc 'initial release' --preview-info-output /Users/username/info.json
5. Support automated testing
-t, --test <project_root>: Submit automated testing, project_root specified project root path.
# Submit the project under the testing path /Users/username/demo cli -t /Users/username/demo