Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #158 from swarmion/chore/shared-serverless-constraint
Browse files Browse the repository at this point in the history
chore: use shared serverless constraint
  • Loading branch information
fargito authored Apr 15, 2022
2 parents fb2ad0d + 2188365 commit f965725
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 22 deletions.
5 changes: 3 additions & 2 deletions backend/core/serverless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AWS } from '@serverless/typescript';

import { httpApiResourceContract } from '@swarmion-starter/core-contracts';
import {
frameworkVersion,
projectName,
sharedEsbuildConfig,
sharedParams,
Expand All @@ -13,15 +14,15 @@ import { functions } from './functions';

const serverlessConfiguration: AWS = {
service: `${projectName}-core`, // Keep it short to have role name below 64
frameworkVersion: '>=3.0.0',
frameworkVersion,
configValidationMode: 'error',
plugins: ['serverless-esbuild'],
provider: {
...sharedProviderConfig,
httpApi: {
payload: '2.0',
cors: {
// @ts-ignore we use a configuration per environment so we put it as a serverless variable
// @ts-expect-error we use a configuration per environment so we put it as a serverless variable
allowedOrigins: '${param:apiGatewayCorsAllowedOrigins}',
allowedHeaders: ['Content-Type', 'Authorization', 'Origin'],
allowedMethods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
Expand Down
3 changes: 2 additions & 1 deletion backend/forum/serverless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AWS } from '@serverless/typescript';

import { httpApiResourceContract } from '@swarmion-starter/core-contracts';
import {
frameworkVersion,
projectName,
sharedEsbuildConfig,
sharedParams,
Expand All @@ -12,7 +13,7 @@ import { functions } from './functions';

const serverlessConfiguration: AWS = {
service: `${projectName}-forum`, // Keep it short to have role name below 64
frameworkVersion: '>=3.0.0',
frameworkVersion,
configValidationMode: 'error',
plugins: ['serverless-esbuild', 'serverless-iam-roles-per-function'],
provider: {
Expand Down
3 changes: 2 additions & 1 deletion backend/users/serverless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AWS } from '@serverless/typescript';

import { httpApiResourceContract } from '@swarmion-starter/core-contracts';
import {
frameworkVersion,
projectName,
sharedEsbuildConfig,
sharedParams,
Expand All @@ -12,7 +13,7 @@ import { functions } from './functions';

const serverlessConfiguration: AWS = {
service: `${projectName}-users`, // Keep it short to have role name below 64
frameworkVersion: '>=3.0.0',
frameworkVersion,
configValidationMode: 'error',
plugins: ['serverless-esbuild', 'serverless-iam-roles-per-function'],
provider: {
Expand Down
2 changes: 1 addition & 1 deletion contracts/core-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"@swarmion/serverless-contracts": "0.5.4"
"@swarmion/serverless-contracts": "0.5.5"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
Expand Down
2 changes: 1 addition & 1 deletion contracts/forum-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"@swarmion/serverless-contracts": "0.5.4"
"@swarmion/serverless-contracts": "0.5.5"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
Expand Down
2 changes: 1 addition & 1 deletion contracts/users-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"@swarmion/serverless-contracts": "0.5.4"
"@swarmion/serverless-contracts": "0.5.5"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
Expand Down
3 changes: 2 additions & 1 deletion frontend/cloudfront/serverless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { AWS } from '@serverless/typescript';
import type { Lift } from 'serverless-lift';

import {
frameworkVersion,
projectName,
sharedParams,
sharedProviderConfig,
} from '@swarmion-starter/serverless-configuration';

const serverlessConfiguration: AWS & Lift = {
service: `${projectName}-frontend`, // Keep it short to have role name below 64
frameworkVersion: '>=3.0.0',
frameworkVersion,
plugins: ['serverless-lift'],
provider: sharedProviderConfig,
params: sharedParams,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@nrwl/linter": "^13.10.1",
"@nrwl/tao": "^13.10.1",
"@nrwl/workspace": "^13.10.1",
"@swarmion/nx-plugin": "0.5.4",
"@swarmion/nx-plugin": "0.5.5",
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.19.0",
Expand Down
1 change: 1 addition & 0 deletions packages/serverless-configuration/src/sharedConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const projectName = 'swarmion-starter';
export const region = 'eu-west-1';
export const frameworkVersion = '>=3.0.0';

export const defaultEnvironment = 'dev';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const mergeStageParams = <
return Object.keys(commonStageParams).reduce(
(prev, stage) => ({
...prev,
// @ts-ignore TODO ignore inner typing here
// @ts-expect-error TODO ignore inner typing here
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
[stage]: { ...commonStageParams[stage], ...serviceStageParams[stage] },
}),
Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4039,7 +4039,7 @@ __metadata:
"@babel/preset-env": ^7.16.11
"@babel/preset-typescript": ^7.16.7
"@babel/runtime": ^7.17.9
"@swarmion/serverless-contracts": 0.5.4
"@swarmion/serverless-contracts": 0.5.5
"@types/node": ^17.0.23
"@zerollup/ts-transform-paths": ^1.7.18
babel-plugin-module-resolver: ^4.1.0
Expand All @@ -4064,7 +4064,7 @@ __metadata:
"@babel/preset-env": ^7.16.11
"@babel/preset-typescript": ^7.16.7
"@babel/runtime": ^7.17.9
"@swarmion/serverless-contracts": 0.5.4
"@swarmion/serverless-contracts": 0.5.5
"@types/node": ^17.0.23
"@zerollup/ts-transform-paths": ^1.7.18
babel-plugin-module-resolver: ^4.1.0
Expand Down Expand Up @@ -4215,7 +4215,7 @@ __metadata:
"@nrwl/linter": ^13.10.1
"@nrwl/tao": ^13.10.1
"@nrwl/workspace": ^13.10.1
"@swarmion/nx-plugin": 0.5.4
"@swarmion/nx-plugin": 0.5.5
"@types/jest": ^27.4.1
"@typescript-eslint/eslint-plugin": ^5.19.0
"@typescript-eslint/parser": ^5.19.0
Expand Down Expand Up @@ -4307,7 +4307,7 @@ __metadata:
"@babel/preset-env": ^7.16.11
"@babel/preset-typescript": ^7.16.7
"@babel/runtime": ^7.17.9
"@swarmion/serverless-contracts": 0.5.4
"@swarmion/serverless-contracts": 0.5.5
"@types/node": ^17.0.23
"@zerollup/ts-transform-paths": ^1.7.18
babel-plugin-module-resolver: ^4.1.0
Expand All @@ -4323,21 +4323,21 @@ __metadata:
languageName: unknown
linkType: soft

"@swarmion/nx-plugin@npm:0.5.4":
version: 0.5.4
resolution: "@swarmion/nx-plugin@npm:0.5.4"
checksum: 3797226e5a55f5ade8d128962e5356248bd8974f5932aac5c380bf0b2314df59f4c8ed6402de8bad5a07235b2dec36e015e4849446c066fd07a382f94ef92a5b
"@swarmion/nx-plugin@npm:0.5.5":
version: 0.5.5
resolution: "@swarmion/nx-plugin@npm:0.5.5"
checksum: 9fb45dcb98906397c8453bf1fa068b29d3dfed2ac32a69f30927eb33333434ec0af0543de3e71128e78678fbbe4d00d632c83515d67c0b29fd1fe78c9b8397b5
languageName: node
linkType: hard

"@swarmion/serverless-contracts@npm:0.5.4":
version: 0.5.4
resolution: "@swarmion/serverless-contracts@npm:0.5.4"
"@swarmion/serverless-contracts@npm:0.5.5":
version: 0.5.5
resolution: "@swarmion/serverless-contracts@npm:0.5.5"
dependencies:
"@babel/runtime": ^7.17.9
axios: ^0.26.1
lodash: ^4.17.21
checksum: 09c56ef2e6b84fac497ae2bb860bd5daf6700d489d7582d98f8c0cc37981f5bde294ade276559c9ebfd991435eae2f92ee548f25afb4389d4c35b5489983be69
checksum: 135e89dcfa3f5b65a8534c5852a3aa081dd6c6ffba83067515f0c8beceb230fdc6e58859ab5bb219505fa99788734d43171c58daafdcd97cfebdf18439e6eb94
languageName: node
linkType: hard

Expand Down

0 comments on commit f965725

Please sign in to comment.