Skip to content

Commit

Permalink
import maps not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmchase committed Feb 26, 2023
1 parent 091cf93 commit d349aaf
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 40 deletions.
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tasks": {
"lock": "deno cache --lock=deno.lock --lock-write deps/mod.ts",
"dev": "deno run --import-map=import_map.json --allow-read --allow-env --allow-net --watch mod.ts",
"dev": "deno run --allow-read --allow-env --allow-net --watch mod.ts",
"dev:link": "deno run --import-map=link.json --allow-read --allow-env --allow-net --watch mod.ts"
}
}
2 changes: 1 addition & 1 deletion deps/grove.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/grove@0.1.0/mod.ts";
export * from "https://deno.land/x/grove@0.2.0/mod.ts";
5 changes: 0 additions & 5 deletions import_map.json

This file was deleted.

2 changes: 1 addition & 1 deletion link.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"imports": {
"#grove/": "../grove/"
"https://deno.land/x/grove@0.2.0/": "../grove/"
}
}
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IContext, IState } from "#grove/mod.ts";
import { IContext, IState } from "../deps/grove.ts";
import { Services } from "./services/mod.ts";
import { Managers } from "./managers/mod.ts";

Expand Down
27 changes: 8 additions & 19 deletions src/controllers/error.controller.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Controller } from "#grove/mod.ts";
import { Controller, ILoggingService } from "../../deps/grove.ts";
import { Application, Context, Status } from "../../deps/oak.ts";
import { State } from "../context.ts";
import { AnalyticsService } from "../services/mod.ts";

export class ErrorController extends Controller<State> {
constructor(private readonly analytics: AnalyticsService) {
constructor(private readonly logging: ILoggingService) {
super();
}

Expand All @@ -17,26 +16,16 @@ export class ErrorController extends Controller<State> {
try {
await next();
} catch (err) {
const { name, message, stack, ...rest } = err;
const { message } = err;
const status = err.status ?? Status.InternalServerError;
ctx.response.status = status;
ctx.response.body = { ok: false, message };
ctx.response.headers.set("Content-Type", "application/json");
console.log({ name, message, stack, ...rest });
this.analytics.send({
event: "request",
action: "error",
data: {
status: ctx.response.status,
error: {
name,
message,
stack,
status,
...rest,
},
},
});
this.logging.error(
"request_error",
message,
err,
);
}
}
}
7 changes: 2 additions & 5 deletions src/controllers/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
HealthController,
IsHtmlController,
LogController,
} from "#grove/mod.ts";
} from "../../deps/grove.ts";
import { Application } from "../../deps/oak.ts";
import { Context, State } from "../context.ts";
import { ErrorController } from "./error.controller.ts";
Expand All @@ -19,7 +19,6 @@ export async function initControllers(
services: {
env,
github,
analytics,
logging,
},
managers: {
Expand All @@ -30,8 +29,7 @@ export async function initControllers(

// This can be any guid, it needs to be configured here as well as in the github app and in the marketplace
const webhookPath = readString(env, "GITHUB_WEBHOOK_PATH", "/webhook");

const error = new ErrorController(analytics);
const error = new ErrorController(logging);
const health = new HealthController();
const log = new LogController(logging);
const isHtml = new IsHtmlController();
Expand All @@ -40,7 +38,6 @@ export async function initControllers(
installations,
interactions,
github,
analytics,
webhookPath,
);
const notfound = new NotFoundController();
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/notfound.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller } from "#grove/mod.ts";
import { Controller } from "../../deps/grove.ts";
import { Application, Context } from "../../deps/oak.ts";
import { State } from "../context.ts";
import { NotFoundError } from "../errors/mod.ts";
Expand Down
4 changes: 1 addition & 3 deletions src/controllers/webhook.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Router,
Status,
} from "../../deps/oak.ts";
import { Controller, ILoggingService } from "#grove/mod.ts";
import { Controller, ILoggingService } from "../../deps/grove.ts";
import { State } from "../context.ts";
import { ModelState } from "../data/state.ts";
import { ISerializable } from "../util/serializable.ts";
Expand Down Expand Up @@ -317,7 +317,6 @@ export class WebhookController extends Controller<State> {
repository: {
id: repositoryId,
full_name: repositoryName,
owner: { login: repositoryOwner },
},
pull_request: {
id: pullRequestId,
Expand Down Expand Up @@ -347,7 +346,6 @@ export class WebhookController extends Controller<State> {
installationId,
userLogin,
repositoryName,
repositoryOwner,
commit,
karma,
});
Expand Down
2 changes: 1 addition & 1 deletion src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Context } from "./context.ts";
import { initServices } from "./services/mod.ts";
import { initManagers } from "./managers/mod.ts";
import { initControllers } from "./controllers/mod.ts";
import { Grove } from "#grove/mod.ts";
import { Grove } from "../deps/grove.ts";

async function initContext(): Promise<Context> {
const services = await initServices();
Expand Down
2 changes: 1 addition & 1 deletion src/services/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ConsoleLoggingService,
ILoggingService,
IServices,
} from "#grove/mod.ts";
} from "../../deps/grove.ts";
import { dotenv } from "../../deps/dotenv.ts";
import { GithubService } from "./github.service.ts";
import { MongoService } from "./mongo.service.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/services/mongo.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ILoggingService } from "#grove/mod.ts";
import { ILoggingService } from "../../deps/grove.ts";
import {
Collection,
Database,
Expand Down

0 comments on commit d349aaf

Please sign in to comment.