From 7e587b62a4c9e2eead8b6484e5de95f54727e9dd Mon Sep 17 00:00:00 2001 From: Josh Black Date: Tue, 7 May 2024 10:50:40 -0500 Subject: [PATCH] chore: add hydro analytics to storybook (#4558) * chore: add hydro analytics to storybook * chore: use previewHead over managerHead * Update build-docs --------- Co-authored-by: Josh Black --- packages/react/.storybook/main.js | 16 ++++++++++++++++ script/build-docs | 2 ++ 2 files changed, 18 insertions(+) diff --git a/packages/react/.storybook/main.js b/packages/react/.storybook/main.js index a3cd97ce78b..54d0375cb1a 100644 --- a/packages/react/.storybook/main.js +++ b/packages/react/.storybook/main.js @@ -1,3 +1,7 @@ +'use strict' + +const {DEPLOY_ENV = 'development'} = process.env + /** * @type {import('@storybook/core-common').StorybookConfig} */ @@ -53,4 +57,16 @@ module.exports = { typescript: { reactDocgen: 'react-docgen', }, + previewHead: head => { + if (DEPLOY_ENV === 'development') { + return head + } + return `${head}\n` + }, + previewBody: body => { + if (DEPLOY_ENV === 'development') { + return body + } + return `${body}\n` + }, } diff --git a/script/build-docs b/script/build-docs index 24ab7d3c95b..0d71259534d 100755 --- a/script/build-docs +++ b/script/build-docs @@ -2,9 +2,11 @@ set -e if [ -n "$1" ]; then + export DEPLOY_ENV="preview" npm run build:preview -w docs npm run build:storybook preview else + export DEPLOY_ENV="production" npm run build -w docs npm run build:storybook fi