Updated serverless example to run on ESM

This commit is contained in:
Alexander Cerutti
2025-01-11 15:43:32 +01:00
parent 4044125e6a
commit 8c8763f8cd
11 changed files with 156 additions and 141 deletions

View File

@@ -6,20 +6,22 @@
"author": "Alexander P. Cerutti <cerutti.alexander@gmail.com>",
"license": "ISC",
"main": "src/index.js",
"type": "module",
"scripts": {
"clear:deps": "rm -rf node_modules",
"example": "pnpm serverless@3 offline --host 0.0.0.0; :'specifying host due to WSL limits'"
"example": "pnpm serverless offline --host 0.0.0.0; :'specifying host due to WSL limits'"
},
"dependencies": {
"aws-sdk": "^2.1691.0",
"tslib": "^2.7.0",
"aws-sdk": "^2.1692.0",
"tslib": "^2.8.1",
"passkit-generator": "workspace:*"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.145",
"@types/aws-lambda": "^8.10.147",
"serverless-offline": "^8.8.1",
"serverless-plugin-typescript": "^2.1.5",
"serverless-s3-local": "^0.8.5",
"typescript": "^5.7.3"
"typescript": "^5.7.3",
"@types/node": "^18"
}
}

View File

@@ -1,9 +1,9 @@
import { ALBEvent, ALBResult } from "aws-lambda";
import { PKPass } from "../../../../lib";
import { PKPass } from "passkit-generator";
import {
throwClientErrorWithoutModelName,
createPassGenerator,
} from "../shared";
} from "../shared.js";
/**
* Lambda for barcodes example

View File

@@ -3,7 +3,7 @@ import { PKPass } from "passkit-generator";
import {
throwClientErrorWithoutModelName,
createPassGenerator,
} from "../shared";
} from "../shared.js";
/**
* Lambda for expirationDate example

View File

@@ -1,6 +1,6 @@
import { ALBEvent, ALBResult } from "aws-lambda";
import { PKPass } from "passkit-generator";
import { createPassGenerator } from "../shared";
import { createPassGenerator } from "../shared.js";
/**
* Lambda for fields example

View File

@@ -1,6 +1,6 @@
export * from "./barcodes";
export * from "./expirationDate";
export * from "./fields";
export * from "./localize";
export * from "./pkpasses";
export * from "./scratch";
export * from "./barcodes.js";
export * from "./expirationDate.js";
export * from "./fields.js";
export * from "./localize.js";
export * from "./pkpasses.js";
export * from "./scratch.js";

View File

@@ -1,7 +1,7 @@
import {
throwClientErrorWithoutModelName,
createPassGenerator,
} from "../shared";
} from "../shared.js";
import type { ALBEvent, ALBResult } from "aws-lambda";
import type { PKPass } from "passkit-generator";

View File

@@ -37,7 +37,7 @@ import {
getS3Instance,
getRandomColorPart,
throwClientErrorWithoutModelName,
} from "../shared";
} from "../shared.js";
import config from "../../config.json";
/**

View File

@@ -4,7 +4,7 @@ import {
createPassGenerator,
getRandomColorPart,
getSpecificFileInModel,
} from "../shared";
} from "../shared.js";
/**
* Lambda for scratch example

View File

@@ -1 +1 @@
export * from "./functions";
export * from "./functions/index.js";

View File

@@ -2,9 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "ESNext",
"module": "CommonJS",
"outDir": "build",
"moduleResolution": "node",
"resolveJsonModule": true
},
"exclude": ["node_modules"]