Gathering detailed insights and metrics for storybook-vscode-component
Gathering detailed insights and metrics for storybook-vscode-component
Gathering detailed insights and metrics for storybook-vscode-component
Gathering detailed insights and metrics for storybook-vscode-component
@storybook/addon-docs
Document component usage and properties in Markdown
@storybook/addon-controls
Interact with component inputs dynamically in the Storybook UI
@storybook/addon-interactions
Automate, test and debug user interactions
@storybook/addon-themes
Switch between multiple themes for you components in Storybook
npm install storybook-vscode-component
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
18 Stars
11 Commits
2 Forks
3 Watching
1 Branches
4 Contributors
Updated on 08 May 2024
TypeScript (99.6%)
JavaScript (0.4%)
Cumulative downloads
Total Downloads
Last day
167.4%
984
Compared to previous day
Last week
-13.4%
2,825
Compared to previous week
Last month
84.4%
13,534
Compared to previous month
Last year
250.4%
124,482
Compared to previous year
2
1
23
A simple storybook addon that opens the source file of the component directly. In local/dev, it opens vs code
and in prod deployment, it opens the file in github
repository.
Prerequistive: A working storybook setup
yarn add -D storybook-vscode-component babel-plugin-macros paths.macro
Note: We are using babel-plugin-macros
& paths.macro
for getting file paths easily. It is optional if you choose to hardcode the path of the file.
If you are using paths.macro
be sure to enable macro in .babelrc
as below:
1// .babelrc 2{ 3 "plugins": [ 4 "macros" 5 ] 6}
.storybook/addon.js
or .storybook/main.js
)1//.storybook/addon.js [deprecated] 2import 'storybook-vscode-component/register'; 3 4// or 5 6// .storybook/main.js 7module.exports = { 8 stories: [ 9 // .... 10 ], 11 addons: [ 12 '@storybook/addon-links', 13 //... 14 'storybook-vscode-component/register', 15 ], 16};
storySource
.You may set three global parameters:
Parameter | Description | |
---|---|---|
workingDir | Path of curent working/root directory | Required |
repository | Url of github repository - to open the files in github | Optional |
branch | The default branch of github repo | Optional, points to master by default |
1// .storybook/preview.js 2import { wd } from 'paths.macro'; 3 4export const parameters = { 5 storySource: { 6 repository: 'https://github.com/example/repo-name', 7 workingDir: wd || '/Usr/vilva/Desktop/project-name', 8 branch: 'branch1', 9 }, 10};
Now you can start writing your stories and pass story level or component level parameters.
There are two possible parameters:
Parameter | Description | Value |
---|---|---|
componentPath | Path of the component used in the story | Either the Absolute path of the component file or path of the file path from the root |
storyPath | Path of the story file assuming both story and component stays in same folder with naming conventions - component: Button.js and story: Button.stories.js | Either the Absolute path of the story file or path of the file path from the root |
One of the above two parameters are mandatory and without these, the addon will disappear.
1// Component level parameters 2import { Button } from './Button'; 3 4export default { 5 title: 'Example/Button', 6 component: Button, 7 parameters: { 8 storySource: { 9 componentPath: 10 '/src/Button/Button.js' || 11 '/Usr/vilva/Desktop/storybook/src/Button/Button.js', 12 }, 13 }, 14}; 15 16const Template = (args) => <Button {...args} />; 17 18export const Primary = Template.bind({}); 19 20// or 21 22storiesOf('Button', module) 23 .addParameters({ 24 storySource: { 25 componentPath: 26 '/src/Button/Button.js' || 27 '/Usr/vilva/Desktop/storybook/src/Button/Button.js', 28 }, 29 }) 30 .add('Primary', () => <Button />);
1import { Button } from './Button'; 2 3export default { 4 title: 'Example/Button', 5 component: Button, 6 parameters: { 7 storySource: { 8 componentPath: 9 '/src/Button/Button.js' || 10 '/Usr/vilva/Desktop/storybook/src/Button/Button.js', 11 }, 12 }, 13}; 14 15const Template = (args) => <Button {...args} />; 16 17export const Primary = Template.bind({}); 18 19Primary.parameters = { 20 storySource: { 21 componentPath: '/src/Button/Button.js', 22 }, 23};
storyPath
Note: This parameter should be used only when the story and corresponding component are in same folder and with same name. Assume if the component is in
src/Button/Button.js
file, and only if the story is insrc/Button/Button.stories.js
file, this parameter will work. But it works for all types of files,.js
,.ts
,.tsx
.
1import { Button } from './Button'; 2import { fileAbsolute } from 'paths.macro'; 3 4export default { 5 title: 'Example/Button', 6 component: Button, 7 parameters: { 8 storySource: { 9 componentPath: 10 '/src/Button/Button.js' || 11 '/Usr/vilva/Desktop/storybook/src/Button/Button.js', 12 }, 13 }, 14}; 15 16const Template = (args) => <Button {...args} />; 17 18export const Primary = Template.bind({}); 19 20Primary.parameters = { 21 storySource: { 22 storyPath: 23 fileAbsolute || 24 '/Usr/vilva/Desktop/storybook/src/Button/Button.stories.js' || 25 '/src/Button/Button.stories.js', 26 }, 27};
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 2/9 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More