mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-16 05:03:11 +08:00
Merge branch 'next' into shilman/21287-cli-upgrade
This commit is contained in:
commit
195e38cb53
65
CHANGELOG.md
65
CHANGELOG.md
@ -1,3 +1,68 @@
|
||||
## 7.0.0-beta.64 (March 9, 2023)
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- Vite: Fix HMR of preview.js [#21485](https://github.com/storybooks/storybook/pull/21485)
|
||||
- Vite: Make sure we update the vite import map when .mdx is added [#21490](https://github.com/storybooks/storybook/pull/21490)
|
||||
- Docs: Don't allow passing `of={}` with undefined prop [#21452](https://github.com/storybooks/storybook/pull/21452)
|
||||
- Composition: Restore support for v2 stories.json [#21354](https://github.com/storybooks/storybook/pull/21354)
|
||||
|
||||
## 7.0.0-beta.63 (March 9, 2023)
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- Story Index: Fix storySort parsing for parameters variable [#21481](https://github.com/storybooks/storybook/pull/21481)
|
||||
- React/Vite: Add some missing types [#21449](https://github.com/storybooks/storybook/pull/21449)
|
||||
- Docs: Cleanup with Promise instead of setTimeout [#21476](https://github.com/storybooks/storybook/pull/21476)
|
||||
- Docs: Re-render MDX files when you fix a thrown error [#21454](https://github.com/storybooks/storybook/pull/21454)
|
||||
- CLI: Fix mdx-to-csf codemod blocks imports [#21448](https://github.com/storybooks/storybook/pull/21448)
|
||||
|
||||
#### Maintenance
|
||||
|
||||
- CLI: Copy tweaks for automigrations [#21475](https://github.com/storybooks/storybook/pull/21475)
|
||||
- CLI: Warn the user when stories glob does not match any file [#21392](https://github.com/storybooks/storybook/pull/21392)
|
||||
- Docs: Use `Of` type in `useOf` argument [#21442](https://github.com/storybooks/storybook/pull/21442)
|
||||
- Telemetry: Is interactive shell [#21436](https://github.com/storybooks/storybook/pull/21436)
|
||||
|
||||
## 7.0.0-beta.62 (March 6, 2023)
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- Vite: Add react docgen types [#21338](https://github.com/storybooks/storybook/pull/21338)
|
||||
- Core: Print errors in `withTelemetry` before prompting [#21407](https://github.com/storybooks/storybook/pull/21407)
|
||||
- Add Angular Builder Codemods [#21409](https://github.com/storybooks/storybook/pull/21409)
|
||||
- Docs: Use async import rather than require in docs [#21402](https://github.com/storybooks/storybook/pull/21402)
|
||||
- Docs: Don't warn if we find the same entry twice [#21403](https://github.com/storybooks/storybook/pull/21403)
|
||||
- Telemetry: Ensure we report errors even when unexpected things happen [#21416](https://github.com/storybooks/storybook/pull/21416)
|
||||
- CLI: Fix versions.ts to install latest prerelease packages [#21418](https://github.com/storybooks/storybook/pull/21418)
|
||||
- Core: Remove pointless `module.hot.decline()` in addons [#21421](https://github.com/storybooks/storybook/pull/21421)
|
||||
- Docs: Allow ArgTable usage unattached [#21371](https://github.com/storybooks/storybook/pull/21371)
|
||||
|
||||
#### Maintenance
|
||||
|
||||
- Addon-docs: Polish styling for 7.0 [#21255](https://github.com/storybooks/storybook/pull/21255)
|
||||
|
||||
## 7.0.0-beta.61 (March 4, 2023)
|
||||
|
||||
#### Features
|
||||
|
||||
- Docs: Show MDX errors using our error overlay [#21369](https://github.com/storybooks/storybook/pull/21369)
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- Core: Remove state deprecation warnings by default [#21367](https://github.com/storybooks/storybook/pull/21367)
|
||||
- Core: Fix default export storySort handling [#21389](https://github.com/storybooks/storybook/pull/21389)
|
||||
- Vue3: Add slot TS types [#21359](https://github.com/storybooks/storybook/pull/21359)
|
||||
- Docs: Fix issue with referencing non-story files with names similar or equal to docs files [#21348](https://github.com/storybooks/storybook/pull/21348)
|
||||
|
||||
#### Maintenance
|
||||
|
||||
- Docs: Update invalid `<Meta of={}>` error to be more helpful. [#21365](https://github.com/storybooks/storybook/pull/21365)
|
||||
|
||||
#### Dependency Upgrades
|
||||
|
||||
- Upgrade react-docgen-typescript-plugin for TS4.8 [#21380](https://github.com/storybooks/storybook/pull/21380)
|
||||
|
||||
## 7.0.0-beta.60 (March 3, 2023)
|
||||
|
||||
#### Bug Fixes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-a11y",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Test component compliance with web accessibility standards",
|
||||
"keywords": [
|
||||
"a11y",
|
||||
@ -63,16 +63,16 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/addon-highlight": "7.0.0-beta.60",
|
||||
"@storybook/channels": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/addon-highlight": "7.0.0-beta.64",
|
||||
"@storybook/channels": "7.0.0-beta.64",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"axe-core": "^4.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"react-resize-detector": "^7.1.2"
|
||||
@ -104,7 +104,7 @@
|
||||
"./src/preview.tsx"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Accessibility",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991665-47042f80-3c7c-11eb-8f00-64b5a18f498a.png",
|
||||
|
@ -1,5 +1,3 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import { global } from '@storybook/global';
|
||||
import { addons } from '@storybook/preview-api';
|
||||
import { EVENTS } from './constants';
|
||||
@ -7,10 +5,6 @@ import type { A11yParameters } from './params';
|
||||
|
||||
const { document, window: globalWindow } = global;
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
||||
const channel = addons.getChannel();
|
||||
// Holds axe core running state
|
||||
let active = false;
|
||||
|
@ -1,8 +1,2 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
export { PARAM_KEY } from './constants';
|
||||
export * from './params';
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-actions",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Get UI feedback when an action is performed on an interactive element",
|
||||
"keywords": [
|
||||
"storybook",
|
||||
@ -77,14 +77,14 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"dequal": "^2.0.2",
|
||||
"lodash": "^4.17.21",
|
||||
"polished": "^4.2.2",
|
||||
@ -121,7 +121,7 @@
|
||||
"./src/preview.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Actions",
|
||||
"unsupportedFrameworks": [
|
||||
|
@ -1,9 +1,3 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
export * from './constants';
|
||||
export * from './models';
|
||||
export * from './runtime';
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-backgrounds",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Switch backgrounds to view components in different settings",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -76,14 +76,14 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"memoizerific": "^1.11.3",
|
||||
"ts-dedent": "^2.0.0"
|
||||
},
|
||||
@ -112,7 +112,7 @@
|
||||
"./src/preview.tsx"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Backgrounds",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991667-479cc600-3c7c-11eb-96d3-410e936252e7.png",
|
||||
|
@ -1,8 +1,2 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
||||
// make it work with --isolatedModules
|
||||
export default {};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-controls",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Interact with component inputs dynamically in the Storybook UI",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -68,15 +68,15 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/blocks": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/blocks": "7.0.0-beta.64",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"lodash": "^4.17.21",
|
||||
"ts-dedent": "^2.0.0"
|
||||
},
|
||||
@ -102,7 +102,7 @@
|
||||
],
|
||||
"platform": "browser"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Controls",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991669-479cc600-3c7c-11eb-93d9-38b67e8371f2.png",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-docs",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Document component usage and properties in Markdown",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -103,19 +103,19 @@
|
||||
"@babel/plugin-transform-react-jsx": "^7.19.0",
|
||||
"@jest/transform": "^29.3.1",
|
||||
"@mdx-js/react": "^2.1.5",
|
||||
"@storybook/blocks": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/csf-plugin": "7.0.0-beta.60",
|
||||
"@storybook/csf-tools": "7.0.0-beta.60",
|
||||
"@storybook/blocks": "7.0.0-beta.64",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/csf-plugin": "7.0.0-beta.64",
|
||||
"@storybook/csf-tools": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/mdx2-csf": "next",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/postinstall": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/react-dom-shim": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/postinstall": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/react-dom-shim": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"fs-extra": "^11.1.0",
|
||||
"remark-external-links": "^8.0.0",
|
||||
"remark-slug": "^6.0.0",
|
||||
@ -148,7 +148,7 @@
|
||||
"./src/shims/mdx-react-shim.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Docs",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { renderElement, unmountElement } from '@storybook/react-dom-shim';
|
||||
import type { Renderer, Parameters, DocsContextProps, DocsRenderFunction } from '@storybook/types';
|
||||
import { Docs, CodeOrSourceMdx, AnchorMdx, HeadersMdx } from '@storybook/blocks';
|
||||
@ -10,33 +10,59 @@ export const defaultComponents: Record<string, any> = {
|
||||
...HeadersMdx,
|
||||
};
|
||||
|
||||
class ErrorBoundary extends Component<{
|
||||
showException: (err: Error) => void;
|
||||
}> {
|
||||
state = { hasError: false };
|
||||
|
||||
static getDerivedStateFromError() {
|
||||
return { hasError: true };
|
||||
}
|
||||
|
||||
componentDidCatch(err: Error) {
|
||||
const { showException } = this.props;
|
||||
showException(err);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { hasError } = this.state;
|
||||
const { children } = this.props;
|
||||
|
||||
return hasError ? null : children;
|
||||
}
|
||||
}
|
||||
|
||||
export class DocsRenderer<TRenderer extends Renderer> {
|
||||
public render: DocsRenderFunction<TRenderer>;
|
||||
|
||||
public unmount: (element: HTMLElement) => void;
|
||||
|
||||
constructor() {
|
||||
this.render = (
|
||||
this.render = async (
|
||||
context: DocsContextProps<TRenderer>,
|
||||
docsParameter: Parameters,
|
||||
element: HTMLElement,
|
||||
callback: () => void
|
||||
): void => {
|
||||
element: HTMLElement
|
||||
): Promise<void> => {
|
||||
const components = {
|
||||
...defaultComponents,
|
||||
...docsParameter?.components,
|
||||
};
|
||||
|
||||
import('@mdx-js/react')
|
||||
.then(({ MDXProvider }) =>
|
||||
renderElement(
|
||||
<MDXProvider components={components}>
|
||||
<Docs context={context} docsParameter={docsParameter} />
|
||||
</MDXProvider>,
|
||||
element
|
||||
return new Promise((resolve, reject) => {
|
||||
import('@mdx-js/react')
|
||||
.then(({ MDXProvider }) =>
|
||||
// We use a `key={}` here to reset the `hasError` state each time we render ErrorBoundary
|
||||
renderElement(
|
||||
<ErrorBoundary showException={reject} key={Math.random()}>
|
||||
<MDXProvider components={components}>
|
||||
<Docs context={context} docsParameter={docsParameter} />
|
||||
</MDXProvider>
|
||||
</ErrorBoundary>,
|
||||
element
|
||||
)
|
||||
)
|
||||
)
|
||||
.then(callback);
|
||||
.then(resolve);
|
||||
});
|
||||
};
|
||||
|
||||
this.unmount = (element: HTMLElement) => {
|
||||
|
@ -96,8 +96,10 @@ async function webpack(
|
||||
...webpackConfig,
|
||||
plugins: [
|
||||
...(webpackConfig.plugins || []),
|
||||
// eslint-disable-next-line global-require
|
||||
...(csfPluginOptions ? [require('@storybook/csf-plugin').webpack(csfPluginOptions)] : []),
|
||||
|
||||
...(csfPluginOptions
|
||||
? [(await import('@storybook/csf-plugin')).webpack(csfPluginOptions)]
|
||||
: []),
|
||||
],
|
||||
|
||||
module: {
|
||||
|
3
code/addons/docs/template/stories/docs2/Error.mdx
vendored
Normal file
3
code/addons/docs/template/stories/docs2/Error.mdx
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{/* This file intentionally has an error */}
|
||||
|
||||
<Story of={Something} />
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-essentials",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Curated addons to bring out the best of Storybook",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -119,23 +119,23 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/addon-actions": "7.0.0-beta.60",
|
||||
"@storybook/addon-backgrounds": "7.0.0-beta.60",
|
||||
"@storybook/addon-controls": "7.0.0-beta.60",
|
||||
"@storybook/addon-docs": "7.0.0-beta.60",
|
||||
"@storybook/addon-highlight": "7.0.0-beta.60",
|
||||
"@storybook/addon-measure": "7.0.0-beta.60",
|
||||
"@storybook/addon-outline": "7.0.0-beta.60",
|
||||
"@storybook/addon-toolbars": "7.0.0-beta.60",
|
||||
"@storybook/addon-viewport": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/addon-actions": "7.0.0-beta.64",
|
||||
"@storybook/addon-backgrounds": "7.0.0-beta.64",
|
||||
"@storybook/addon-controls": "7.0.0-beta.64",
|
||||
"@storybook/addon-docs": "7.0.0-beta.64",
|
||||
"@storybook/addon-highlight": "7.0.0-beta.64",
|
||||
"@storybook/addon-measure": "7.0.0-beta.64",
|
||||
"@storybook/addon-outline": "7.0.0-beta.64",
|
||||
"@storybook/addon-toolbars": "7.0.0-beta.64",
|
||||
"@storybook/addon-viewport": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"ts-dedent": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@storybook/vue": "7.0.0-beta.60",
|
||||
"@storybook/vue": "7.0.0-beta.64",
|
||||
"typescript": "^4.9.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@ -166,5 +166,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-mdx-gfm",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "GitHub Flavored Markdown in Storybook",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -69,5 +69,5 @@
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-highlight",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Highlight DOM nodes within your stories",
|
||||
"keywords": [
|
||||
"storybook-addons",
|
||||
@ -61,9 +61,9 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/preview-api": "7.0.0-beta.60"
|
||||
"@storybook/preview-api": "7.0.0-beta.64"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/webpack-env": "^1.16.0",
|
||||
@ -78,7 +78,7 @@
|
||||
"./src/preview.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"sbmodern": "dist/modern/index.js",
|
||||
"storybook": {
|
||||
"displayName": "Highlight",
|
||||
|
@ -1,8 +1,4 @@
|
||||
export { HIGHLIGHT, RESET_HIGHLIGHT } from './constants';
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
||||
// make it work with --isolatedModules
|
||||
export default {};
|
||||
|
@ -20,10 +20,6 @@ export const highlightObject = (color: string) => ({
|
||||
boxShadow: '0 0 0 6px rgba(255,255,255,0.6)',
|
||||
});
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
||||
interface HighlightInfo {
|
||||
/** html selector of the element */
|
||||
elements: string[];
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-interactions",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Automate, test and debug user interactions",
|
||||
"keywords": [
|
||||
"storybook-addons",
|
||||
@ -72,16 +72,16 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/instrumenter": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/instrumenter": "7.0.0-beta.64",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"jest-mock": "^27.0.6",
|
||||
"polished": "^4.2.2",
|
||||
"ts-dedent": "^2.2.0"
|
||||
@ -118,7 +118,7 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Interactions",
|
||||
"unsupportedFrameworks": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-jest",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "React storybook addon that show component jest report",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -70,13 +70,13 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"react-resize-detector": "^7.1.2",
|
||||
"upath": "^1.2.0"
|
||||
},
|
||||
@ -105,7 +105,7 @@
|
||||
],
|
||||
"platform": "browser"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Jest",
|
||||
"icon": "https://pbs.twimg.com/profile_images/821713465245102080/mMtKIMax_400x400.jpg",
|
||||
|
@ -1,5 +1,3 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import { addons } from '@storybook/preview-api';
|
||||
import { normalize, sep } from 'upath';
|
||||
import { ADD_TESTS, defineJestParameter } from './shared';
|
||||
@ -62,7 +60,3 @@ export const withTests = (userOptions: { results: any; filesExt?: string }) => {
|
||||
return storyFn();
|
||||
};
|
||||
};
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-links",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Link stories together to build demos and prototypes with your UI components",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -80,14 +80,14 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/csf": "next",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/router": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/router": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"prop-types": "^15.7.2",
|
||||
"ts-dedent": "^2.0.0"
|
||||
},
|
||||
@ -119,7 +119,7 @@
|
||||
],
|
||||
"post": "./scripts/fix-preview-api-reference.ts"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Links",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991673-48355c80-3c7c-11eb-9b6e-b627c96a75f6.png",
|
||||
|
@ -1,5 +1,3 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import { dedent } from 'ts-dedent';
|
||||
|
||||
let hasWarned = false;
|
||||
@ -20,7 +18,3 @@ export function LinkTo(): null {
|
||||
}
|
||||
|
||||
export { linkTo, hrefTo, withLinks, navigate } from './utils';
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-measure",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Inspect layouts by visualizing the box model",
|
||||
"keywords": [
|
||||
"storybook-addons",
|
||||
@ -75,13 +75,13 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60"
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "~4.9.3"
|
||||
@ -108,7 +108,7 @@
|
||||
"./src/preview.tsx"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Measure",
|
||||
"unsupportedFrameworks": [
|
||||
|
@ -1,8 +1,2 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
||||
// make it work with --isolatedModules
|
||||
export default {};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-outline",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Outline all elements with CSS to help with layout placement and alignment",
|
||||
"keywords": [
|
||||
"storybook-addons",
|
||||
@ -78,13 +78,13 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"ts-dedent": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -112,7 +112,7 @@
|
||||
"./src/preview.tsx"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Outline",
|
||||
"unsupportedFrameworks": [
|
||||
|
@ -1,8 +1,2 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
||||
// make it work with --isolatedModules
|
||||
export default {};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-storyshots",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Take a code snapshot of every story automatically with Jest",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -37,12 +37,12 @@
|
||||
"dependencies": {
|
||||
"@jest/transform": "^29.3.1",
|
||||
"@storybook/babel-plugin-require-context-hook": "1.0.1",
|
||||
"@storybook/client-api": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/core-webpack": "7.0.0-beta.60",
|
||||
"@storybook/client-api": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/core-webpack": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"@types/glob": "^7.1.3",
|
||||
"@types/jest-specific-snapshot": "^0.5.6",
|
||||
"glob": "^8.1.0",
|
||||
@ -57,11 +57,11 @@
|
||||
"@angular/core": "^13.3.6",
|
||||
"@angular/platform-browser-dynamic": "^13.3.6",
|
||||
"@emotion/jest": "^11.8.0",
|
||||
"@storybook/addon-docs": "7.0.0-beta.60",
|
||||
"@storybook/angular": "7.0.0-beta.60",
|
||||
"@storybook/react": "7.0.0-beta.60",
|
||||
"@storybook/vue": "7.0.0-beta.60",
|
||||
"@storybook/vue3": "7.0.0-beta.60",
|
||||
"@storybook/addon-docs": "7.0.0-beta.64",
|
||||
"@storybook/angular": "7.0.0-beta.64",
|
||||
"@storybook/react": "7.0.0-beta.64",
|
||||
"@storybook/vue": "7.0.0-beta.64",
|
||||
"@storybook/vue3": "7.0.0-beta.64",
|
||||
"babel-loader": "^9.1.2",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
@ -142,7 +142,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"bundler": {},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Storyshots",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991676-48cdf300-3c7c-11eb-8aa1-944dab6ab29b.png",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-storyshots-puppeteer",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Image snapshots addition to StoryShots based on puppeteer",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -36,8 +36,8 @@
|
||||
"dependencies": {
|
||||
"@axe-core/puppeteer": "^4.2.0",
|
||||
"@storybook/csf": "next",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"@types/jest-image-snapshot": "^5.1.0",
|
||||
"jest-image-snapshot": "^6.0.0"
|
||||
},
|
||||
@ -49,7 +49,7 @@
|
||||
"rimraf": "^3.0.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@storybook/addon-storyshots": "7.0.0-beta.60",
|
||||
"@storybook/addon-storyshots": "7.0.0-beta.64",
|
||||
"puppeteer": ">=2.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
@ -61,5 +61,5 @@
|
||||
"access": "public"
|
||||
},
|
||||
"bundler": {},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-storysource",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "View a story’s source code to see how it works and paste into your app",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -54,13 +54,13 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/router": "7.0.0-beta.60",
|
||||
"@storybook/source-loader": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/router": "7.0.0-beta.64",
|
||||
"@storybook/source-loader": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"estraverse": "^5.2.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"react-syntax-highlighter": "^15.5.0"
|
||||
@ -92,7 +92,7 @@
|
||||
"./src/preset.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Storysource",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991675-48cdf300-3c7c-11eb-9400-58de5ac6daa7.png",
|
||||
|
@ -1,9 +1,3 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import { ADDON_ID, PANEL_ID } from './events';
|
||||
|
||||
export { ADDON_ID, PANEL_ID };
|
||||
|
||||
if (module && module.hot && module.hot.decline) {
|
||||
module.hot.decline();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-toolbars",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Create your own toolbar items that control story rendering",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -68,11 +68,11 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60"
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "~4.9.3"
|
||||
@ -99,7 +99,7 @@
|
||||
],
|
||||
"platform": "browser"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Toolbars",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991677-48cdf300-3c7c-11eb-93b4-19b0e3366959.png",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-viewport",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Build responsive components by adjusting Storybook’s viewport size and orientation",
|
||||
"keywords": [
|
||||
"addon",
|
||||
@ -73,13 +73,13 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"memoizerific": "^1.11.3",
|
||||
"prop-types": "^15.7.2"
|
||||
},
|
||||
@ -109,7 +109,7 @@
|
||||
"./src/preview.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11",
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3",
|
||||
"storybook": {
|
||||
"displayName": "Viewport",
|
||||
"icon": "https://user-images.githubusercontent.com/263385/101991678-48cdf300-3c7c-11eb-9764-f8af293c1b28.png",
|
||||
|
@ -2,9 +2,16 @@
|
||||
|
||||
- [Storybook for Angular](#storybook-for-angular)
|
||||
- [Getting Started](#getting-started)
|
||||
- [Setup Compodoc](#setup-compodoc)
|
||||
- [Support for multi-project workspace](#support-for-multi-project-workspace)
|
||||
- [Setup Storybook for your Angular projects](#setup-storybook-for-your-angular-projects)
|
||||
- [Run Storybook](#run-storybook)
|
||||
- [Setup Compodoc](#setup-compodoc)
|
||||
- [Automatic setup](#automatic-setup)
|
||||
- [Manual setup](#manual-setup)
|
||||
- [FAQ](#faq)
|
||||
- [How do I migrate to a Angular Storybook builder?](#how-do-i-migrate-to-a-angular-storybook-builder)
|
||||
- [Do you have only one Angular project in your workspace?](#do-you-have-only-one-angular-project-in-your-workspace)
|
||||
- [Adjust your `package.json`](#adjust-your-packagejson)
|
||||
- [I have multiple projects in my Angular workspace](#i-have-multiple-projects-in-my-angular-workspace)
|
||||
|
||||
Storybook for Angular is a UI development environment for your Angular components.
|
||||
With it, you can visualize different states of your UI components and develop them interactively.
|
||||
@ -21,15 +28,9 @@ cd my-angular-app
|
||||
npx storybook init
|
||||
```
|
||||
|
||||
### Setup Compodoc
|
||||
## Setup Storybook for your Angular projects
|
||||
|
||||
When installing, you will be given the option to set up Compodoc, which is a tool for creating documentation for Angular projects.
|
||||
|
||||
You can include JSDoc comments above components, directives, and other parts of your Angular code to include documentation for those elements. Compodoc uses these comments to generate documentation for your application. In Storybook, it is useful to add explanatory comments above @Inputs and @Outputs, since these are the main elements that Storybook displays in its user interface. The @Inputs and @Outputs are the elements that you can interact with in Storybook, such as controls.
|
||||
|
||||
## Support for multi-project workspace
|
||||
|
||||
Storybook supports Angular multi-project workspace. You can setup Storybook for each project in the workspace. When running `npx storybook init` you will be asked for which project Storybook should be set up. Essentially, during initialization, the `angular.json` will be edited to add the Storybook configuration for the selected project. The configuration looks approximately like this:
|
||||
Storybook supports Angular multi-project workspace. You can setup Storybook for each project in the workspace. When running `npx storybook init` you will be asked for which project Storybook should be set up. Essentially, during initialization, the `.storybook` folder will be created and the `angular.json` will be edited to add the Storybook configuration for the selected project. The configuration looks approximately like this:
|
||||
|
||||
```json
|
||||
// angular.json
|
||||
@ -44,10 +45,14 @@ Storybook supports Angular multi-project workspace. You can setup Storybook for
|
||||
"storybook": {
|
||||
"builder": "@storybook/angular:start-storybook",
|
||||
"options": {
|
||||
// the path to the storybook config directory
|
||||
"configDir": ".storybook",
|
||||
// the build target of your project
|
||||
"browserTarget": "your-project:build",
|
||||
"compodoc": false,
|
||||
// the port you want to start Storybook on
|
||||
"port": 6006
|
||||
// further options are available and can be found in
|
||||
// https://github.com/storybookjs/storybook/tree/next/code/frameworks/angular/src/builders/start-storybook/schema.json
|
||||
}
|
||||
},
|
||||
"build-storybook": {
|
||||
@ -55,8 +60,9 @@ Storybook supports Angular multi-project workspace. You can setup Storybook for
|
||||
"options": {
|
||||
"configDir": ".storybook",
|
||||
"browserTarget": "your-project:build",
|
||||
"compodoc": false,
|
||||
"outputDir": "dist/storybook/your-project"
|
||||
// further options are available and can be found in
|
||||
// https://github.com/storybookjs/storybook/tree/next/code/frameworks/angular/src/builders/build-storybook/schema.json
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -70,19 +76,161 @@ Storybook supports Angular multi-project workspace. You can setup Storybook for
|
||||
To run Storybook for a particular project, please run:
|
||||
|
||||
```sh
|
||||
ng run your-project:storybook
|
||||
ng run <your-project>:storybook
|
||||
```
|
||||
|
||||
To build Storybook, run:
|
||||
|
||||
```sh
|
||||
ng run your-project:build-storybook
|
||||
ng run <your-project>:build-storybook
|
||||
```
|
||||
|
||||
You will find the output in `dist/storybook/your-project`.
|
||||
|
||||
For more information visit: [storybook.js.org](https://storybook.js.org)
|
||||
|
||||
## Setup Compodoc
|
||||
|
||||
You can include JSDoc comments above components, directives, and other parts of your Angular code to include documentation for those elements. Compodoc uses these comments to generate documentation for your application. In Storybook, it is useful to add explanatory comments above @Inputs and @Outputs, since these are the main elements that Storybook displays in its user interface. The @Inputs and @Outputs are the elements that you can interact with in Storybook, such as controls.
|
||||
|
||||
### Automatic setup
|
||||
|
||||
When installing Storybook via `sb init`, you will be given the option to set up Compodoc automatically.
|
||||
|
||||
### Manual setup
|
||||
|
||||
If you have already installed Storybook, you can set up Compodoc manually.
|
||||
|
||||
Install the following dependencies:
|
||||
|
||||
```sh
|
||||
npm i -D @compodoc/compodoc
|
||||
```
|
||||
|
||||
Add the following option to your to the Storybook Builder:
|
||||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"projects": {
|
||||
...
|
||||
"your-project": {
|
||||
...
|
||||
"architect": {
|
||||
...
|
||||
"storybook": {
|
||||
"builder": "@storybook/angular:start-storybook",
|
||||
"options": {
|
||||
...
|
||||
"compodoc": true,
|
||||
"compodocArgs": [
|
||||
"-e",
|
||||
"json",
|
||||
"-d",
|
||||
// Where to store the generated documentation. It's usually the root of your Angular project. It's not necessarily the root of your Angular Workspace!
|
||||
"."
|
||||
],
|
||||
}
|
||||
},
|
||||
"build-storybook": {
|
||||
"builder": "@storybook/angular:build-storybook",
|
||||
"options": {
|
||||
...
|
||||
"compodoc": true,
|
||||
"compodocArgs": [
|
||||
"-e",
|
||||
"json",
|
||||
"-d",
|
||||
"."
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Go to your `.storybook/preview.js` and add the following:
|
||||
|
||||
```js
|
||||
import { setCompodocJson } from '@storybook/addon-docs/angular';
|
||||
import docJson from '../documentation.json';
|
||||
setCompodocJson(docJson);
|
||||
|
||||
const preview: Preview = {
|
||||
...
|
||||
};
|
||||
|
||||
export default preview;
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### How do I migrate to a Angular Storybook builder?
|
||||
|
||||
The Storybook [Angular builder](https://angular.io/guide/glossary#builder) is a new way to run Storybook in an Angular workspace. It is a drop-in replacement for running `storybook dev` and `storybook build` directly.
|
||||
|
||||
#### Do you have only one Angular project in your workspace?
|
||||
|
||||
In this case go to your `angular.json` and add `storybook` and `build-storybook` entries in `architect` section of your project like shown above.
|
||||
|
||||
##### Adjust your `package.json`
|
||||
|
||||
Go to your `package.json` and adjust your script section. Usually, it will look like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"storybook": "start-storybook -p 6006", // or `storybook dev -p 6006`
|
||||
"build-storybook": "build-storybook" // or `storybook build`
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Now, you can run Storybook with `ng run <your-project>:storybook` and build it with `ng run <your-project>:build-storybook`. Adjust the scripts in your `package.json` accordingly.
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"storybook": "ng run <project-name>:storybook", // or `storybook dev -p 6006`
|
||||
"build-storybook": "ng run <project-name>:build-storybook" // or `storybook build`
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Also remove the compodoc part in your script section if you have set it up previously.
|
||||
It is now built-in in `@storybook/angular` and you don't have to call it explicitly:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"docs:json": "compodoc -p tsconfig.json -e json -d ./documentation",
|
||||
"storybook": "npm run docs:json && start-storybook -p 6006",
|
||||
"build-storybook": "npm run docs:json && build-storybook"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Change it to:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"storybook": "ng run <project-name>:storybook",
|
||||
"build-storybook": "ng run <project-name>:build-storybook"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### I have multiple projects in my Angular workspace
|
||||
|
||||
In this case you have to adjust your `angular.json` and `package.json` as described above for each project in which you want to use Storybook. Please note, that each project should have a dedicated `.storybook` folder, which should be placed in the root of the project.
|
||||
|
||||
You can run `npx sb init` sequentially for each project to setup Storybook for each of them to automatically create the `.storybook` folder and create the necessary configuration in your `angular.json`.
|
||||
|
||||
You can then use [Storybook composition](https://storybook.js.org/docs/angular/sharing/storybook-composition) to composite multiple Storybooks into one.
|
||||
|
||||
---
|
||||
|
||||
Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish.
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/angular",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
||||
"keywords": [
|
||||
"storybook",
|
||||
@ -36,20 +36,20 @@
|
||||
"prep": "../../../scripts/prepare/tsc.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/cli": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/core-client": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/core-server": "7.0.0-beta.60",
|
||||
"@storybook/core-webpack": "7.0.0-beta.60",
|
||||
"@storybook/docs-tools": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/cli": "7.0.0-beta.64",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/core-client": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/core-server": "7.0.0-beta.64",
|
||||
"@storybook/core-webpack": "7.0.0-beta.64",
|
||||
"@storybook/docs-tools": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0",
|
||||
"@types/react": "^16.14.34",
|
||||
"@types/react-dom": "^16.9.14",
|
||||
@ -123,5 +123,5 @@
|
||||
"bundler": {
|
||||
"tsConfig": "tsconfig.build.json"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import { buildStaticStandalone, withTelemetry } from '@storybook/core-server';
|
||||
import { StyleElement } from '@angular-devkit/build-angular/src/builders/browser/schema';
|
||||
import { StandaloneOptions } from '../utils/standalone-options';
|
||||
import { runCompodoc } from '../utils/run-compodoc';
|
||||
import { buildStandaloneErrorHandler } from '../utils/build-standalone-errors-handler';
|
||||
import { errorSummary, printErrorDetails } from '../utils/error-handler';
|
||||
|
||||
export type StorybookBuilderOptions = JsonObject & {
|
||||
browserTarget?: string | null;
|
||||
@ -121,8 +121,9 @@ function runInstance(options: StandaloneBuildOptions) {
|
||||
{
|
||||
cliOptions: options,
|
||||
presetOptions: { ...options, corePresets: [], overridePresets: [] },
|
||||
printError: printErrorDetails,
|
||||
},
|
||||
() => buildStaticStandalone(options)
|
||||
)
|
||||
).pipe(catchError((error: any) => throwError(buildStandaloneErrorHandler(error))));
|
||||
).pipe(catchError((error: any) => throwError(errorSummary(error))));
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import { buildDevStandalone, withTelemetry } from '@storybook/core-server';
|
||||
import { StyleElement } from '@angular-devkit/build-angular/src/builders/browser/schema';
|
||||
import { StandaloneOptions } from '../utils/standalone-options';
|
||||
import { runCompodoc } from '../utils/run-compodoc';
|
||||
import { buildStandaloneErrorHandler } from '../utils/build-standalone-errors-handler';
|
||||
import { printErrorDetails, errorSummary } from '../utils/error-handler';
|
||||
|
||||
export type StorybookBuilderOptions = JsonObject & {
|
||||
browserTarget?: string | null;
|
||||
@ -139,12 +139,13 @@ function runInstance(options: StandaloneOptions) {
|
||||
{
|
||||
cliOptions: options,
|
||||
presetOptions: { ...options, corePresets: [], overridePresets: [] },
|
||||
printError: printErrorDetails,
|
||||
},
|
||||
() =>
|
||||
buildDevStandalone(options).then(
|
||||
({ port }) => observer.next(port),
|
||||
(error) => observer.error(buildStandaloneErrorHandler(error))
|
||||
)
|
||||
);
|
||||
() => buildDevStandalone(options)
|
||||
)
|
||||
.then(({ port }) => observer.next(port))
|
||||
.catch((error) => {
|
||||
observer.error(errorSummary(error));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { logger, instance as npmLog } from '@storybook/node-logger';
|
||||
import { dedent } from 'ts-dedent';
|
||||
|
||||
export const buildStandaloneErrorHandler = (error: any): any => {
|
||||
export const printErrorDetails = (error: any): void => {
|
||||
// Duplicate code for Standalone error handling
|
||||
// Source: https://github.com/storybookjs/storybook/blob/39c7ba09ad84fbd466f9c25d5b92791a5450b9f6/lib/core-server/src/build-dev.ts#L136
|
||||
npmLog.heading = '';
|
||||
@ -19,6 +19,9 @@ export const buildStandaloneErrorHandler = (error: any): any => {
|
||||
}
|
||||
|
||||
logger.line();
|
||||
};
|
||||
|
||||
export const errorSummary = (error: any): string => {
|
||||
return error.close
|
||||
? dedent`
|
||||
FATAL broken build!, will close the process,
|
@ -1,7 +1,9 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import { PresetProperty } from '@storybook/types';
|
||||
import { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
require.resolve('./server/framework-preset-angular-cli'),
|
||||
require.resolve('./server/framework-preset-angular-ivy'),
|
||||
@ -19,9 +21,7 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/ember",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.",
|
||||
"homepage": "https://github.com/storybookjs/storybook/tree/main/frameworks/ember",
|
||||
"bugs": {
|
||||
@ -31,12 +31,12 @@
|
||||
"prep": "../../../scripts/prepare/tsc.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/docs-tools": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/docs-tools": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"ts-dedent": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -59,5 +59,5 @@
|
||||
"access": "public"
|
||||
},
|
||||
"bundler": {},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
require.resolve('./server/framework-preset-babel-ember'),
|
||||
require.resolve('./server/framework-preset-ember-docs'),
|
||||
@ -13,9 +15,7 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/html-vite",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for HTML and Vite: Develop HTML in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,15 +48,15 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/addons": "7.0.0-beta.60",
|
||||
"@storybook/builder-vite": "7.0.0-beta.60",
|
||||
"@storybook/channel-postmessage": "7.0.0-beta.60",
|
||||
"@storybook/channel-websocket": "7.0.0-beta.60",
|
||||
"@storybook/client-api": "7.0.0-beta.60",
|
||||
"@storybook/core-server": "7.0.0-beta.60",
|
||||
"@storybook/html": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/preview-web": "7.0.0-beta.60",
|
||||
"@storybook/addons": "7.0.0-beta.64",
|
||||
"@storybook/builder-vite": "7.0.0-beta.64",
|
||||
"@storybook/channel-postmessage": "7.0.0-beta.64",
|
||||
"@storybook/channel-websocket": "7.0.0-beta.64",
|
||||
"@storybook/client-api": "7.0.0-beta.64",
|
||||
"@storybook/core-server": "7.0.0-beta.64",
|
||||
"@storybook/html": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/preview-web": "7.0.0-beta.64",
|
||||
"magic-string": "^0.27.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -76,5 +76,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/html-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for HTML: View HTML snippets in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,11 +48,11 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/html": "7.0.0-beta.60",
|
||||
"@storybook/preset-html-webpack": "7.0.0-beta.60",
|
||||
"@storybook/html": "7.0.0-beta.64",
|
||||
"@storybook/preset-html-webpack": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -76,5 +76,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
path.dirname(require.resolve(path.join('@storybook/preset-html-webpack', 'package.json'))),
|
||||
wrapForPnP('@storybook/preset-html-webpack'),
|
||||
];
|
||||
|
||||
export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
|
||||
@ -12,11 +14,9 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
renderer: path.dirname(require.resolve(path.join('@storybook/html', 'package.json'))),
|
||||
renderer: wrapForPnP('@storybook/html'),
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/nextjs",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Next.js",
|
||||
"keywords": [
|
||||
"storybook",
|
||||
@ -71,13 +71,13 @@
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.21.0",
|
||||
"@babel/runtime": "^7.21.0",
|
||||
"@storybook/addon-actions": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/preset-react-webpack": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/react": "7.0.0-beta.60",
|
||||
"@storybook/addon-actions": "7.0.0-beta.64",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/preset-react-webpack": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/react": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0",
|
||||
"css-loader": "^6.7.3",
|
||||
"find-up": "^5.0.0",
|
||||
@ -148,5 +148,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/preact-vite",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Preact and Vite: Develop Preact components in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,8 +48,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@preact/preset-vite": "^2.0.0",
|
||||
"@storybook/builder-vite": "7.0.0-beta.60",
|
||||
"@storybook/preact": "7.0.0-beta.60"
|
||||
"@storybook/builder-vite": "7.0.0-beta.64",
|
||||
"@storybook/preact": "7.0.0-beta.64"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.0.0",
|
||||
@ -73,5 +73,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/preact-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Preact: Develop Preact Component in isolation.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,10 +48,10 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/preact": "7.0.0-beta.60",
|
||||
"@storybook/preset-preact-webpack": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/preact": "7.0.0-beta.64",
|
||||
"@storybook/preset-preact-webpack": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -77,5 +77,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
path.dirname(require.resolve(path.join('@storybook/preset-preact-webpack', 'package.json'))),
|
||||
wrapForPnP('@storybook/preset-preact-webpack'),
|
||||
];
|
||||
|
||||
export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
|
||||
@ -12,11 +14,9 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
renderer: path.dirname(require.resolve(path.join('@storybook/preact', 'package.json'))),
|
||||
renderer: wrapForPnP('@storybook/preact'),
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/react-vite",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for React and Vite: Develop React components in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -50,8 +50,8 @@
|
||||
"dependencies": {
|
||||
"@joshwooding/vite-plugin-react-docgen-typescript": "^0.2.1",
|
||||
"@rollup/pluginutils": "^4.2.0",
|
||||
"@storybook/builder-vite": "7.0.0-beta.60",
|
||||
"@storybook/react": "7.0.0-beta.60",
|
||||
"@storybook/builder-vite": "7.0.0-beta.64",
|
||||
"@storybook/react": "7.0.0-beta.64",
|
||||
"@vitejs/plugin-react": "^3.0.1",
|
||||
"ast-types": "^0.14.2",
|
||||
"magic-string": "^0.27.0",
|
||||
@ -80,5 +80,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
/* eslint-disable global-require */
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import { hasVitePlugins } from '@storybook/builder-vite';
|
||||
import { dirname, join } from 'path';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const core: PresetProperty<'core', StorybookConfig> = {
|
||||
builder: '@storybook/builder-vite',
|
||||
renderer: '@storybook/react',
|
||||
builder: wrapForPnP('@storybook/builder-vite') as '@storybook/builder-vite',
|
||||
renderer: wrapForPnP('@storybook/react'),
|
||||
};
|
||||
|
||||
export const viteFinal: StorybookConfig['viteFinal'] = async (config, { presets }) => {
|
||||
|
@ -1,11 +1,24 @@
|
||||
import type { StorybookConfig as StorybookConfigBase } from '@storybook/types';
|
||||
import type {
|
||||
StorybookConfig as StorybookConfigBase,
|
||||
TypescriptOptions as TypescriptOptionsBase,
|
||||
} from '@storybook/types';
|
||||
import type { StorybookConfigVite, BuilderOptions } from '@storybook/builder-vite';
|
||||
import type docgenTypescript from '@joshwooding/vite-plugin-react-docgen-typescript';
|
||||
|
||||
type FrameworkName = '@storybook/react-vite';
|
||||
type BuilderName = '@storybook/builder-vite';
|
||||
|
||||
export type FrameworkOptions = {
|
||||
builder?: BuilderOptions;
|
||||
strictMode?: boolean;
|
||||
/**
|
||||
* Use React's legacy root API to mount components
|
||||
* @description
|
||||
* React has introduced a new root API with React 18.x to enable a whole set of new features (e.g. concurrent features)
|
||||
* If this flag is true, the legacy Root API is used to mount components to make it easier to migrate step by step to React 18.
|
||||
* @default false
|
||||
*/
|
||||
legacyRootApi?: boolean;
|
||||
};
|
||||
|
||||
type StorybookConfigFramework = {
|
||||
@ -25,6 +38,19 @@ type StorybookConfigFramework = {
|
||||
};
|
||||
};
|
||||
|
||||
type TypescriptOptions = TypescriptOptionsBase & {
|
||||
/**
|
||||
* Sets the type of Docgen when working with React and TypeScript
|
||||
*
|
||||
* @default `'react-docgen-typescript'`
|
||||
*/
|
||||
reactDocgen: 'react-docgen-typescript' | 'react-docgen' | false;
|
||||
/**
|
||||
* Configures `@joshwooding/vite-plugin-react-docgen-typescript`
|
||||
*/
|
||||
reactDocgenTypescriptOptions: Parameters<typeof docgenTypescript>[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* The interface for Storybook configuration in `main.ts` files.
|
||||
*/
|
||||
@ -33,4 +59,6 @@ export type StorybookConfig = Omit<
|
||||
keyof StorybookConfigVite | keyof StorybookConfigFramework
|
||||
> &
|
||||
StorybookConfigVite &
|
||||
StorybookConfigFramework;
|
||||
StorybookConfigFramework & {
|
||||
typescript?: Partial<TypescriptOptions>;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/react-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,9 +48,9 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/preset-react-webpack": "7.0.0-beta.60",
|
||||
"@storybook/react": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/preset-react-webpack": "7.0.0-beta.64",
|
||||
"@storybook/react": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -83,5 +83,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty, Options } from '@storybook/types';
|
||||
import type { FrameworkOptions, StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
path.dirname(require.resolve(path.join('@storybook/preset-react-webpack', 'package.json'))),
|
||||
wrapForPnP('@storybook/preset-react-webpack'),
|
||||
];
|
||||
|
||||
const defaultFrameworkOptions: FrameworkOptions = {
|
||||
@ -26,7 +28,7 @@ export const frameworkOptions = async (
|
||||
}
|
||||
if (typeof config === 'undefined') {
|
||||
return {
|
||||
name: require.resolve('@storybook/react-webpack5') as '@storybook/react-webpack5',
|
||||
name: wrapForPnP('@storybook/react-webpack5') as '@storybook/react-webpack5',
|
||||
options: defaultFrameworkOptions,
|
||||
};
|
||||
}
|
||||
@ -46,12 +48,10 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
renderer: path.dirname(require.resolve(path.join('@storybook/react', 'package.json'))),
|
||||
renderer: wrapForPnP('@storybook/react'),
|
||||
};
|
||||
};
|
||||
|
||||
@ -60,9 +60,7 @@ export const webpack: StorybookConfig['webpack'] = async (config) => {
|
||||
|
||||
config.resolve.alias = {
|
||||
...config.resolve?.alias,
|
||||
'@storybook/react': path.dirname(
|
||||
require.resolve(path.join('@storybook/react', 'package.json'))
|
||||
),
|
||||
'@storybook/react': wrapForPnP('@storybook/react'),
|
||||
};
|
||||
return config;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/server-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,10 +48,10 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/preset-server-webpack": "7.0.0-beta.60",
|
||||
"@storybook/server": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/preset-server-webpack": "7.0.0-beta.64",
|
||||
"@storybook/server": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -74,5 +74,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
path.dirname(require.resolve(path.join('@storybook/preset-server-webpack', 'package.json'))),
|
||||
wrapForPnP('@storybook/preset-server-webpack'),
|
||||
];
|
||||
|
||||
export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
|
||||
@ -12,11 +14,9 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
renderer: path.dirname(require.resolve(path.join('@storybook/server', 'package.json'))),
|
||||
renderer: wrapForPnP('@storybook/server'),
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/svelte-vite",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Svelte and Vite: Develop Svelte components in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,9 +48,9 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-vite": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/svelte": "7.0.0-beta.60",
|
||||
"@storybook/builder-vite": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/svelte": "7.0.0-beta.64",
|
||||
"@sveltejs/vite-plugin-svelte": "^2.0.0",
|
||||
"magic-string": "^0.27.0",
|
||||
"svelte": "^3.0.0",
|
||||
@ -80,5 +80,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/svelte-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Svelte: Develop Svelte Component in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,10 +48,10 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/preset-svelte-webpack": "7.0.0-beta.60",
|
||||
"@storybook/svelte": "7.0.0-beta.60"
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/preset-svelte-webpack": "7.0.0-beta.64",
|
||||
"@storybook/svelte": "7.0.0-beta.64"
|
||||
},
|
||||
"devDependencies": {
|
||||
"svelte": "^3.48.0",
|
||||
@ -78,5 +78,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
path.dirname(require.resolve(path.join('@storybook/preset-svelte-webpack', 'package.json'))),
|
||||
wrapForPnP('@storybook/preset-svelte-webpack'),
|
||||
];
|
||||
|
||||
export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
|
||||
@ -12,11 +14,9 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
renderer: path.dirname(require.resolve(path.join('@storybook/svelte', 'package.json'))),
|
||||
renderer: wrapForPnP('@storybook/svelte'),
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/sveltekit",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for SvelteKit",
|
||||
"keywords": [
|
||||
"storybook",
|
||||
@ -51,9 +51,9 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-vite": "7.0.0-beta.60",
|
||||
"@storybook/svelte": "7.0.0-beta.60",
|
||||
"@storybook/svelte-vite": "7.0.0-beta.60"
|
||||
"@storybook/builder-vite": "7.0.0-beta.64",
|
||||
"@storybook/svelte": "7.0.0-beta.64",
|
||||
"@storybook/svelte-vite": "7.0.0-beta.64"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.0.0",
|
||||
@ -76,5 +76,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/vue-vite",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Vue2 and Vite: Develop Vue2 Components in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,10 +48,10 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-vite": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/core-server": "7.0.0-beta.60",
|
||||
"@storybook/vue": "7.0.0-beta.60",
|
||||
"@storybook/builder-vite": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/core-server": "7.0.0-beta.64",
|
||||
"@storybook/vue": "7.0.0-beta.64",
|
||||
"magic-string": "^0.27.0",
|
||||
"vue-docgen-api": "^4.40.0"
|
||||
},
|
||||
@ -79,5 +79,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/vue-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Vue: Develop Vue Component in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,10 +48,10 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/preset-vue-webpack": "7.0.0-beta.60",
|
||||
"@storybook/vue": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/preset-vue-webpack": "7.0.0-beta.64",
|
||||
"@storybook/vue": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -83,5 +83,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
path.dirname(require.resolve(path.join('@storybook/preset-vue-webpack', 'package.json'))),
|
||||
wrapForPnP('@storybook/preset-vue-webpack'),
|
||||
];
|
||||
|
||||
export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
|
||||
@ -12,12 +14,10 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
renderer: path.dirname(require.resolve(path.join('@storybook/vue', 'package.json'))),
|
||||
renderer: wrapForPnP('@storybook/vue'),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/vue3-vite",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Vue3 and Vite: Develop Vue3 components in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,9 +48,9 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-vite": "7.0.0-beta.60",
|
||||
"@storybook/core-server": "7.0.0-beta.60",
|
||||
"@storybook/vue3": "7.0.0-beta.60",
|
||||
"@storybook/builder-vite": "7.0.0-beta.64",
|
||||
"@storybook/core-server": "7.0.0-beta.64",
|
||||
"@storybook/vue3": "7.0.0-beta.64",
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
"magic-string": "^0.27.0",
|
||||
"vue-docgen-api": "^4.40.0"
|
||||
@ -78,5 +78,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/vue3-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for Vue 3: Develop Vue 3 Components in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,10 +48,10 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/preset-vue3-webpack": "7.0.0-beta.60",
|
||||
"@storybook/vue3": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/preset-vue3-webpack": "7.0.0-beta.64",
|
||||
"@storybook/vue3": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -80,5 +80,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
path.dirname(require.resolve(path.join('@storybook/preset-vue3-webpack', 'package.json'))),
|
||||
wrapForPnP('@storybook/preset-vue3-webpack'),
|
||||
];
|
||||
|
||||
export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
|
||||
@ -12,12 +14,10 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
renderer: path.dirname(require.resolve(path.join('@storybook/vue3', 'package.json'))),
|
||||
renderer: wrapForPnP('@storybook/vue3'),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/web-components-vite",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for web-components and Vite: Develop Web Components in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -48,10 +48,10 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/builder-vite": "7.0.0-beta.60",
|
||||
"@storybook/core-server": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/web-components": "7.0.0-beta.60",
|
||||
"@storybook/builder-vite": "7.0.0-beta.64",
|
||||
"@storybook/core-server": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/web-components": "7.0.0-beta.64",
|
||||
"magic-string": "^0.27.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -75,5 +75,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/web-components-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook for web-components: View web components snippets in isolation with Hot Reloading.",
|
||||
"keywords": [
|
||||
"lit",
|
||||
@ -52,10 +52,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/preset-web-components-webpack": "7.0.0-beta.60",
|
||||
"@storybook/web-components": "7.0.0-beta.60",
|
||||
"@storybook/builder-webpack5": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/preset-web-components-webpack": "7.0.0-beta.64",
|
||||
"@storybook/web-components": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -80,5 +80,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import path from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import type { PresetProperty } from '@storybook/types';
|
||||
import type { StorybookConfig } from './types';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
export const addons: PresetProperty<'addons', StorybookConfig> = [
|
||||
path.dirname(
|
||||
require.resolve(path.join('@storybook/preset-web-components-webpack', 'package.json'))
|
||||
),
|
||||
wrapForPnP('@storybook/preset-web-components-webpack'),
|
||||
];
|
||||
|
||||
export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
|
||||
@ -14,11 +14,9 @@ export const core: PresetProperty<'core', StorybookConfig> = async (config, opti
|
||||
return {
|
||||
...config,
|
||||
builder: {
|
||||
name: path.dirname(
|
||||
require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))
|
||||
) as '@storybook/builder-webpack5',
|
||||
name: wrapForPnP('@storybook/builder-webpack5') as '@storybook/builder-webpack5',
|
||||
options: typeof framework === 'string' ? {} : framework.options.builder || {},
|
||||
},
|
||||
renderer: path.dirname(require.resolve(path.join('@storybook/web-components', 'package.json'))),
|
||||
renderer: wrapForPnP('@storybook/web-components'),
|
||||
};
|
||||
};
|
||||
|
@ -17,8 +17,8 @@ const localStorageMock = {
|
||||
setItem: jest.fn().mockName('setItem'),
|
||||
clear: jest.fn().mockName('clear'),
|
||||
};
|
||||
// @ts-expect-error (Converted from ts-ignore)
|
||||
global.localStorage = localStorageMock;
|
||||
|
||||
Object.defineProperty(global, 'localStorage', { value: localStorageMock, writable: true });
|
||||
|
||||
/* Fail tests on PropType warnings
|
||||
This allows us to throw an error in tests environments when there are prop-type warnings.
|
||||
|
@ -2,5 +2,5 @@
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"registry": "https://registry.npmjs.org",
|
||||
"version": "7.0.0-beta.60"
|
||||
"version": "7.0.0-beta.64"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addons",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook addons store",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -44,9 +44,9 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60"
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
||||
@ -60,5 +60,5 @@
|
||||
"./src/index.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/builder-manager",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook manager builder",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -44,9 +44,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/manager": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/manager": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@types/ejs": "^3.1.1",
|
||||
"@types/find-cache-dir": "^3.2.1",
|
||||
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.10",
|
||||
@ -73,5 +73,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/builder-vite",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "A plugin to run and build Storybooks with Vite",
|
||||
"homepage": "https://github.com/storybookjs/storybook/tree/main/code/lib/builder-vite/#readme",
|
||||
"bugs": {
|
||||
@ -42,16 +42,16 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/channel-postmessage": "7.0.0-beta.60",
|
||||
"@storybook/channel-websocket": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/csf-plugin": "7.0.0-beta.60",
|
||||
"@storybook/channel-postmessage": "7.0.0-beta.64",
|
||||
"@storybook/channel-websocket": "7.0.0-beta.64",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/csf-plugin": "7.0.0-beta.64",
|
||||
"@storybook/mdx2-csf": "next",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/preview": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/preview": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"browser-assert": "^1.2.1",
|
||||
"es-module-lexer": "^0.9.3",
|
||||
"express": "^4.17.3",
|
||||
@ -100,5 +100,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import type { Options, PreviewAnnotation } from '@storybook/types';
|
||||
import { virtualPreviewFile, virtualStoriesFile } from './virtual-file-names';
|
||||
import { processPreviewAnnotation } from './utils/process-preview-annotation';
|
||||
|
||||
export async function generateIframeScriptCode(options: Options) {
|
||||
export async function generateIframeScriptCode(options: Options, projectRoot: string) {
|
||||
const { presets } = options;
|
||||
const rendererName = await getRendererName(options);
|
||||
|
||||
@ -12,7 +12,9 @@ export async function generateIframeScriptCode(options: Options) {
|
||||
[],
|
||||
options
|
||||
);
|
||||
const configEntries = [...previewAnnotations].filter(Boolean).map(processPreviewAnnotation);
|
||||
const configEntries = [...previewAnnotations]
|
||||
.filter(Boolean)
|
||||
.map((path) => processPreviewAnnotation(path, projectRoot));
|
||||
|
||||
const filesToImport = (files: string[], name: string) =>
|
||||
files.map((el, i) => `import ${name ? `* as ${name}_${i} from ` : ''}'${el}'`).join('\n');
|
||||
|
@ -3,7 +3,7 @@ import type { Options, PreviewAnnotation } from '@storybook/types';
|
||||
import { virtualStoriesFile, virtualAddonSetupFile } from './virtual-file-names';
|
||||
import { processPreviewAnnotation } from './utils/process-preview-annotation';
|
||||
|
||||
export async function generateModernIframeScriptCode(options: Options) {
|
||||
export async function generateModernIframeScriptCode(options: Options, projectRoot: string) {
|
||||
const { presets, configDir } = options;
|
||||
const frameworkName = await getFrameworkName(options);
|
||||
|
||||
@ -13,9 +13,20 @@ export async function generateModernIframeScriptCode(options: Options) {
|
||||
[],
|
||||
options
|
||||
);
|
||||
const relativePreviewAnnotations = [...previewAnnotations, previewOrConfigFile]
|
||||
const previewAnnotationURLs = [...previewAnnotations, previewOrConfigFile]
|
||||
.filter(Boolean)
|
||||
.map(processPreviewAnnotation);
|
||||
.map((path) => processPreviewAnnotation(path, projectRoot));
|
||||
|
||||
// This is pulled out to a variable because it is reused in both the initial page load
|
||||
// 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 configs = await Promise.all([${previewAnnotationURLs
|
||||
.map((previewAnnotation) => `import('${previewAnnotation}')`)
|
||||
.join(',\n')}])
|
||||
return composeConfigs(configs);
|
||||
}`;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
const generateHMRHandler = (frameworkName: string): string => {
|
||||
@ -34,13 +45,10 @@ export async function generateModernIframeScriptCode(options: Options) {
|
||||
window.__STORYBOOK_PREVIEW__.onStoriesChanged({ importFn: newModule.importFn });
|
||||
});
|
||||
|
||||
import.meta.hot.accept(${JSON.stringify(
|
||||
relativePreviewAnnotations
|
||||
)}, ([...newConfigEntries]) => {
|
||||
const newGetProjectAnnotations = () => composeConfigs(newConfigEntries);
|
||||
|
||||
import.meta.hot.accept(${JSON.stringify(previewAnnotationURLs)}, () => {
|
||||
${getPreviewAnnotationsFunction}
|
||||
// getProjectAnnotations has changed so we need to patch the new one in
|
||||
window.__STORYBOOK_PREVIEW__.onGetProjectAnnotationsChanged({ getProjectAnnotations: newGetProjectAnnotations });
|
||||
window.__STORYBOOK_PREVIEW__.onGetProjectAnnotationsChanged({ getProjectAnnotations });
|
||||
});
|
||||
}`.trim();
|
||||
};
|
||||
@ -56,13 +64,7 @@ export async function generateModernIframeScriptCode(options: Options) {
|
||||
import '${virtualAddonSetupFile}';
|
||||
import { importFn } from '${virtualStoriesFile}';
|
||||
|
||||
const getProjectAnnotations = async () => {
|
||||
const configs = await Promise.all([${relativePreviewAnnotations
|
||||
.map((previewAnnotation) => `import('${previewAnnotation}')`)
|
||||
.join(',\n')}])
|
||||
return composeConfigs(configs);
|
||||
}
|
||||
|
||||
${getPreviewAnnotationsFunction}
|
||||
|
||||
window.__STORYBOOK_PREVIEW__ = window.__STORYBOOK_PREVIEW__ || new PreviewWeb();
|
||||
|
||||
|
@ -25,6 +25,8 @@ export * from './types';
|
||||
*/
|
||||
export type StorybookViteConfig = StorybookBaseConfig & StorybookConfigVite;
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
function iframeMiddleware(options: Options, server: ViteDevServer): RequestHandler {
|
||||
return async (req, res, next) => {
|
||||
if (!req.url.match(/^\/iframe\.html($|\?)/)) {
|
||||
@ -64,7 +66,7 @@ export const start: ViteBuilder['start'] = async ({
|
||||
}) => {
|
||||
server = await createViteServer(options as Options, devServer);
|
||||
|
||||
const previewResolvedDir = dirname(require.resolve('@storybook/preview/package.json'));
|
||||
const previewResolvedDir = wrapForPnP('@storybook/preview');
|
||||
const previewDirOrigin = join(previewResolvedDir, 'dist');
|
||||
|
||||
router.use(`/sb-preview`, express.static(previewDirOrigin, { immutable: true, maxAge: '5m' }));
|
||||
@ -82,7 +84,7 @@ export const start: ViteBuilder['start'] = async ({
|
||||
export const build: ViteBuilder['build'] = async ({ options }) => {
|
||||
const viteCompilation = viteBuild(options as Options);
|
||||
|
||||
const previewResolvedDir = dirname(require.resolve('@storybook/preview/package.json'));
|
||||
const previewResolvedDir = wrapForPnP('@storybook/preview');
|
||||
const previewDirOrigin = join(previewResolvedDir, 'dist');
|
||||
const previewDirTarget = join(options.outputDir || '', `sb-preview`);
|
||||
|
||||
|
@ -20,6 +20,7 @@ import {
|
||||
export function codeGeneratorPlugin(options: Options): Plugin {
|
||||
const iframePath = require.resolve('@storybook/builder-vite/input/iframe.html');
|
||||
let iframeId: string;
|
||||
let projectRoot: string;
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
return {
|
||||
@ -44,7 +45,7 @@ export function codeGeneratorPlugin(options: Options): Plugin {
|
||||
|
||||
server.watcher.on('add', (path) => {
|
||||
// TODO maybe use the stories declaration in main
|
||||
if (/\.stories\.([tj])sx?$/.test(path) || /\.(story|stories).mdx$/.test(path)) {
|
||||
if (/\.stories\.([tj])sx?$/.test(path) || /\.mdx$/.test(path)) {
|
||||
// We need to emit a change event to trigger HMR
|
||||
server.watcher.emit('change', virtualStoriesFile);
|
||||
}
|
||||
@ -66,6 +67,7 @@ export function codeGeneratorPlugin(options: Options): Plugin {
|
||||
}
|
||||
},
|
||||
configResolved(config) {
|
||||
projectRoot = config.root;
|
||||
iframeId = `${config.root}/iframe.html`;
|
||||
},
|
||||
resolveId(source) {
|
||||
@ -87,7 +89,7 @@ export function codeGeneratorPlugin(options: Options): Plugin {
|
||||
|
||||
return undefined;
|
||||
},
|
||||
async load(id) {
|
||||
async load(id, config) {
|
||||
const storyStoreV7 = options.features?.storyStoreV7;
|
||||
if (id === virtualStoriesFile) {
|
||||
if (storyStoreV7) {
|
||||
@ -106,9 +108,9 @@ export function codeGeneratorPlugin(options: Options): Plugin {
|
||||
|
||||
if (id === virtualFileId) {
|
||||
if (storyStoreV7) {
|
||||
return generateModernIframeScriptCode(options);
|
||||
return generateModernIframeScriptCode(options, projectRoot);
|
||||
}
|
||||
return generateIframeScriptCode(options);
|
||||
return generateIframeScriptCode(options, projectRoot);
|
||||
}
|
||||
|
||||
if (id === iframeId) {
|
||||
|
@ -0,0 +1,67 @@
|
||||
import { processPreviewAnnotation } from './process-preview-annotation';
|
||||
import 'jest-os-detection';
|
||||
|
||||
describe('processPreviewAnnotation()', () => {
|
||||
it('should pull the `bare` value from an object', () => {
|
||||
const annotation = {
|
||||
bare: '@storybook/addon-links/preview',
|
||||
absolute: '/Users/foo/storybook/node_modules/@storybook/addon-links/dist/preview.mjs',
|
||||
};
|
||||
const url = processPreviewAnnotation(annotation, '/Users/foo/storybook/');
|
||||
expect(url).toBe('@storybook/addon-links/preview');
|
||||
});
|
||||
|
||||
it.skipWindows(
|
||||
'should convert absolute filesystem paths into urls relative to project root',
|
||||
() => {
|
||||
const annotation = '/Users/foo/storybook/.storybook/preview.js';
|
||||
const url = processPreviewAnnotation(annotation, '/Users/foo/storybook/');
|
||||
expect(url).toBe('/.storybook/preview.js');
|
||||
}
|
||||
);
|
||||
|
||||
it.onWindows(
|
||||
'should convert absolute windows filesystem paths into urls relative to project root',
|
||||
() => {
|
||||
const annotation = 'C:/foo/storybook/.storybook/preview.js';
|
||||
const url = processPreviewAnnotation(annotation, 'C:/foo/storybook');
|
||||
expect(url).toBe('/.storybook/preview.js');
|
||||
}
|
||||
);
|
||||
|
||||
it('should convert relative paths into urls', () => {
|
||||
const annotation = './src/stories/components';
|
||||
const url = processPreviewAnnotation(annotation, '/Users/foo/storybook/');
|
||||
expect(url).toBe('/src/stories/components');
|
||||
});
|
||||
|
||||
it('should convert node_modules into bare paths', () => {
|
||||
const annotation = '/Users/foo/storybook/node_modules/storybook-addon/preview';
|
||||
const url = processPreviewAnnotation(annotation, '/Users/foo/storybook/');
|
||||
expect(url).toBe('storybook-addon/preview');
|
||||
});
|
||||
|
||||
it.skipWindows('should convert relative paths outside the root into absolute', () => {
|
||||
const annotation = '../parent.js';
|
||||
const url = processPreviewAnnotation(annotation, '/Users/foo/storybook/');
|
||||
expect(url).toBe('/Users/foo/parent.js');
|
||||
});
|
||||
|
||||
it.onWindows('should convert relative paths outside the root into absolute on Windows', () => {
|
||||
const annotation = '../parent.js';
|
||||
const url = processPreviewAnnotation(annotation, 'C:/Users/foo/storybook/');
|
||||
expect(url).toBe('C:/Users/foo/parent.js');
|
||||
});
|
||||
|
||||
it.skipWindows('should not change absolute paths outside of the project root', () => {
|
||||
const annotation = '/Users/foo/parent.js';
|
||||
const url = processPreviewAnnotation(annotation, '/Users/foo/storybook/');
|
||||
expect(url).toBe(annotation);
|
||||
});
|
||||
|
||||
it.onWindows('should not change Windows absolute paths outside of the project root', () => {
|
||||
const annotation = 'D:/Users/foo/parent.js';
|
||||
const url = processPreviewAnnotation(annotation, 'D:/Users/foo/storybook/');
|
||||
expect(url).toBe(annotation);
|
||||
});
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
import type { PreviewAnnotation } from '@storybook/types';
|
||||
import { resolve } from 'path';
|
||||
import { resolve, isAbsolute, relative } from 'path';
|
||||
import slash from 'slash';
|
||||
import { transformAbsPath } from './transform-abs-path';
|
||||
|
||||
@ -8,10 +8,9 @@ import { transformAbsPath } from './transform-abs-path';
|
||||
* a bit more restrained.
|
||||
*
|
||||
* For node_modules, we want bare imports (so vite can process them),
|
||||
* and for files in the user's source,
|
||||
* we want absolute paths.
|
||||
* and for files in the user's source, we want URLs absolute relative to project root.
|
||||
*/
|
||||
export function processPreviewAnnotation(path: PreviewAnnotation | undefined) {
|
||||
export function processPreviewAnnotation(path: PreviewAnnotation | undefined, projectRoot: string) {
|
||||
// If entry is an object, take the first, which is the
|
||||
// bare (non-absolute) specifier.
|
||||
// This is so that webpack can use an absolute path, and
|
||||
@ -21,10 +20,7 @@ export function processPreviewAnnotation(path: PreviewAnnotation | undefined) {
|
||||
if (typeof path === 'object') {
|
||||
return path.bare;
|
||||
}
|
||||
// resolve relative paths into absolute paths, but don't resolve "bare" imports
|
||||
if (path?.startsWith('./') || path?.startsWith('../')) {
|
||||
return slash(resolve(path));
|
||||
}
|
||||
|
||||
// This should not occur, since we use `.filter(Boolean)` prior to
|
||||
// calling this function, but this makes typescript happy
|
||||
if (!path) {
|
||||
@ -37,5 +33,20 @@ export function processPreviewAnnotation(path: PreviewAnnotation | undefined) {
|
||||
return transformAbsPath(path);
|
||||
}
|
||||
|
||||
return slash(path);
|
||||
// resolve absolute paths relative to project root
|
||||
const relativePath = isAbsolute(path) ? slash(relative(projectRoot, path)) : path;
|
||||
|
||||
// resolve relative paths into absolute urls
|
||||
// note: this only works if vite's projectRoot === cwd.
|
||||
if (relativePath.startsWith('./')) {
|
||||
return slash(relativePath.replace(/^\.\//, '/'));
|
||||
}
|
||||
|
||||
// If something is outside of root, convert to absolute. Uncommon?
|
||||
if (relativePath.startsWith('../')) {
|
||||
return slash(resolve(projectRoot, relativePath));
|
||||
}
|
||||
|
||||
// At this point, it must be relative to the root but not start with a ./ or ../
|
||||
return slash(`/${relativePath}`);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/builder-webpack5",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook framework-agnostic API",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -58,25 +58,25 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.12.10",
|
||||
"@storybook/addons": "7.0.0-beta.60",
|
||||
"@storybook/api": "7.0.0-beta.60",
|
||||
"@storybook/channel-postmessage": "7.0.0-beta.60",
|
||||
"@storybook/channel-websocket": "7.0.0-beta.60",
|
||||
"@storybook/channels": "7.0.0-beta.60",
|
||||
"@storybook/client-api": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/components": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/core-webpack": "7.0.0-beta.60",
|
||||
"@storybook/addons": "7.0.0-beta.64",
|
||||
"@storybook/api": "7.0.0-beta.64",
|
||||
"@storybook/channel-postmessage": "7.0.0-beta.64",
|
||||
"@storybook/channel-websocket": "7.0.0-beta.64",
|
||||
"@storybook/channels": "7.0.0-beta.64",
|
||||
"@storybook/client-api": "7.0.0-beta.64",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/components": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/core-webpack": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/manager-api": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/preview": "7.0.0-beta.60",
|
||||
"@storybook/preview-api": "7.0.0-beta.60",
|
||||
"@storybook/router": "7.0.0-beta.60",
|
||||
"@storybook/store": "7.0.0-beta.60",
|
||||
"@storybook/theming": "7.0.0-beta.60",
|
||||
"@storybook/manager-api": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/preview": "7.0.0-beta.64",
|
||||
"@storybook/preview-api": "7.0.0-beta.64",
|
||||
"@storybook/router": "7.0.0-beta.64",
|
||||
"@storybook/store": "7.0.0-beta.64",
|
||||
"@storybook/theming": "7.0.0-beta.64",
|
||||
"@types/node": "^16.0.0",
|
||||
"@types/semver": "^7.3.4",
|
||||
"babel-loader": "^9.0.0",
|
||||
@ -131,5 +131,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ export const printDuration = (startTime: [number, number]) =>
|
||||
.replace(' s', ' seconds')
|
||||
.replace(' m', ' minutes');
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
let compilation: ReturnType<typeof webpackDevMiddleware> | undefined;
|
||||
let reject: (reason?: any) => void;
|
||||
|
||||
@ -173,7 +175,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({
|
||||
|
||||
compilation = webpackDevMiddleware(compiler, middlewareOptions);
|
||||
|
||||
const previewResolvedDir = dirname(require.resolve('@storybook/preview/package.json'));
|
||||
const previewResolvedDir = wrapForPnP('@storybook/preview');
|
||||
const previewDirOrigin = join(previewResolvedDir, 'dist');
|
||||
|
||||
router.use(`/sb-preview`, express.static(previewDirOrigin, { immutable: true, maxAge: '5m' }));
|
||||
@ -286,7 +288,7 @@ const builder: BuilderFunction = async function* builderGeneratorFn({ startTime,
|
||||
});
|
||||
});
|
||||
|
||||
const previewResolvedDir = dirname(require.resolve('@storybook/preview/package.json'));
|
||||
const previewResolvedDir = wrapForPnP('@storybook/preview');
|
||||
const previewDirOrigin = join(previewResolvedDir, 'dist');
|
||||
const previewDirTarget = join(options.outputDir || '', `sb-preview`);
|
||||
|
||||
|
@ -27,8 +27,10 @@ import { dedent } from 'ts-dedent';
|
||||
import type { BuilderOptions, TypescriptOptions } from '../types';
|
||||
import { createBabelLoader } from './babel-loader-preview';
|
||||
|
||||
const wrapForPnP = (input: string) => dirname(require.resolve(join(input, 'package.json')));
|
||||
|
||||
const storybookPaths: Record<string, string> = {
|
||||
global: dirname(require.resolve('@storybook/global/package.json')),
|
||||
global: wrapForPnP('@storybook/global'),
|
||||
...[
|
||||
// these packages are not pre-bundled because of react dependencies
|
||||
'api',
|
||||
@ -40,12 +42,12 @@ const storybookPaths: Record<string, string> = {
|
||||
].reduce(
|
||||
(acc, sbPackage) => ({
|
||||
...acc,
|
||||
[`@storybook/${sbPackage}`]: dirname(require.resolve(`@storybook/${sbPackage}/package.json`)),
|
||||
[`@storybook/${sbPackage}`]: wrapForPnP(`@storybook/${sbPackage}`),
|
||||
}),
|
||||
{}
|
||||
),
|
||||
// deprecated, remove in 8.0
|
||||
[`@storybook/api`]: dirname(require.resolve(`@storybook/manager-api/package.json`)),
|
||||
[`@storybook/api`]: wrapForPnP(`@storybook/manager-api`),
|
||||
};
|
||||
|
||||
export default async (
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/channel-postmessage",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -43,9 +43,9 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/channels": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/core-events": "7.0.0-beta.60",
|
||||
"@storybook/channels": "7.0.0-beta.64",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/core-events": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"qs": "^6.10.0",
|
||||
"telejson": "^7.0.3"
|
||||
@ -61,5 +61,5 @@
|
||||
"./src/index.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/channel-websocket",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -43,8 +43,8 @@
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/channels": "7.0.0-beta.60",
|
||||
"@storybook/client-logger": "7.0.0-beta.60",
|
||||
"@storybook/channels": "7.0.0-beta.64",
|
||||
"@storybook/client-logger": "7.0.0-beta.64",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"telejson": "^7.0.3"
|
||||
},
|
||||
@ -59,5 +59,5 @@
|
||||
"./src/index.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/channels",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -53,5 +53,5 @@
|
||||
"./src/index.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sb",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook CLI",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -21,10 +21,10 @@
|
||||
"license": "MIT",
|
||||
"bin": "./index.js",
|
||||
"dependencies": {
|
||||
"@storybook/cli": "7.0.0-beta.60"
|
||||
"@storybook/cli": "7.0.0-beta.64"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "storybook",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook CLI",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -24,10 +24,10 @@
|
||||
"storybook": "./index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/cli": "7.0.0-beta.60"
|
||||
"@storybook/cli": "7.0.0-beta.64"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/cli",
|
||||
"version": "7.0.0-beta.60",
|
||||
"version": "7.0.0-beta.64",
|
||||
"description": "Storybook's CLI - easiest method of adding storybook to your projects",
|
||||
"keywords": [
|
||||
"cli",
|
||||
@ -57,13 +57,13 @@
|
||||
"@babel/core": "^7.20.2",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@ndelangen/get-tarball": "^3.0.7",
|
||||
"@storybook/codemod": "7.0.0-beta.60",
|
||||
"@storybook/core-common": "7.0.0-beta.60",
|
||||
"@storybook/core-server": "7.0.0-beta.60",
|
||||
"@storybook/csf-tools": "7.0.0-beta.60",
|
||||
"@storybook/node-logger": "7.0.0-beta.60",
|
||||
"@storybook/telemetry": "7.0.0-beta.60",
|
||||
"@storybook/types": "7.0.0-beta.60",
|
||||
"@storybook/codemod": "7.0.0-beta.64",
|
||||
"@storybook/core-common": "7.0.0-beta.64",
|
||||
"@storybook/core-server": "7.0.0-beta.64",
|
||||
"@storybook/csf-tools": "7.0.0-beta.64",
|
||||
"@storybook/node-logger": "7.0.0-beta.64",
|
||||
"@storybook/telemetry": "7.0.0-beta.64",
|
||||
"@storybook/types": "7.0.0-beta.64",
|
||||
"@types/semver": "^7.3.4",
|
||||
"boxen": "^5.1.2",
|
||||
"chalk": "^4.1.0",
|
||||
@ -94,7 +94,7 @@
|
||||
"util-deprecate": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@storybook/client-api": "7.0.0-beta.60",
|
||||
"@storybook/client-api": "7.0.0-beta.64",
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/prompts": "^2.0.9",
|
||||
"@types/puppeteer-core": "^2.1.0",
|
||||
@ -114,5 +114,5 @@
|
||||
],
|
||||
"platform": "node"
|
||||
},
|
||||
"gitHead": "325e0406b449b740d94d481a32a62304a8b2fd11"
|
||||
"gitHead": "f33337d997ae5db03f3b7681cffe0a154e1798f3"
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { promisify } = require('util');
|
||||
const { readJson, writeFile } = require('fs-extra');
|
||||
const { exec } = require('child_process');
|
||||
const path = require('path');
|
||||
const globby = require('globby');
|
||||
const semver = require('semver');
|
||||
const { default: dedent } = require('ts-dedent');
|
||||
|
||||
@ -11,6 +11,19 @@ const rootDirectory = path.join(__dirname, '..', '..', '..');
|
||||
|
||||
const logger = console;
|
||||
|
||||
const getMonorepoPackages = async () => {
|
||||
const process = promisify(exec);
|
||||
const contents = await process('yarn lerna ls --json', {
|
||||
cwd: rootDirectory,
|
||||
});
|
||||
|
||||
const projects = JSON.parse(contents.stdout);
|
||||
return projects.reduce((acc, project) => {
|
||||
acc[project.name] = path.join(project.location, 'package.json');
|
||||
return acc;
|
||||
}, []);
|
||||
};
|
||||
|
||||
const run = async () => {
|
||||
const updatedVersion = process.argv[process.argv.length - 1];
|
||||
|
||||
@ -18,17 +31,12 @@ const run = async () => {
|
||||
|
||||
logger.log(`Generating versions.ts with v${updatedVersion}`);
|
||||
|
||||
const storybookPackagesPaths = await globby(
|
||||
`${rootDirectory}/@(frameworks|addons|lib|renderers|presets)/**/package.json`,
|
||||
{
|
||||
ignore: '**/node_modules/**/*',
|
||||
}
|
||||
);
|
||||
const storybookPackages = await getMonorepoPackages();
|
||||
|
||||
const packageToVersionMap = (
|
||||
await Promise.all(
|
||||
storybookPackagesPaths.map(async (storybookPackagePath) => {
|
||||
const { name, version } = await readJson(storybookPackagePath);
|
||||
Object.keys(storybookPackages).map(async (pkgName) => {
|
||||
const { name, version } = await readJson(storybookPackages[pkgName]);
|
||||
|
||||
return {
|
||||
name,
|
||||
|
@ -0,0 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`is not Nx project angular builders Angular < 14.0.0 should throw an Error 1`] = `
|
||||
"❌ Your project uses Angular < 14.0.0. Storybook 7.0 for Angular requires Angular 14.0.0 or higher.
|
||||
Please upgrade your Angular version to at least version 14.0.0 to use Storybook 7.0 in your project."
|
||||
`;
|
@ -49,11 +49,11 @@ export const addReact: Fix<AddReactOptions> = {
|
||||
return dedent`
|
||||
We've detected that you're using ${dependentsFormatted}.
|
||||
|
||||
Starting in Storybook 7 we now require the following peer dependencies:
|
||||
Starting in Storybook 7, we now require these peer dependencies to render docs:
|
||||
|
||||
${additionalDependenciesFormatted}
|
||||
|
||||
We can add these for you automatically.
|
||||
We can add these for you automatically as dev dependencies.
|
||||
|
||||
More info: ${chalk.yellow(
|
||||
'https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-peer-dependencies-required'
|
||||
|
@ -0,0 +1,132 @@
|
||||
import type { StorybookConfig } from '@storybook/types';
|
||||
import type { PackageJson } from '../../js-package-manager';
|
||||
import { makePackageManager, mockStorybookData } from '../helpers/testing-helpers';
|
||||
import { angularBuildersMultiproject } from './angular-builders-multiproject';
|
||||
import * as helpers from '../../helpers';
|
||||
import * as angularHelpers from '../../generators/ANGULAR/helpers';
|
||||
|
||||
const checkAngularBuilders = async ({
|
||||
packageJson,
|
||||
main: mainConfig = {},
|
||||
storybookVersion = '7.0.0',
|
||||
}: {
|
||||
packageJson: PackageJson;
|
||||
main?: Partial<StorybookConfig> & Record<string, unknown>;
|
||||
storybookVersion?: string;
|
||||
}) => {
|
||||
mockStorybookData({ mainConfig, storybookVersion });
|
||||
|
||||
// mock file system (look at eslint plugin test)
|
||||
|
||||
return angularBuildersMultiproject.check({
|
||||
packageManager: makePackageManager(packageJson),
|
||||
});
|
||||
};
|
||||
|
||||
jest.mock('../../helpers', () => ({
|
||||
...jest.requireActual('../../helpers'),
|
||||
isNxProject: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('../../generators/ANGULAR/helpers', () => ({
|
||||
...jest.requireActual('../../generators/ANGULAR/helpers'),
|
||||
AngularJSON: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('is Nx project', () => {
|
||||
beforeEach(() => {
|
||||
(helpers.isNxProject as any as jest.SpyInstance).mockReturnValue(true);
|
||||
});
|
||||
|
||||
it('should return null', async () => {
|
||||
const packageJson = {
|
||||
dependencies: { '@storybook/angular': '^7.0.0-alpha.0' },
|
||||
};
|
||||
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('is not Nx project', () => {
|
||||
beforeEach(() => {
|
||||
(helpers.isNxProject as any as jest.SpyInstance).mockReturnValue(false);
|
||||
});
|
||||
|
||||
describe('angular builders', () => {
|
||||
afterEach(jest.restoreAllMocks);
|
||||
|
||||
describe('Angular not found', () => {
|
||||
const packageJson = {
|
||||
dependencies: { '@storybook/angular': '^7.0.0-alpha.0' },
|
||||
};
|
||||
|
||||
it('should return null', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Angular < 14.0.0', () => {
|
||||
const packageJson = {
|
||||
dependencies: { '@storybook/angular': '^7.0.0-alpha.0', '@angular/core': '^12.0.0' },
|
||||
};
|
||||
|
||||
it('should return null', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Angular >= 14.0.0', () => {
|
||||
const packageJson = {
|
||||
dependencies: { '@storybook/angular': '^7.0.0-alpha.0', '@angular/core': '^15.0.0' },
|
||||
};
|
||||
|
||||
describe('has one Storybook builder defined', () => {
|
||||
beforeEach(() => {
|
||||
// Mock AngularJSON.constructor
|
||||
(angularHelpers.AngularJSON as jest.Mock).mockImplementation(() => ({
|
||||
hasStorybookBuilder: true,
|
||||
}));
|
||||
});
|
||||
|
||||
it('should return null', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('has one project', () => {
|
||||
beforeEach(() => {
|
||||
// Mock AngularJSON.constructor
|
||||
(angularHelpers.AngularJSON as jest.Mock).mockImplementation(() => ({
|
||||
hasStorybookBuilder: false,
|
||||
projects: {
|
||||
project1: { root: 'project1', architect: {} },
|
||||
},
|
||||
rootProject: 'project1',
|
||||
}));
|
||||
});
|
||||
|
||||
it('should return null', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('has multiple projects without root project defined', () => {
|
||||
beforeEach(() => {
|
||||
// Mock AngularJSON.constructor
|
||||
(angularHelpers.AngularJSON as jest.Mock).mockImplementation(() => ({
|
||||
hasStorybookBuilder: false,
|
||||
projects: {
|
||||
project1: { root: 'project1', architect: {} },
|
||||
project2: { root: 'project2', architect: {} },
|
||||
},
|
||||
rootProject: null,
|
||||
}));
|
||||
});
|
||||
|
||||
it('should return an empty object', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toMatchObject({});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,66 @@
|
||||
import { dedent } from 'ts-dedent';
|
||||
import semver from 'semver';
|
||||
import chalk from 'chalk';
|
||||
import type { Fix } from '../types';
|
||||
import { isNxProject } from '../../helpers';
|
||||
import { AngularJSON } from '../../generators/ANGULAR/helpers';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface AngularBuildersMultiprojectRunOptions {}
|
||||
|
||||
export const angularBuildersMultiproject: Fix<AngularBuildersMultiprojectRunOptions> = {
|
||||
id: 'angular-builders-multiproject',
|
||||
promptOnly: true,
|
||||
|
||||
async check({ packageManager, configDir }) {
|
||||
const packageJSON = packageManager.retrievePackageJson();
|
||||
|
||||
// Skip in case of NX
|
||||
if (isNxProject(packageJSON)) {
|
||||
return null;
|
||||
}
|
||||
const allDependencies = packageManager.getAllDependencies();
|
||||
|
||||
const angularVersion = allDependencies['@angular/core'];
|
||||
const angularCoerced = semver.coerce(angularVersion)?.version;
|
||||
|
||||
// skip non-angular projects
|
||||
if (!angularCoerced) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is Angular version lower than 14? -> throw an error (only supports ng 14)
|
||||
if (semver.lt(angularCoerced, '14.0.0')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const angularJSON = new AngularJSON();
|
||||
|
||||
const { hasStorybookBuilder } = angularJSON;
|
||||
|
||||
// skip if workspace has already one or more Storybook builder
|
||||
if (hasStorybookBuilder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (angularJSON.rootProject || Object.keys(angularJSON.projects).length === 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {};
|
||||
},
|
||||
|
||||
prompt() {
|
||||
return dedent`
|
||||
In Storybook 6.4 we have deprecated calling Storybook directly (npm run storybook) for Angular. In Storybook 7.0, we've removed it entirely. Instead you have to set up the Storybook builder in your ${chalk.yellow(
|
||||
'angular.json'
|
||||
)} and execute ${chalk.yellow('ng run <your-project>:storybook')} to start Storybook.
|
||||
|
||||
❌ Your Angular workspace uses multiple projects defined in the ${chalk.yellow(
|
||||
'angular.json'
|
||||
)} file and we were not able to detect a root project. Therefore we are not able to automigrate to use Angular Storybook builder. Instead, please visit ${chalk.yellow(
|
||||
'https://github.com/storybookjs/storybook/tree/next/code/frameworks/angular'
|
||||
)} to do the migration manually.
|
||||
`;
|
||||
},
|
||||
};
|
135
code/lib/cli/src/automigrate/fixes/angular-builders.test.ts
Normal file
135
code/lib/cli/src/automigrate/fixes/angular-builders.test.ts
Normal file
@ -0,0 +1,135 @@
|
||||
import type { StorybookConfig } from '@storybook/types';
|
||||
import type { PackageJson } from '../../js-package-manager';
|
||||
import { makePackageManager, mockStorybookData } from '../helpers/testing-helpers';
|
||||
import { angularBuilders } from './angular-builders';
|
||||
import * as helpers from '../../helpers';
|
||||
import * as angularHelpers from '../../generators/ANGULAR/helpers';
|
||||
|
||||
const checkAngularBuilders = async ({
|
||||
packageJson,
|
||||
main: mainConfig = {},
|
||||
storybookVersion = '7.0.0',
|
||||
}: {
|
||||
packageJson: PackageJson;
|
||||
main?: Partial<StorybookConfig> & Record<string, unknown>;
|
||||
storybookVersion?: string;
|
||||
}) => {
|
||||
mockStorybookData({ mainConfig, storybookVersion });
|
||||
|
||||
// mock file system (look at eslint plugin test)
|
||||
|
||||
return angularBuilders.check({
|
||||
packageManager: makePackageManager(packageJson),
|
||||
});
|
||||
};
|
||||
|
||||
jest.mock('../../helpers', () => ({
|
||||
...jest.requireActual('../../helpers'),
|
||||
isNxProject: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('../../generators/ANGULAR/helpers', () => ({
|
||||
...jest.requireActual('../../generators/ANGULAR/helpers'),
|
||||
AngularJSON: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('is Nx project', () => {
|
||||
beforeEach(() => {
|
||||
(helpers.isNxProject as any as jest.SpyInstance).mockReturnValue(true);
|
||||
});
|
||||
|
||||
it('should return null', async () => {
|
||||
const packageJson = {
|
||||
dependencies: { '@storybook/angular': '^7.0.0-alpha.0' },
|
||||
};
|
||||
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('is not Nx project', () => {
|
||||
beforeEach(() => {
|
||||
(helpers.isNxProject as any as jest.SpyInstance).mockReturnValue(false);
|
||||
});
|
||||
|
||||
describe('angular builders', () => {
|
||||
afterEach(jest.restoreAllMocks);
|
||||
|
||||
describe('Angular not found', () => {
|
||||
const packageJson = {
|
||||
dependencies: { '@storybook/angular': '^7.0.0-alpha.0' },
|
||||
};
|
||||
|
||||
it('should return null', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Angular < 14.0.0', () => {
|
||||
const packageJson = {
|
||||
dependencies: { '@storybook/angular': '^7.0.0-alpha.0', '@angular/core': '^12.0.0' },
|
||||
};
|
||||
|
||||
it('should throw an Error', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).rejects.toThrowErrorMatchingSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Angular >= 14.0.0', () => {
|
||||
const packageJson = {
|
||||
dependencies: { '@storybook/angular': '^7.0.0-alpha.0', '@angular/core': '^15.0.0' },
|
||||
};
|
||||
|
||||
describe('has one Storybook builder defined', () => {
|
||||
beforeEach(() => {
|
||||
// Mock AngularJSON.constructor
|
||||
(angularHelpers.AngularJSON as jest.Mock).mockImplementation(() => ({
|
||||
hasStorybookBuilder: true,
|
||||
}));
|
||||
});
|
||||
|
||||
it('should return null', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('has multiple projects without root project defined', () => {
|
||||
beforeEach(() => {
|
||||
// Mock AngularJSON.constructor
|
||||
(angularHelpers.AngularJSON as jest.Mock).mockImplementation(() => ({
|
||||
hasStorybookBuilder: false,
|
||||
projects: {
|
||||
project1: { root: 'project1', architect: {} },
|
||||
project2: { root: 'project2', architect: {} },
|
||||
},
|
||||
rootProject: null,
|
||||
}));
|
||||
});
|
||||
|
||||
it('should return null', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('has one project', () => {
|
||||
beforeEach(() => {
|
||||
// Mock AngularJSON.constructor
|
||||
(angularHelpers.AngularJSON as jest.Mock).mockImplementation(() => ({
|
||||
hasStorybookBuilder: false,
|
||||
projects: {
|
||||
project1: { root: 'project1', architect: {} },
|
||||
},
|
||||
rootProject: 'project1',
|
||||
}));
|
||||
});
|
||||
|
||||
it('should proceed and return data', async () => {
|
||||
await expect(checkAngularBuilders({ packageJson })).resolves.toMatchObject({
|
||||
mainConfig: {},
|
||||
packageManager: {},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
106
code/lib/cli/src/automigrate/fixes/angular-builders.ts
Normal file
106
code/lib/cli/src/automigrate/fixes/angular-builders.ts
Normal file
@ -0,0 +1,106 @@
|
||||
import { dedent } from 'ts-dedent';
|
||||
import semver from 'semver';
|
||||
import type { StorybookConfig } from '@storybook/types';
|
||||
import chalk from 'chalk';
|
||||
import prompts from 'prompts';
|
||||
import type { Fix } from '../types';
|
||||
import { getStorybookData } from '../helpers/mainConfigFile';
|
||||
import { isNxProject } from '../../helpers';
|
||||
import { AngularJSON } from '../../generators/ANGULAR/helpers';
|
||||
import type { JsPackageManager } from '../../js-package-manager';
|
||||
|
||||
interface AngularBuildersRunOptions {
|
||||
mainConfig: StorybookConfig;
|
||||
packageManager: JsPackageManager;
|
||||
}
|
||||
|
||||
export const angularBuilders: Fix<AngularBuildersRunOptions> = {
|
||||
id: 'angular-builders',
|
||||
|
||||
async check({ packageManager, configDir }) {
|
||||
const packageJSON = packageManager.retrievePackageJson();
|
||||
|
||||
// Skip in case of NX
|
||||
if (isNxProject(packageJSON)) {
|
||||
return null;
|
||||
}
|
||||
const allDependencies = packageManager.getAllDependencies();
|
||||
|
||||
const angularVersion = allDependencies['@angular/core'];
|
||||
const angularCoerced = semver.coerce(angularVersion)?.version;
|
||||
|
||||
// skip non-angular projects
|
||||
if (!angularCoerced) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is Angular version lower than 14? -> throw an error (only supports ng 14)
|
||||
if (semver.lt(angularCoerced, '14.0.0')) {
|
||||
throw new Error(dedent`
|
||||
❌ Your project uses Angular < 14.0.0. Storybook 7.0 for Angular requires Angular 14.0.0 or higher.
|
||||
Please upgrade your Angular version to at least version 14.0.0 to use Storybook 7.0 in your project.
|
||||
`);
|
||||
}
|
||||
|
||||
const angularJSON = new AngularJSON();
|
||||
|
||||
const { hasStorybookBuilder } = angularJSON;
|
||||
|
||||
// skip if workspace has already one or more Storybook builder
|
||||
if (hasStorybookBuilder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!angularJSON.rootProject && Object.keys(angularJSON.projects).length > 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { mainConfig } = await getStorybookData({ configDir, packageManager });
|
||||
|
||||
return {
|
||||
mainConfig,
|
||||
packageManager,
|
||||
};
|
||||
},
|
||||
|
||||
prompt() {
|
||||
return dedent`
|
||||
We have detected that your project does not use the Storybook Angular builder yet. In Storybook 6.4 we have deprecated calling Storybook directly (npm run storybook) for Angular. In Storybook 7.0, we've removed it entirely.
|
||||
|
||||
In order to use the Storybook Angular builder, we need to add a few entries to your angular.json file. Additionally, we will add the @compodoc/compodoc package to your devDependencies if you want and we will add a few scripts to your package.json file.
|
||||
|
||||
Also feel free to remove the Compodoc script from your package.json file if you don't use it apart from Storybook anymore. Storybook uses Compodoc internally and you don't have to call in separately anymore.
|
||||
|
||||
Read more about the Angular builder here: ${chalk.yellow(
|
||||
'https://storybook.js.org/docs/angular/configure/storybook-builders'
|
||||
)}
|
||||
`;
|
||||
},
|
||||
|
||||
async run({ result }) {
|
||||
const angularJSON = new AngularJSON();
|
||||
const { packageManager } = result;
|
||||
|
||||
const { useCompoDoc } = await prompts({
|
||||
type: 'confirm',
|
||||
name: 'useCompoDoc',
|
||||
message: 'Have you set up compodoc in Storybook previously?',
|
||||
});
|
||||
|
||||
const angularProjectName = await angularJSON.getProjectName();
|
||||
|
||||
angularJSON.addStorybookEntries({
|
||||
angularProjectName,
|
||||
storybookFolder: '.storybook',
|
||||
useCompodoc: useCompoDoc,
|
||||
root: '.',
|
||||
});
|
||||
|
||||
angularJSON.write();
|
||||
|
||||
packageManager.addScripts({
|
||||
storybook: `ng run ${angularProjectName}:storybook`,
|
||||
'build-storybook': `ng run ${angularProjectName}:build-storybook`,
|
||||
});
|
||||
},
|
||||
};
|
@ -64,7 +64,7 @@ export const autodocsTrue: Fix<AutodocsTrueFrameworkRunOptions> = {
|
||||
${autodocsFormatted}
|
||||
${value === 'tag' ? tagWarning : ''}
|
||||
More info: ${chalk.yellow(
|
||||
'https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#autodocs'
|
||||
'https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#autodocs-changes'
|
||||
)}
|
||||
`;
|
||||
}
|
||||
@ -77,7 +77,7 @@ export const autodocsTrue: Fix<AutodocsTrueFrameworkRunOptions> = {
|
||||
${autodocsFormatted}
|
||||
|
||||
More info: ${chalk.yellow(
|
||||
'https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#autodocs'
|
||||
'https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#autodocs-changes'
|
||||
)}
|
||||
`;
|
||||
},
|
||||
|
@ -17,6 +17,8 @@ import { addReact } from './add-react';
|
||||
import { nodeJsRequirement } from './nodejs-requirement';
|
||||
import { missingBabelRc } from './missing-babelrc';
|
||||
import { bareMdxStoriesGlob } from './bare-mdx-stories-glob';
|
||||
import { angularBuilders } from './angular-builders';
|
||||
import { angularBuildersMultiproject } from './angular-builders-multiproject';
|
||||
|
||||
export * from '../types';
|
||||
|
||||
@ -38,6 +40,8 @@ export const allFixes: Fix[] = [
|
||||
autodocsTrue,
|
||||
addReact,
|
||||
missingBabelRc,
|
||||
angularBuildersMultiproject,
|
||||
angularBuilders,
|
||||
];
|
||||
|
||||
export const initFixes: Fix[] = [missingBabelRc, eslintPlugin];
|
||||
|
@ -61,10 +61,12 @@ export const mdxgfm: Fix<Options> = {
|
||||
|
||||
async run({ packageManager, dryRun, mainConfigPath, skipInstall }) {
|
||||
if (!dryRun) {
|
||||
const packageJson = packageManager.retrievePackageJson();
|
||||
const versionToInstall = getStorybookVersionSpecifier(packageManager.retrievePackageJson());
|
||||
await packageManager.addDependencies({ installAsDevDependencies: true, skipInstall }, [
|
||||
`@storybook/addon-mdx-gfm@${versionToInstall}`,
|
||||
]);
|
||||
await packageManager.addDependencies(
|
||||
{ installAsDevDependencies: true, skipInstall, packageJson },
|
||||
[`@storybook/addon-mdx-gfm@${versionToInstall}`]
|
||||
);
|
||||
|
||||
await updateMainConfig({ mainConfigPath, dryRun }, async (main) => {
|
||||
const addonsToAdd = ['@storybook/addon-mdx-gfm'];
|
||||
|
@ -30,7 +30,7 @@ export const getStorybookData = async ({
|
||||
|
||||
let mainConfig: StorybookConfig;
|
||||
try {
|
||||
mainConfig = await loadMainConfig({ configDir });
|
||||
mainConfig = await loadMainConfig({ configDir, noCache: true });
|
||||
} catch (err) {
|
||||
throw new Error(
|
||||
dedent`Unable to find or evaluate ${chalk.blue(mainConfigPath)}: ${err.message}`
|
||||
|
@ -1,24 +1,18 @@
|
||||
import { sync as readUpSync } from 'read-pkg-up';
|
||||
import { logger } from '@storybook/node-logger';
|
||||
import { buildStaticStandalone, withTelemetry } from '@storybook/core-server';
|
||||
import { cache } from '@storybook/core-common';
|
||||
|
||||
export const build = async (cliOptions: any) => {
|
||||
try {
|
||||
const options = {
|
||||
...cliOptions,
|
||||
configDir: cliOptions.configDir || './.storybook',
|
||||
outputDir: cliOptions.outputDir || './storybook-static',
|
||||
ignorePreview: !!cliOptions.previewUrl && !cliOptions.forceBuildPreview,
|
||||
configType: 'PRODUCTION',
|
||||
cache,
|
||||
packageJson: readUpSync({ cwd: __dirname }).packageJson,
|
||||
};
|
||||
await withTelemetry('build', { cliOptions, presetOptions: options }, () =>
|
||||
buildStaticStandalone(options)
|
||||
);
|
||||
} catch (err) {
|
||||
logger.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
const options = {
|
||||
...cliOptions,
|
||||
configDir: cliOptions.configDir || './.storybook',
|
||||
outputDir: cliOptions.outputDir || './storybook-static',
|
||||
ignorePreview: !!cliOptions.previewUrl && !cliOptions.forceBuildPreview,
|
||||
configType: 'PRODUCTION',
|
||||
cache,
|
||||
packageJson: readUpSync({ cwd: __dirname }).packageJson,
|
||||
};
|
||||
await withTelemetry('build', { cliOptions, presetOptions: options }, () =>
|
||||
buildStaticStandalone(options)
|
||||
);
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user