Fixed exports and compiled function to ESM

This commit is contained in:
Alexander Cerutti
2023-07-29 23:58:49 +02:00
parent f2442fc4ce
commit fb6e6739b5
3 changed files with 7 additions and 4 deletions

View File

@@ -16,6 +16,7 @@
"engines": { "engines": {
"node": "16" "node": "16"
}, },
"type": "module",
"main": "lib/index.js", "main": "lib/index.js",
"dependencies": { "dependencies": {
"axios": "^1.2.6", "axios": "^1.2.6",

View File

@@ -1,11 +1,13 @@
import functions from "firebase-functions"; import * as functions from "firebase-functions";
import admin from "firebase-admin"; import admin from "firebase-admin";
import { PKPass } from "passkit-generator"; import passkit 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";
import os from "node:os"; import os from "node:os";
const PKPass = passkit.PKPass;
// Firebase init // Firebase init
admin admin
.initializeApp .initializeApp
@@ -57,7 +59,7 @@ declare global {
} }
} }
exports.pass = functions.https.onRequest(async (request, response) => { export const pass = functions.https.onRequest(async (request, response) => {
const newPass = await PKPass.from( const newPass = await PKPass.from(
{ {
// Get relevant pass model from model folder (see passkit-generator/examples/models/) // Get relevant pass model from model folder (see passkit-generator/examples/models/)

View File

@@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es2016", "target": "ESNext",
"module": "NodeNext", "module": "NodeNext",
"rootDir": "src", "rootDir": "src",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",