Repository navigation
feat: add Storybook for Desktop renderer components #1708
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
Open
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9f3c74e
feat(storybook): add a Storybook runtime for renderer components
benceruleanlu 749ffb9
test(storybook): exercise BaseSelect in a real browser
benceruleanlu 420b639
ci(storybook): build the preview and run story tests on every PR
benceruleanlu 5e4c8c7
fix(storybook): keep BaseSelect's Docs examples and Controls working
benceruleanlu 7a204dd
ci(storybook): report the checked-out merge's real parents
benceruleanlu a53e327
ci(storybook): run the Storybook job on the CI Node version
benceruleanlu df370ae
ci(storybook): set up Node from .nvmrc
benceruleanlu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,3 +43,6 @@ docs/telemetry.md | |
| __pycache__/ | ||
| *.pyc | ||
| coverage/ | ||
|
|
||
| # Static Storybook output | ||
| storybook-static/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { resolve } from 'node:path' | ||
| import tailwindcss from '@tailwindcss/vite' | ||
| import vue from '@vitejs/plugin-vue' | ||
| import type { StorybookConfig } from '@storybook/vue3-vite' | ||
| import { mergeConfig } from 'vite' | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: ['../stories/**/*.stories.ts'], | ||
| staticDirs: [{ from: '../src/renderer/public/images', to: '/images' }], | ||
| addons: ['@storybook/addon-docs', '@storybook/addon-vitest'], | ||
| framework: { | ||
| name: '@storybook/vue3-vite', | ||
| // The default vue-docgen-api is deprecated, and vue-component-meta's HMR hook throws when a | ||
| // story edit updates the virtual stories module. | ||
| options: { docgen: false } | ||
| }, | ||
| core: { disableTelemetry: true }, | ||
| async viteFinal(config) { | ||
| return mergeConfig(config, { | ||
| resolve: { | ||
| alias: { | ||
| '@renderer': resolve(import.meta.dirname, '../src/renderer/src'), | ||
| '@locales': resolve(import.meta.dirname, '../locales') | ||
| } | ||
| }, | ||
| plugins: [vue(), tailwindcss()] | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| export default config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { createPinia, disposePinia } from 'pinia' | ||
| import { nextTick, type App } from 'vue' | ||
| import { setup, type Preview } from '@storybook/vue3-vite' | ||
| import { createAppI18n } from '../src/renderer/src/lib/i18nFactory' | ||
| import '../src/renderer/src/assets/main.css' | ||
|
|
||
| function installPlugins(app: App): void { | ||
| const pinia = createPinia() | ||
| app.use(pinia) | ||
| // Pinia outlives its app, so stores would keep their subscriptions (to preload events, say). | ||
| // onUnmount runs before the tree unmounts; wait so components' unmount hooks can still use stores. | ||
| app.onUnmount(() => void nextTick(() => disposePinia(pinia))) | ||
| // Not the panel's shared instance: vue-i18n disposes an installed instance when its app unmounts. | ||
| app.use(createAppI18n()) | ||
| } | ||
|
|
||
| setup(installPlugins) | ||
| // Storybook keeps setup callbacks for the page's lifetime and cannot drop one, so a hot | ||
| // update of this file would install Pinia and vue-i18n twice; reload the preview instead. | ||
| import.meta.hot?.dispose(() => location.reload()) | ||
|
|
||
| const preview: Preview = { | ||
| parameters: { | ||
| layout: 'fullscreen', | ||
| // Popovers and takeover screens teleport to body. On the generated Docs page, | ||
| // separate iframes run each story's play function and isolate its stores and | ||
| // any preload API sample; `docs.story.autoplay` applies only to inline stories. | ||
| docs: { story: { inline: false, height: '800px' } } | ||
| }, | ||
| beforeEach() { | ||
| document.documentElement.dataset.theme = 'dark' | ||
| } | ||
| } | ||
|
|
||
| export default preview |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🛡️ Detected with Advanced Tier | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
sed -n '1,155p' .github/workflows/ci.ymlRepository: Comfy-Org/Comfy-Desktop
Length of output: 5435
🌐 Web query:
official actions/checkout v7 persist-credentials default local git config documentation💡 Result:
Security Misconfiguration
Reachability: External
Exploitability: Moderate
CWE: CWE-522 — Insufficiently Protected Credentials
View Security blast radius
Disable checkout credential persistence in the Storybook job.
actions/checkout@v7persists credentials by default. It stores the credential in a runner temporary file and configures Git to use it; it is not written directly to.git/config. Thepull_requestjob then runs PR-controlled dependency installation and the Storybook build with authenticated Git available. The job's later Git commands only read local objects, so no authenticated Git operation needs this credential.Proposed fix
- name: Checkout uses: actions/checkout@v7 + with: + persist-credentials: false📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.30.1)
[warning] 85-88: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 86-86: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents