-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: New documentation for Monorepo
- Loading branch information
Showing
16 changed files
with
145 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ import brands from 'websites/data/brands' | |
--- | ||
|
||
## Features | ||
### Syntax Highlighting | ||
🚧 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Props } from 'websites/types/Props' | ||
import create from '~/og-image' | ||
import metadata from './metadata' | ||
import type { AbsoluteTemplateString } from 'next/dist/lib/metadata/types/metadata-types' | ||
|
||
export const alt = (metadata.title as AbsoluteTemplateString)?.absolute || metadata.title as string | ||
export const contentType = 'image/jpg' | ||
export const runtime = 'nodejs' | ||
|
||
export default (props: Props) => create({ | ||
props, | ||
metadata | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
## Foreword [sr-only] | ||
The Master CSS [Language Server](/reference/language-server) and [ESLint plugin](/reference/eslint) both support the monorepo development strategy. | ||
|
||
By default, the language server will form independent workspaces based on the location of the __master.css.*__ configuration files, independent of the package manager's workspace. The same goes for ESLint, which forms a new working directory based on the location of its configuration file. | ||
|
||
Officially integrated packages or extensions will automatically read the __master.css.*__ configuration based on the current running directory. This means that you can start using it with zero configuration as long as you create a configuration file in the workspace. | ||
|
||
--- | ||
|
||
## One root master.css.js | ||
Whether it's a single repository or a monorepo, create a __master.css.js__ file in the root directory for your design system. | ||
```treeview | ||
🗂️ src | ||
📄 eslint.config.js | ||
📄 master.css.js | ||
``` | ||
The language service will create at least a root workspace regardless of whether `master.css.*` exists. | ||
|
||
--- | ||
|
||
## One master.css.js per microservice | ||
When there are different design systems or complex requirements in a monorepo, you may need to create __master.css.js__ and __eslint.config.js__ for multiple folders. | ||
|
||
(i) This will create two workspaces, `/` and `/apps/a`. | ||
```treeview | ||
🗂️ apps | ||
|-- 🗂️ a | ||
| |-- 📄 eslint.config.js | ||
| `-- 📄 master.css.js | ||
`-- 🗂️ b | ||
📄 eslint.config.js | ||
📄 master.css.js | ||
``` | ||
Note that `/apps/b` will be considered part of the root workspace `/`. | ||
|
||
### Shared the configuration | ||
In each workspace, you need to export the common root configuration. | ||
```ts name=apps/a/master.css.js | ||
export { default } from '../../master.css' | ||
``` | ||
Or extend it and add workspace-specific customization options. | ||
```ts name=apps/a/master.css.js | ||
import common from '../../master.css' | ||
|
||
export default { | ||
extends: [ | ||
common | ||
], | ||
... | ||
} | ||
``` | ||
Regardless of whether there is a specific workspace configuration, exporting the configuration is necessary when the workspace exists in __eslint.config.js__. | ||
|
||
(x) Forgot to create __/apps/a/master.css.js__ in the workspace and export the root configuration. | ||
```treeview | ||
🗂️ apps | ||
|-- 🗂️ a | ||
| |-- 📄 eslint.config.js | ||
-| `-- 📄 master.css.js | ||
`-- 🗂️ b | ||
📄 eslint.config.js | ||
📄 master.css.js | ||
``` | ||
Unless this workspace is not using Master CSS, this is a common oversight. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Metadata } from 'websites/types/Metadata' | ||
|
||
const metadata: Metadata = { | ||
title: 'Monorepo', | ||
description: 'A guide to setting up Master CSS in a modern repository.', | ||
category: 'Development Strategy' | ||
} | ||
|
||
export default metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Layout from '~/layouts/doc' | ||
import pageCategories from '~/data/guide-categories.json' | ||
import metadata from './metadata' | ||
/* @ts-expect-error toc */ | ||
import Content, { toc } from './content.mdx' | ||
import { generate } from '~/utils/metadata' | ||
|
||
export const dynamic = 'force-static' | ||
export const revalidate = false | ||
|
||
export async function generateMetadata(props: any, parent: any) { | ||
return await generate(metadata, props, parent) | ||
} | ||
|
||
export default async function Page(props: any) { | ||
return ( | ||
<Layout {...props} pageCategories={pageCategories} pageDirname={__dirname} metadata={metadata} toc={toc} > | ||
<Content /> | ||
</Layout > | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters