-
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.
- Loading branch information
0 parents
commit 7f5d110
Showing
14 changed files
with
288 additions
and
0 deletions.
There are no files selected for viewing
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,10 @@ | ||
.aws-sam/ | ||
.DS_Store | ||
.pnp.cjs | ||
.pnp.loader.mjs | ||
.yarn/ | ||
coverage/ | ||
dist/ | ||
logs | ||
node_modules/ | ||
yarn.lock |
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 @@ | ||
20.18.0 |
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 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"foxundermoon.shell-format", | ||
"orta.vscode-jest", | ||
"vscode.json-language-features", | ||
"vscode.typescript-language-features" | ||
] | ||
} |
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,52 @@ | ||
{ | ||
"[ignore]": { | ||
"editor.defaultFormatter": "foxundermoon.shell-format" | ||
}, | ||
"[dotenv]": { | ||
"editor.defaultFormatter": "foxundermoon.shell-format" | ||
}, | ||
"[json]": { | ||
"editor.defaultFormatter": "vscode.json-language-features" | ||
}, | ||
"[css]": { | ||
"editor.defaultFormatter": "vscode.css-language-features" | ||
}, | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint", | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "always", | ||
"source.organizeImports": "never" | ||
}, | ||
"eslint.validate": [ | ||
"javascript", | ||
"typescript", | ||
"markdown", | ||
"json", | ||
"jsonc", | ||
"yaml", | ||
"xml", | ||
"html" | ||
], | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"typescript.format.enable": false, | ||
"jest.runMode": "on-demand", | ||
"editor.tabSize": 2, | ||
"explorer.excludeGitIgnore": false, | ||
"files.exclude": { | ||
"**/.git": false, | ||
"**/.gitignore": false, | ||
"node_modules": true, | ||
"dist": true, | ||
".cache": true | ||
}, | ||
"files.associations": { | ||
"*.test.ts": "typescript" | ||
}, | ||
"typescript.suggest.autoImports": true, | ||
"typescript.preferences.importModuleSpecifier": "relative", | ||
"typescript.referencesCodeLens.enabled": true, | ||
"typescript.updateImportsOnFileMove.enabled": "always", | ||
"[yaml]": { | ||
"editor.defaultFormatter": "redhat.vscode-yaml" | ||
} | ||
} |
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 @@ | ||
nodeLinker: node-modules |
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,14 @@ | ||
import * as process from 'node:process' | ||
import esbuild from 'esbuild' | ||
|
||
esbuild.build({ | ||
entryPoints: ['./src/lambda.ts'], | ||
bundle: true, | ||
platform: 'node', | ||
target: ['node20'], | ||
outdir: './dist', | ||
sourcemap: true, | ||
minify: false, | ||
external: ['aws-sdk'], | ||
logLevel: 'info', | ||
}).catch(() => process.exit(1)) |
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,21 @@ | ||
import antfu from '@antfu/eslint-config' | ||
|
||
export default antfu({ | ||
ignores: [ | ||
'.pnpm-store/', | ||
'.vscode/', | ||
'events/', | ||
'package.json', | ||
'samconfig.toml', | ||
'template.yaml', | ||
'tsconfig.json', | ||
], | ||
plugins: { | ||
}, | ||
languageOptions: { | ||
}, | ||
rules: { | ||
}, | ||
settings: { | ||
}, | ||
}) |
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,7 @@ | ||
{ | ||
"httpMethod": "POST", | ||
"body": "{\"filename\": \"testfile.jpg\"}", | ||
"headers": { | ||
"Content-Type": "application/json" | ||
} | ||
} |
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 @@ | ||
import type { Config } from 'jest' | ||
|
||
const customJestConfig: Config = { | ||
testEnvironment: 'node', | ||
moduleNameMapper: { | ||
'^@/(.*)$': '<rootDir>/src/$1', | ||
}, | ||
testMatch: ['<rootDir>/test/**/*.test.ts}'], | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
|
||
transform: { | ||
'^.+\\.(ts)$': '@swc/jest', | ||
}, | ||
collectCoverage: true, | ||
coverageDirectory: 'coverage', | ||
moduleFileExtensions: ['ts', 'js'], | ||
} | ||
|
||
export default customJestConfig |
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,61 @@ | ||
{ | ||
"name": "p6- | ||
"description": "APIGW Receiver Serverless Image Brander for LDAR Pets", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/luckydoganimalrescue/p6-ldar-cdk-pnp-brand-image.git" | ||
}, | ||
"version": "0.3.0", | ||
"author": { | ||
"name": "Philip M. Gollucci", | ||
"email": "pgollucci@p6m7g8.com", | ||
"url": "https://www.linkedin.com/in/pgollucci", | ||
"organization": true | ||
}, | ||
"keywords": [ | ||
"aws", | ||
"lambda", | ||
"samcli" | ||
], | ||
"engines": { | ||
"node": ">= 20.10.18" | ||
}, | ||
"license": "Apache-2.0", | ||
"type": "module", | ||
"main": "src/lambda.ts", | ||
"scripts": { | ||
"all": "yarn nuke && yarn install && yarn docker && yarn sam:container && yarn run ci", | ||
"bundle": "node --trace-deprecation esbuild.config.mjs", | ||
"ci": "yarn run lint && yarn run test && yarn run bundle", | ||
"docker": "docker run -it --rm -v $(pwd):/app -w /app node:20 bash -c \"rm -rf node_modules && COREPACK_ENABLE_DOWNLOAD_PROMPT=0 CI=1 corepack enable && COREPACK_ENABLE_DOWNLOAD_PROMPT=0 CI=1 yarn install\"", | ||
"nuke": "rm -rf .aws-sam coverage dist node_modules .yarn", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"sam:container": "sam build --use-container", | ||
"sam:start:api": "yarn run ci && sam local start-api --port 3001 --debug", | ||
"sam:invoke:X": "yarn run ci && sam local invoke XFunction --event events/brand.json", | ||
"test": "node --trace-deprecation ./node_modules/jest/bin/jest.js --config jest.config.ts --coverage --passWithNoTests", | ||
"test:watch": "node --trace-deprecation ./node_modules/jest/bin/jest.js --config jest.config.ts --watch --coverage", | ||
"type": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"aws-lambda": "^1.0.7" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^3.8.0", | ||
"@swc/jest": "^0.2.36", | ||
"@types/aws-lambda": "^8.10.145", | ||
"@types/jest": "^29.5.14", | ||
"@types/node": "^22.7.9", | ||
"@typescript-eslint/eslint-plugin": "^8.11.0", | ||
"@typescript-eslint/parser": "^8.11.0", | ||
"esbuild": "^0.24.0", | ||
"eslint": "^9.13.0", | ||
"eslint-plugin-import": "^2.31.0", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.2.5", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.6.3" | ||
}, | ||
"packageManager": "yarn@4.5.1" | ||
} |
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 @@ | ||
version = 0.1 | ||
|
||
[default.deploy] | ||
|
||
[default.package] |
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 @@ | ||
import type { Context } from 'aws-lambda' | ||
import * as process from 'node:process' | ||
|
||
export const handler = async ( | ||
event, | ||
_context: Context, | ||
): => { | ||
const body = JSON.parse(event.body || '{]') | ||
|
||
return { | ||
statusCode: 200, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Headers': '*', | ||
'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE,PATCH,OPTIONS', | ||
}, | ||
body: JSON.stringify({ x }), | ||
} | ||
} |
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,29 @@ | ||
Resources: | ||
MyApi: | ||
Type: AWS::Serverless::Api | ||
Properties: | ||
StageName: Prod | ||
Cors: | ||
AllowMethods: "'OPTIONS,GET,POST'" | ||
AllowHeaders: "'Content-Type'" | ||
AllowOrigin: "'*'" | ||
|
||
XFunction: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: dist/X.handler | ||
Runtime: nodejs20.x | ||
CodeUri: ./dist | ||
Events: | ||
ApiEvent: | ||
Type: Api | ||
Properties: | ||
RestApiId: !Ref MyApi | ||
Path: /X | ||
Method: post | ||
|
||
XunctionLogGroup: | ||
Type: AWS::Logs::LogGroup | ||
Properties: | ||
LogGroupName: /aws/lambda/XFunctionLogGroup | ||
RetentionInDays: 14 |
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,40 @@ | ||
{ | ||
"compilerOptions": { | ||
"incremental": true, | ||
"target": "ESNext", | ||
"lib": [ | ||
"esnext" | ||
], | ||
"module": "ESNext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"types": [ | ||
"node", | ||
"jest" | ||
], | ||
"allowJs": false, | ||
"strict": true, | ||
"strictFunctionTypes": true, | ||
"strictNullChecks": true, | ||
"strictPropertyInitialization": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"noUncheckedIndexedAccess": true, | ||
"useUnknownInCatchVariables": true, | ||
"noEmit": true, | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"jest.config.ts", | ||
"src/**/*.ts", | ||
"test/**/*.ts", | ||
], | ||
"exclude": [ | ||
"dist", | ||
"node_modules" | ||
] | ||
} |