11#! /usr/bin/env bash
2+
23set -exuo pipefail
34
4- node scripts/check-version.cjs
5+ cd " $( dirname " $0 " ) /.."
6+
7+ node scripts/utils/check-version.cjs
58
69# Build into dist and will publish the package from there,
710# so that src/resources/foo.ts becomes <package root>/resources/foo.js
@@ -22,7 +25,7 @@ if [ -e "bin/cli" ]; then
2225fi
2326# this converts the export map paths for the dist directory
2427# 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
2629
2730# build to .js/.mjs/.d.ts files
2831npm exec tsc-multi
@@ -32,22 +35,22 @@ cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
3235# we need to add exports = module.exports = OpenAI Node to index.js;
3336# No way to get that from index.ts because it would cause compile errors
3437# when building .mjs
35- node scripts/fix-index-exports.cjs
38+ node scripts/utils/ fix-index-exports.cjs
3639# with "moduleResolution": "nodenext", if ESM resolves to index.d.ts,
3740# it'll have TS errors on the default import. But if it resolves to
3841# index.d.mts the default import will work (even though both files have
3942# the same export default statement)
4043cp dist/index.d.ts dist/index.d.mts
4144cp tsconfig.dist-src.json dist/src/tsconfig.json
4245
43- node scripts/postprocess-files.cjs
46+ node scripts/utils/ postprocess-files.cjs
4447
4548# make sure that nothing crashes when we require the output CJS or
4649# import the output ESM
4750(cd dist && node -e ' require("openai")' )
4851(cd dist && node -e ' import("openai")' --input-type=module)
4952
50- if command -v deno & > /dev/null && [ -e ./build-deno ]
53+ if command -v deno & > /dev/null && [ -e ./scripts/ build-deno ]
5154then
52- ./build-deno
55+ ./scripts/ build-deno
5356fi
0 commit comments