forked from storybookjs/vue-cli-plugin-storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
61 lines (56 loc) · 1.53 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// eslint-disable-next-line import/no-extraneous-dependencies
const server = require('@storybook/core/server');
const {
devOptions,
prodOptions,
generateVueCliOptions,
generateCommanderProgram,
} = require('./options');
const defaultOptions = {
allowedPlugins: [],
};
// eslint-disable-next-line no-unused-vars
module.exports = (api, { pluginOptions = {} }) => {
const options = Object.assign({}, defaultOptions, pluginOptions.storybook);
api.registerCommand('storybook:serve', {
description: 'Start storybook',
usage: 'vue-cli-service storybook:serve',
options: generateVueCliOptions(devOptions),
}, (_, argv) => {
server.buildDev({
packageJson: {
name: '@storybook/vue',
version: '^4.2.0-alpha.11',
},
frameworkPresets: [
{
name: require.resolve('./preset'),
options: { api, options },
},
],
...generateCommanderProgram(argv, devOptions),
});
});
api.registerCommand('storybook:build', {
description: 'Build storybook',
usage: 'vue-cli-service storybook:build',
options: generateVueCliOptions(prodOptions),
}, (_, argv) => {
server.buildStatic({
packageJson: {
name: '@storybook/vue',
version: '^4.2.0-alpha.11',
},
frameworkPresets: [
{
name: require.resolve('./preset'),
options: { api, options },
},
],
...generateCommanderProgram(argv, prodOptions),
});
});
};
module.exports.defaultModes = {
'storybook:build': 'production',
};