Skip to content

Commit

Permalink
Merge pull request #27260 from storybookjs/version-patch-from-8.1.3
Browse files Browse the repository at this point in the history
Release: Patch 8.1.4
  • Loading branch information
shilman authored May 27, 2024
2 parents a2b9d08 + 55a3718 commit 85f02a4
Show file tree
Hide file tree
Showing 64 changed files with 764 additions and 539 deletions.
33 changes: 18 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ parameters:
default: "skipped"

executors:
sb_node_16_classic:
sb_node_18_classic:
parameters:
class:
description: The Resource class
Expand All @@ -21,7 +21,7 @@ executors:
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
sb_node_16_browsers:
sb_node_18_browsers:
parameters:
class:
description: The Resource class
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
pretty-docs:
executor:
class: medium
name: sb_node_16_classic
name: sb_node_18_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
Expand All @@ -125,7 +125,7 @@ jobs:
build:
executor:
class: xlarge
name: sb_node_16_classic
name: sb_node_18_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
lint:
executor:
class: large
name: sb_node_16_classic
name: sb_node_18_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
Expand All @@ -185,7 +185,7 @@ jobs:
check:
executor:
class: xlarge
name: sb_node_16_classic
name: sb_node_18_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
Expand All @@ -202,7 +202,7 @@ jobs:
- report-workflow-on-failure
- cancel-workflow-on-failure
script-checks:
executor: sb_node_16_browsers
executor: sb_node_18_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
unit-tests:
executor:
class: xlarge
name: sb_node_16_browsers
name: sb_node_18_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
Expand All @@ -252,7 +252,7 @@ jobs:
coverage:
executor:
class: small
name: sb_node_16_browsers
name: sb_node_18_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
Expand All @@ -263,7 +263,7 @@ jobs:
chromatic-internal-storybooks:
executor:
class: medium+
name: sb_node_16_browsers
name: sb_node_18_browsers
environment:
NODE_OPTIONS: --max_old_space_size=6144
steps:
Expand All @@ -287,13 +287,16 @@ jobs:
type: integer
executor:
class: medium
name: sb_node_16_browsers
name: sb_node_18_browsers
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- attach_workspace:
at: .
- run:
name: Enable Corepack
command: sudo corepack enable yarn
- run:
name: Creating Sandboxes
command: yarn task --task sandbox --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task sandbox) --no-link --start-from=never --junit
Expand All @@ -311,7 +314,7 @@ jobs:
type: integer
executor:
class: medium
name: sb_node_16_browsers
name: sb_node_18_browsers
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
Expand All @@ -331,7 +334,7 @@ jobs:
type: integer
executor:
class: large
name: sb_node_16_browsers
name: sb_node_18_browsers
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
Expand Down Expand Up @@ -410,7 +413,7 @@ jobs:
type: integer
executor:
class: medium
name: sb_node_16_browsers
name: sb_node_18_browsers
parallelism: << parameters.parallelism >>
steps:
- checkout
Expand Down Expand Up @@ -493,7 +496,7 @@ jobs:
test-empty-init:
executor:
class: medium
name: sb_node_16_browsers
name: sb_node_18_browsers
parameters:
packageManager:
type: string
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 8.1.4

