/
createDlls.js
53 lines (49 loc) · 1.18 KB
/
createDlls.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
import path from 'path';
import webpack from 'webpack';
import config from './webpackDllsConfig';
const resolveLocal = dir => path.join(__dirname, dir);
const webpackAsPromised = c =>
new Promise((res, rej) => {
webpack(c).run((err, stats) => {
if (err || stats.hasErrors() || stats.hasWarnings()) {
rej(stats);
return;
}
res(stats);
});
});
const run = () =>
webpackAsPromised(
config({
entry: {
storybook_ui: [
'@emotion/core',
'@emotion/styled',
'@storybook/addons',
'@storybook/api',
'@storybook/components',
'@storybook/core-events',
'@storybook/theming',
'airbnb-js-shims',
'emotion-theming',
'prop-types',
'react',
'react-dom',
'regenerator-runtime/runtime',
resolveLocal('../dist/index.js'),
],
},
})
);
run().then(
s => {
// eslint-disable-next-line no-console
console.log('success: ', s.toString());
process.exitCode = 0;
},
s => {
// eslint-disable-next-line no-console
console.error('failed: ', s.toString());
process.exitCode = 1;
}
);