Skip to main content

Mono-repository

The composable-ui repository is a mono-repository managed by pnpm workspaces and Turborepo. With a mono-repository, you can isolate code into manageable packages, and share the code between multiple applications.

Structure and Configurations

Composable packages

Code related to specific features of Composable UI is organized into isolated internal packages for easier maintenance, scalability and reusability of code. Packages in the /packages directory are used in both the /composable-ui and storybook applications. For example, React components defined in package /packages/ui are used in both the Composable UI Next.js application (/composable-ui) and Storybook (/storybook).

The /packages directory contains the following packages:

PackageDescription
cms-genericAn example implementation of a Content Management System.
commerce-genericAn example implementation of an ecommerce engine.
eslint-config-customThe eslint configurations, including packages/eslint-config-next and eslint-config-prettier.
stripeThe Stripe integration package.
tsconfigThe tsconfig.json files used throughout the mono-repository.
typesThe component types shared by the Next.js app and other integration packages.
uiThe packages for building UI, such asa Chakra configuration files and components.

You can import the code in a package directory. For example, you can import the code in packages/ui as @composable/ui and use it in the code directly as in the following code sample:

    import { ImageBannerProps } from '@composable/ui'
export const ImageBanner = (props: ImageBannerProps) => {
return <div>{props.image?.src}</div>
}

The following table lists the packages exported by the mono-repository:

Export codePath
@composable/cms-genericpackages/cms-generic
@composable/commerce-genericpackages/commerce-generic
@composable/eslint-config-custompackages/eslint-config-custom
@composable/stripepackages/stripe
@composable/tsconfigpackages/tsconfig
@composable/typespackages/types
@composable/uipackages/ui

The name of each package is defined in the package.json file within each package directory. For example, packages/ui/package.json defines that the package is exported as @composable/ui.

Configuration

The root files, pnpm-workspace.yaml and turbo.json contain the settings required to manage the mono-repository.

Other Configuration Files

The composable-ui repository consists of the following JavaScript tooling and developer experience configuration files:

FileDescription
.eslintrc.jsThe configuration file for ESLint, which analyzes the code and identifies potential errors, style issues, and other issues, based on a set of configurable rules. You can define the rules and configuration options for ESLint in this file.
.prettierignoreThe configuration file used by Prettier to exclude files or directories from being formatted by the extension. For more information, see the Ignoring Code page.
.prettierrcThe configuration file used by Prettier to customize the default settings to format the code. For default setting, see the Basic Configuration section.
turbo.jsonThe Configuration file for the mono-repository manager, Turborepo. For more information on the settings, see the Configuration Options page.
.vscode/extensions.jsonThe configuration file to specify the required Visual Studio Code extensions. For the list of extensions, see the Recommended Visual Studio Code Extensions section.

Building

When you make changes to any packages, remember to go back to the root directory and re-build using the following command:

pnpm build

Deployment

For information on deploying the mono-repository, see the Composable UI Readme.