-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.js
47 lines (42 loc) · 950 Bytes
/
build.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
const fs = require('fs')
const path = require('path')
const paths = [
'lib/core.js',
'lib/hooks.js',
'lib/index.js',
'lib/service.js',
'types',
'package-lock.json',
'CHANGELOG.md',
'LICENSE.md',
'README.md',
]
;(async function () {
const { execa } = await import('execa')
const sh = (...args) => execa(...args, { stdio: 'inherit', shell: true })
await sh('rm -rf dist && mkdir -p dist')
for (const p of paths) {
await sh(`cp -R ${p} dist`)
}
const pkg = require('./package.json')
fs.writeFileSync(
path.join('dist', 'package.json'),
JSON.stringify(
{
name: pkg.name,
version: pkg.version,
description: pkg.description,
type: 'module',
exports: {
'.': './index.js',
'./core': './core.js',
'./service': './service.js',
'./hooks': './hooks.js',
},
...pkg,
},
null,
2,
),
)
})()