-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(serverless): ⚡ add config serverless functions (#2)
* chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore(be): 🚀 config serverless * chore: 🚀 config serverless * chore: 🚀 config serverless * chore: 🚀 config serverless * chore: 🚀 config serverless * chore: 🚀 config serverless * chore: 🚀 config serverless * chore: 🚀 config serverless * chore: 🚀 config serverless
- Loading branch information
1 parent
86e1a18
commit 69f8c69
Showing
14 changed files
with
142 additions
and
16 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './dtos'; | ||
export * from './guards'; | ||
export * from './strategies'; | ||
export * from './auth.module'; | ||
export * from './auth.service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './auth'; | ||
export * from './task-logs'; | ||
export * from './tasks'; | ||
export * from './users'; | ||
export * from './app.module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './tasks.module'; | ||
export * from './schemas'; | ||
export * from './tasks.module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Config for using path-aliases | ||
*/ | ||
|
||
const path = require('path'); | ||
const moduleAlias = require('module-alias'); | ||
const tsConfigPaths = require('tsconfig-paths'); | ||
const tsConfig = require('./tsconfig.json'); | ||
|
||
const baseUrl = tsConfig?.compilerOptions?.baseUrl ?? '../'; | ||
|
||
// Register tsconfig-paths, use for TS | ||
tsConfigPaths.register({ | ||
baseUrl: baseUrl, | ||
paths: tsConfig.compilerOptions.paths, | ||
cwd: __dirname, | ||
}); | ||
|
||
// Config for serverless can understand alias | ||
if (tsConfig?.compilerOptions?.paths) { | ||
for (const alias in tsConfig.compilerOptions.paths) { | ||
const paths = tsConfig.compilerOptions.paths[alias]; | ||
if (paths) { | ||
let targetPath = paths[0]; | ||
targetPath = targetPath.replace(/(\/\*|\*|\\*)$/g, ''); | ||
const formattedAlias = alias.replace(/(\/\*|\*|\\*)$/g, ''); | ||
moduleAlias.addAlias(formattedAlias, path.resolve(__dirname, baseUrl, targetPath)); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Require the needed modules, that serverless can compile it to JS | ||
* Then the server can be import and run it | ||
*/ | ||
require('../../apps/be/common/src/index'); | ||
require('../../apps/be/src/app/index'); | ||
|
||
/** | ||
* Main file to run the server | ||
*/ | ||
require('../../apps/be/src/main'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"target": "ES2021", | ||
"module": "CommonJS", | ||
"moduleResolution": "Node", | ||
"skipLibCheck": true, | ||
"types": ["node"], | ||
"strictPropertyInitialization": false, | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"baseUrl": "../../", | ||
"paths": { | ||
"~be/app/*": ["apps/be/src/app/*"], | ||
"~be/common/*": ["apps/be/common/src/*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "https://openapi.vercel.sh/vercel.json", | ||
"regions": ["sin1"], | ||
"installCommand": "cd ../ && yarn install --immutable", | ||
"buildCommand": "", | ||
"functions": { | ||
"api/**/*.ts": { | ||
"maxDuration": 60 | ||
} | ||
}, | ||
"rewrites": [{ "source": "/(.*)", "destination": "/api" }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$schema": "https://openapi.vercel.sh/vercel.json", | ||
"framework": "nextjs", | ||
"regions": ["sin1"], | ||
"installCommand": "yarn install --immutable", | ||
"buildCommand": "yarn nx build fe", | ||
"outputDirectory": "dist/apps/fe/.next", | ||
"cleanUrls": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters