Skip to content

Commit

Permalink
Merge branch 'next' into feature/portable-stories-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Mar 5, 2024
2 parents 6933131 + b314219 commit 9b9d6be
Show file tree
Hide file tree
Showing 133 changed files with 1,304 additions and 686 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -759,30 +759,30 @@ workflows:
requires:
- build
- create-sandboxes:
parallelism: 34
parallelism: 35
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 34
parallelism: 35
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 31
parallelism: 32
requires:
- build-sandboxes
- e2e-production:
parallelism: 29
parallelism: 30
requires:
- build-sandboxes
- e2e-dev:
parallelism: 2
requires:
- create-sandboxes
- test-runner-production:
parallelism: 29
parallelism: 30
requires:
- build-sandboxes
- test-portable-stories:
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/generate-sandboxes-main.yml

This file was deleted.

60 changes: 0 additions & 60 deletions .github/workflows/generate-sandboxes-next.yml

This file was deleted.

127 changes: 127 additions & 0 deletions .github/workflows/generate-sandboxes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Generate and publish sandboxes

on:
schedule:
- cron: "2 2 */1 * *"
workflow_dispatch:
# To test fixes on push rather than wait for the scheduling, do the following:
# 1. Uncomment the lines below and add your branch.
# push:
# branches:
# - <your-branch-name>
# 2. Change the "ref" value to <your-branch-name> in the actions/checkout step below.
# 3. Comment out the whole "generate-main" job starting at line 77
# 4. 👉 DON'T FORGET TO UNDO THE STEPS BEFORE YOU MERGE YOUR CHANGES!

env:
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
CLEANUP_SANDBOX_NODE_MODULES: "true"

defaults:
run:
working-directory: ./code

jobs:
generate-next:
name: Generate to next
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: next

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

- name: Setup git user
run: |
git config --global user.name "storybook-bot"
git config --global user.email "32066757+storybook-bot@users.noreply.github.com"
- name: Install dependencies
working-directory: ./scripts
run: node --experimental-modules ./check-dependencies.js

- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link

- name: Publish to local registry
run: yarn local-registry --publish

- name: Run local registry
run: yarn local-registry --open &

- name: Wait for registry
run: yarn wait-on tcp:127.0.0.1:6001

- name: Generate
id: generate
run: yarn generate-sandboxes --local-registry

- name: Publish
# publish sandboxes even if the generation fails, as some sandboxes might have been generated successfully
if: ${{ !cancelled() }}
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT }}@github.com/storybookjs/sandboxes.git --push --branch=next

- name: Report failure to Discord
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: |
The generation of some or all sandboxes on the **next** branch has failed.
[See the job summary for details](/~https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
generate-main:
name: Generate to main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main

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

- name: Setup git user
run: |
git config --global user.name "storybook-bot"
git config --global user.email "32066757+storybook-bot@users.noreply.github.com"
- name: Install dependencies
working-directory: ./scripts
run: node --experimental-modules ./check-dependencies.js

- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link

- name: Publish to local registry
run: yarn local-registry --publish

- name: Run local registry
run: yarn local-registry --open &

- name: Wait for registry
run: yarn wait-on tcp:127.0.0.1:6001

- name: Generate
id: generate
run: yarn generate-sandboxes --local-registry

- name: Publish
# publish sandboxes even if the generation fails, as some sandboxes might have been generated successfully
if: ${{ !cancelled() }}
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT }}@github.com/storybookjs/sandboxes.git --push --branch=main

