Skip to content

Commit

Permalink
build: fix build global may be failed (#1744)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuweiGL authored Jul 7, 2021
1 parent 83b5f4b commit 818aa13
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scripts/build-global.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import fs from 'fs-extra'
const copy = (dist = 'esm') => {
fs.copy('./src/global.d.ts', `./${dist}/global.d.ts`)
const copy = async (dist = 'esm') => {
await fs.copy('./src/global.d.ts', `./${dist}/global.d.ts`)
}
fs.copy('./src/global.d.ts', './lib/global.d.ts')
const writeRef = (dist = 'esm') => {
fs.writeFile(
const writeRef = async (dist = 'esm') => {
await fs.writeFile(
`./${dist}/index.d.ts`,
`/// <reference path="global.d.ts" />\n${fs.readFileSync(
`./${dist}/index.d.ts`,
'utf8'
)}`
)
}
copy('esm')
copy('lib')
writeRef('esm')
writeRef('lib')

;(async () => {
await copy('esm')
await copy('lib')
await writeRef('esm')
await writeRef('lib')
})()

0 comments on commit 818aa13

Please sign in to comment.