From 96f73ba0fbc7f3b477c3c9074115e894fc9a271a Mon Sep 17 00:00:00 2001 From: Josh Black Date: Fri, 3 May 2024 10:33:56 -0500 Subject: [PATCH] chore: add hydro analytics to storybook --- packages/react/.storybook/main.js | 16 ++++++++++++++++ script/build-docs | 3 +++ 2 files changed, 19 insertions(+) diff --git a/packages/react/.storybook/main.js b/packages/react/.storybook/main.js index a3cd97ce78b3..aba56f7dffdb 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', }, + managerHead: 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 24ab7d3c95b0..1361351850aa 100755 --- a/script/build-docs +++ b/script/build-docs @@ -2,9 +2,12 @@ set -e if [ -n "$1" ]; then + # export DEPLOY_ENV="preview" + export DEPLOY_ENV="production" 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