Skip to content

Commit

Permalink
add "Examples Only" version of Storybook and Chromatic
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed Jun 20, 2024
1 parent 799eb49 commit d0d95f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,18 @@ jobs:
run: >
pnpm run build
- name: Publish to Chromatic
uses: chromaui/action@v1
- name: Upload to Chromatic
uses: chromaui/action@v11
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
onlyChanged: true

- name: Upload "Examples" to Chromatic
uses: chromaui/action@v11
env:
EXAMPLES_ONLY: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN_EXAMPLES_ONLY }}
onlyChanged: true
8 changes: 5 additions & 3 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import type { StorybookConfig } from '@storybook/svelte-vite';

const examplesOnly = process.env.EXAMPLES_ONLY === 'true';

const config: StorybookConfig = {
stories: [
{
directory: '../examples',
files: '**/*.stories.@(ts|svelte)',
titlePrefix: 'Examples',
titlePrefix: examplesOnly ? undefined : 'Examples',
},
{
!examplesOnly && {
directory: '../tests/stories',
files: '**/*.stories.@(ts|svelte)',
titlePrefix: 'Tests',
},
],
].filter(Boolean) as StorybookConfig['stories'],
framework: '@storybook/svelte-vite',
addons: ['../dist/preset.js', '@storybook/addon-essentials', '@storybook/addon-interactions'],
};
Expand Down

0 comments on commit d0d95f4

Please sign in to comment.