Skip to content

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 .

Notifications You must be signed in to change notification settings

Yash-Solanki6803/Turborepo-Flowbite-Tailwind-Storybook-Jest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

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 .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published