Skip to content

Commit c3967ce

Browse files
committed
refactor: build scripts
1 parent 18a62ca commit c3967ce

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

scripts/build.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { execSync } from 'node:child_process'
2+
import fs from 'fs-extra'
3+
4+
async function build() {
5+
await fs.remove('./out')
6+
execSync('tsup src/index.ts --format cjs --external vscode --no-shims', { stdio: 'inherit' })
7+
8+
const files = [
9+
'LICENSE',
10+
'README.md',
11+
'snippets',
12+
'.vscodeignore',
13+
'resources',
14+
'assets',
15+
'syntaxes',
16+
'ui'
17+
]
18+
19+
for (const f of files)
20+
{await fs.copy(`./${f}`, `./out/${f}`)}
21+
22+
const json = await fs.readJSON('./package.json')
23+
delete json.scripts
24+
delete json.devDependencies
25+
json.main = 'index.js'
26+
await fs.writeJSON('./out/package.json', json)
27+
}
28+
29+
build()

0 commit comments

Comments
 (0)