mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 14:25:17 +00:00
Updated firebase function example
This commit is contained in:
@@ -10,23 +10,24 @@
|
|||||||
"build": "rm -rf lib && pnpm tsc"
|
"build": "rm -rf lib && pnpm tsc"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16"
|
"node": "20"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"firebase-admin": "^11.11.1",
|
"firebase-admin": "^13.0.2",
|
||||||
"firebase-functions": "^4.9.0",
|
"firebase-functions": "^6.2.0",
|
||||||
"tslib": "^2.7.0",
|
"tslib": "^2.8.1",
|
||||||
"passkit-generator": "workspace:*"
|
"passkit-generator": "workspace:*"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"passkit-generator": "workspace:*"
|
"passkit-generator": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"firebase-functions-test": "^0.2.3",
|
"firebase-functions-test": "^3.4.0",
|
||||||
"firebase-tools": "^12.9.1",
|
"firebase-tools": "^13.29.1",
|
||||||
"typescript": "^5.7.3"
|
"typescript": "^5.7.3",
|
||||||
|
"@types/node": "^20"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as functions from "firebase-functions";
|
import * as functions from "firebase-functions/https";
|
||||||
import { initializeApp } from "firebase-admin/app";
|
import { initializeApp } from "firebase-admin/app";
|
||||||
import { getStorage } from "firebase-admin/storage";
|
import { getStorage } from "firebase-admin/storage";
|
||||||
import passkit from "passkit-generator";
|
import { PKPass } from "passkit-generator";
|
||||||
import type { Barcode, TransitType } from "passkit-generator";
|
import type { Barcode, TransitType } from "passkit-generator";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
@@ -12,8 +12,6 @@ import os from "node:os";
|
|||||||
// Should probably not be used in production
|
// Should probably not be used in production
|
||||||
import startData from "./startData.json" assert { type: "json" };
|
import startData from "./startData.json" assert { type: "json" };
|
||||||
|
|
||||||
const PKPass = passkit.PKPass;
|
|
||||||
|
|
||||||
interface RequestWithBody extends functions.Request {
|
interface RequestWithBody extends functions.Request {
|
||||||
body: {
|
body: {
|
||||||
passModel: string;
|
passModel: string;
|
||||||
@@ -68,7 +66,7 @@ initializeApp({
|
|||||||
|
|
||||||
const storageRef = getStorage().bucket();
|
const storageRef = getStorage().bucket();
|
||||||
|
|
||||||
export const pass = functions.https.onRequest(
|
export const pass = functions.onRequest(
|
||||||
async (request: RequestWithBody, response) => {
|
async (request: RequestWithBody, response) => {
|
||||||
let modelBasePath: string;
|
let modelBasePath: string;
|
||||||
|
|
||||||
|
|||||||
2042
pnpm-lock.yaml
generated
2042
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user