diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3638b7f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/dist/app.js", + "port": "9229" + } + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 733742d..fe09bf8 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,13 @@ "name": "responder", "version": "1.0.0", "description": "", - "main": "app.js", + "main": "dist/app.js", "scripts": { - "start": "serverless offline --noPrependStageInUrl", + "cleanup": "rm -rf dist", + "build": "yarn cleanup && tsc -p .", + "build:watch": "yarn cleanup && tsc -w -p .", + "start": "yarn build && serverless offline --location dist --noPrependStageInUrl", + "start:debug": "yarn build && node --inspect ./node_modules/.bin/serverless offline --location dist --noPrependStageInUrl", "deploy": "serverless deploy" }, "author": "", @@ -16,6 +20,7 @@ }, "devDependencies": { "nodemon": "^2.0.15", - "serverless-offline": "^8.3.1" + "serverless-offline": "^8.3.1", + "typescript": "^4.5.4" } } \ No newline at end of file diff --git a/serverless.yml b/serverless.yml index 9c0c4fe..1c06286 100644 --- a/serverless.yml +++ b/serverless.yml @@ -17,4 +17,7 @@ functions: method: post plugins: - serverless-offline +custom: + serverless-offline: + port: 4000 useDotEnv: true diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..7c6a860 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "esModuleInterop": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "allowJs": true, + "sourceMap": true, + "rootDir": "src", + "outDir": "dist" + }, + "include": [ + "src/**/*" + ] + } \ No newline at end of file