Skip to content

Getting started

Prerequisites

  • Node.js ≥ 18
  • npm (or another client compatible with package.json workspaces-style installs)

Install the package

From npm (when published):

bash
npm install cross-framework

For local development of this repository, clone the repo and from the repository root:

bash
npm install
npm run build

The 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.tsx

This 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.tsx at the repository root.
  • After conversion, compare with examples/Button.vue if 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.tsx

Use 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.

Questions? parsajiravand@gmail.com · MIT License · BRANDING.md for name / fork policy · https://cross-framework.netlify.app/ · https://cross-framework-doc.netlify.app/