Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@splice/addon-storybook-preview-branch
Advanced tools
This module is a Storybook addon for presenting and modifying the current Preview Branch of Storybook being viewed.
The UI is a text input in the Storybook toolbar which contains the name of the branch currently being viewed.
To change the branch you enter the branch you want into the input and press return. When Storybook reloads your target branch of Storybook will be what is presented.
This addons depends on some infrastructure to allow for different branches to be served.
master
staging
<username>/feature-name
branch
cookie (not an HTTP-Only cookie!). If the cookie is not set it should use the default branch (likely master
).Cache-Control: no-cache
to ensure the target branch content is served whenever the value of the branch
cookie changes.storybook.example.com
). The bucket is configured to operate as a static web server.master
branch) and uploads it to a folder in the bucket named after the branch (ie, storybook.example.com/dandean/8786/my-feature
)storybook.example.com
and proxies them to S3. Before the requests are proxied nginx looks for the cooke and rewrites the request to the target directory in the bucket. Our nginx config looks something like this:location / {
# Disable HTTP Caching
expires -1;
# If the branch query param exists (ex: ?branch=<branch>) then pass
# that value into a cookie and redirect to the bare hostname:
if ($arg_branch) {
add_header Set-Cookie "branch=$arg_branch; Path=/" always;
return 302 $scheme://$host;
}
# If cookie named branch is not set, use `master`...
if ($cookie_branch = "") {
# If found, use value to prefix URL and rewrite:
rewrite (.*) /master$1 break;
}
# ...if cookie named "branch" set, use it...
if ($cookie_branch) {
# If found, use value to prefix URL and rewrite:
rewrite (.*) /$cookie_branch$1 break;
}
# Proxy all requests to the static host.
proxy_pass http://storybook.example.com.s3-website-us-west-1.amazonaws.com;
}
With this infrastructure in place this addon reads the cookie and reflects its value into the input. When the form is submitted the cookie is updated, the page is refreshed, and the proxy serves the new target branch.
npm install
.npm run build:watch
.npm link
to expose your local build to your local Storybook.npm link @splice/addon-storybook-preview-branch
to pull in your local dev build.package.json
and run npm publish
.FAQs
Unknown package
We found that @splice/addon-storybook-preview-branch 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.