-
Notifications
You must be signed in to change notification settings - Fork 233
/
_build_npm.ts
executable file
·73 lines (67 loc) · 1.81 KB
/
_build_npm.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-net --allow-env --allow-run
// Copyright 2018-2022 the oak authors. All rights reserved. MIT license.
/**
* This is the build script for building the oak framework into a Node.js
* compatible npm package.
*
* @module
*/
async function start() {
await emptyDir("./npm");
await copy("fixtures", "npm/esm/fixtures", { overwrite: true });
await copy("fixtures", "npm/script/fixtures", { overwrite: true });
await build({
entryPoints: ["./mod.ts"],
outDir: "./npm",
mappings: {
"./http_server_native.ts": "./http_server_node.ts",
},
shims: {
blob: true,
crypto: true,
deno: true,
undici: true,
custom: [{
package: {
name: "stream/web",
},
globalNames: ["ReadableStream", "TransformStream"],
}, {
module: "./node_shims.ts",
globalNames: ["ErrorEvent"],
}],
},
test: true,
compilerOptions: {
importHelpers: true,
target: "ES2021",
},
package: {
name: "@oakserver/oak",
version: Deno.args[0],
description: "A middleware framework for handling HTTP requests",
license: "MIT",
engines: {
node: ">=16.5.0 <18",
},
repository: {
type: "git",
url: "git+https://github.com/oakserver/oak.git",
},
bugs: {
url: "https://github.com/oakserver/oak/issues",
},
dependencies: {
"tslib": "~2.3.1",
},
devDependencies: {
"@types/node": "^16",
},
},
});
await Deno.copyFile("LICENSE", "npm/LICENSE");
await Deno.copyFile("README.md", "npm/README.md");
}
start();