npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

addon-confluence

v0.0.25

Published

An addon to implement Confluence documentation in StoryBook.

Downloads

1,032

Readme

Storybook Addon confluence-addon

An addon to implement Confluence documentation in Storybook.

Getting started

1. Install

npm install -D addon-confluence

yarn add -D addon-confluence

pnpm add -D addon-confluence

2. Register the addon in `.storybook/main.js"

export default {
  addons: ["addon-confluence"],
};

3. Create a token for Confluence!

Go to this link and create an API Token for your account. Then add it along with the email for your account to a .env file as so.

[email protected]
STORYBOOK_CONFLUENCE_TOKEN=YourTokenHere!

4. Add a middleware.js file to your .storybook folder, and copy this code to it

The file name must be "middleware.js". This is an undocumented method for injecting routes into the Storybook Express.js server. This step is necessary to prevent CORS issues due to the browser trying to access different origins from local host. Ensure the file name is correct, or else Storybook will not recognize it.

module.exports = require("addon-confluence");

5. Set Default Domain Globally (Optional)

You can set the default Confluence domain at the top level in your preview.(js|ts) file, so you don’t need to specify it for every story. You can still override it at the story level if needed.

const preview: Preview = {
  parameters: {
    confluence: {
      domain: "your-domain",
    },
    backgrounds: {
      default: "light",
    },
  },
};

export default preview;

6. Add it to a story!

Now, the only needed information is the unique domain name and the numeric page id. You can find these within the url while viewing the desired Confluence page.

For example: https://<YOUR_DOMAIN>.atlassian.net/wiki//pages/<YOUR_PAGE_ID>/Example_Page_Name

Then simply add "confluence" as an object to your story. And then add the domain and id as its properties:

export default {
  title: "My stories",
  component: Button,
};

export const myStory = {
  parameters: {
    confluence: {
      id: 12345,
      domain: "your-domain", // Optional if set globally
    },
  },
};

7. Injecting Environment Variables in GitHub Actions

Start by adding a new secret to your GitHub repository. Navigate to your repository on GitHub, click on the "Settings" tab, and then click on "Secrets" in the left-hand sidebar. Click on the "New repository secret" button, and add the following secrets:

  • STORYBOOK_CONFLUENCE_EMAIL: The email address associated with your Confluence account.
  • STORYBOOK_CONFLUENCE_TOKEN: The API token generated for your Confluence account.

If you are using Chromatic for deployment and need to inject environment variables into your hosted Storybook, update your .github/workflows/chromatic.yml file as follows:

.github/workflows/chromatic.yml
jobs:
  chromatic:
    steps:
      # ... other steps

      - uses: chromaui/action@latest
        with:
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
        env:
          # 👇 Sets the environment variable
          STORYBOOK_CONFLUENCE_EMAIL: ${{ secrets.STORYBOOK_CONFLUENCE_EMAIL }}
          STORYBOOK_CONFLUENCE_TOKEN: ${{ secrets.STORYBOOK_CONFLUENCE_TOKEN }}

By adding this configuration, your Storybook environment variables will be correctly injected during the Chromatic deployment process.

Example Image - Storybook - Confluence-addon