mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-19 05:02:40 +08:00
Expose standalone build from @storybook/core
This commit is contained in:
parent
da3c6c6b05
commit
b9fb04b185
24
lib/core/src/server/standalone.js
Normal file
24
lib/core/src/server/standalone.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { buildStaticStandalone } from './build-static';
|
||||
import { buildDevStandalone } from './build-dev';
|
||||
|
||||
async function build(options = {}, frameworkOptions = {}) {
|
||||
const { mode = 'dev' } = options;
|
||||
|
||||
const commonOptions = {
|
||||
...options,
|
||||
...frameworkOptions,
|
||||
frameworkPresets: [...options.frameworkPresets, ...(frameworkOptions.frameworkPresets || [])],
|
||||
};
|
||||
|
||||
if (mode === 'dev') {
|
||||
return buildDevStandalone(commonOptions);
|
||||
}
|
||||
|
||||
if (mode === 'static') {
|
||||
return buildStaticStandalone(commonOptions);
|
||||
}
|
||||
|
||||
throw new Error(`'mode' parameter should be either 'dev' or 'static'`);
|
||||
}
|
||||
|
||||
export default build;
|
3
lib/core/standalone.js
Normal file
3
lib/core/standalone.js
Normal file
@ -0,0 +1,3 @@
|
||||
const build = require('./dist/server/standalone').default;
|
||||
|
||||
module.exports = build;
|
Loading…
x
Reference in New Issue
Block a user