diff --git a/app.js b/app.js index 7aed666..2f28ad3 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,7 @@ /** * @param {import('probot').Probot} app */ -module.exports = (app) => { +export default (app) => { app.log.info("Yay! The app was loaded!"); app.on("issues.opened", async (context) => { diff --git a/netlify/functions/webhooks.js b/netlify/functions/webhooks.js index a9e290e..195723d 100644 --- a/netlify/functions/webhooks.js +++ b/netlify/functions/webhooks.js @@ -1,5 +1,5 @@ -const { createProbot } = require("probot"); -const app = require("../../app"); +import { createProbot } from "probot"; +import app from "../../app.js"; const probot = createProbot(); const loadingApp = probot.load(app); @@ -10,7 +10,7 @@ const loadingApp = probot.load(app); * @param {import("@netlify/functions").HandlerEvent} event * @param {import("@netlify/functions").HandlerContext} context */ -exports.handler = async function (event, context) { +export const handler = async function (event, context) { try { await loadingApp; diff --git a/package.json b/package.json index dc1148f..b6b25f0 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "description": "Probot & Netlify Functions example", "main": "app.js", + "type": "module", "scripts": { "start": "probot run ./app.js", "test": "node test.js" diff --git a/test.js b/test.js index 5eb379c..ba430b7 100644 --- a/test.js +++ b/test.js @@ -1,12 +1,12 @@ -const { suite } = require("uvu"); -const assert = require("uvu/assert"); +import { suite } from "uvu"; +import * as assert from "uvu/assert"; -const nock = require("nock"); +import nock from "nock"; nock.disableNetConnect(); -const { Probot, ProbotOctokit } = require("probot"); +import { Probot, ProbotOctokit } from "probot"; -const app = require("./app"); +import app from "./app.js"; /** @type {import('probot').Probot */ let probot;