Skip to content

Commit

Permalink
Merge pull request #181 from storybookjs/experimental-support-svelte-v5
Browse files Browse the repository at this point in the history
Experimental support for Svelte 5
  • Loading branch information
JReinhold authored Jul 14, 2024
2 parents 7b9b259 + 26b0f68 commit 2577ae1
Show file tree
Hide file tree
Showing 156 changed files with 18,882 additions and 10,872 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Check

on: [push]

defaults:
run:
shell: bash

env:
CI: true

permissions:
contents: read

jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4

- name: Enable corepack (for pnpm)
# https://nodejs.org/api/corepack.html
run: corepack enable

- name: Setup Node.js
# https://github.com/actions/setup-node
uses: actions/setup-node@v4
with:
cache: pnpm
node-version-file: '.nvmrc'

- name: Install Node.js dependencies with pnpm
# https://pnpm.io/cli/install
run: >
pnpm install
--frozen-lockfile
- name: Build package
run: >
pnpm build
- name: Run svelte-check
run: >
pnpm check
50 changes: 38 additions & 12 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
name: "Chromatic"
name: Chromatic

on: push

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v3

- name: Enable corepack (for pnpm)
# https://nodejs.org/api/corepack.html
run: corepack enable

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
uses: pnpm/action-setup@v2
with:
version: 8
run_install: true
- name: Publish to Chromatic
uses: chromaui/action@v1
cache: 'pnpm'
node-version-file: '.nvmrc'

- name: Install Node.js dependencies with pnpm
# https://pnpm.io/cli/install
run: >
pnpm install
--frozen-lockfile
- name: Build package
run: >
pnpm run build
- name: Upload to Chromatic
uses: chromaui/action@v11
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
onlyChanged: true
exitOnceUploaded: true

- name: Upload "Examples" to Chromatic
uses: chromaui/action@v11
env:
EXAMPLES_ONLY: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN_EXAMPLES_ONLY }}
onlyChanged: true
exitOnceUploaded: true
28 changes: 16 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,30 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@v3

- name: Prepare repository
run: git fetch --unshallow --tags
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Set git user'
run: |
git config --global user.name 'storybook-bot'
git config --global user.email '[email protected]'
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Enable corepack (for pnpm)
# https://nodejs.org/api/corepack.html
run: corepack enable

- name: Install dependencies
uses: pnpm/action-setup@v2
- name: Use Node.js
uses: actions/setup-node@v4
with:
version: 8
run_install: true
cache: 'pnpm'
node-version-file: '.nvmrc'

- name: Install Node.js dependencies with pnpm
# https://pnpm.io/cli/install
run: >
pnpm install
--frozen-lockfile
- name: Create Release
env:
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test

on: [push]

defaults:
run:
shell: bash

env:
CI: true

permissions:
contents: read

jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4

- name: Enable corepack (for pnpm)
# https://nodejs.org/api/corepack.html
run: corepack enable

- name: Setup Node.js
# https://github.com/actions/setup-node
uses: actions/setup-node@v4
with:
cache: pnpm
node-version-file: '.nvmrc'

- name: Install Node.js dependencies with pnpm
# https://pnpm.io/cli/install
run: >
pnpm install
--frozen-lockfile
- name: Run tests with Vitest
# https://vitest.dev/guide/cli.html
run: >
pnpm vitest run
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
.vite-inspect/
.svelte-kit/
dist/
node_modules/
storybook-static/
build-storybook.log
package-lock.json
.DS_Store
.env
*.log
*.log

# .d.ts files generated by `svelte-package`
examples/**/*.d.ts
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
dist
tests/__compiled__
pnpm-lock.yaml
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

30 changes: 17 additions & 13 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import type { StorybookConfig } from '@storybook/svelte-vite';

const examplesOnly = process.env.EXAMPLES_ONLY === 'true';

const config: StorybookConfig = {
stories: [
'../**/*.mdx',
{
directory: '../examples',
files: '**/*.stories.@(ts|svelte)',
titlePrefix: examplesOnly ? undefined : 'Examples',
},
!examplesOnly && {
directory: '../tests/stories',
files: '**/*.stories.@(ts|svelte)',
titlePrefix: 'Tests',
},
].filter(Boolean) as StorybookConfig['stories'],
framework: '@storybook/svelte-vite',
stories: [{
directory: '../stories',
files:'**/*.stories.svelte',
titlePrefix:'Demo'
}],
addons: [
'../dist/preset/index.js',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
docs: {
autodocs: 'tag'
}
addons: ['../dist/preset.js', '@storybook/addon-essentials', '@storybook/addon-interactions'],
};

export default config;
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@

#### 🐛 Bug Fix

- Allow configuration of filename patterns besides *.stories.svelte [#140](https://github.com/storybookjs/addon-svelte-csf/pull/140) ([@j3rem1e](https://github.com/j3rem1e))
- Allow configuration of filename patterns besides \*.stories.svelte [#140](https://github.com/storybookjs/addon-svelte-csf/pull/140) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

Expand Down
Loading

0 comments on commit 2577ae1

Please sign in to comment.