Addon-docs: manager/preview addon refactor

This commit is contained in:
Michael Shilman 2022-03-23 03:32:51 +08:00
parent 14e3d8516a
commit b94875522b
7 changed files with 17 additions and 26 deletions

1
addons/docs/manager.js Normal file
View File

@ -0,0 +1 @@
import './dist/esm/manager';

View File

@ -1,16 +1 @@
const { findDistEsm } = require('@storybook/core-common');
const { webpack } = require('./dist/cjs/frameworks/common/preset');
function managerEntries(entry = [], options) {
return [...entry, findDistEsm(__dirname, 'manager')];
}
function config(entry = [], options = {}) {
return [findDistEsm(__dirname, 'frameworks/common/config'), ...entry];
}
module.exports = {
webpack,
managerEntries,
config,
};
module.exports = require('./dist/cjs/preset');

1
addons/docs/preview.js Normal file
View File

@ -0,0 +1 @@
export * from './dist/esm/preview';

View File

@ -1,2 +1,6 @@
/* eslint-disable import/extensions */
require('./dist/esm/manager.js');
import { once } from '@storybook/client-logger';
import './manager';
once.warn(
'register.js is deprecated see https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-registerjs'
);

View File

@ -1,8 +0,0 @@
export const parameters = {
docs: {
inlineStories: false,
getContainer: async () => (await import('../../blocks')).DocsContainer,
getPage: async () => (await import('../../blocks')).DocsPage,
iframeHeight: 100,
},
};

View File

@ -0,0 +1,8 @@
export const parameters = {
docs: {
inlineStories: false,
getContainer: async () => (await import('./blocks')).DocsContainer,
getPage: async () => (await import('./blocks')).DocsPage,
iframeHeight: 100,
},
};