-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpack.ts
42 lines (36 loc) · 1.07 KB
/
pack.ts
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
import {Packager} from '../../Kodhe/kwruntime/std/package/compiler/pack.ts'
import {Builder} from '../../Kodhe/kwruntime/std/package/compiler/build.ts'
import Path from 'path'
import fs from 'fs'
main()
async function main(){
let workingFolder = Path.join(__dirname, "dist")
if(!fs.existsSync(workingFolder)) fs.mkdirSync(workingFolder)
let buildOptions = {
packager: null,
npmExternalModules: [
"@kwruntime/[email protected]"
],
target: 'node'
}
let packer = new Packager({
workingFolder,
root: Path.join(__dirname, "project"),
follow: true,
hash: "com.kodhe.kodnet-3.0",
useDataFolder: true,
main: "program.ts",
buildOptions
})
buildOptions.packager = packer
/*
let builder = new Builder(buildOptions)
await builder.compile(Path.join(__dirname, "project", "main.ts"))
await builder.writeTo(Path.join(workingFolder, "kodnet.js"))
*/
await packer.addSourceFile(Path.join(__dirname, "project", "main.ts"), "program.ts")
await packer.add([
Path.join(__dirname, "project")
])
await packer.writeTo(Path.join(workingFolder, "kodnet-3.0.6.kwc"))
}