Skip to content

Commit

Permalink
feat(examples): update design-system (#5884)
Browse files Browse the repository at this point in the history
  • Loading branch information
tknickman committed Sep 6, 2023
1 parent fb9bec0 commit c82ec82
Show file tree
Hide file tree
Showing 38 changed files with 6,308 additions and 6,845 deletions.
10 changes: 0 additions & 10 deletions examples/design-system/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion examples/design-system/.npmrc
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*
8 changes: 4 additions & 4 deletions examples/design-system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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`.

Expand Down
3 changes: 1 addition & 2 deletions examples/design-system/apps/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
root: true,
extends: ["acme"],
extends: ["custom/storybook"],
};
39 changes: 27 additions & 12 deletions examples/design-system/apps/docs/.storybook/main.js
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;
32 changes: 17 additions & 15 deletions examples/design-system/apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "start-storybook -p 6006",
"build": "build-storybook --docs",
"dev": "storybook dev -p 6006",
"build": "storybook build --docs",
"preview-storybook": "serve storybook-static",
"clean": "rm -rf .turbo && rm -rf node_modules"
"clean": "rm -rf .turbo && rm -rf node_modules",
"lint": "eslint ./stories/*.stories.tsx"
},
"dependencies": {
"@acme/core": "workspace:0.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"ui": "workspace:*"
},
"devDependencies": {
"@acme/tsconfig": "workspace:0.0.0",
"@storybook/addon-actions": "^6.5.14",
"@storybook/addon-docs": "^6.5.14",
"@storybook/addon-essentials": "^6.5.14",
"@storybook/addon-links": "^6.5.14",
"@storybook/builder-vite": "^0.1.41",
"@storybook/react": "^6.5.14",
"@storybook/addon-actions": "^7.4.0",
"@storybook/addon-docs": "^7.4.0",
"@storybook/addon-essentials": "^7.4.0",
"@storybook/addon-links": "^7.4.0",
"@storybook/react": "^7.4.0",
"@storybook/react-vite": "^7.4.0",
"@vitejs/plugin-react": "^1.3.2",
"eslint-config-acme": "workspace:0.0.0",
"eslint-config-custom": "workspace:*",
"serve": "^13.0.4",
"typescript": "^4.9.3",
"vite": "^2.9.15"
"storybook": "^7.4.0",
"tsconfig": "workspace:*",
"typescript": "^5.2.2",
"vite": "^4.4.9"
}
}
20 changes: 0 additions & 20 deletions examples/design-system/apps/docs/stories/button.stories.mdx

This file was deleted.

46 changes: 46 additions & 0 deletions examples/design-system/apps/docs/stories/button.stories.tsx
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"]
}
6 changes: 3 additions & 3 deletions examples/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
},
"devDependencies": {
"@changesets/cli": "^2.25.2",
"eslint": "^8.29.0",
"eslint-config-acme": "workspace:0.0.0",
"prettier": "^2.8.0",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsconfig": "workspace:*",
"turbo": "latest"
},
"packageManager": "pnpm@8.6.10"
Expand Down
4 changes: 0 additions & 4 deletions examples/design-system/packages/acme-core/.eslintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions examples/design-system/packages/acme-core/src/Button.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions examples/design-system/packages/acme-core/src/index.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions examples/design-system/packages/acme-tsconfig/node16.json

This file was deleted.

4 changes: 0 additions & 4 deletions examples/design-system/packages/acme-utils/.eslintrc.js

This file was deleted.

31 changes: 0 additions & 31 deletions examples/design-system/packages/acme-utils/package.json

This file was deleted.

3 changes: 0 additions & 3 deletions examples/design-system/packages/acme-utils/src/index.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions examples/design-system/packages/acme-utils/src/toSlug.ts

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions examples/design-system/packages/acme-utils/src/usePrevious.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions examples/design-system/packages/eslint-config-acme/index.js

This file was deleted.

15 changes: 0 additions & 15 deletions examples/design-system/packages/eslint-config-acme/package.json

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.
Loading

1 comment on commit c82ec82

@vercel
Copy link

@vercel vercel bot commented on c82ec82 Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

examples-designsystem-docs – ./examples/design-system/apps/docs

examples-designsystem-docs.vercel.sh
turborepo-examples-designsystem-docs.vercel.sh
examples-designsystem-docs-git-main.vercel.sh

Please sign in to comment.