- Angular: Revert style adjustments - [#27361](https://github.com/storybookjs/storybook/pull/27361), thanks @valentinpalkovic!
- Svelte: Support latest prerelease - [#27378](https://github.com/storybookjs/storybook/pull/27378), thanks @valentinpalkovic!
- Tags: Fix composition with older storybooks - [#27358](https://github.com/storybookjs/storybook/pull/27358), thanks @shilman!
- Vite: Fix HMR issue for Storybook preview files - [#27256](https://github.com/storybookjs/storybook/pull/27256), thanks @valentinpalkovic!

## 8.1.3

- Angular: Support v18 - [#27237](https://github.com/storybookjs/storybook/pull/27237), thanks @valentinpalkovic!
Expand Down
12 changes: 8 additions & 4 deletions code/builders/builder-vite/src/codegen-modern-iframe-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ export async function generateModernIframeScriptCode(options: Options, projectRo
// and the HMR handler. We don't use the hot.accept callback params because only the changed
// modules are provided, the rest are null. We can just re-import everything again in that case.
const getPreviewAnnotationsFunction = `
const getProjectAnnotations = async () => {
const getProjectAnnotations = async (hmrPreviewAnnotationModules = []) => {
const configs = await Promise.all([${previewAnnotationURLs
.map((previewAnnotation) => `import('${previewAnnotation}')`)
.map(
(previewAnnotation, index) =>
// Prefer the updated module from an HMR update, otherwise import the original module
`hmrPreviewAnnotationModules.at(${index}) ?? import('${previewAnnotation}')`
)
.join(',\n')}])
return composeConfigs(configs);
}`;
Expand All @@ -45,10 +49,10 @@ export async function generateModernIframeScriptCode(options: Options, projectRo
window.__STORYBOOK_PREVIEW__.onStoriesChanged({ importFn: newModule.importFn });
});
import.meta.hot.accept(${JSON.stringify(previewAnnotationURLs)}, () => {
import.meta.hot.accept(${JSON.stringify(previewAnnotationURLs)}, (previewAnnotationModules) => {
${getPreviewAnnotationsFunction}
// getProjectAnnotations has changed so we need to patch the new one in
window.__STORYBOOK_PREVIEW__.onGetProjectAnnotationsChanged({ getProjectAnnotations });
window.__STORYBOOK_PREVIEW__.onGetProjectAnnotationsChanged({ getProjectAnnotations: () => getProjectAnnotations(previewAnnotationModules) });
});
}`.trim();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { dirname, join, resolve } from 'path';
import { DefinePlugin, HotModuleReplacementPlugin, ProgressPlugin, ProvidePlugin } from 'webpack';
import type { Configuration } from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';

// @ts-expect-error (I removed this on purpose, because it's incorrect)
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
import TerserWebpackPlugin from 'terser-webpack-plugin';
Expand Down Expand Up @@ -54,11 +53,7 @@ const storybookPaths: Record<string, string> = {
};

export default async (
options: Options & {
typescriptOptions: TypescriptOptions;
/* Build entries, which should not be linked in the iframe HTML file */
excludeChunks?: string[];
}
options: Options & { typescriptOptions: TypescriptOptions }
): Promise<Configuration> => {
const {
outputDir = join('.', 'public'),
Expand All @@ -69,7 +64,6 @@ export default async (
previewUrl,
typescriptOptions,
features,
excludeChunks = [],
} = options;

const isProd = configType === 'PRODUCTION';
Expand Down Expand Up @@ -178,7 +172,6 @@ export default async (
alwaysWriteToDisk: true,
inject: false,
template,
excludeChunks,
templateParameters: {
version: packageJson.version,
globals: {
Expand Down
43 changes: 43 additions & 0 deletions code/e2e-tests/composition.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { test, expect } from '@playwright/test';
import { SbPage } from './util';

const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:6006';

// This is a slow test, and (presumably) framework independent, so only run it on one sandbox
const skipTest = process.env.STORYBOOK_TEMPLATE_NAME !== 'react-vite/default-ts';

test.describe('composition', () => {
test.beforeEach(async ({ page }) => {
if (skipTest) return;
await page.goto(storybookUrl);
await new SbPage(page).waitUntilLoaded();
});

test('should correctly filter composed stories', async ({ page }) => {
if (skipTest) return;

// Expect that composed Storybooks are visible
await expect(await page.getByTitle('Storybook 8.0.0')).toBeVisible();
await expect(await page.getByTitle('Storybook 7.6.18')).toBeVisible();

// Expect composed stories to be available in the sidebar
await page.locator('[id="storybook\\@8\\.0\\.0_components-badge"]').click();
await expect(
await page.locator('[id="storybook\\@8\\.0\\.0_components-badge--default"]')
).toBeVisible();

await page.locator('[id="storybook\\@7\\.6\\.18_components-badge"]').click();
await expect(
await page.locator('[id="storybook\\@7\\.6\\.18_components-badge--default"]')
).toBeVisible();

// Expect composed stories `to be available in the search
await page.getByPlaceholder('Find components').fill('Button');
await expect(
await page.getByRole('option', { name: 'Button Storybook 8.0.0 / @blocks / examples' })
).toBeVisible();
await expect(
await page.getByRole('option', { name: 'Button Storybook 7.6.18 / @blocks / examples' })
).toBeVisible();
});
});
Loading

0 comments on commit 85f02a4

Please sign in to comment.