Skip to content

Commit

Permalink
fix: remove eventsource dependency (#2052)
Browse files Browse the repository at this point in the history
* fix: remove eventsource dependency

* also remove eventsource types

* remove reference to eventsource import in test file
  • Loading branch information
Uzlopak authored Jul 13, 2024
1 parent cc86a53 commit caee841
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 16 deletions.
10 changes: 1 addition & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"commander": "^12.0.0",
"deepmerge": "^4.3.1",
"dotenv": "^16.3.1",
"eventsource": "^2.0.2",
"express": "^4.18.2",
"ioredis": "^5.3.2",
"js-yaml": "^4.1.0",
Expand All @@ -69,7 +68,6 @@
"@octokit/webhooks-examples": "^7.3.1",
"@octokit/webhooks-methods": "^4.0.0",
"@octokit/webhooks-types": "^7.3.1",
"@types/eventsource": "^1.1.15",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.0.0",
"@types/supertest": "^6.0.0",
Expand Down
4 changes: 1 addition & 3 deletions src/helpers/webhook-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import EventSource from "eventsource";

import type { Logger } from "pino";

export const createWebhookProxy = async (
Expand All @@ -13,7 +11,7 @@ export const createWebhookProxy = async (
target: `http://localhost:${opts.port}${opts.path}`,
fetch: opts.fetch,
});
return smee.start();
return smee.start() as EventSource;
} catch (error) {
opts.logger.warn(
"Run `npm install --save-dev smee-client` to proxy webhooks to localhost.",
Expand Down
1 change: 0 additions & 1 deletion src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { createWebhookProxy } from "../helpers/webhook-proxy.js";
import { VERSION } from "../version.js";
import type { ApplicationFunction, ServerOptions } from "../types.js";
import type { Probot } from "../index.js";
import type EventSource from "eventsource";
import { rebindLog } from "../helpers/rebind-log.js";

// the default path as defined in @octokit/webhooks
Expand Down
1 change: 0 additions & 1 deletion test/webhook-proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const sse: (
next: express.NextFunction,
) => void = require("connect-sse")();
import fetchMock from "fetch-mock";
import EventSource from "eventsource";
import { describe, expect, afterEach, test, vi } from "vitest";
import { getLog } from "../src/helpers/get-log.js";
import { createWebhookProxy } from "../src/helpers/webhook-proxy.js";
Expand Down

0 comments on commit caee841

Please sign in to comment.