Skip to content

Commit

Permalink
Add Storybook boilerplate to design-system package (#1660)
Browse files Browse the repository at this point in the history
  • Loading branch information
kachkaev authored Dec 16, 2022
1 parent 688eaa7 commit b87989b
Show file tree
Hide file tree
Showing 29 changed files with 3,871 additions and 252 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ seed-users.json
*.tfstate.*
*.secrets.tfvars
*.pem

# Workspace-specific
/packages/hash/design-system/storybook-static
3 changes: 3 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,6 @@ seed-users.json
*.tfstate.*
*.secrets.tfvars
*.pem

# Workspace-specific
/packages/hash/design-system/storybook-static
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ seed-users.json
*.tfstate.*
*.secrets.tfvars
*.pem

# Workspace-specific
/packages/hash/design-system/storybook-static
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = (workspaceDirPath) => {
);
}

const workspaceDirPrefix = `${path
const workspaceDirPrefix = `/${path
.relative(monorepoRoot, workspaceDirPath)
.replace(/\\/g, "/")}/`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ module.exports = {
],
},
},
{
files: [".storybook/*", "**/*.stories.{j,t}s{x,}"],
rules: {
"import/no-extraneous-dependencies": [
"error",
{ devDependencies: true },
],
},
},
{
files: ["*.config.{c,m,}{j,t}s", "*.d.ts", "*rc.{c,m,}js"],
rules: {
Expand Down
16 changes: 16 additions & 0 deletions packages/hash/design-system/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
...require("@local/eslint-config/generate-workspace-config.cjs")(__dirname),
extends: [
"plugin:storybook/recommended",
"@local/eslint-config/legacy-base-eslintrc-to-refactor.cjs",
],
rules: {
...require("@local/eslint-config/temporarily-disable-rules.cjs")([
/* 2022-11-29: 14 */ "@typescript-eslint/no-unsafe-assignment",
Expand All @@ -18,5 +22,17 @@ module.exports = {
],
},
],
"storybook/no-uninstalled-addons": [
"error",
{ packageJsonLocation: `${__dirname}/package.json` },
],
},
overrides: [
{
files: ["*.stories.{j,t}s{x,}"],
rules: {
"import/no-default-export": "off",
},
},
],
};
18 changes: 18 additions & 0 deletions packages/hash/design-system/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-webpack5",
options: {},
},
core: {
disableTelemetry: true,
},
docs: {
docsPage: true,
},
};
9 changes: 9 additions & 0 deletions packages/hash/design-system/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};
6 changes: 6 additions & 0 deletions packages/hash/design-system/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
"@babel/preset-typescript",
],
};
13 changes: 13 additions & 0 deletions packages/hash/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"main": "./src/ui.ts",
"types": "./src/ui.ts",
"scripts": {
"build-storybook": "storybook build",
"fix:eslint": "eslint --fix .",
"lint:eslint": "eslint --report-unused-disable-directives .",
"lint:tsc": "tsc --noEmit",
"storybook": "storybook dev -p 6006",
"test": "jest"
},
"dependencies": {
Expand All @@ -22,11 +24,22 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@babel/preset-env": "7.20.2",
"@babel/preset-typescript": "7.18.6",
"@local/eslint-config": "0.0.0-private",
"@local/tsconfig": "0.0.0-private",
"@storybook/addon-essentials": "^7.0.0-beta.6",
"@storybook/addon-interactions": "^7.0.0-beta.6",
"@storybook/addon-links": "^7.0.0-beta.6",
"@storybook/blocks": "^7.0.0-beta.6",
"@storybook/react": "^7.0.0-beta.6",
"@storybook/react-webpack5": "^7.0.0-beta.6",
"@storybook/testing-library": "^0.0.14-next.1",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.8",
"eslint": "8.29.0",
"eslint-plugin-storybook": "0.6.8",
"storybook": "^7.0.0-beta.6",
"typescript": "4.9.4"
},
"peerDependencies": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/hash/design-system/src/stories/assets/colors.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/hash/design-system/src/stories/assets/flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/hash/design-system/src/stories/assets/plugin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b87989b

Please sign in to comment.