Skip to content

Commit

Permalink
feature #3 - Update config setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeniosales committed Oct 15, 2022
1 parent f8f29ab commit f192deb
Show file tree
Hide file tree
Showing 8 changed files with 544 additions and 159 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ bower_components

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
.build

# Dependency directories
node_modules/
Expand Down
3 changes: 2 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {Config} from '@jest/types';
/* tslint:disable */
import type { Config } from '@jest/types';
// Sync object
const config: Config.InitialOptions = {
verbose: true,
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"lint": "tslint --project tsconfig.json -t verbose",
"lint-fix": "tslint --fix src/**/*.ts test/**/*.ts -t verbose",
"test": "jest",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"deploy": "clear && sls deploy --verbose"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
Expand Down Expand Up @@ -38,15 +39,16 @@
"ts-node-dev": "^1.1.8",
"tslint": "^6.1.3",
"tslint-config-standard": "^9.0.0",
"typescript": "^4.8.4"
"typescript": "^4.8.4",
"serverless-dynamodb-local": "^0.2.40"
},
"dependencies": {
"aws-lambda": "^1.0.7",
"aws-sdk": "^2.1082.0",
"axios": "^0.25.0",
"cors": "^2.8.5",
"dotenv": "^16.0.0",
"dynamoose": "^1.11.1",
"dynamoose": "^2.8.5",
"ts-node": "^10.7.0"
}
}
27 changes: 23 additions & 4 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ service: sbf
frameworkVersion: ">=1.50.0 <2.0.0"
provider:
name: aws
runtime: nodejs12.x
runtime: nodejs14.x
timeout: 30
memorySize: 512
stage: ${opt:stage, 'dev'}
region: us-east-1
deploymentBucket:
name: sbf-sls-artifacts-custom-test-${self:provider.stage}
useDotenv: true
iamRoleStatements:
- Effect: Allow
Action:
- 'ssm:GetParameter'
- 'ssm:GetParameters'
- 'ssm:GetParameterHistory'
- 'ssm:GetParametersByPath'
- 'ssm:DescribeParameters'
Resource: "*"
- Effect: Allow
Action:
- dynamodb:DescribeTable
Expand All @@ -24,16 +34,25 @@ provider:
- dynamodb:GetShardIterator
- dynamodb:ListStreams
- dynamodb:Scan
Resource: arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/*
Resource: "*"
environment:
STAGE: ${self:provider.stage}
STAGE: "${self:provider.stage}"
SQS_UPDATE_EXCHANGE_RATE_ARN: ${ssm:/exchangeRate/infra/sqs/updateExchangeRateQueueArn}
EXCHANGE_RATE_API_KEY: ${ssm:/exchangeRate/infra/api/exchangeRate/token}

plugins:
- serverless-plugin-typescript
- serverless-offline
- serverless-dotenv-plugin
- serverless-dynamodb-local

custom:
funcDir: src/4-framework/functions
baseApi: sbf/v1
baseApiInternal: api/v1
serverless-offline:
port: 4000
stage: dev

functions:
# Exchange Rate
- ${file(${self:custom.funcDir}/exchangeRate/_handlers.yml)}
1 change: 1 addition & 0 deletions terraform/ssm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ resource "aws_ssm_parameter" "exchange-rate-api-token-ssm" {
name = "/exchangeRate/infra/api/exchangeRate/token"
type = "String"
value = "custom"
overwrite = true
}
33 changes: 10 additions & 23 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
{
"extends": "./tsconfig.paths.json",
"compilerOptions": {
"lib": ["ES6"],
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"removeComments": true,
"skipLibCheck": true,
"allowJs": true,
"sourceMap": true,
"target": "ES6"
},
"include": ["src/**/*.ts", "test"],
"exclude": [
"node_modules/**/*",
".serverless/**/*",
".webpack/**/*",
"_warmup/**/*",
".vscode/**/*"
]
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"rootDir": ".", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"resolveJsonModule": true
}
}
12 changes: 0 additions & 12 deletions tsconfig.paths.json

This file was deleted.

Loading

0 comments on commit f192deb

Please sign in to comment.