-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_npm.ts
executable file
·128 lines (122 loc) · 3.66 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/env -S deno run --allow-read --allow-write=./,/Users/qwtel/Library/Caches/deno --allow-net --allow-env=HOME,DENO_AUTH_TOKENS,DENO_DIR --allow-run=git,pnpm
// ex. scripts/build_npm.ts
import { basename, extname } from "https://deno.land/std@0.133.0/path/mod.ts";
import { build, emptyDir } from "https://deno.land/x/dnt/mod.ts";
import {
latestVersion, copyMdFiles, getDescription, getGHTopics, getGHLicense, getGHHomepage,
} from 'https://gist.githubusercontent.com/qwtel/ecf0c3ba7069a127b3d144afc06952f5/raw/latest-version.ts'
await emptyDir("./npm");
const name = basename(Deno.cwd())
await build({
entryPoints: ["./index.ts", {
name: './basics',
path: 'basics.ts'
}, {
name: './body-parser',
path: 'body-parser.ts'
}, {
name: './caching',
path: 'caching.ts'
}, {
name: './content-negotiation',
path: 'content-negotiation.ts'
}, {
name: './context',
path: 'context.ts'
}, {
name: './cookies',
path: 'cookies.ts'
}, {
name: './cors',
path: 'cors.ts'
}, {
name: './session',
path: 'session.ts'
}],
outDir: "./npm",
shims: {},
test: false,
typeCheck: false,
package: {
// package.json properties
name: `@worker-tools/${name}`,
version: await latestVersion(),
description: await getDescription(),
license: await getGHLicense(name) ?? 'MIT',
publishConfig: {
access: "public"
},
author: "Florian Klampfer <mail@qwtel.com> (https://qwtel.com/)",
repository: {
type: "git",
url: `git+https://github.com/worker-tools/${name}.git`,
},
bugs: {
url: `https://github.com/worker-tools/${name}/issues`,
},
homepage: await getGHHomepage(name) ?? `https://github.com/worker-tools/${name}#readme`,
keywords: await getGHTopics(name) ?? [],
},
packageManager: 'pnpm',
compilerOptions: {
sourceMap: true,
target: 'ES2019',
},
mappings: {
// "https://ghuc.cc/kenchris/urlpattern-polyfill@69ac528/src/index.d.ts": {
// name: "urlpattern-polyfill",
// version: "^4.0.3",
// subPath: 'dist/index.d.ts'
// },
'https://ghuc.cc/qwtel/kv-storage-interface/index.d.ts': {
name: "kv-storage-interface",
version: "^0.2.0",
},
"https://ghuc.cc/qwtel/uuid-class/index.ts": {
name: "uuid-class",
version: "latest",
},
"https://ghuc.cc/qwtel/base64-encoding/index.ts": {
name: "base64-encoding",
version: "latest",
},
'https://cdn.skypack.dev/ts-functional-pipe@3.1.2?dts': {
name: "ts-functional-pipe",
version: "^3.1.2",
},
'https://cdn.skypack.dev/negotiated@1.0.2': {
name: "negotiated",
version: "^1.0.2",
},
"https://cdn.skypack.dev/msgpackr@1.5.5": {
name: "msgpackr",
version: "^1.5.5",
},
"https://ghuc.cc/worker-tools/request-cookie-store/index.ts": {
name: "@worker-tools/request-cookie-store",
version: "latest"
},
"https://ghuc.cc/worker-tools/signed-cookie-store/index.ts": {
name: "@worker-tools/signed-cookie-store",
version: "latest"
},
"https://ghuc.cc/worker-tools/encrypted-cookie-store/index.ts": {
name: "@worker-tools/encrypted-cookie-store",
version: "latest"
},
'https://ghuc.cc/worker-tools/resolvable-promise/index.ts': {
name: "@worker-tools/resolvable-promise",
version: "latest"
},
'https://ghuc.cc/worker-tools/extendable-promise/index.ts': {
name: "@worker-tools/extendable-promise",
version: "latest"
},
"https://ghuc.cc/worker-tools/response-creators/index.ts": {
name: "@worker-tools/response-creators",
version: "latest"
}
},
});
// post build steps
await copyMdFiles()