- name: Report failure to Discord
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: |
The generation of some or all sandboxes on the **main** branch has failed.
[See the job summary for details](/~https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
16 changes: 16 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 8.0.0-rc.2

- CLI: Add @storybook/addons automigration - [#26295](/~https://github.com/storybookjs/storybook/pull/26295), thanks [@valentinpalkovic](/~https://github.com/valentinpalkovic)!
- CLI: Fix vite config automigration to resolve from project root - [#26262](/~https://github.com/storybookjs/storybook/pull/26262), thanks [@valentinpalkovic](/~https://github.com/valentinpalkovic)!
- CLI: Improve `add` command & add tests - [#26298](/~https://github.com/storybookjs/storybook/pull/26298), thanks [@ndelangen](/~https://github.com/ndelangen)!
- CLI: Update minimum Node.js version requirement - [#26312](/~https://github.com/storybookjs/storybook/pull/26312), thanks [@valentinpalkovic](/~https://github.com/valentinpalkovic)!
- CSF-tools/Codemods: Upgrade recast - [#26286](/~https://github.com/storybookjs/storybook/pull/26286), thanks [@43081j](/~https://github.com/43081j)!
- Controls: Fix type summary when table.type unset - [#26283](/~https://github.com/storybookjs/storybook/pull/26283), thanks [@shilman](/~https://github.com/shilman)!
- Core: Add event when serverChannel disconnects - [#26322](/~https://github.com/storybookjs/storybook/pull/26322), thanks [@ndelangen](/~https://github.com/ndelangen)!
- Core: Fix composition of storybooks on same origin - [#26304](/~https://github.com/storybookjs/storybook/pull/26304), thanks [@ndelangen](/~https://github.com/ndelangen)!
- Portable stories: Improve existing APIs, add loaders support - [#26267](/~https://github.com/storybookjs/storybook/pull/26267), thanks [@yannbf](/~https://github.com/yannbf)!
- React: Handle TypeScript path aliases in react-docgen loader - [#26273](/~https://github.com/storybookjs/storybook/pull/26273), thanks [@valentinpalkovic](/~https://github.com/valentinpalkovic)!
- Svelte: Support `5.0.0-next.65` prerelease - [#26188](/~https://github.com/storybookjs/storybook/pull/26188), thanks [@JReinhold](/~https://github.com/JReinhold)!
- Upgrade: Add missing isUpgrade parameter to automigrate function - [#26293](/~https://github.com/storybookjs/storybook/pull/26293), thanks [@valentinpalkovic](/~https://github.com/valentinpalkovic)!
- Vue: Return component from `composeStory` - [#26317](/~https://github.com/storybookjs/storybook/pull/26317), thanks [@JReinhold](/~https://github.com/JReinhold)!

## 8.0.0-rc.1

- CLI: Fix addon compatibility check error reporting in storybook dev - [#26258](/~https://github.com/storybookjs/storybook/pull/26258), thanks [@yannbf](/~https://github.com/yannbf)!
Expand Down
30 changes: 29 additions & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [Project annotations are now merged instead of overwritten in composeStory](#project-annotations-are-now-merged-instead-of-overwritten-in-composestory)
- [Type change in `composeStories` API](#type-change-in-composestories-api)
- [DOM structure changed in portable stories](#dom-structure-changed-in-portable-stories)
- [Composed Vue stories are now components instead of functions](#composed-vue-stories-are-now-components-instead-of-functions)
- [Tab addons are now routed to a query parameter](#tab-addons-are-now-routed-to-a-query-parameter)
- [Default keyboard shortcuts changed](#default-keyboard-shortcuts-changed)
- [Manager addons are now rendered with React 18](#manager-addons-are-now-rendered-with-react-18)
Expand Down Expand Up @@ -467,6 +468,33 @@ test("snapshots the story with custom id", () => {
});
```

#### Composed Vue stories are now components instead of functions

`composeStory` (and `composeStories`) from `@storybook/vue3` now return Vue components rather than story functions that return components. This means that when rendering these composed stories you just pass the composed story _without_ first calling it.

Previously when using `composeStory` from `@storybook/testing-vue3`, you would render composed stories with e.g. `render(MyStoryComposedStory({ someProp: true}))`. That is now changed to more [closely match how you would render regular Vue components](https://testing-library.com/docs/vue-testing-library/examples).

When migrating from `@storybook/testing-vue3`, you will likely hit the following error:

```ts
TypeError: Cannot read properties of undefined (reading 'devtoolsRawSetupState')
```

To fix it, you should change the usage of the composed story to reference it instead of calling it as a function. Here's an example using `@testing-library/vue` and Vitest:

```diff
import { it } from 'vitest';
import { render } from '@testing-library/vue';
import * as stories from './Button.stories';
import { composeStory } from '@storybook/vue3';

it('renders primary button', () => {
const Primary = composeStory(stories.Primary, stories.default);
- render(Primary({ label: 'Hello world' }));
+ render(Primary, { props: { label: 'Hello world' } });
});
```

### Tab addons are now routed to a query parameter

The URL of a tab used to be: `http://localhost:6006/?path=/my-addon-tab/my-story`.
Expand Down Expand Up @@ -1061,7 +1089,7 @@ The `hideNoControlsWarning` parameter is now removed. [More info here](#addon-co
The `setGlobalConfig` (used for reusing stories in your tests) is now removed in favor of `setProjectAnnotations`.

```ts
import { setProjectAnnotations } from `@storybook/testing-react`.
import { setProjectAnnotations } from `@storybook/react`.
```

#### StorybookViteConfig type from @storybook/builder-vite
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-a11y",
"version": "8.0.0-rc.1",
"version": "8.0.0-rc.2",
"description": "Test component compliance with web accessibility standards",
"keywords": [
"a11y",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-actions",
"version": "8.0.0-rc.1",
"version": "8.0.0-rc.2",
"description": "Get UI feedback when an action is performed on an interactive element",
"keywords": [
"storybook",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-backgrounds",
"version": "8.0.0-rc.1",
"version": "8.0.0-rc.2",
"description": "Switch backgrounds to view components in different settings",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-controls",
"version": "8.0.0-rc.1",
"version": "8.0.0-rc.2",
"description": "Interact with component inputs dynamically in the Storybook UI",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-docs",
"version": "8.0.0-rc.1",
"version": "8.0.0-rc.2",
"description": "Document component usage and properties in Markdown",
"keywords": [
"addon",
Expand Down
Loading

0 comments on commit 9b9d6be

Please sign in to comment.