storybook/addons/docs/common/makePreset.js
2019-07-27 03:31:48 +08:00

25 lines
535 B
JavaScript

const fs = require('fs');
const common = require('./preset');
module.exports = framework => {
const configModule = `${__dirname}/config-${framework}`;
const configContents = `
const { addParameters } = require('@storybook/${framework}');
const { DocsPage } = require('@storybook/addon-docs/blocks');
addParameters({
docs: DocsPage,
});
`.trim();
fs.writeFileSync(`${configModule}.js`, configContents);
function config(entry = []) {
return [configModule, ...entry];
}
return {
...common,
config,
};
};