Skip to content

Commit

Permalink
Merge pull request #17 from tetarchus/next
Browse files Browse the repository at this point in the history
Release/1.0.0
  • Loading branch information
tetarchus authored Aug 20, 2024
2 parents 48e189b + f0d38da commit 78c63af
Show file tree
Hide file tree
Showing 57 changed files with 31,176 additions and 12,275 deletions.
12 changes: 12 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"projectName": "storybook-addon-badges",
"projectOwner": "tetarchus",
"repoType": "github",
"repoHost": "https://github.com",
"files": ["README.md"],
"imageSize": 100,
"commit": true,
"commitConvention": "angular",
"contributors": [],
"contributorsPerLine": 7
}
44 changes: 44 additions & 0 deletions .autorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"baseBranch": "main",
"plugins": [
"released",
[
"npm",
{
"canaryScope": "@auto-canary",
"exact": true
}
],
[
"all-contributors",
{
"exclude": [
"dependabot",
"renovate"
],
"types": {
"code": [
"**/docs/**/*",
"**/src/**/*",
"**/package.json",
"**/tsconfig.json"
],
"plugin": "**/plugin/**/*"
}
}
],
[
"conventional-commits",
{
"preset": "angular"
}
],
"first-time-contributor"
],
"labels": [
{
"name": "skip-ci",
"releaseType": "skip"
}
]
}
41 changes: 41 additions & 0 deletions .github/images/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
branches:
- main

jobs:
test-deploy:
name: Test Deployments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .nvmrc

- name: Install Dependencies
run: npm ci

- name: Typecheck
run: npm run tsc && npm run tsc -w docs

- name: Run Tests
run: npm run test

- name: Build Addon
run: npm run build

- name: Build Docs
run: npm run build -w docs
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy Docs to Github Pages

on:
push:
branches:
- main

jobs:
build:
name: Setup Node Modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .nvmrc

- name: Install Dependencies
run: npm ci

- name: Build Docs
run: npm run build -w docs

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
15 changes: 9 additions & 6 deletions .github/workflows/release.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
name: Release
name: Release Storybook Addon

on: [push]

jobs:
release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
if:
'!contains(github.event.head_commit.message, "ci skip") &&
!contains(github.event.head_commit.message, "skip ci")'
# TODO: Check labels?
steps:
- uses: actions/checkout@v4

- name: Prepare repository
run: git fetch --unshallow --tags

- name: Use Node.js 18.x
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
cache: npm
node-version-file: .nvmrc

- name: Install dependencies
- name: Install Dependencies
run: npm install --ignore-scripts

- name: Create Release
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules/
storybook-static/
build-storybook.log
.DS_Store
.env
.env
.vscode
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact = true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.16.0
84 changes: 82 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
[![npm version](https://badge.fury.io/js/tetarchus%2Fstorybook-addon-badges.svg)](https://www.npmjs.com/package/tetarchus/storybook-addon-badges)

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

> [!TIP]
>
> For more detailed documentation please see the
> [Docs](https://tetarchus.github.io/storybook-addon-badges).
## Installation

Expand Down Expand Up @@ -32,6 +42,76 @@ const config: StorybookConfig = {
export default config;
```

## Configuration
You can add badges globally, to a single component, or to an individual story. Simply add an array
of strings containing the badge text as a parameter to the preview file (for global badges):

```ts
// .storybook/preview.ts
// Replace `[your-framework]` with the name of your framework
import type { Preview } from '@storybook/[your-framework]';

const preview: Preview = {
//...other preview config
parameters: {
//...other parameters
badges: ['beta'],
},
};

export default preview;
```

Or at the component/story level:

```ts
// MyComponent.stories.ts
// Replace your-framework with the name of your framework
import type { Meta } from '@storybook/your-framework';

import { MyComponent } from './MyComponent';

const meta = {
title: 'Path/To/MyComponent',
component: MyComponent,
parameters: {
badges: ['beta'], // <= Add component badges here
//...other parameters
},
} satisfies Meta<typeof MyComponent>;

type Story = StoryObj<typeof meta>;

const Default: Story = {
args: {
//...component props
},
parameters: {
badges: ['beta'], // <= Add story badges here
},
};

export default meta;
export { Default };
```

> [!WARNING]
>
> Badges can currently only be read from a single set of `parameters`, so story badges overwrite
> global and component level badges, and component badges overwrite global badges.
For information about adding custom badge styles, tooltips and more, please see the
[full documentation](https://tetarchus.github.io/storybook-addon-badges)

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

`storybook-addon-badges` comes with several pre-configured badge styles that can either be extended from or overwritten.
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
18 changes: 18 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Storybook Addon Badges - Documentation Site

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

## Contributing to the documentation

Seen a mistake in the docs? Think something could be clearer? Please
[raise an issue](https://github.com/tetarchus/storybook-addon-badges/issues) or a
[pull request](https://github.com/tetarchus/storybook-addon-badges/pulls)!

To make a PR, simply fork this repo, make your changes

See the [Docusaurus Docs](https://docusaurus.io/docs/docs-introduction) for information about
writing the documentation.

## Deployments

This repo is set to automatically deploy the docs pages when changes are made after merging a PR.
Loading

0 comments on commit 78c63af

Please sign in to comment.