From 4b76534cb6f0fe386211501e8d969fc4de17a24f Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Wed, 26 Oct 2022 00:31:54 +0200 Subject: [PATCH 1/5] add blocksOnly configuration to SB4SB --- code/package.json | 3 +++ code/ui/.storybook/main.ts | 33 +++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/code/package.json b/code/package.json index 9cbf11580c80..c23bcde6f74c 100644 --- a/code/package.json +++ b/code/package.json @@ -75,6 +75,9 @@ "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:chromatic", "storybook:ui": "./lib/cli/bin/index.js dev --port 6006 --config-dir ./ui/.storybook --no-manager-cache", "storybook:ui:build": "./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", diff --git a/code/ui/.storybook/main.ts b/code/ui/.storybook/main.ts index 973da3430c64..cf91a08607b5 100644 --- a/code/ui/.storybook/main.ts +++ b/code/ui/.storybook/main.ts @@ -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', From b42aa8bf65da6f98b80915b38812d3ae81aa5953 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Wed, 26 Oct 2022 13:54:18 +0200 Subject: [PATCH 2/5] add Blocks SB to CircleCI, fix project tokens --- .circleci/config.yml | 19 +++++++++++++++++++ code/package.json | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 29b3963fa0a4..69cbc6a2e27a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -299,6 +299,22 @@ jobs: yarn storybook:ui:chromatic - store_test_results: path: test-results + chromatic-storybook-blocks: + executor: + class: medium+ + name: sb_node_16_browsers + steps: + - git-shallow-clone/checkout_advanced: + clone_options: '--depth 1 --verbose' + - attach_workspace: + at: . + - run: + name: Running Chromatic + command: | + cd code + yarn storybook:blocks:chrmoatic + - store_test_results: + path: test-results ## new workflow create-sandboxes: executor: @@ -421,6 +437,9 @@ workflows: - chromatic-storybook-ui: requires: - build + - chromatic-storybook-blocks: + requires: + - build - coverage: requires: - unit-tests diff --git a/code/package.json b/code/package.json index c23bcde6f74c..8b254e2aec1b 100644 --- a/code/package.json +++ b/code/package.json @@ -77,10 +77,10 @@ "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:chromatic", + "storybook:blocks:chromatic": "BLOCKS_ONLY=true yarn storybook:ui:chromatic --project-token=${CHROMATIC_TOKEN_STORYBOOK_BLOCKS:-MISSING_PROJECT_TOKEN}", "storybook:ui": "./lib/cli/bin/index.js dev --port 6006 --config-dir ./ui/.storybook --no-manager-cache", "storybook:ui:build": "./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" From 7b3f74454f7adc49ec25825f96f713400b01dc64 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Wed, 26 Oct 2022 14:12:12 +0200 Subject: [PATCH 3/5] Fix syntax error in scripts --- code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/package.json b/code/package.json index 8b254e2aec1b..7d590cffe42b 100644 --- a/code/package.json +++ b/code/package.json @@ -80,7 +80,7 @@ "storybook:blocks:chromatic": "BLOCKS_ONLY=true yarn storybook:ui:chromatic --project-token=${CHROMATIC_TOKEN_STORYBOOK_BLOCKS:-MISSING_PROJECT_TOKEN}", "storybook:ui": "./lib/cli/bin/index.js dev --port 6006 --config-dir ./ui/.storybook --no-manager-cache", "storybook:ui:build": "./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:MISSING_PROJECT_TOKEN} --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" From 59f26edbb15b6461f4ad8952568d1f3e47fb8cec Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Wed, 26 Oct 2022 14:24:22 +0200 Subject: [PATCH 4/5] fix CircleCI typo --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 69cbc6a2e27a..2301105c9bd7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -312,7 +312,7 @@ jobs: name: Running Chromatic command: | cd code - yarn storybook:blocks:chrmoatic + yarn storybook:blocks:chromatic - store_test_results: path: test-results ## new workflow From beee5fcfd71d8194eaf9fd7cc8370f97fbbbccab Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Wed, 26 Oct 2022 23:20:27 +0200 Subject: [PATCH 5/5] merge CI jobs for Chromatic Storybooks --- .circleci/config.yml | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 69cbc6a2e27a..a75956d9c4db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -283,7 +283,7 @@ jobs: command: | cd code yarn coverage - chromatic-storybook-ui: + chromatic-internal-storybooks: executor: class: medium+ name: sb_node_16_browsers @@ -297,22 +297,7 @@ jobs: command: | cd code yarn storybook:ui:chromatic - - store_test_results: - path: test-results - chromatic-storybook-blocks: - executor: - class: medium+ - name: sb_node_16_browsers - steps: - - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' - - attach_workspace: - at: . - - run: - name: Running Chromatic - command: | - cd code - yarn storybook:blocks:chrmoatic + yarn storybook:blocks:chromatic - store_test_results: path: test-results ## new workflow @@ -434,10 +419,7 @@ workflows: - script-unit-tests: requires: - build - - chromatic-storybook-ui: - requires: - - build - - chromatic-storybook-blocks: + - chromatic-internal-storybooks: requires: - build - coverage: