Write components once, run everywhere. Compiles to React, Vue, Qwik, Solid, Angular, Svelte, and more.
Write components once, compile to every framework
Mitosis provides a unified development experience across all frameworks, enabling you to build components in a single codebase and compile them to React, Vue, Angular, Svelte, Solid, Alpine, Qwik, and more.
Using Mitosis, you can:
PS: We are actively looking for folks interested in becoming contributors to Mitosis. If interested, look at our list of good first issues or reach out on our Discord
To create a new Mitosis project from scratch, run the following create command:
npm create @builder.io/mitosis@latest
Once completed, make sure to read the README.md generated in your new project. It will explain the structure of your project, and provide a walkthrough on how to build/test your components.
Read the full getting started docs for more.
To make generating Mitosis components easier, as well as to keep your design system in code in sync with your design system in Figma, Mitosis integrates with Figma.
Learn more about our Figma integration.
Interested in contribute? Head over to the CONTRIBUTING docs and see how you can get setup & started!
Once you're ready, checkout our issues page and grab your first issue!
@builder.io/mitosis requires @babel/parser, @babel/types, and @babel/traverse without declaring them in dependencies
https://github.com/BuilderIO/mitosis/issues/1822
Labels: 없음
json plugins that return a new component are ignored by the next plugin
https://github.com/BuilderIO/mitosis/issues/1817
Labels: 없음
Welcome ⚡️!! If you've found a bug, or have an idea to add a feature we'd love to hear from you. It may save time to first ping the group on Mitosis' Discord channel to talk through any ideas or any issues that may be a bug.
Mitosis is structured as a mono-repo using Yarn (v3) Workspaces and Nx. The packages
live under packages/ and examples/:
core (@builder.io/mitosis): contains the Mitosis enginecli (@builder.io/mitosis-cli): contains the Mitosis CLI, and depends on coresite: contains the Mitosis site hosted at mitosis.builder.ioeslint-plugin (@builder.io/eslint-plugin-mitosis): contains the Mitosis eslint rules to enforce valid Mitosis component syntax. Yet to be released.First, you should run yarn in the root of the project to install all the dependencies.
For all packages, the below steps to develop locally are the same:
# run local development server
yarn start
# run unit tests
yarn test
We need your help! If you found a bug, it's best to create an issue and follow the template we've created for you. Afterwards, create a Pull Request that replicates the issue using a test.
In core, we use vitest snapshots & integration tests for test coverage. If you are solving a problem that is reproducible by a fiddle in mitosis.builder.io/playground, we highly recommend the following flow:
packages/core/src/__tests__/data. See packages/core/src/tests/data/basic.raw.tsx as an example.BASIC_TESTS.yarn g:nx test:watch in the packages/core directory to run the snapshot tests in watch modePS: don't worry about failing imports in the raw test TSX files. These are not an issue, since the files are standalone and don't actually belong to a cohesive project.
.lite.tsx Mitosis component in the e2e app<Show when={state.pathToUse.startsWith('/your-component-path')}>yarn ci:build to build all packagesyarn ci:e2e to run the integration tests against all serversIf you want to create a new project inside e2e. You should name the folder e2e-XXX where XXX should be replaced with the target.
Make sure that you change the name inside package.json of this project to @builder.io/e2e-XXX. Additionally, you need to add private: true to package.json to avoid publishing the project.
From there, you can keep iterating until the snapshots look as expected, and the integration tests pass!
Before submitting your PR, please make sure to format the codebase and update all snapshots:
yarn fmt:prettier.yarn test:update. This will run a Nx command that will update all the snapshots in the core and cli packages. while making sure all required dependencies are built beforehand. If there are some difference between the generated snapshots in your local environment and GitHub Action you are able to download the correct snapshots via 'Summary' in the pipeline run. Wait until the job test-update is done, scroll to the bottom and download snapshots-updates. You should be able to copy&past the snapshots to packages/core/src/__tests__/__snapshots__.yarn g:changeset and follow the CLI instructions.Here's the changeset format we like to follow (this is mostly relvant for the core package):
[GENERATORS_IMPACTED] TYPE: DESCRIPTION
Examples:
[React,Vue,Solid] Bug: Fix style bindings not applying.
[Angular] Feature: Add support for ngFor bindings.
[All] Feature: store state types.