Skip to content

Commit f0a5f07

Browse files
authored
Merge pull request #24613 from storybookjs/version-patch-from-7.5.2
Release: Patch 7.5.3
2 parents 0ef03ec + 740e15a commit f0a5f07

25 files changed

+117
-90
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 7.5.3
2+
3+
- Angular: Support v17 - [#24717](https://github.com/storybookjs/storybook/pull/24717), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
4+
- CLI: Catch when prettier failed to prettify main and preview config files - [#24604](https://github.com/storybookjs/storybook/pull/24604), thanks [@kasperpeulen](https://github.com/kasperpeulen)!
5+
- UI: Fix button contrast-ratio - [#24525](https://github.com/storybookjs/storybook/pull/24525), thanks [@maheshchandra10](https://github.com/maheshchandra10)!
6+
17
## 7.5.2
28

39
- Addon-themes: Fix globals not being set when using absolute path - [#24596](https://github.com/storybookjs/storybook/pull/24596), thanks [@JReinhold](https://github.com/JReinhold)!

Diff for: code/frameworks/angular/package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,17 @@
9090
"zone.js": "^0.13.0"
9191
},
9292
"peerDependencies": {
93-
"@angular-devkit/architect": ">=0.1400.0 < 0.1700.0",
94-
"@angular-devkit/build-angular": ">=14.1.0 < 17.0.0",
95-
"@angular-devkit/core": ">=14.1.0 < 17.0.0",
96-
"@angular/cli": ">=14.1.0 < 17.0.0",
97-
"@angular/common": ">=14.1.0 < 17.0.0",
98-
"@angular/compiler": ">=14.1.0 < 17.0.0",
99-
"@angular/compiler-cli": ">=14.1.0 < 17.0.0",
100-
"@angular/core": ">=14.1.0 < 17.0.0",
101-
"@angular/forms": ">=14.1.0 < 17.0.0",
102-
"@angular/platform-browser": ">=14.1.0 < 17.0.0",
103-
"@angular/platform-browser-dynamic": ">=14.1.0 < 17.0.0",
93+
"@angular-devkit/architect": ">=0.1400.0 < 0.1800.0",
94+
"@angular-devkit/build-angular": ">=14.1.0 < 18.0.0",
95+
"@angular-devkit/core": ">=14.1.0 < 18.0.0",
96+
"@angular/cli": ">=14.1.0 < 18.0.0",
97+
"@angular/common": ">=14.1.0 < 18.0.0",
98+
"@angular/compiler": ">=14.1.0 < 18.0.0",
99+
"@angular/compiler-cli": ">=14.1.0 < 18.0.0",
100+
"@angular/core": ">=14.1.0 < 18.0.0",
101+
"@angular/forms": ">=14.1.0 < 18.0.0",
102+
"@angular/platform-browser": ">=14.1.0 < 18.0.0",
103+
"@angular/platform-browser-dynamic": ">=14.1.0 < 18.0.0",
104104
"@babel/core": "*",
105105
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
106106
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",

Diff for: code/lib/cli/src/generators/configure.ts

+25-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import fse from 'fs-extra';
22
import path from 'path';
33
import { dedent } from 'ts-dedent';
4+
import { logger } from '@storybook/node-logger';
45
import { externalFrameworks, SupportedLanguage } from '../project_types';
56

67
interface ConfigureMainOptions {
@@ -33,8 +34,6 @@ interface ConfigurePreviewOptions {
3334
rendererId: string;
3435
}
3536

36-
const logger = console;
37-
3837
/**
3938
* We need to clean up the paths in case of pnp
4039
* input: "path.dirname(require.resolve(path.join('@storybook/react-webpack5', 'package.json')))"
@@ -96,20 +95,25 @@ export async function configureMain({
9695
finalPrefixes.push(`/** @type { import('${frameworkPackage}').StorybookConfig } */`);
9796
}
9897

99-
const mainJsContents = mainConfigTemplate
98+
let mainJsContents = mainConfigTemplate
10099
.replace('<<import>>', `${imports.join('\n\n')}\n\n`)
101100
.replace('<<prefix>>', finalPrefixes.length > 0 ? `${finalPrefixes.join('\n\n')}\n` : '')
102101
.replace('<<type>>', isTypescript ? ': StorybookConfig' : '')
103102
.replace('<<mainContents>>', mainContents);
104103

105-
const prettier = (await import('prettier')).default;
106-
107104
const mainPath = `./${storybookConfigFolder}/main.${isTypescript ? 'ts' : 'js'}`;
108-
const prettyMain = prettier.format(dedent(mainJsContents), {
109-
...prettier.resolveConfig.sync(process.cwd()),
110-
filepath: mainPath,
111-
});
112-
await fse.writeFile(mainPath, prettyMain, { encoding: 'utf8' });
105+
106+
try {
107+
const prettier = (await import('prettier')).default;
108+
mainJsContents = prettier.format(dedent(mainJsContents), {
109+
...prettier.resolveConfig.sync(process.cwd()),
110+
filepath: mainPath,
111+
});
112+
} catch {
113+
logger.verbose(`Failed to prettify ${mainPath}`);
114+
}
115+
116+
await fse.writeFile(mainPath, mainJsContents, { encoding: 'utf8' });
113117
}
114118

115119
export async function configurePreview(options: ConfigurePreviewOptions) {
@@ -140,7 +144,7 @@ export async function configurePreview(options: ConfigurePreviewOptions) {
140144
.filter(Boolean)
141145
.join('\n');
142146

143-
const preview = dedent`
147+
let preview = dedent`
144148
${prefix}${prefix.length > 0 ? '\n' : ''}
145149
${
146150
!isTypescript && rendererPackage
@@ -163,11 +167,15 @@ export async function configurePreview(options: ConfigurePreviewOptions) {
163167
.replace(' \n', '')
164168
.trim();
165169

166-
const prettier = (await import('prettier')).default;
170+
try {
171+
const prettier = (await import('prettier')).default;
172+
preview = prettier.format(preview, {
173+
...prettier.resolveConfig.sync(process.cwd()),
174+
filepath: previewPath,
175+
});
176+
} catch {
177+
logger.verbose(`Failed to prettify ${previewPath}`);
178+
}
167179

168-
const prettyPreview = prettier.format(preview, {
169-
...prettier.resolveConfig.sync(process.cwd()),
170-
filepath: previewPath,
171-
});
172-
await fse.writeFile(previewPath, prettyPreview, { encoding: 'utf8' });
180+
await fse.writeFile(previewPath, preview, { encoding: 'utf8' });
173181
}

Diff for: code/lib/theming/src/themes/light.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const theme: ThemeVars = {
2121
// Text colors
2222
textColor: color.darkest,
2323
textInverseColor: color.lightest,
24-
textMutedColor: color.mediumdark,
24+
textMutedColor: color.dark,
2525

2626
// Toolbar default and active colors
2727
barTextColor: color.mediumdark,

Diff for: code/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -328,5 +328,6 @@
328328
"Dependency Upgrades"
329329
]
330330
]
331-
}
331+
},
332+
"deferredNextVersion": "7.5.3"
332333
}

Diff for: code/yarn.lock

+11-11
Original file line numberDiff line numberDiff line change
@@ -6438,17 +6438,17 @@ __metadata:
64386438
webpack: 5
64396439
zone.js: ^0.13.0
64406440
peerDependencies:
6441-
"@angular-devkit/architect": ">=0.1400.0 < 0.1700.0"
6442-
"@angular-devkit/build-angular": ">=14.1.0 < 17.0.0"
6443-
"@angular-devkit/core": ">=14.1.0 < 17.0.0"
6444-
"@angular/cli": ">=14.1.0 < 17.0.0"
6445-
"@angular/common": ">=14.1.0 < 17.0.0"
6446-
"@angular/compiler": ">=14.1.0 < 17.0.0"
6447-
"@angular/compiler-cli": ">=14.1.0 < 17.0.0"
6448-
"@angular/core": ">=14.1.0 < 17.0.0"
6449-
"@angular/forms": ">=14.1.0 < 17.0.0"
6450-
"@angular/platform-browser": ">=14.1.0 < 17.0.0"
6451-
"@angular/platform-browser-dynamic": ">=14.1.0 < 17.0.0"
6441+
"@angular-devkit/architect": ">=0.1400.0 < 0.1800.0"
6442+
"@angular-devkit/build-angular": ">=14.1.0 < 18.0.0"
6443+
"@angular-devkit/core": ">=14.1.0 < 18.0.0"
6444+
"@angular/cli": ">=14.1.0 < 18.0.0"
6445+
"@angular/common": ">=14.1.0 < 18.0.0"
6446+
"@angular/compiler": ">=14.1.0 < 18.0.0"
6447+
"@angular/compiler-cli": ">=14.1.0 < 18.0.0"
6448+
"@angular/core": ">=14.1.0 < 18.0.0"
6449+
"@angular/forms": ">=14.1.0 < 18.0.0"
6450+
"@angular/platform-browser": ">=14.1.0 < 18.0.0"
6451+
"@angular/platform-browser-dynamic": ">=14.1.0 < 18.0.0"
64526452
"@babel/core": "*"
64536453
react: ^16.8.0 || ^17.0.0 || ^18.0.0
64546454
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0

Diff for: docs/configure/sidebar-and-urls.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,6 @@ When Storybook generates the titles for all matching stories, they'll retain the
162162

163163
### Story Indexers
164164

165-
[Story Indexers](./main-config-indexers.md) are a set of heuristics used by Storybook to crawl your filesystem based on a given glob pattern searching for matching stories, which is then used to generate an `index.json` (formerly `stories.json`) file responsible for populating the sidebar with the necessary information. By default, this heuristic will look for files that contain the following scheme `*.stories.@(js|jsx|mjs|ts|tsx)`.
165+
[Story Indexers](../api/main-config-indexers.md) are a set of heuristics used by Storybook to crawl your filesystem based on a given glob pattern searching for matching stories, which is then used to generate an `index.json` (formerly `stories.json`) file responsible for populating the sidebar with the necessary information. By default, this heuristic will look for files that contain the following scheme `*.stories.@(js|jsx|mjs|ts|tsx)`.
166166

167-
You can provide your own indexer to include stories with a different naming convention, adjust the automatic title generation beyond a prefix, and many other use cases. For more information, see the [Story Indexers API reference](./main-config-indexers.md).
167+
You can provide your own indexer to include stories with a different naming convention, adjust the automatic title generation beyond a prefix, and many other use cases. For more information, see the [Story Indexers API reference](../api/main-config-indexers.md).

Diff for: docs/sharing/publish-storybook.md

+18-3
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,30 @@ When you publish Storybook, you also get component history and versioning down t
131131

132132
## Publish Storybook to other services
133133

134-
Since Storybook is built as a static web application, you can also publish it to any web host, including [GitHub Pages](https://docs.github.com/en/pages), [Netlify](https://www.netlify.com/), [AWS S3](https://aws.amazon.com/s3/), and more. However, features such as [Composition](./storybook-composition.md),
135-
[embedding stories](./embed.md), history, and versioning require tighter integration with Storybook APIs and secure authentication. Your hosting provider may not be capable of supporting these features. Learn about the Component Publishing Protocol (CPP) to see what.
134+
Since Storybook is built as a static web application, you can also publish it to any web host, including [GitHub Pages](https://docs.github.com/en/pages), [Netlify](https://www.netlify.com/), [AWS S3](https://aws.amazon.com/s3/), and more. However, features such as [Composition](./storybook-composition.md), [embedding stories](./embed.md), history, versioning, and assets may require tighter integration with Storybook APIs and secure authentication. If you want to know more about headers, you can refer to the [Migration guide](https://github.com/storybookjs/storybook/blob/main/MIGRATION.md#deploying-build-artifacts). Additionally, if you want to learn about the Component Publishing Protocol (CPP), you can find more information below.
135+
136+
### GitHub Pages
137+
138+
To deploy Storybook on GitHub Pages, use the community-built [Deploy Storybook to GitHub Pages](https://github.com/bitovi/github-actions-storybook-to-github-pages) Action. To enable it, create a new workflow file inside your `.github/workflows` directory with the following content:
139+
140+
141+
<!-- prettier-ignore-start -->
142+
143+
<CodeSnippets
144+
paths={[
145+
'common/ghp-github-action.yml.mdx',
146+
]}
147+
/>
148+
149+
<!-- prettier-ignore-end -->
136150

137151
<div class="aside">
138152

139-
ℹ️ Additional header configuration may be required to serve Storybook's static files correctly on your host. For more information on the required headers, see the [Migration guide](https://github.com/storybookjs/storybook/blob/main/MIGRATION.md#deploying-build-artifacts).
153+
ℹ️ The GitHub Pages Action requires additional configuration options to customize the deployment process. Refer to the [official documentation](https://github.com/marketplace/actions/deploy-storybook-to-github-pages) for more information.
140154

141155
</div>
142156

157+
143158
<details>
144159

145160
<summary><h2>Component Publishing Protocol (CPP)</h2></summary>

Diff for: docs/snippets/angular/component-story-figma-integration.ts.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
import type { Meta, StoryObj } from '@storybook/angular/';
55

6-
import { withDesign } from 'storybook-addon-designs';
7-
86
import { MyComponent } from './MyComponent.component';
97

108
// More on default export: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export
119
const meta: Meta<MyComponent> = {
1210
component: MyComponent,
13-
decorators: [withDesign],
1411
};
1512

1613
export default meta;

Diff for: docs/snippets/common/ghp-github-action.yml.mdx

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
```yml
2+
# .github/workflows/deploy-github-pages.yaml
3+
4+
# Workflow name
5+
name: Build and Publish Storybook to GitHub Pages
6+
7+
on:
8+
# Event for the workflow to run on
9+
push:
10+
branches:
11+
- 'your-branch-name' # Replace with the branch you want to deploy from
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# List of jobs
19+
jobs:
20+
deploy:
21+
runs-on: ubuntu-latest
22+
# Job steps
23+
steps:
24+
# Manual Checkout
25+
- uses: actions/checkout@v3
26+
27+
# Set up Node
28+
- uses: actions/setup-node@v3
29+
with:
30+
node-version: '16.x'
31+
32+
#👇 Add Storybook build and deploy to GitHub Pages as a step in the workflow
33+
- uses: bitovi/[email protected]
34+
with:
35+
install_command: yarn install # default: npm ci
36+
build_command: yarn build-storybook # default: npm run build-storybook
37+
path: storybook-static # default: dist/storybook
38+
checkout: false # default: true
39+
```

Diff for: docs/snippets/react/component-story-figma-integration.js.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
```js
22
// MyComponent.stories.js|jsx
33

4-
import { withDesign } from 'storybook-addon-designs';
5-
64
import { MyComponent } from './MyComponent';
75

86
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
97
export default {
108
component: MyComponent,
11-
decorators: [withDesign],
129
};
1310

1411
export const Example = {

Diff for: docs/snippets/react/component-story-figma-integration.ts-4-9.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
import type { Meta, StoryObj } from '@storybook/react';
55

6-
import { withDesign } from 'storybook-addon-designs';
7-
86
import { MyComponent } from './MyComponent';
97

108
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
119
const meta = {
1210
component: MyComponent,
13-
decorators: [withDesign],
1411
} satisfies Meta<typeof MyComponent>;
1512

1613
export default meta;

Diff for: docs/snippets/react/component-story-figma-integration.ts.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
import type { Meta, StoryObj } from '@storybook/react';
55

6-
import { withDesign } from 'storybook-addon-designs';
7-
86
import { MyComponent } from './MyComponent';
97

108
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
119
const meta: Meta<typeof MyComponent> = {
1210
component: MyComponent,
13-
decorators: [withDesign],
1411
};
1512

1613
export default meta;

Diff for: docs/snippets/solid/component-story-figma-integration.js.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
```js
22
// MyComponent.stories.js|jsx
33

4-
import { withDesign } from 'storybook-addon-designs';
5-
64
import { MyComponent } from './MyComponent';
75

86
export default {
97
component: MyComponent,
10-
decorators: [withDesign],
118
};
129

1310
export const Example = {

Diff for: docs/snippets/solid/component-story-figma-integration.ts-4-9.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33

44
import type { Meta, StoryObj } from 'storybook-solidjs';
55

6-
import { withDesign } from 'storybook-addon-designs';
7-
86
import { MyComponent } from './MyComponent';
97

108
const meta = {
119
component: MyComponent,
12-
decorators: [withDesign],
1310
} satisfies Meta<typeof MyComponent>;
1411

1512
export default meta;

Diff for: docs/snippets/solid/component-story-figma-integration.ts.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33

44
import type { Meta, StoryObj } from 'storybook-solidjs';
55

6-
import { withDesign } from 'storybook-addon-designs';
7-
86
import { MyComponent } from './MyComponent';
97

108
const meta: Meta<typeof MyComponent> = {
119
component: MyComponent,
12-
decorators: [withDesign],
1310
};
1411

1512
export default meta;

Diff for: docs/snippets/svelte/component-story-figma-integration.js.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
```js
22
// MyComponent.stories.js
33

4-
import { withDesign } from 'storybook-addon-designs';
5-
64
import MyComponent from './MyComponent.svelte';
75

86
// More on default export: https://storybook.js.org/docs/svelte/writing-stories/introduction#default-export
97
export default {
108
component: { MyComponent },
11-
decorators: [withDesign],
129
};
1310

1411
export const Example = {

Diff for: docs/snippets/svelte/component-story-figma-integration.mdx.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
import { Canvas, Meta, Story } from '@storybook/addon-docs';
55

6-
import { withDesign } from 'storybook-addon-designs';
7-
86
import MyComponent from './MyComponent.svelte';
97

108
<Meta
119
title="FigmaExample"
1210
component={MyComponent}
13-
decorators={[withDesign]}
1411
/>
1512

1613
<!--

Diff for: docs/snippets/vue/component-story-figma-integration.js.mdx

-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
```js
22
// MyComponent.stories.js
33

4-
import { withDesign } from 'storybook-addon-designs';
5-
64
import MyComponent from './MyComponent.vue';
75

86
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
97
export default {
108
component: MyComponent,
11-
decorators: [withDesign],
129
};
1310

1411
export const Example = {

0 commit comments

Comments
 (0)