-
Notifications
You must be signed in to change notification settings - Fork 1
/
packerConfig.js
57 lines (55 loc) · 2.1 KB
/
packerConfig.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
const path = require('path');
const {packer, webpack} = require('lerna-packer');
const {makeModulePackageJson, copyRootPackageJson, transformForEsModule} = require('lerna-packer/packer/modulePackages');
packer({
apps: {
demo: {
root: path.resolve(__dirname, 'packages', 'demo'),
template: path.resolve(__dirname, 'packages', 'demo/public/index.html'),
contentBase: path.resolve(__dirname, 'packages', 'demo/public'),// dev-server
port: 4203,
main: path.resolve(__dirname, 'packages', 'demo/src/index.tsx'),
dist: path.resolve(__dirname, 'dist', 'demo'),
devServer: {
client: {
overlay: false,
progress: false,
},
},
publicPath: '/',
},
},
packages: {
// the keys are the commonjs names that is applied to externals
// this is the same as `@babel/plugin-transform-modules-commonjs` applies
kitCode: {
name: '@ui-schema/kit-codemirror',
root: path.resolve(__dirname, 'packages', 'kit-codemirror'),
entry: path.resolve(__dirname, 'packages', 'kit-codemirror/src/'),
},
materialCode: {
name: '@ui-schema/material-code',
root: path.resolve(__dirname, 'packages', 'material-code'),
entry: path.resolve(__dirname, 'packages', 'material-code/src/'),
},
},
}, __dirname, {
afterEsModules: (packages, pathBuild) => {
return Promise.all([
makeModulePackageJson(transformForEsModule)(packages, pathBuild),
copyRootPackageJson()(packages, pathBuild),
])
},
})
.then(([execs, elapsed]) => {
if(execs.indexOf('doServe') !== -1) {
console.log('[packer] is now serving (after ' + elapsed + 'ms)')
} else {
console.log('[packer] finished successfully (after ' + elapsed + 'ms)', execs)
process.exit(0)
}
})
.catch((e) => {
console.error('[packer] finished with error(s)', e)
process.exit(1)
})