Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@greenberry/storybook-template
Advanced tools
This is a template project. To use this in a new project follow the instructions in first steps.
name
property package.json
to reflect your project. Ensure it begins with @greenberry
to make it privateupstream
so you can rebase for updates
git remote add upstream git@bitbucket.org:greenberrynl/storybook.git
git fetch upstream master
src/
constants/
myConstants.js <-- Global constants are used in multiple places or exposed to the world
components/
MyComponent/
index.js <-- The component
index.story.js <-- The component's story
index.spec.js <-- (Optional) Component unit tests
utils.js <-- (Optional) Local utils are only used by this component
utils.spec.js <-- Tests of local utils
constants.js <-- (Optional) Local constants
assets/ <-- Assets and resources used by the component can be put here
image.svg
utils/ <-- Global utils are used by multiple components
myUtil/
index.js <-- The util
index.spec.js <-- The util tests
constants.js <-- (Optional) Local constants
Example
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { text } from '@storybook/addon-knobs';
import Button from './index';
storiesOf('UI|Button', module)
.addParameters({ options: { selectedPanel: 'storybook/actions/panel' } })
.add(
'with text',
() => <Button onClick={action('onClick')}>Hello Button</Button>,
{ info: 'Describe your components usage here' }
)
For running test we use Jest a test running framework created by Facebook. By using "Storyshots" we are able to automatically generate snapshots for each story. This means that all the cases/states visualised inside Storybook are automatically tests and verified.
For learning more about Jest consult their documentation
Running tests
yarn test
Update outdated snapshots
yarn test -u
To use the latest changes we will need to publish the a new version to the NPM registry for this we will use Yarn.
yarn publish
When running the publish
command a "hook" will be fired triggering the prepublish
command configured in the package.json
.
This will prompt you to specify a new version. For versioning we use Semver.
So given a version number MAJOR.MINOR.PATCH
(1.0.0
), increment the:
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
When you are not signed in to NPM yet, you will be prompted to sign in after which it will start uploading the package.
By default, Storybook comes with a way to list stories and visualize them. Addons implement extra features for Storybooks to make them more useful. Addons in this project;
FAQs
Template project for component libraries
The npm package @greenberry/storybook-template receives a total of 8 weekly downloads. As such, @greenberry/storybook-template popularity was classified as not popular.
We found that @greenberry/storybook-template demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.