diff --git a/bun.lockb b/bun.lockb index 6450b66..b1e5e8d 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 4c9313a..f16e265 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "devDependencies": { "bun-types": "latest" }, + "scripts": { + "prepare-client-serverless": "bun --filter 'doorman-client' build && cp -fr packages/client/dist/* packages/serverless/assets/ && cp -f packages/serverless/assets/index.html packages/serverless/assets/assets/index.html", + "deploy-serverless": "bun run prepare-client-serverless && bun --filter 'serverless' deploy" + }, "peerDependencies": { "typescript": "^5.0.0" }, @@ -13,6 +17,7 @@ "crypto": "^1.0.1", "express-fingerprint": "^1.2.2", "node-fetch": "^3.3.2", - "react-otp-input": "^3.1.1" + "react-otp-input": "^3.1.1", + "twilio-cli": "^5.19.4" } } diff --git a/packages/serverless/.gitignore b/packages/serverless/.gitignore new file mode 100644 index 0000000..655b8ab --- /dev/null +++ b/packages/serverless/.gitignore @@ -0,0 +1,135 @@ +# Twilio Serverless +.twiliodeployinfo + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +assets + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* diff --git a/packages/serverless/.nvmrc b/packages/serverless/.nvmrc new file mode 100644 index 0000000..25bf17f --- /dev/null +++ b/packages/serverless/.nvmrc @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/packages/serverless/.twilioserverlessrc b/packages/serverless/.twilioserverlessrc new file mode 100644 index 0000000..a7f5a1c --- /dev/null +++ b/packages/serverless/.twilioserverlessrc @@ -0,0 +1,42 @@ +{ + "commands": {}, + "environments": {}, + "projects": {}, + // "assets": true /* Upload assets. Can be turned off with --no-assets */, + // "assetsFolder": null /* Specific folder name to be used for static assets */, + // "buildSid": null /* An existing Build SID to deploy to the new environment */, + // "createEnvironment": false /* Creates environment if it couldn't find it. */, + // "cwd": null /* Sets the directory of your existing Serverless project. Defaults to current directory */, + // "detailedLogs": false /* Toggles detailed request logging by showing request body and query params */, + // "edge": null /* Twilio API Region */, + // "env": null /* Path to .env file for environment variables that should be installed */, + // "environment": "dev" /* The environment name (domain suffix) you want to use for your deployment. Alternatively you can specify an environment SID starting with ZE. */, + // "extendedOutput": false /* Show an extended set of properties on the output */, + // "force": false /* Will run deployment in force mode. Can be dangerous. */, + // "forkProcess": true /* Disable forking function processes to emulate production environment */, + // "functionSid": null /* Specific Function SID to retrieve logs for */, + // "functions": true /* Upload functions. Can be turned off with --no-functions */, + // "functionsFolder": null /* Specific folder name to be used for static functions */, + // "inspect": null /* Enables Node.js debugging protocol */, + // "inspectBrk": null /* Enables Node.js debugging protocol, stops execution until debugger is attached */, + // "legacyMode": false /* Enables legacy mode, it will prefix your asset paths with /assets */, + // "live": true /* Always serve from the current functions (no caching) */, + // "loadLocalEnv": false /* Includes the local environment variables */, + // "loadSystemEnv": false /* Uses system environment variables as fallback for variables specified in your .env file. Needs to be used with --env explicitly specified. */, + // "logCacheSize": null /* Tailing the log endpoint will cache previously seen entries to avoid duplicates. The cache is topped at a maximum of 1000 by default. This option can change that. */, + // "logLevel": "info" /* Level of logging messages. */, + // "logs": true /* Toggles request logging */, + // "ngrok": null /* Uses ngrok to create a public url. Pass a string to set the subdomain (requires a paid-for ngrok account). */, + // "outputFormat": "" /* Output the results in a different format */, + // "overrideExistingProject": false /* Deploys Serverless project to existing service if a naming conflict has been found. */, + // "port": "3000" /* Override default port of 3000 */, + // "production": false /* Promote build to the production environment (no domain suffix). Overrides environment flag */, + // "properties": null /* Specify the output properties you want to see. Works best on single types */, + // "region": null /* Twilio API Region */, + "runtime": "node18" /* The version of Node.js to deploy the build to. (node18) */, + // "serviceName": null /* Overrides the name of the Serverless project. Default: the name field in your package.json */, + // "serviceSid": null /* SID of the Twilio Serverless Service to deploy to */, + // "sourceEnvironment": null /* SID or suffix of an existing environment you want to deploy from. */, + // "tail": false /* Continuously stream the logs */, + // "template": null /* undefined */, +} \ No newline at end of file diff --git a/packages/serverless/package.json b/packages/serverless/package.json new file mode 100644 index 0000000..7897b4e --- /dev/null +++ b/packages/serverless/package.json @@ -0,0 +1,20 @@ +{ + "name": "serverless", + "version": "0.0.0", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "twilio-run", + "deploy": "twilio-run deploy --service-name react-twilio-serverless" + }, + "dependencies": { + "twilio": "^3.56", + "@twilio/runtime-handler": "1.3.0" + }, + "devDependencies": { + "twilio-run": "^3.5.4" + }, + "engines": { + "node": "18" + } +} \ No newline at end of file