diff --git a/bun.lockb b/bun.lockb index 144415a..98ed205 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/doorman-client/bun.lockb b/packages/doorman-client/bun.lockb deleted file mode 100755 index 747920f..0000000 Binary files a/packages/doorman-client/bun.lockb and /dev/null differ diff --git a/packages/doorman-client/package.json b/packages/doorman-client/package.json index 78e90e6..d49430c 100644 --- a/packages/doorman-client/package.json +++ b/packages/doorman-client/package.json @@ -13,13 +13,16 @@ "dependencies": { "@twilio-labs/serverless-runtime-types": "^4.0.1", "@twilio/runtime-handler": "1.3.0", + "doorman-api": "workspace:*", "node-fetch": "^2.7.0", "prom-client": "^15.1.3", "prometheus-remote-write": "^0.5.1", "promise.timeout": "^1.2.0", "twilio": "^3.84.1", "winston": "^3.17.0", - "winston-loki": "^6.1.3" + "winston-loki": "^6.1.3", + "zod": "^3.25.56", + "zod_utilz": "^0.8.4" }, "devDependencies": { "@types/bun": "latest", diff --git a/packages/doorman-client/src/index.ts b/packages/doorman-client/src/index.ts index 8f3794b..0a6169b 100644 --- a/packages/doorman-client/src/index.ts +++ b/packages/doorman-client/src/index.ts @@ -10,12 +10,26 @@ const functionFiles = paths.map(path => readdirSync(path).map(file => path + "/" // for hot reload to work, we import all the files we want to build const imports = functionFiles.forEach(file => require('./' + path.relative('src', file))); + console.log("functions to build:", functionFiles); + +const bundledModules = ['zod_utilz']; + +const externalModules = Object.keys(require('../package.json').dependencies) + .filter(dep => !bundledModules.includes(dep)); + +console.log("Explicitly bundling dependencies", bundledModules); + +// console.log("external modules: ", externalModules); + console.log("Building functions..."); + await Bun.build({ entrypoints: functionFiles, outdir: './build/functions', - packages: 'external', + packages: 'bundle', target: 'node', + external: externalModules, + root: './src/functions', format: 'cjs', }); diff --git a/tsconfig.json b/tsconfig.json index 7556e1d..a7ef960 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,9 @@ "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "allowJs": true, + "esModuleInterop": true, "types": [ + "cypress", "bun-types" // add Bun global ] }