Appearance
CLI
The cross-framework binary (also exposed as cross-ui) is implemented in src/index.ts at the repository root.
Command
bash
cross-framework convert <input> [options]npx cross-framework works without a global install.
Options
| Option | Default | Description |
|---|---|---|
--from <framework> | react | Source framework. Only react is supported. |
--to <framework> | vue | Target framework. Only vue is supported. |
--out-dir <dir> | (same as input file) | Directory for the output .vue file. |
Short form for --out-dir follows cac conventions: --out-dir (with a hyphen) is what the CLI reads; the implementation also accepts outDir when calling programmatically.
Output path
From src/convert.ts:
- The output filename is
<basename>.vue, wherebasenameis the input file name without.tsx,.ts,.jsx, or.js(soFoo.tsx→Foo.vue, notFoo.tsx.vue). - If
--out-diris omitted, the output directory is the directory containing the input file. - The output directory is created with
mkdirSync(..., { recursive: true }).
Success output
On success the CLI prints:
text
Wrote <absolute-or-resolved-path>Errors
- If
from/toare not the supported pair,convert()throws:"Only --from react --to vue is supported in this version."
- The CLI catches errors, prints the message to stderr, and exits with code 1.
Examples
bash
# Default: write Button.vue next to Button.tsx
npx cross-framework convert ./src/Button.tsx
# Explicit framework flags (same defaults)
npx cross-framework convert ./src/Button.tsx --from react --to vue
# Write to a build folder
npx cross-framework convert ./src/Button.tsx --out-dir ./out/vue