Skip to content

Commit

Permalink
Merge pull request #19630 from storybookjs/jeppe/sb-867-set-up-storyb…
Browse files Browse the repository at this point in the history
…ook-that-only-contains-doc
  • Loading branch information
JReinhold authored Oct 26, 2022
2 parents c55f8fa + a40e3bf commit cf7d54b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ jobs:
command: |
cd code
yarn coverage
chromatic-storybook-ui:
chromatic-internal-storybooks:
executor:
class: medium+
name: sb_node_16_browsers
Expand All @@ -297,6 +297,7 @@ jobs:
command: |
cd code
yarn storybook:ui:chromatic
yarn storybook:blocks:chromatic
- store_test_results:
path: test-results
## new workflow
Expand Down Expand Up @@ -418,7 +419,7 @@ workflows:
- script-unit-tests:
requires:
- build
- chromatic-storybook-ui:
- chromatic-internal-storybooks:
requires:
- build
- coverage:
Expand Down
5 changes: 4 additions & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@
"publish:debug": "npm run publish:latest -- --npm-tag=debug --no-push",
"publish:latest": "lerna publish --exact --concurrency 1 --force-publish",
"publish:next": "npm run publish:latest -- --npm-tag=next",
"storybook:blocks": "BLOCKS_ONLY=true yarn storybook:ui",
"storybook:blocks:build": "BLOCKS_ONLY=true yarn storybook:ui:build",
"storybook:blocks:chromatic": "BLOCKS_ONLY=true yarn storybook:ui:chromatic --project-token=${CHROMATIC_TOKEN_STORYBOOK_BLOCKS:-MISSING_PROJECT_TOKEN}",
"storybook:ui": "NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" ./lib/cli/bin/index.js dev --port 6006 --config-dir ./ui/.storybook --no-manager-cache",
"storybook:ui:build": "NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" ./lib/cli/bin/index.js build --config-dir ./ui/.storybook",
"storybook:ui:chromatic": "yarn chromatic --build-script-name storybook:ui:build --storybook-config-dir ./ui/.storybook --storybook-base-dir ./code/ui --project-token=$CHROMATIC_TOKEN_STORYBOOK_UI --only-changed --exit-zero-on-changes --exit-once-uploaded",
"storybook:ui:chromatic": "yarn chromatic --build-script-name storybook:ui:build --storybook-config-dir ./ui/.storybook --storybook-base-dir ./code/ui --project-token=${CHROMATIC_TOKEN_STORYBOOK_UI:-MISSING_PROJECT_TOKEN} --only-changed --exit-zero-on-changes --exit-once-uploaded",
"task": "cd .. && yarn task",
"test": "NODE_OPTIONS=--max_old_space_size=4096 jest --config ./jest.config.js",
"test:cli": "npm --prefix lib/cli run test"
Expand Down
33 changes: 19 additions & 14 deletions code/ui/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import type { StorybookConfig } from '../../frameworks/react-vite/dist';

const isBlocksOnly = process.env.BLOCKS_ONLY === 'true';

const allStories = [
{
directory: '../manager/src',
titlePrefix: '@storybook-ui',
},
{
directory: '../components/src',
titlePrefix: '@storybook-components',
},
{
directory: '../blocks/src',
titlePrefix: '@storybook-blocks',
},
];
const blocksOnlyStories = ['../blocks/src/**/*.stories.@(js|jsx|ts|tsx|mdx)'];

const config: StorybookConfig = {
stories: [
{
directory: '../manager/src',
titlePrefix: '@storybook-ui',
},
{
directory: '../components/src',
titlePrefix: '@storybook-components',
},
{
directory: '../blocks/src',
titlePrefix: '@storybook-blocks',
},
],
stories: isBlocksOnly ? blocksOnlyStories : allStories,
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
Expand Down

0 comments on commit cf7d54b

Please sign in to comment.