JoshK2 / build-react-typescript-components-in-isolation

Build React TypeScript Components in Isolation from your Workspace

Home Page:https://bit.dev/joshk/build-react-typescript-components-in-isolation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ“¦ Build React Typescript components in isolated environment

bit components GitHub license

This is a demo project for building components locally in isolated environment using Bit.
You can read the post here.

πŸ‘Ύ Using Bit to virtually isolated components

  • Install and Initialize Bit: npm install bit-bin -g
  • Initialize Bit workspace: bit init
  • Track all the components: bit add src/components/*
  • Import the relevant compiler: bit import bit.envs/compilers/typescript --compiler
  • Build all the components in an isolated environment: bit build

πŸš€ Export the components to bit.dev so they can be easily shared between projects

  • Create a collection in bit.dev
  • Build and tag the tracked components: bit ag -a 1.0.0
  • Export them to the collection you just created: bit export <username>.<collection>
  • Now you can install your components in other projects and modify them locally using Bit.

🍾 Final result - components are fully reusable

You can see here the collection I created for exporting the components.

πŸ“– Read the full post to understand better this repository.
You can read the post here.

About

Build React TypeScript Components in Isolation from your Workspace

https://bit.dev/joshk/build-react-typescript-components-in-isolation

License:MIT License


Languages

Language:TypeScript 78.0%Language:HTML 15.8%Language:CSS 6.2%