Skip to content

Commit e443fd0

Browse files
authored
Merge pull request #82 from storybookjs/esm-only
Prepare for Storybook 10: Output ESM-only
2 parents b31cc1b + 187b38b commit e443fd0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+6595
-7812
lines changed

.github/workflows/build.yml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,59 @@ name: Build
33
on: [push]
44

55
jobs:
6-
release:
6+
lint:
77
runs-on: ubuntu-latest
88
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
9+
strategy:
10+
matrix:
11+
node-version: [20.19, 22.12]
912
steps:
10-
- uses: actions/checkout@v4
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Install pnpm
19+
uses: pnpm/action-setup@v4
20+
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'pnpm'
26+
27+
- name: Install dependencies
28+
run: pnpm install
29+
30+
- name: Check for linter errors
31+
run: pnpm lint
32+
33+
build:
34+
runs-on: ubuntu-latest
35+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
36+
strategy:
37+
matrix:
38+
node-version: [20.19, 22.12]
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
1144

12-
- name: Prepare repository
13-
run: git fetch --unshallow --tags
45+
- name: Install pnpm
46+
uses: pnpm/action-setup@v4
1447

15-
- name: Use Node.js 20.x
48+
- name: Use Node.js ${{ matrix.node-version }}
1649
uses: actions/setup-node@v4
1750
with:
18-
node-version: 20.x
51+
node-version: ${{ matrix.node-version }}
52+
cache: 'pnpm'
1953

2054
- name: Install dependencies
21-
run: npm install --ignore-scripts
55+
run: pnpm install
2256

23-
- name: Build
24-
run: |
25-
npm run build
57+
- name: Build addon
58+
run: pnpm build
2659

2760
- name: Build Storybook
28-
run: |
29-
npm run build-storybook
61+
run: pnpm build-storybook

.github/workflows/release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@ on: [push]
55
jobs:
66
release:
77
runs-on: ubuntu-latest
8-
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
8+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci') && github.repository != 'storybookjs/addon-kit'"
99
steps:
10-
- uses: actions/checkout@v4
10+
- name: Checkout
11+
uses: actions/checkout@v4
1112

1213
- name: Prepare repository
1314
run: git fetch --unshallow --tags
1415

16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
1519
- name: Use Node.js 20.x
1620
uses: actions/setup-node@v4
1721
with:
1822
node-version: 20.x
23+
cache: 'pnpm'
1924

2025
- name: Install dependencies
21-
run: npm install --ignore-scripts
26+
run: pnpm install
2227

2328
- name: Create Release
2429
env:
2530
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2631
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2732
run: |
28-
npm run release
33+
pnpm run release

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ node_modules/
33
storybook-static/
44
build-storybook.log
55
.DS_Store
6-
.env
6+
.env
7+
.eslintcache

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
dist
2+
pnpm-lock.yaml
3+
node_modules
4+
storybook-static

.prettierrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
{}
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"arrowParens": "always",
5+
"printWidth": 120,
6+
"tabWidth": 2,
7+
"useTabs": false
8+
}

.storybook/local-preset.cjs

Lines changed: 0 additions & 15 deletions
This file was deleted.

.storybook/local-preset.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { fileURLToPath } from 'node:url';
2+
3+
/**
4+
* to load the built addon in this test Storybook
5+
*/
6+
export function previewAnnotations(entry = []) {
7+
return [...entry, fileURLToPath(import.meta.resolve('../dist/preview.js'))];
8+
}
9+
10+
export function managerEntries(entry = []) {
11+
return [...entry, fileURLToPath(import.meta.resolve('../dist/manager.js'))];
12+
}
13+
14+
export * from '../dist/preset.js';

.storybook/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { defineMain } from "@storybook/react-vite/node";
1+
import { defineMain } from '@storybook/react-vite/node';
22

33
const config = defineMain({
4-
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
5-
addons: ["@storybook/addon-docs", "./local-preset.cjs"],
6-
framework: "@storybook/react-vite",
4+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
5+
addons: ['@storybook/addon-docs', import.meta.resolve('./local-preset.ts')],
6+
framework: '@storybook/react-vite',
77
});
88

99
export default config;

.storybook/manager.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { addons } from 'storybook/manager-api';
2+
3+
import { renderLabel } from '../src/manager-helpers';
4+
5+
/*
6+
* This is an example of opt-in usage of addon exports. Your users can choose to
7+
* import and use this helper, or not. Opt-in helpers should be exported in their
8+
* own file rather than in `manager.tsx`, because importing `manager.tsx` multiple
9+
* times can cause the addon registration code to run multiple times.
10+
*/
11+
addons.setConfig({
12+
sidebar: {
13+
renderLabel,
14+
},
15+
});

.storybook/preview-head.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)