-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(examples): update design-system #5884
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
auto-install-peers = true | ||
node-linker=hoisted | ||
public-hoist-pattern[]=*storybook* | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,10 +42,10 @@ Using Turborepo simplifies managing your design system monorepo, as you can have | |
This Turborepo includes the following packages and applications: | ||
|
||
- `apps/docs`: Component documentation site with Storybook | ||
- `packages/@acme/core`: Core React components | ||
- `packages/@acme/utils`: Shared React utilities | ||
- `packages/@acme/tsconfig`: Shared `tsconfig.json`s used throughout the Turborepo | ||
- `packages/eslint-config-acme`: ESLint preset | ||
- `packages/ui`: Core React components | ||
- `packages/utils`: Shared React utilities | ||
- `packages/tsconfig`: Shared `tsconfig.json`s used throughout the Turborepo | ||
- `packages/eslint-config-custom`: ESLint preset | ||
Comment on lines
+45
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updating the names just to be consistent with the rest of our examples. Also utils wasn't being used at all so removed it. |
||
|
||
Each package and app is 100% [TypeScript](https://www.typescriptlang.org/). Workspaces enables us to "hoist" dependencies that are shared between packages to the root `package.json`. This means smaller `node_modules` folders and a better local dev experience. To install a dependency for the entire monorepo, use the `-w` workspaces flag with `pnpm add`. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ["acme"], | ||
extends: ["custom/storybook"], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,42 @@ | ||
const path = require("path"); | ||
import { dirname, join, resolve } from "path"; | ||
|
||
module.exports = { | ||
stories: ["../stories/**/*.stories.mdx", "../stories/**/*.stories.tsx"], | ||
addons: ["@storybook/addon-links", "@storybook/addon-essentials"], | ||
framework: "@storybook/react", | ||
core: { | ||
builder: "@storybook/builder-vite", | ||
function getAbsolutePath(value) { | ||
return dirname(require.resolve(join(value, "package.json"))); | ||
} | ||
|
||
const config = { | ||
stories: ["../stories/*.stories.tsx", "../stories/**/*.stories.tsx"], | ||
addons: [ | ||
getAbsolutePath("@storybook/addon-links"), | ||
getAbsolutePath("@storybook/addon-essentials"), | ||
getAbsolutePath("@storybook/addon-docs"), | ||
], | ||
framework: { | ||
name: getAbsolutePath("@storybook/react-vite"), | ||
options: {}, | ||
}, | ||
|
||
core: {}, | ||
|
||
async viteFinal(config, { configType }) { | ||
// customize the Vite config here | ||
return { | ||
...config, | ||
define: { "process.env": {} }, | ||
resolve: { | ||
alias: [ | ||
{ | ||
find: "@acme/core", | ||
replacement: path.resolve( | ||
__dirname, | ||
"../../../packages/acme-core/" | ||
), | ||
find: "ui", | ||
replacement: resolve(__dirname, "../../../packages/ui/"), | ||
}, | ||
], | ||
}, | ||
}; | ||
}, | ||
|
||
docs: { | ||
autodocs: true, | ||
}, | ||
}; | ||
|
||
export default config; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { Button } from "ui"; | ||
|
||
const meta: Meta<typeof Button> = { | ||
component: Button, | ||
argTypes: { | ||
type: { | ||
control: { type: "radio" }, | ||
options: ["button", "submit", "reset"], | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Button>; | ||
|
||
/* | ||
*👇 Render functions are a framework specific feature to allow you control on how the component renders. | ||
* See https://storybook.js.org/docs/react/api/csf | ||
* to learn how to use render functions. | ||
*/ | ||
export const Primary: Story = { | ||
render: (props) => ( | ||
<Button | ||
{...props} | ||
onClick={(): void => { | ||
// eslint-disable-next-line no-alert -- alert for demo | ||
alert("Hello from Turborepo!"); | ||
}} | ||
> | ||
Hello | ||
</Button> | ||
), | ||
name: "Button", | ||
args: { | ||
children: "Hello", | ||
type: "button", | ||
style: { | ||
color: "blue", | ||
border: "1px solid gray", | ||
padding: 10, | ||
borderRadius: 10, | ||
}, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"extends": "@acme/tsconfig/react-library.json", | ||
"extends": "tsconfig/react-app.json", | ||
"include": ["."], | ||
"exclude": ["dist", "build", "node_modules"] | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@turbo/eslint-config` | ||
|
||
Collection of internal eslint configurations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth it for this change alone