Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add hydro analytics to storybook #4558

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/react/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
'use strict'

const {DEPLOY_ENV = 'development'} = process.env

/**
* @type {import('@storybook/core-common').StorybookConfig}
*/
Expand Down Expand Up @@ -53,4 +57,16 @@ module.exports = {
typescript: {
reactDocgen: 'react-docgen',
},
previewHead: head => {
if (DEPLOY_ENV === 'development') {
return head
}
return `${head}\n<meta name="ha-url" content="https://collector.githubapp.com/primer/collect">`
},
previewBody: body => {
if (DEPLOY_ENV === 'development') {
return body
}
return `${body}\n<script src="https://analytics.githubassets.com/hydro-marketing.min.js"></script>`
},
}
2 changes: 2 additions & 0 deletions script/build-docs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading