Skip to content

Commit

Permalink
chore: remove @storybook/addons
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerFeng committed Sep 12, 2023
1 parent fba44ca commit c048491
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
5 changes: 2 additions & 3 deletions packages/storybook/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
"@modern-js/core": "workspace:*",
"@modern-js/runtime": "workspace:*",
"@modern-js/utils": "workspace:*",
"@rspack/dev-client": "0.2.12",
"@storybook/addons": "^6.3.7",
"@rspack/dev-client": "0.3.2",
"@storybook/api": "^7.4.0",
"@storybook/components": "^7.4.0",
"@storybook/core-common": "^7.4.0",
Expand All @@ -54,13 +53,13 @@
"@storybook/mdx1-csf": "^1.0.0",
"@storybook/mdx2-csf": "^1.1.0",
"@storybook/preview": "^7.4.0",
"@storybook/preview-api": "^7.4.0",
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.0c3f3b7.0",
"@storybook/router": "^7.4.0",
"@storybook/theming": "^7.4.0",
"@types/webpack-hot-middleware": "^2.25.6",
"ast-types": "^0.14.2",
"babel-plugin-react-docgen": "^4.2.1",
"glob-promise": "^6.0.3",
"minimatch": "^3.0.4",
"react-docgen": "6.0.0-alpha.3",
"remark-external-links": "^9.0.1",
Expand Down
6 changes: 1 addition & 5 deletions packages/storybook/builder/src/addons/components/modern.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ import { createApp } from '@modern-js/runtime';
import type { Plugin, RouterConfig } from '@modern-js/runtime';
import router from '@modern-js/runtime/router';
import state from '@modern-js/runtime/model';
import type { StoryFn as StoryFunction } from '@storybook/addons';
import type { IConfig } from '../type';

export const WrapProviders = (
storyFn: StoryFunction<JSX.Element>,
config: IConfig,
) => {
export const WrapProviders = (storyFn: any, config: IConfig) => {
const App = createApp({
plugins: resolvePlugins(config.modernConfigRuntime),
})(storyFn);
Expand Down
8 changes: 3 additions & 5 deletions packages/storybook/builder/src/addons/withPluginRuntime.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { type StoryFn as StoryFunction, useParameter } from '@storybook/addons';
import { useParameter } from '@storybook/preview-api';
import { DecoratorFunction } from '@storybook/types';
import { WrapProviders } from './components/modern';
import type { IConfig } from './type';

export const withPluginRuntime = (
storyFn: StoryFunction<JSX.Element>,
// context: StoryContext
) => {
export const withPluginRuntime: DecoratorFunction = storyFn => {
const modernConfigRuntime = useParameter<IConfig['modernConfigRuntime']>(
'modernConfigRuntime',
);
Expand Down
7 changes: 3 additions & 4 deletions packages/storybook/builder/src/plugin-storybook.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable max-lines */
import { isAbsolute, join, resolve } from 'path';
import { slash, watch } from '@modern-js/utils';
import { slash, watch, globby } from '@modern-js/utils';
import {
BuilderPlugin,
SharedBuilderConfig,
Expand All @@ -22,7 +22,6 @@ import {
loadPreviewOrConfigFile,
} from '@storybook/core-common';
import { globals } from '@storybook/preview/globals';
import { promise as glob } from 'glob-promise';

import type {
BuilderPluginAPI as WebpackAPI,
Expand Down Expand Up @@ -401,7 +400,7 @@ async function createStoriesEntry(cwd: string, storyPatterns: string[]) {
const stories = (
await Promise.all(
storyPatterns.map(pattern => {
return glob(slash(pattern), { follow: true });
return globby(slash(pattern), { followSymbolicLinks: true });
}),
)
).reduce((carry, stories) => carry.concat(stories), []);
Expand Down Expand Up @@ -458,7 +457,7 @@ async function watchStories(
const stories = (
await Promise.all(
patterns.map(pattern => {
return glob(slash(pattern), { follow: true });
return globby(slash(pattern), { followSymbolicLinks: true });
}),
)
).reduce((carry, stories) => carry.concat(stories), []);
Expand Down

0 comments on commit c048491

Please sign in to comment.