Developer Tools provide two types of interfaces for external calls: command lines and HTTP services. Developers can indicate the tools to perform actions such as log in, preview, and upload through command lines or HTTP requests.

Command Line

Through the command line to call the completed installation tool executable file, complete the login, preview, uploading, automated testing and other operations. Calling return code 0 means normal, and -1 means error.

Location of command line tools :

macOS: <installation path>/Contents/Resources/app.nw/bin/cli

Windows: <installation path>/cli.bat

1. Command Line Startup Tools

-o, --open [projectpath]: Open the tools. If it comes with projectpath, just open the tools. If it does not come with the project path, open the project in the path. Each execution will be automatically compiled and refreshed, and the simulator and debugger will be automatically opened. Projectpath cannot be a relative path. The project path must have a correctly formatted project.config.json, which also has the fields oappid and projectname.

Example:

# Open tool
cli -o
# Open the project under path /Users/username/demo
cli -o base64@/Users/username/demo

2. Command Line Login

The command line provides two login methods: one is to convert the login QR code to base64 for the user, so that the user can integrate it into his own system; and the second is to print the QR code on the command line.

-l, --login: Start login logic.

--login-qr-output [format[@path]]: Specifies the output format of the QR code. Format optional values include terminal (command line output), base64, image. If it is filled with path,it means the result is output to the file in the specified path. If it is not filled with path, it means the result is output to the command line. If this option is not used or used but not filled with format, the command line prints by default.

Example:

# Login, and print the login QR code in the terminal
cli -l
# Login, and print the QR code in the base64 format in the terminal
cli -l --login-qr-output base64
# Log in, convert the QR code to base64 and save it to the file /Users/username/code.txt 
cli -l --login-qr-output base64@/Users/username/code.txt

3. Command Line Submission Preview

You must be logged in during the preview. If you are not logged in, you will be prompted to log in first. The previewed QR code can be printed on the command line or converted to base64. ES6 and other project configurations can be read from project.config.json .

-p, --preview <project_root>: Preview the code, project_root specifies the project root path.

--preview-qr-output [format[@path]]: Specifies the output form of the QR code. It means the same as the login option --login-qr-output.

Example:

# Preview, and print the login QR code in the terminal
cli -p /Users/username/demo
# Preview, convert the QR code to base64 and save it to the file /Users/username/code.txt
cli -p /Users/username/demo --preview-qr-output base64@/Users/username/code.txt

4. Command Line Upload Code

You must be logged in to upload your code. If you are not logged in, you will be prompted to log in first.

The information needed to upload the code includes the project root directory, version number, and optional version notes.

-u, --upload <version@project_root>: Upload the code, version specifies the version number, and project_root specifies the project root path.

--upload-desc <desc>: Notes when uploading code.

Example:

# Upload the project under /Users/username/demo, specify the version number as 1.0.0, version notes for the initial release
cli -u 1.0.0@/Users/username/demo --upload-desc 'initial release'

5. Support Automated Test

-t, --test <project_root>: Submit an automated test, project_root specifies the project root path.

Example:

# Submit the project under the test path /Users/username/demo
cli -t /Users/username/demo

个结果 ""

    没有找到相关内容 ""