Skip to content

Commit

Permalink
Added smartness to preview.js to detect github builds and prepare for…
Browse files Browse the repository at this point in the history
… pages deploy properly.
  • Loading branch information
patcon committed Oct 7, 2024
1 parent 4c127be commit 0ffbd79
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @type { import('@storybook/react').Preview } */
const isGithubBuild = !!process.env["GITHUB_REPOSITORY"]
const preview = {
parameters: {
branches: {
Expand All @@ -13,4 +14,11 @@ const preview = {
},
};

if (isGithubBuild) {
const [owner, repo] = GITHUB_REPOSITORY.split("/")
preview.parameters["branches"] = {
hostname: `${owner}.github.io/${repo}`,
}
}

export default preview;

0 comments on commit 0ffbd79

Please sign in to comment.