Git Product home page Git Product logo

yash-solanki6803 / turborepo-flowbite-tailwind-storybook-jest Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 2.27 MB

A turborepo which has the following : 1. Tailwind CSS 2. Jest 3. Storybook 4. Flowbite-UI I have used a robust way to configure dependencies . Thus even if you aren't using these libraries . You can still use the same approach to configure your dependencies. Checkout README for full guide .

JavaScript 11.24% TypeScript 43.07% CSS 5.39% HTML 40.31%
dependencies flowbite-ui jest monorepo storybook tailwind-css turborepo-example

turborepo-flowbite-tailwind-storybook-jest's Introduction

Turborepo starter

This is an official starter Turborepo.

Using this example

Run the following command:

npx create-turbo@latest

What's inside?

This Turborepo includes the following packages/apps:

Apps and Packages

  • web: Current Web Application
  • ui: A component library used by web.
  • eslint-config-custom: eslint configurations (includes eslint-config-next and eslint-config-prettier)
  • jestconfig: jest configurations
  • tsconfig: tsconfig.jsons used throughout the monorepo
  • tailwindconfig: tailwind.config.js used throughout the monorepo

Each package/app is 100% TypeScript.

Utilities

This Turborepo has some additional tools already setup for you:

Build

To build all apps and packages, run the following command:

npm run build

Note: Building the app will also run npm build storybook

Develop

To develop all apps and packages, run the following command:

npm run dev

Note: Developing the app will also run npm run storybook

Remote Caching

Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.

By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can create one, then enter the following commands:

cd <path-to-your-turborepo>
npx turbo login

This will authenticate the Turborepo CLI with your Vercel account.

Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:

npx turbo link

Setting Up a New Dependency in TurboRepo Monorepo

This guide outlines the steps to add and configure a new dependency within a TurboRepo monorepo.

Steps

1. Install the NPM Package in the Monorepo Root

npm install <package-name>

2. Create a Config Folder

If the dependency requires a config file, create a new folder within /packages following the convention <package-name>config. For instance, jestconfig.

3. Configure the Package

Create package.json for the Config

Inside the config folder (<package-name>config), create a package.json file with the following template:

{
  "name": "<package-name>config",
  "version": "0.0.0",
  "main": "./index.ts",
  "license": "MIT"
}

Create index.ts and Config File

In the same config folder, create an index.ts file. Add the configuration code in this file, for example, jest.config.js.

4. Update Workspace Config Files

In each workspace where you want to use the config, create a config file (e.g., jest.config.js) and import the config file from the config package:

module.exports = require("jestconfig");

5. Add Scripts to Workspace Package.json

In the package.json of each workspace, add necessary scripts, for example:

"scripts": {
  "test": "jest"
}

6. Add Dependency in Workspace Package.json

In the /packages/ui/package.json and /packages/web/package.json, add the dependency for the config package:

"dependencies": {
  "jestconfig": "*"
}

7. Finalize Installation

Run the following command in the root of the monorepo:

npm install

Important Notes

For better understanding, refer to specific files within the workspace (e.g., /packages/web):

  • package.json
  • tsconfig.json
  • next.config.js
  • eslintrc.js

These files demonstrate how to import the config files into the workspace's config files.


This guide helps integrate a new dependency into a TurboRepo monorepo, providing a streamlined approach to configuring and utilizing dependencies across multiple workspaces. Adjust these steps based on specific project needs and configurations.


Feel free to adjust or expand upon this guide for your project's requirements!

Useful Links

Learn more about the power of Turborepo:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.