Skip to content

Commit 0c52fb1

Browse files
committed
last fixes
1 parent 500a73e commit 0c52fb1

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

packages/mocks/MIGRATION.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ For Storybook v9 and later:
1717

1818
```diff
1919
// .storybook/main.js
20-
/** @type { import('../../../../index.d.ts').StorybookConfig } */
20+
/** @type {import('@web/storybook-framework-web-components').StorybookConfig} */
2121
const config = {
2222
stories: ['../stories/**/*.stories.js', '../stories/**/*.mdx'],
2323
addons: [
@@ -28,6 +28,10 @@ const config = {
2828
export default config;
2929
```
3030

31+
### Removed `mockRollupPlugin`
32+
33+
This plugin was mainly used for bundling Storybook, so it's not very useful on it's own, therefore it was deleted from `@web/mocks`.
34+
3135
### Update of `msw`
3236

3337
The version of `msw` was bumped to latest.

packages/mocks/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ const r = await fetch('/api/foo').then(r => r.json());
153153
console.assert(r.foo === 'bar');
154154
```
155155

156-
## `@web/storybook-builder`
156+
## Storybook integration
157157

158-
We created addon `@web/storybook-addon-mocks`.
158+
We created a Storybook addon `@web/storybook-addon-mocks`.
159159

160160
See [it's documentation](https://github.com/modernweb-dev/web/blob/master/packages/storybook-addon-mocks/README.md) for more details.
161161

packages/storybook-addon-mocks/src/preset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function rollupFinal(config) {
2121
const require = createRequire(import.meta.url);
2222
// @ts-expect-error
2323
config.plugins.push({
24-
name: 'rollup-plugin-msw',
24+
name: 'rollup-plugin-storybook-addon-mocks',
2525
writeBundle(opts) {
2626
const serviceWorkerPath = require.resolve('msw/mockServiceWorker.js');
2727
const sw = fs.readFileSync(serviceWorkerPath, 'utf8');

packages/storybook-builder/src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import rollupPluginNodeResolve from '@rollup/plugin-node-resolve';
22
import rollupPluginReplace from '@rollup/plugin-replace';
33
import { getBuilderOptions } from 'storybook/internal/common';
44
import { logger } from 'storybook/internal/node-logger';
5-
// Import both globals and globalsNameReferenceMap to prevent retrocompatibility.
6-
// @ts-ignore
7-
import { globals, globalsNameReferenceMap } from 'storybook/internal/preview/globals';
5+
import { globalsNameReferenceMap } from 'storybook/internal/preview/globals';
86
import type {
97
Builder,
108
Options,
@@ -96,7 +94,7 @@ export const start: WdsBuilder['start'] = async ({ startTime, options, router, s
9694
wdsPluginPrebundleModules(env, options),
9795
wdsPluginStorybookBuilder(options),
9896
wdsPluginMdx(options),
99-
wdsPluginExternalGlobals(globalsNameReferenceMap || globals),
97+
wdsPluginExternalGlobals(globalsNameReferenceMap),
10098
wdsPluginReplace({
10199
...stringifyProcessEnvs(env),
102100
include: ['**/node_modules/@storybook/**/*'],
@@ -174,7 +172,7 @@ export const build: WdsBuilder['build'] = async ({ startTime, options }) => {
174172
rollupPluginPrebundleModules(env, options),
175173
rollupPluginStorybookBuilder(options),
176174
rollupPluginMdx(options),
177-
rollupPluginExternalGlobals(globalsNameReferenceMap || globals),
175+
rollupPluginExternalGlobals(globalsNameReferenceMap),
178176
rollupPluginReplace({
179177
...stringifyProcessEnvs(env),
180178
include: ['**/node_modules/@storybook/**/*'],

0 commit comments

Comments
 (0)