(English/中文)
LCUI CLI is command line interface for rapid LCUI development. providing:
- Project scaffolding.
- A compiler similar to Webpack that can load specific types of files and compile them into C code using a loader. The following loaders exist:
- ts-loader: Load JavaScript and TypeScript files, supporting JSX syntax. You can write LCUI widgets like you would write React components.
- css-loader: Load CSS files, supporting the CSS Modules.
- sass-loader: Load the Sass/SCSS file and compile it into CSS.
- json-loader: Load JSON files, allowing you to describe the interface in JSON format.
- xml-loader: Load an XML file, allowing you to describe the interface in XML format.
- yaml-loader: Load YAML files, allowing you to describe the interface in YAML format.
Before installing this tool, you need to install these dependencies on your computer:
Afterwards, run:
npm install -g @lcui/cli
# Or
yarn global add @lcui/cliCreate an LCUI application project:
lcui create my-projectCompile all files in the src directory:
lcui buildCompile a single file:
lcui build app/page.tsxlcui build is incremental by default. A build manifest is persisted at
.lcui/build/manifest.json and tracks, for every source file:
- A
sha256of the source file content - The loader chain and options that produced it
- The list of dependencies that the loaders read (imports,
@use/@importpartials,postcss.config.js,tailwind.config.js, …) - The list of output files (
.mjsmodules,.c/.hfor components, resources copied intodist/) together with theirsha256
On the next build a file is rebuilt only when its source hash, its dependency hashes or its output hashes do not match the manifest. Everything else is skipped — its outputs are reused as-is.
In addition every write goes through writeIfChanged: if the new bytes are
identical to the existing file we do not touch it, so downstream tools that
rely on mtime (most notably xmake) will not see spurious changes and will
not trigger a full C rebuild.
Available options:
--force— ignore the manifest and rebuild everything. Useful if you suspect the cache is stale, or after editing files that the dependency tracker cannot see.--skip-xmake— do not invokexmakeafter compilation, even ifxmake.luaexists.
The manifest is automatically invalidated when:
@lcui/cliis upgraded- The compiler configuration changes
tsconfig.json,postcss.config.*,tailwind.config.*orlcui.config.jschange