|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +const build = require('./build'); |
| 4 | +const server = require('./server'); |
| 5 | +const makeWebpackConfig = require('./make-webpack-config'); |
| 6 | +const getConfig = require('./config'); |
| 7 | + |
| 8 | +module.exports = { |
| 9 | + /** |
| 10 | + * Build style guide. |
| 11 | + * |
| 12 | + * @param {object} config Styleguidist config. |
| 13 | + * @param {Function} callback callback(err, config, stats). |
| 14 | + * @return {Compiler} Webpack Compiler instance. |
| 15 | + */ |
| 16 | + build(config, callback) { |
| 17 | + config = getConfig(config); |
| 18 | + return build(config, (err, stats) => callback(err, config, stats)); |
| 19 | + }, |
| 20 | + |
| 21 | + /** |
| 22 | + * Start style guide dev server. |
| 23 | + * |
| 24 | + * @param {object} config Styleguidist config. |
| 25 | + * @param {Function} callback callback(err, config). |
| 26 | + * @return {Compiler} Webpack Compiler instance. |
| 27 | + */ |
| 28 | + server(config, callback) { |
| 29 | + config = getConfig(config); |
| 30 | + return server(config, err => callback(err, config)); |
| 31 | + }, |
| 32 | + |
| 33 | + /** |
| 34 | + * Return Styleguidist Webpack config. |
| 35 | + * |
| 36 | + * @param {object} config Styleguidist config. |
| 37 | + * @param {string} env 'production' or 'development'. |
| 38 | + * @return {object} |
| 39 | + */ |
| 40 | + makeWebpackConfig(config, env) { |
| 41 | + config = getConfig(config); |
| 42 | + return makeWebpackConfig(config, env); |
| 43 | + }, |
| 44 | +}; |
0 commit comments