forked from openai/openai-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-deno
executable file
·48 lines (37 loc) · 1.07 KB
/
build-deno
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
#!/usr/bin/env bash
set -exuo pipefail
rm -rf deno; mkdir deno
cp -rp src/* deno
# x-release-please-start-version
cat << EOF > deno/README.md
# OpenAI Node API Library - Deno build
This is a build produced from https://github.com/openai/openai-node – please go there to read the source and docs, file issues, etc.
Usage:
\`\`\`ts
import OpenAI from "https://deno.land/x/openai@v4.38.2/mod.ts";
const client = new OpenAI();
\`\`\`
Note that in most Deno environments, you can also do this:
\`\`\`ts
import OpenAI from "npm:openai";
\`\`\`
EOF
# x-release-please-end
rm deno/_shims/auto/*-node.ts
for dir in deno/_shims deno/_shims/auto; do
rm "${dir}"/*.{d.ts,js,mjs}
for file in "${dir}"/*-deno.ts; do
mv -- "$file" "${file%-deno.ts}.ts"
done
done
for file in LICENSE CHANGELOG.md; do
if [ -e "${file}" ]; then cp "${file}" deno; fi
done
npm exec ts-node -T -- scripts/denoify.ts
deno fmt deno
deno check deno/mod.ts
if [ -e deno_tests ]; then
deno test deno_tests --allow-env
fi
# make sure that nothing crashes when we load the Deno module
(cd deno && deno run mod.ts)