Skip to content

Commit f2ed940

Browse files
authored
Merge pull request #10 from storybookjs/feat/sb-10
feat: Port to Storybook 10
2 parents a6c7f84 + c0b0d84 commit f2ed940

Some content is hidden

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

44 files changed

+7454
-9745
lines changed

.babelrc.js

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

.changeset/config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "storybookjs/addon-cssresources" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch"
10+
}

.changeset/forty-horses-serve.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@storybook/addon-cssresources': major
3+
---
4+
5+
Support Storybook 10 & ESM-only
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: 'Setup Node.js and Dependencies'
2+
description: 'Sets up Node.js, caches and installs dependencies'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Setup Node.js
8+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
9+
with:
10+
node-version-file: '.nvmrc'
11+
12+
- name: Install pnpm
13+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
17+
with:
18+
node-version: 24
19+
cache: 'pnpm'
20+
21+
- name: Install dependencies
22+
shell: bash
23+
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts

.github/workflows/check.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Check
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- next
9+
10+
permissions:
11+
id-token: write # used to upload artifacts to codecov
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Install pnpm
24+
uses: pnpm/action-setup@v4
25+
26+
- name: Setup Node.js and Install Dependencies
27+
uses: ./.github/actions/setup-node-and-install
28+
29+
- name: Check for linter errors
30+
run: pnpm lint
31+
32+
build:
33+
runs-on: ubuntu-latest
34+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
35+
strategy:
36+
matrix:
37+
node-version: [20.19, 22.12]
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Install pnpm
45+
uses: pnpm/action-setup@v4
46+
47+
- name: Use Node.js ${{ matrix.node-version }}
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: ${{ matrix.node-version }}
51+
cache: 'pnpm'
52+
53+
- name: Install dependencies
54+
run: pnpm install
55+
56+
- name: Build addon
57+
run: pnpm build
58+
59+
- name: Build Storybook
60+
run: pnpm build-storybook
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish preview
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- next
9+
10+
jobs:
11+
release-preview:
12+
name: Publish preview releases
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
17+
18+
- name: Setup Node.js and Install Dependencies
19+
uses: ./.github/actions/setup-node-and-install
20+
21+
- name: Build
22+
run: pnpm build
23+
24+
- name: Publish preview releases
25+
run: pnpm pkg-pr-new publish

.github/workflows/release.yml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,46 @@
11
name: Release
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- next
48

59
jobs:
610
release:
11+
permissions:
12+
contents: write # to create release (changesets/action)
13+
pull-requests: write # to create pull request (changesets/action)
14+
id-token: write # required for provenance and oidc publish
15+
16+
# prevents this action from running on forks
17+
if: github.repository == 'storybookjs/mcp'
18+
19+
name: Release
720
runs-on: ubuntu-latest
8-
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
9-
steps:
10-
- uses: actions/checkout@v2
1121

12-
- name: Prepare repository
13-
run: git fetch --unshallow --tags
22+
steps:
23+
# see https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow
24+
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
25+
id: app-token
26+
with:
27+
app-id: ${{ vars.STORYBOOK_BOT_APP_ID }}
28+
private-key: ${{ secrets.STORYBOOK_BOT_APP_PRIVATE_KEY }}
1429

15-
- name: Use Node.js 14.x
16-
uses: actions/setup-node@v1
30+
- name: Checkout
31+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1732
with:
18-
node-version: 14.x
33+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
34+
fetch-depth: 0
1935

20-
- name: Install dependencies
21-
uses: bahmutov/npm-install@v1
36+
- name: Setup Node.js and Install Dependencies
37+
uses: ./.github/actions/setup-node-and-install
2238

23-
- name: Create Release
39+
- name: Create Release Pull Request or Publish to npm
40+
id: changesets
41+
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
42+
with:
43+
publish: pnpm release
44+
commitMode: github-api
2445
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
27-
run: |
28-
yarn release
46+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

.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

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.16.0

.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

0 commit comments

Comments
 (0)