From 588aaa0ff41aa05be98ad3170a6bf0fddb7b71a7 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Thu, 11 Apr 2024 17:46:07 +0300 Subject: [PATCH 1/4] docs: allow having Internal section with stories only visible for dev mode --- packages/core/.storybook/manager.jsx | 7 +++++++ packages/core/.storybook/preview.tsx | 1 + packages/core/package.json | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/.storybook/manager.jsx b/packages/core/.storybook/manager.jsx index 18d90f52a1..069a4bcd48 100644 --- a/packages/core/.storybook/manager.jsx +++ b/packages/core/.storybook/manager.jsx @@ -24,6 +24,13 @@ addons.setConfig({ } return {name.replace(storyStatus, "").trim()}; + }, + filters: { + patterns: filterInternalStoryDocsPage } } }); + +function filterInternalStoryDocsPage(item) { + return process.env.STORYBOOK_ENV === "development" || !item.tags?.includes?.("internal"); +} diff --git a/packages/core/.storybook/preview.tsx b/packages/core/.storybook/preview.tsx index 5323cb1a33..51f0a67a7d 100644 --- a/packages/core/.storybook/preview.tsx +++ b/packages/core/.storybook/preview.tsx @@ -97,6 +97,7 @@ const preview: Preview = { "Catalog", "Change Log", "Typography Migration Guide", + "Internal", "Foundations", "Buttons", "Inputs", diff --git a/packages/core/package.json b/packages/core/package.json index c51ccbfa14..28da577ea7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -72,7 +72,7 @@ "build:esm": "rollup -c", "build:esm:mock-classnames": "mock_classnames=on rollup -c", "build:react-icons": "svg2react-icon --typescript --keep-colors ../../node_modules/monday-ui-style/src/Icons src/components/Icon/Icons", - "storybook": "storybook dev -p 7008", + "storybook": "STORYBOOK_ENV=development storybook dev -p 7008", "build-storybook": "yarn build:storybook-exports && storybook build -o static_storybook", "deploy-storybook": "storybook-to-ghpages", "chromatic:local": "chromatic -t $CHROMATIC_PROJECT_TOKEN", From 99fa6e1bc4dc618abd105252ccdb1f8b1c8ecada Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Mon, 15 Apr 2024 10:44:40 +0300 Subject: [PATCH 2/4] docs: filter with NODE_ENV or story includes "internal" or docs page starts with "Internal" --- packages/core/.storybook/manager.jsx | 12 ++++++++---- packages/core/package.json | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/core/.storybook/manager.jsx b/packages/core/.storybook/manager.jsx index 069a4bcd48..b3959e6aff 100644 --- a/packages/core/.storybook/manager.jsx +++ b/packages/core/.storybook/manager.jsx @@ -1,8 +1,9 @@ -import { addons } from "@storybook/manager-api"; import React from "react"; +import { addons } from "@storybook/manager-api"; import { SidebarItem } from "vibe-storybook-components"; import "vibe-storybook-components/index.css"; import theme from "./theme"; +import isChromatic from "chromatic/isChromatic"; window.STORYBOOK_GA_ID = "UA-308574295"; window.STORYBOOK_REACT_GA_OPTIONS = {}; @@ -26,11 +27,14 @@ addons.setConfig({ return {name.replace(storyStatus, "").trim()}; }, filters: { - patterns: filterInternalStoryDocsPage + patterns: filterStory } } }); -function filterInternalStoryDocsPage(item) { - return process.env.STORYBOOK_ENV === "development" || !item.tags?.includes?.("internal"); +function filterStory(item) { + console.log(process.env.NODE_ENV === "development", item.title, ...item.tags, { item }); + const isDev = isChromatic() || process.env.NODE_ENV === "development"; + const isInternal = !item.tags?.includes?.("internal") && !item.title?.startsWith?.("Internal"); + return isDev || isInternal; } diff --git a/packages/core/package.json b/packages/core/package.json index 28da577ea7..c51ccbfa14 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -72,7 +72,7 @@ "build:esm": "rollup -c", "build:esm:mock-classnames": "mock_classnames=on rollup -c", "build:react-icons": "svg2react-icon --typescript --keep-colors ../../node_modules/monday-ui-style/src/Icons src/components/Icon/Icons", - "storybook": "STORYBOOK_ENV=development storybook dev -p 7008", + "storybook": "storybook dev -p 7008", "build-storybook": "yarn build:storybook-exports && storybook build -o static_storybook", "deploy-storybook": "storybook-to-ghpages", "chromatic:local": "chromatic -t $CHROMATIC_PROJECT_TOKEN", From 21dd2195d2f5e64d76564d9c9e765513f4292796 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Mon, 15 Apr 2024 10:44:56 +0300 Subject: [PATCH 3/4] docs(Catalog): filter Catalog story --- .../stand-alone-documentaion/catalog/catalog.stories.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/storybook/stand-alone-documentaion/catalog/catalog.stories.tsx b/packages/core/src/storybook/stand-alone-documentaion/catalog/catalog.stories.tsx index ce32929ce5..c0e93821f8 100644 --- a/packages/core/src/storybook/stand-alone-documentaion/catalog/catalog.stories.tsx +++ b/packages/core/src/storybook/stand-alone-documentaion/catalog/catalog.stories.tsx @@ -1,7 +1,8 @@ import { CatalogTemplate } from "./Catalog/Catalog.stories.templates"; export default { - title: "Catalog" + title: "Catalog", + tags: ["internal"] }; export const Catalog = { From 0b5c06d3d8496f8dbd707b31fcfc1e2a299debb0 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Mon, 15 Apr 2024 11:01:16 +0300 Subject: [PATCH 4/4] chore: remove console log --- packages/core/.storybook/manager.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/.storybook/manager.jsx b/packages/core/.storybook/manager.jsx index b3959e6aff..1d2cbde815 100644 --- a/packages/core/.storybook/manager.jsx +++ b/packages/core/.storybook/manager.jsx @@ -33,7 +33,6 @@ addons.setConfig({ }); function filterStory(item) { - console.log(process.env.NODE_ENV === "development", item.title, ...item.tags, { item }); const isDev = isChromatic() || process.env.NODE_ENV === "development"; const isInternal = !item.tags?.includes?.("internal") && !item.title?.startsWith?.("Internal"); return isDev || isInternal;