Skip to content

Commit 16e86ea

Browse files
authored
chore: separate stories into docs package (#3152)
1 parent bc9e300 commit 16e86ea

File tree

788 files changed

+1197
-1872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

788 files changed

+1197
-1872
lines changed

.cursor/rules/file-structures.mdc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ The `packages/core/src` directory generally contains the following:
1717
- **`utils/`**: Includes utility functions that are not specific to any single component or hook.
1818
- **`types/`**: Defines shared TypeScript types and interfaces used throughout the `@vibe/core` library.
1919
- **`constants/`**: Stores constant values used across the library.
20-
- **`storybook/`**: Contains global Storybook configurations, decorators, or providers.
2120
- **`styles/`**: Can include global styles or theme-related style files, although most component-specific styling is co-located with the component. It is preferred to not add new code to this directory.
2221
- **`index.ts`**: The main export file for the `@vibe/core` library, re-exporting key modules and components.
2322

@@ -37,8 +36,6 @@ Each component within `packages/core/src/components/` should follow a consistent
3736
- **`__tests__/`**: Contains unit and integration tests **only for the main component files** in the root directory.
3837
- Files within this directory follow the pattern `ComponentName.test.ts`.
3938
- **DO NOT** place tests for subcomponents, hooks, utils, or context in this directory.
40-
- **`__stories__/`**: Holds Storybook stories for the component.
41-
- Files are typically named `ComponentName.stories.tsx`.
4239
- **`components/`**: For more complex components, this directory can house sub-components that are only used by `ComponentName`.
4340
- **Each subcomponent should have its own `__tests__/` directory** if tests are needed.
4441
- Structure: `ComponentName/components/SubComponent/__tests__/SubComponent.test.tsx`

.cursor/rules/naming-conventions.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This document outlines the naming conventions to be followed when developing wit
4444
- **Utility Tests**: Place in `ComponentName/utils/__tests__/utilityName.test.ts`
4545
- **Context Tests**: Place in `ComponentName/context/__tests__/ComponentNameContext.test.ts`
4646
- **DO NOT** centralize all tests in the component root `__tests__` directory.
47-
- **Stories**: Storybook files SHOULD be placed in a `__stories__` subdirectory.
47+
- **Stories**: Storybook files SHOULD be placed in a `packages/docs` subdirectory.
4848
- Story files typically follow the pattern `ComponentName.stories.tsx`.
4949
- Refer to the storybook-stories.mdc file in the monorepo for Storybook specific conventions.
5050
- **Helper/Utility Files**: Utility functions or helper components specific to a single component can be placed in a `helper` or `utils` subdirectory, or directly within the component folder if small and highly specific.

.cursor/rules/storybook-stories.mdc

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
---
2-
description: "Guides the creation and modification of Storybook files specifically within the 'packages/core' package. It covers conventions, best practices, and helps answer questions about existing story implementations within 'packages/core'."
2+
description: "Guides the creation and modification of Storybook files specifically within the 'packages/docs' package. It covers conventions, best practices, and helps answer questions about existing story implementations within 'packages/core'."
33
globs:
4-
- "packages/core/**/__stories__/**/*.stories.tsx"
5-
- "packages/core/**/__stories__/**/*.mdx"
6-
- "packages/core/src/storybook/**"
4+
- "packages/docs/**/*.stories.tsx"
5+
- "packages/docs/**/*.mdx"
76
alwaysApply: false
87
---
98

10-
# Storybook Stories for @vibe/core library
9+
# Storybook Stories for @vibe/docs library
1110

12-
This document outlines the rules and best practices for creating and maintaining Storybook stories for the `@vibe/core` library.
13-
14-
**Storybook Scope:** Storybook is exclusively used for the `@vibe/core` library within this monorepo. Do not create stories for components or utilities in other packages. Stories should _only_ be written for UI components found in `packages/core/src/components/`. Stories for custom hooks (e.g., `useWizard`) are not to be created.
11+
This document outlines the rules and best practices for creating and maintaining Storybook stories for the `@vibe/docs` library.
1512

1613
## 1. File Structure and Naming Conventions
1714

18-
- **Location:** Component stories **must** be co-located with their respective component. Each component that requires stories must have a `__stories__` subdirectory.
19-
- Example: `packages/core/src/components/ComponentName/__stories__/`
20-
- **Story File:** Inside the `__stories__` directory, the main story file **must** be named after the component, using PascalCase, followed by the `.stories.tsx` extension.
21-
- Example: `packages/core/src/components/ComponentName/__stories__/ComponentName.stories.tsx`
22-
- **MDX File:** An accompanying MDX documentation file **must** also be created in the `__stories__` directory, named after the component.
23-
- Example: `packages/core/src/components/ComponentName/__stories__/ComponentName.mdx`
15+
- **Location:** Component stories are located in the `@vibe/docs` package, organized by component type in `packages/docs/src/pages/`.
16+
- Example for components: `packages/docs/src/pages/components/ComponentName/`
17+
- Example for hooks: `packages/docs/src/pages/hooks/hookName/`
18+
- **Story File:** The main story file **must** be named after the component, using PascalCase, followed by the `.stories.tsx` extension.
19+
- Example: `packages/docs/src/pages/components/ComponentName/ComponentName.stories.tsx`
20+
- **MDX File:** An accompanying MDX documentation file **must** also be created in the same directory, named after the component.
21+
- Example: `packages/docs/src/pages/components/ComponentName/ComponentName.mdx`
2422

2523
## 2. `.stories.tsx` File Structure and Content
2624

@@ -41,7 +39,7 @@ The default export defines the component's metadata for Storybook.
4139
```typescript
4240
import React from "react";
4341
import { Meta, StoryObj } from "@storybook/react";
44-
import ComponentName from "../ComponentName"; // Adjust path as necessary
42+
import { ComponentName } from "@vibe/core";
4543
// Import other Vibe components or types if needed for stories
4644

4745
export default {
@@ -252,7 +250,7 @@ The following is a template for `ComponentName.mdx`:
252250
````mdx
253251
import { Meta } from "@storybook/blocks";
254252
import * as ComponentStories from "./ComponentName.stories"; // Import the stories
255-
import ComponentName from "../ComponentName";
253+
import { ComponentName } from "@vibe/core";
256254

257255
<Meta of={ComponentStories} />
258256

.github/workflows/chromatic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
token: ${{ secrets.GITHUB_TOKEN }}
3535
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
36-
workingDir: packages/core
36+
workingDir: packages/docs
3737
exitOnceUploaded: true
3838
onlyChanged: false
3939
skip: ${{ needs.build.outputs.has_changes == 'false' }}

.github/workflows/publish-storybook.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
- name: Build & deploy Storybooks to GitHub Pages
2222
run: |
2323
yarn lerna run build --include-dependencies
24-
yarn lerna run --scope @vibe/core build-storybook
25-
cd packages/core/static_storybook
24+
yarn lerna run --scope @vibe/docs build-storybook
25+
cd packages/docs/static_storybook
2626
echo "vibe.monday.com" > ./CNAME
2727
env:
2828
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

components/button/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"scripts": {
3131
"build": "rollup -c",
3232
"test": "vitest run",
33-
"storybook": "storybook dev -p 7008",
3433
"lint": "eslint \"./src/**/*.{js,jsx,ts,tsx}\""
3534
},
3635
"dependencies": {
@@ -43,13 +42,11 @@
4342
"devDependencies": {
4443
"@testing-library/react": "^12.1.2",
4544
"@vibe/config": "3.0.2",
46-
"@vibe/icons": "1.9.0",
47-
"@vibe/storybook-config": "3.0.2",
45+
"@vibe/icons": "1.11.0",
4846
"react": "^16.13.0",
4947
"react-dom": "^16.13.0",
5048
"react-test-renderer": "16",
5149
"typescript": "^4.7.3",
52-
"vibe-storybook-components": "1.0.2",
5350
"vitest": "^1.6.0"
5451
},
5552
"peerDependencies": {

components/icon/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"scripts": {
3131
"build": "rollup -c",
3232
"test": "vitest run",
33-
"storybook": "storybook dev -p 7008",
3433
"lint": "eslint \"./src/**/*.{js,jsx,ts,tsx}\""
3534
},
3635
"dependencies": {
@@ -41,12 +40,9 @@
4140
},
4241
"devDependencies": {
4342
"@vibe/config": "3.0.2",
44-
"@vibe/icons": "1.11.0",
45-
"@vibe/storybook-config": "3.0.2",
4643
"react": "^16.13.0",
4744
"react-dom": "^16.13.0",
4845
"typescript": "^4.7.3",
49-
"vibe-storybook-components": "1.0.2",
5046
"vitest": "^1.6.0"
5147
},
5248
"peerDependencies": {

components/loader/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"scripts": {
3131
"build": "rollup -c",
3232
"test": "vitest run",
33-
"storybook": "storybook dev -p 7008",
3433
"lint": "eslint \"./src/**/*.{js,jsx,ts,tsx}\""
3534
},
3635
"dependencies": {
@@ -40,12 +39,10 @@
4039
"devDependencies": {
4140
"@testing-library/react": "^12.1.2",
4241
"@vibe/config": "3.0.2",
43-
"@vibe/storybook-config": "3.0.2",
4442
"react": "^16.13.0",
4543
"react-dom": "^16.13.0",
4644
"react-test-renderer": "16",
4745
"typescript": "^4.7.3",
48-
"vibe-storybook-components": "1.0.2",
4946
"vitest": "^1.6.0"
5047
},
5148
"peerDependencies": {

components/loader/src/Loader/__stories__/Loader.stories.tsx

Lines changed: 0 additions & 168 deletions
This file was deleted.

packages/core/package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@
8181
"build:esm": "rollup -c",
8282
"build:esm:mock-classnames": "mock_classnames=on rollup -c",
8383
"build:metadata": "tsx src/scripts/generate-metadata.ts",
84-
"storybook": "storybook dev -p 7008",
85-
"build-storybook": "storybook build -o static_storybook && node .storybook/storybook-title-fix.js static_storybook",
86-
"deploy-storybook": "storybook-to-ghpages",
87-
"chromatic:local": "chromatic -t $CHROMATIC_PROJECT_TOKEN",
8884
"link-local": "npm link && npm start",
8985
"plop": "plop",
9086
"lint": "eslint \"./src/**/*.{js,jsx,ts,tsx}\"",
@@ -134,7 +130,6 @@
134130
"@babel/preset-typescript": "^7.23.3",
135131
"@babel/standalone": "^7.24.4",
136132
"@babel/types": "^7.24.0",
137-
"@chromatic-com/storybook": "^3.2.4",
138133
"@hot-loader/react-dom": "^16.13.0",
139134
"@jest/transform": "^29.7.0",
140135
"@rollup/plugin-babel": "^6.0.2",
@@ -274,9 +269,6 @@
274269
"*.scss.js",
275270
"*.css.js"
276271
],
277-
"storybook-deployer": {
278-
"commitMessage": "Deploy Storybook [ci-skip]"
279-
},
280272
"browserslist": [
281273
"extends browserslist-config-monday"
282274
]

0 commit comments

Comments
 (0)