Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 2.09 KB

File metadata and controls

20 lines (16 loc) · 2.09 KB

@miden-sdk/create-miden-para-react

npm create @miden-sdk/miden-para-react@latest my-app scaffolds the latest Vite react-ts starter, overwrites it with this repo's vite.config.ts, swaps in a Para + Miden-ready App.tsx, and adds the deps needed to run it out of the box. The scaffold always runs create-vite with --yes --no-install and pipes "no" to the install prompt to prevent upstream installs from overwriting the template before we patch it.

What it does

  • Runs npm create vite@latest <target> -- --template react-ts so you always start from the upstream default.
  • Replaces vite.config.ts with the Para + Miden-friendly config (dedupe/exclude and WASM asset handling).
  • Replaces src/App.tsx with a ParaSignerProvider + MidenProvider starter that reports wallet, account ID, and client readiness.
  • Adds Para/Miden deps: @miden-sdk/miden-para, @miden-sdk/react, @getpara/react-sdk-lite, @getpara/evm-wallet-connectors, @miden-sdk/miden-sdk, plus dev plugins vite-plugin-node-polyfills, vite-plugin-wasm, and vite-plugin-top-level-await.
  • Installs dependencies using your detected package manager (pnpm, yarn, bun, or falls back to npm); create-vite is invoked with --yes --no-install and auto-answers "no" to install prompts to avoid reverting the patched files.
  • Writes .npmrc with legacy-peer-deps=true for peer dependency resolution.
  • Adds src/polyfills.ts and injects it into src/main.tsx to provide Buffer/process in the browser.

Usage

  • Standard: npm create @miden-sdk/miden-para-react@latest my-new-app
  • Skip install: add --skip-install if you want to install later.
  • Set VITE_PARA_API_KEY in a .env.local (or similar) file so the generated App.tsx can initialize Para. Production deployments require a Para production API key.
  • Recommended next steps: cd my-new-app && npm install && npm run dev (.npmrc opts into legacy peer deps so npm works).

Publish from this folder with npm publish --access public when you're ready. For local testing, run node ./packages/create-miden-para-react/bin/create-miden-para-react.mjs my-app.