
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@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
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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.