Appearance
Getting started
Prerequisites
- Node.js ≥ 18
- npm (or another client compatible with
package.jsonworkspaces-style installs)
Install the package
From npm (when published):
bash
npm install cross-frameworkFor local development of this repository, clone the repo and from the repository root:
bash
npm install
npm run buildThe build step runs tsup and produces dist/, which powers both the CLI and programmatic exports.
Convert one file (CLI)
bash
npx cross-framework convert --from react --to vue ./examples/Button.tsxThis writes Button.vue next to Button.tsx (same directory). Use --out-dir <dir> to write the .vue elsewhere.
See the CLI reference for every flag.
Example in this repo
- Input:
examples/Button.tsxat the repository root. - After conversion, compare with
examples/Button.vueif you keep a reference output in your tree.
From the repo root:
bash
npm run build
npx cross-framework convert --from react --to vue ./examples/Button.tsxUse from JavaScript / TypeScript
ts
import { convertCode } from "cross-framework"
const vueCode = convertCode({
from: "react",
to: "vue",
sourceCode: reactCode,
filename: "MyComponent.tsx",
})Details: Programmatic API.
Contributors with access to the repository can run npm test from the root (builds, then runs node --test).
Published sites: documentation lives at cross-framework-doc.netlify.app; the public playground is at cross-framework.netlify.app. This VitePress site is built from the docs/ folder.
Learn what the compiler does
See Compiler features for a full inventory of parser and codegen behavior (src/parser/react.ts, src/codegen/vue.ts).
Contact
parsajiravand@gmail.com — questions, issues, or interest in joining the team. More contact options may be added later. Details: Contact.