新功能

Storybook 擴充套件,旨在讓使用者看到您的儲存庫有哪些新功能

在 Github 上查看

storybook-addon-whats-new

這是什麼?

這是一個 Storybook 擴充套件,旨在讓使用者看到您的儲存庫有哪些新功能。建議連結到您的 CHANGELOG.md 以進行自動更新,或者您可以使用更客製化的更新來管理 Markdown 檔案。

安全性政策

設定安全性政策

如何安裝?

安裝依賴項

yarn add -D storybook-addon-whats-new

Storybook 5.3 及更新版本

然後將其新增到您的 .storybook/main.js

module.exports = {
  // other configs here
  addons: ['storybook-addon-whats-new']
}

Storybook <=5.2

在 Storybook 設定目錄中編輯或建立一個名為 addons.js 的檔案 (預設為 .storybook)。將以下內容新增至其中

import 'storybook-addon-whats-new';

開始使用

本機設定

若要設定此擴充套件,您必須提供一個 whatsNewSource 參數,其中包含要顯示的 Markdown 檔案的位置

import React from "react";
import { Button } from "./Button";
import WhatsNew from './WHATS_NEW.md';

export default {
  title: "Example/Button",
  component: Button,
  parameters: {
    whatsNewSource: WhatsNew,
  },
};

全域設定

如果您想在每個 story 上顯示「新功能」面板,您可以在 .storybook/preview.js 中全域設定 (Storybook <= 5.2 的版本則是 .storybook/config.js)。若要設定此擴充套件,您必須提供一個 whatsNewSource 參數,其中包含要顯示的 Markdown 檔案的位置

import { addParameters } from '@storybook/react'; // <- or your storybook framework
import WhatsNew from './WHATS_NEW.md';

addParameters({
  whatsNewSource: WhatsNew,
});
由以下人員製作
  • kennethbigler
    kennethbigler
適用於
    Angular
    React
    Vue
標籤