Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Eric Nelson sandalsoft

🏠
Working from home
Block or report user

Report or block sandalsoft

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View serverless.yml
custom:
functionName: __FUNCTION_NAME__
service:
name: ${self:custom.functionName}
plugins:
- serverless-plugin-typescript
provider:
View prettier.config.js
module.exports = {
trailingComma: `es5`,
};
View babel.config.js
module.exports = {
presets: [`@babel/env`, `@babel/preset-typescript`],
plugins: [
`@babel/proposal-class-properties`,
`@babel/proposal-object-rest-spread`,
`transform-es2015-modules-commonjs`,
`@babel/plugin-proposal-optional-chaining`,
[
`@babel/plugin-transform-runtime`,
{
View lambda2img.Dockerfile
ARG FUNCTION_RUNTIME
FROM mikesir87/aws-cli as code
ARG FUNCTION_NAME
ARG AWS_DEFAULT_REGION
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
RUN wget -O function.zip `aws lambda get-function --function-name $FUNCTION_NAME --query 'Code.Location' --output text`
View .eslintrc.js
module.exports = {
parser: "@typescript-eslint/parser",
extends: [
// "plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
],
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
View axios_mock.ts
// from https://stackoverflow.com/questions/51393952/mock-inner-axios-create/51414152#51414152
const mockAxios: any = jest.genMockFromModule('axios');
mockAxios.get = jest.fn(() => mockAxios);
mockAxios.post = jest.fn(() => mockAxios);
export default mockAxios;
View Dockerfile
FROM mhart/alpine-node:8
ENV APPDIR=/app
RUN mkdir $APPDIR
RUN npm install --global tsc typescript
ENV HOME=$APPDIR
COPY package.json $APPDIR
COPY jest.config.js $APPDIR
COPY license.txt $APPDIR
COPY .gitignore $APPDIR
View ts.launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/dist/client.js",
"cwd": "${workspaceRoot}",
"preLaunchTask": "npm: build",
View jest.config.js
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
coverageReporters: ["json", "lcov", "text", "clover"],
// collectCoverage: true,
transform: {
"^.+\\.tsx?$": "ts-jest"
},
// testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
testMatch: ["**/*.test.[tj]s"],
You can’t perform that action at this time.