1
1
#! /usr/bin/env bash
2
+
2
3
set -exuo pipefail
3
4
4
- node scripts/check-version.cjs
5
+ cd " $( dirname " $0 " ) /.."
6
+
7
+ node scripts/utils/check-version.cjs
5
8
6
9
# Build into dist and will publish the package from there,
7
10
# so that src/resources/foo.ts becomes <package root>/resources/foo.js
@@ -22,7 +25,7 @@ if [ -e "bin/cli" ]; then
22
25
fi
23
26
# this converts the export map paths for the dist directory
24
27
# and does a few other minor things
25
- node scripts/make-dist-package-json.cjs > dist/package.json
28
+ node scripts/utils/ make-dist-package-json.cjs > dist/package.json
26
29
27
30
# build to .js/.mjs/.d.ts files
28
31
npm exec tsc-multi
@@ -32,22 +35,22 @@ cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
32
35
# we need to add exports = module.exports = OpenAI Node to index.js;
33
36
# No way to get that from index.ts because it would cause compile errors
34
37
# when building .mjs
35
- node scripts/fix-index-exports.cjs
38
+ node scripts/utils/ fix-index-exports.cjs
36
39
# with "moduleResolution": "nodenext", if ESM resolves to index.d.ts,
37
40
# it'll have TS errors on the default import. But if it resolves to
38
41
# index.d.mts the default import will work (even though both files have
39
42
# the same export default statement)
40
43
cp dist/index.d.ts dist/index.d.mts
41
44
cp tsconfig.dist-src.json dist/src/tsconfig.json
42
45
43
- node scripts/postprocess-files.cjs
46
+ node scripts/utils/ postprocess-files.cjs
44
47
45
48
# make sure that nothing crashes when we require the output CJS or
46
49
# import the output ESM
47
50
(cd dist && node -e ' require("openai")' )
48
51
(cd dist && node -e ' import("openai")' --input-type=module)
49
52
50
- if command -v deno & > /dev/null && [ -e ./build-deno ]
53
+ if command -v deno & > /dev/null && [ -e ./scripts/ build-deno ]
51
54
then
52
- ./build-deno
55
+ ./scripts/ build-deno
53
56
fi
0 commit comments