@lvgl/lvglpro 2.0.1-120-g4cb6d6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -0
- package/bin/lvglpro.js +19 -0
- package/package.json +14 -0
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# LVGL Pro CLI
|
|
2
|
+
|
|
3
|
+
The LVGL Pro CLI provides command-line access to LVGL Pro Editor workflows. It can generate C code from XML projects, compile project runtimes, validate projects, compare generated output, run XML interaction tests, and capture screenshots.
|
|
4
|
+
|
|
5
|
+
**NOTE**: The LVGL Pro CLI requires a token to operate. You can obtain the token from your [lvgl.io/pro](lvgl.io/pro) dashhboard, if your license supports it.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Generate C code from LVGL XML projects
|
|
10
|
+
- Compile editor or CLI runtimes
|
|
11
|
+
- Validate project XML and report contextual errors
|
|
12
|
+
- Compare generated output against reference directories
|
|
13
|
+
- Run one or all XML interaction tests in a headless runtime
|
|
14
|
+
- Capture screenshots from LVGL 9.5 or newer projects
|
|
15
|
+
- Keep the local LVGL resource cache synchronized with the CLI package
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
`npm install --global @lvgl/lvglpro`
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
lvglpro <command> [arguments] [options]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Use `--help` for the complete command list or `<command> --help` for command-specific options:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
lvglpro --help
|
|
31
|
+
lvglpro generate --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Authentication
|
|
35
|
+
|
|
36
|
+
Every command requires a valid LVGL license token. Pass it to an individual command with `--token`:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
lvglpro generate ./my-project --token <license-token>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Alternatively, set `LVGLPRO_CLI_TOKEN` for the current shell or CI job:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# macOS/Linux
|
|
46
|
+
export LVGLPRO_CLI_TOKEN=<license-token>
|
|
47
|
+
|
|
48
|
+
# PowerShell
|
|
49
|
+
$env:LVGLPRO_CLI_TOKEN = '<license-token>'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The `--token` value takes precedence over `LVGLPRO_CLI_TOKEN`.
|
|
53
|
+
|
|
54
|
+
## Resources
|
|
55
|
+
|
|
56
|
+
The CLI distribution includes `lvgl-resources.zip`. During normal setup, the CLI checks the cached resource hash and extracts updated resources into:
|
|
57
|
+
|
|
58
|
+
- Windows: `%APPDATA%\lvgl-editor\resources`
|
|
59
|
+
- macOS: `~/Library/Application Support/lvgl-editor/resources`
|
|
60
|
+
- Linux: `~/.config/lvgl-editor/resources`
|
|
61
|
+
|
|
62
|
+
`generate` and `compile` accept `--skip-resources` when the cache has already been prepared. This skips both the hash check and resource copy.
|
|
63
|
+
|
|
64
|
+
## Commands
|
|
65
|
+
|
|
66
|
+
### `generate <project-path>`
|
|
67
|
+
|
|
68
|
+
Generate C code from the XML project.
|
|
69
|
+
|
|
70
|
+
Options:
|
|
71
|
+
|
|
72
|
+
- `--token <license-token>`: Provide the license token for this command.
|
|
73
|
+
- `--ignore-fonts`: Skip font conversion.
|
|
74
|
+
- `--ignore-images`: Skip image conversion.
|
|
75
|
+
- `--skip-resources`: Skip checking and copying the resource cache.
|
|
76
|
+
|
|
77
|
+
### `compile <project-path>`
|
|
78
|
+
|
|
79
|
+
Compile the project runtime.
|
|
80
|
+
|
|
81
|
+
Options:
|
|
82
|
+
|
|
83
|
+
- `--target <target>`: Build `cli` or `editor` output. Defaults to `cli`.
|
|
84
|
+
- `--token <license-token>`: Provide the license token for this command.
|
|
85
|
+
- `--skip-resources`: Skip checking and copying the resource cache.
|
|
86
|
+
|
|
87
|
+
The `cli` target builds the Node runtime used by test and screenshot commands. The `editor` target builds the web runtime used by the editor.
|
|
88
|
+
|
|
89
|
+
### `validate <project-path>`
|
|
90
|
+
|
|
91
|
+
Validate the XML project and report files containing errors.
|
|
92
|
+
|
|
93
|
+
Options:
|
|
94
|
+
|
|
95
|
+
- `-l, --errorlimit <amount>`: Maximum number of errors to display. Defaults to `10`.
|
|
96
|
+
- `--token <license-token>`: Provide the license token for this command.
|
|
97
|
+
|
|
98
|
+
### `compare <first-project-path> <second-project-path>`
|
|
99
|
+
|
|
100
|
+
Recursively compare two directories and report missing, additional, or changed files.
|
|
101
|
+
|
|
102
|
+
Options:
|
|
103
|
+
|
|
104
|
+
- `--token <license-token>`: Provide the license token for this command.
|
|
105
|
+
|
|
106
|
+
### `run-test <project-path> <testing-file>`
|
|
107
|
+
|
|
108
|
+
Run one XML interaction test. `testing-file` is relative to the project directory. A CLI runtime is built automatically if the project does not already contain one.
|
|
109
|
+
|
|
110
|
+
Options:
|
|
111
|
+
|
|
112
|
+
- `--slowdown <number>`: Delay test execution for observation. `0` is fastest and is the default.
|
|
113
|
+
- `--token <license-token>`: Provide the license token for this command.
|
|
114
|
+
|
|
115
|
+
### `run-all-tests <project-path>`
|
|
116
|
+
|
|
117
|
+
Recursively run project XML files whose names start with `test` and end with `.xml`. A CLI runtime is built automatically if necessary.
|
|
118
|
+
|
|
119
|
+
Options:
|
|
120
|
+
|
|
121
|
+
- `--slowdown <number>`: Delay test execution for observation. `0` is fastest and is the default.
|
|
122
|
+
- `--token <license-token>`: Provide the license token for this command.
|
|
123
|
+
|
|
124
|
+
### `screenshot <project-path> <screen>`
|
|
125
|
+
|
|
126
|
+
Capture a PNG of the selected screen. Screenshots require LVGL 9.5 or newer. A CLI runtime is built automatically if necessary.
|
|
127
|
+
|
|
128
|
+
Options:
|
|
129
|
+
|
|
130
|
+
- `--out <out-file>`: Output path. Defaults to `<screen-name>.png` in the current directory.
|
|
131
|
+
- `--delay <delay>`: Delay capture by the given number of milliseconds. Defaults to `0`.
|
|
132
|
+
- `--token <license-token>`: Provide the license token for this command.
|
|
133
|
+
|
|
134
|
+
## Examples
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Generate code without converting fonts or images
|
|
138
|
+
lvglpro generate ./my-project --ignore-fonts --ignore-images
|
|
139
|
+
|
|
140
|
+
# Generate code using an already-prepared resource cache
|
|
141
|
+
lvglpro generate ./my-project --skip-resources
|
|
142
|
+
|
|
143
|
+
# Compile the Node runtime used by CLI tests
|
|
144
|
+
lvglpro compile ./my-project --target cli
|
|
145
|
+
|
|
146
|
+
# Compile the editor web runtime
|
|
147
|
+
lvglpro compile ./my-project --target editor
|
|
148
|
+
|
|
149
|
+
# Validate a project and display at most five errors
|
|
150
|
+
lvglpro validate ./my-project --errorlimit 5
|
|
151
|
+
|
|
152
|
+
# Compare generated output with a reference directory
|
|
153
|
+
lvglpro compare ./output ./expected
|
|
154
|
+
|
|
155
|
+
# Run one interaction test
|
|
156
|
+
lvglpro run-test ./my-project tests/test-navigation.xml --slowdown 2
|
|
157
|
+
|
|
158
|
+
# Run every interaction test
|
|
159
|
+
lvglpro run-all-tests ./my-project
|
|
160
|
+
|
|
161
|
+
# Capture a screen after a 500 ms delay
|
|
162
|
+
lvglpro screenshot ./my-project screens/main.xml --delay 500 --out ./main.png
|
|
163
|
+
```
|
package/bin/lvglpro.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Entry point for the root @lvgl/lvglpro npm package. Delegates to the prebuilt bundle published
|
|
3
|
+
// as a platform-specific optional dependency (e.g. @lvgl/lvglpro-linux-x64).
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
7
|
+
const rootPackageName = require('../package.json').name;
|
|
8
|
+
const platformPackageName = `${rootPackageName}-${platformKey}`;
|
|
9
|
+
|
|
10
|
+
let bundlePath;
|
|
11
|
+
try {
|
|
12
|
+
bundlePath = require.resolve(`${platformPackageName}/lvglpro.js`);
|
|
13
|
+
} catch {
|
|
14
|
+
console.error(`The LVGL CLI does not support this platform (${platformKey}).`);
|
|
15
|
+
console.error(`Expected optional dependency "${platformPackageName}" to be installed.`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
require(bundlePath);
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lvgl/lvglpro",
|
|
3
|
+
"version": "2.0.1-120-g4cb6d6",
|
|
4
|
+
"description": "Command-line access to LVGL Pro Editor workflows: generate C code from XML projects, compile runtimes, validate projects, and more.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"lvglpro": "bin/lvglpro.js"
|
|
8
|
+
},
|
|
9
|
+
"optionalDependencies": {
|
|
10
|
+
"@lvgl/lvglpro-win32-x64": "2.0.1-120-g4cb6d6",
|
|
11
|
+
"@lvgl/lvglpro-linux-x64": "2.0.1-120-g4cb6d6",
|
|
12
|
+
"@lvgl/lvglpro-darwin-arm64": "2.0.1-120-g4cb6d6"
|
|
13
|
+
}
|
|
14
|
+
}
|