aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-08-18 18:39:50 +0200
committerHampusM <hampus@hampusmat.com>2021-08-18 18:39:50 +0200
commit1e5309e7f842491a24e4c7a61ce1f69b695dfe17 (patch)
tree5ab77afd060f4bec601c183fb6509bb8882f573b /packages
parentd1a1b7dc947063aef5f8375a6a1e03246b272c84 (diff)
Cleaned up backend routes's imports
Diffstat (limited to 'packages')
-rw-r--r--packages/server/src/routes/api/util.ts4
-rw-r--r--packages/server/src/routes/api/v1/data.ts2
-rw-r--r--packages/server/src/routes/api/v1/index.ts8
-rw-r--r--packages/server/src/routes/api/v1/repo/branches.ts6
-rw-r--r--packages/server/src/routes/api/v1/repo/index.ts10
-rw-r--r--packages/server/src/routes/api/v1/repo/log.ts6
-rw-r--r--packages/server/src/routes/repo.ts10
-rw-r--r--packages/server/tsconfig.json2
8 files changed, 25 insertions, 23 deletions
diff --git a/packages/server/src/routes/api/util.ts b/packages/server/src/routes/api/util.ts
index 2a06393..2af2ecd 100644
--- a/packages/server/src/routes/api/util.ts
+++ b/packages/server/src/routes/api/util.ts
@@ -1,5 +1,5 @@
-import { Commit } from "../../git/commit";
-import { Repository } from "../../git/repository";
+import { Commit } from "git/commit";
+import { Repository } from "git/repository";
type VerificationResultType = "SUCCESS" | "NOT_FOUND" | "INVALID";
diff --git a/packages/server/src/routes/api/v1/data.ts b/packages/server/src/routes/api/v1/data.ts
index 97f07ff..35902c6 100644
--- a/packages/server/src/routes/api/v1/data.ts
+++ b/packages/server/src/routes/api/v1/data.ts
@@ -7,7 +7,7 @@ import {
BranchSummary,
Branch as APIBranch
} from "api";
-import { Branch, Commit, Patch, Repository, Tag } from "../../../git";
+import { Branch, Commit, Patch, Repository, Tag } from "git";
export async function getLogCommits(commits: Commit[]): Promise<LogCommit[]> {
return Promise.all(commits.map(async(commit: Commit) => {
diff --git a/packages/server/src/routes/api/v1/index.ts b/packages/server/src/routes/api/v1/index.ts
index 7997b4d..0a28409 100644
--- a/packages/server/src/routes/api/v1/index.ts
+++ b/packages/server/src/routes/api/v1/index.ts
@@ -1,12 +1,12 @@
import { FastifyPluginCallback } from "fastify";
-import { Repository } from "../../../git/repository";
-import { FastifyPluginOptions, Route } from "../../../types/fastify";
+import { Repository } from "git/repository";
+import { FastifyPluginOptions, Route } from "types/fastify";
import repo from "./repo";
import { verifyRepoName } from "../util";
import { Info as APIInfo } from "api";
-import { ServerError } from "../../../git/error";
+import { ServerError } from "git/error";
import { getRepositories, getRepository } from "./data";
-import { sources } from "../../../cache";
+import { sources } from "cache";
const reposEndpoints: FastifyPluginCallback<FastifyPluginOptions> = (fastify, opts, done) => {
fastify.route({
diff --git a/packages/server/src/routes/api/v1/repo/branches.ts b/packages/server/src/routes/api/v1/repo/branches.ts
index f709f4d..84ca003 100644
--- a/packages/server/src/routes/api/v1/repo/branches.ts
+++ b/packages/server/src/routes/api/v1/repo/branches.ts
@@ -1,7 +1,7 @@
import { FastifyPluginCallback } from "fastify";
-import { sources } from "../../../../cache";
-import { Branch } from "../../../../git/branch";
-import { FastifyPluginOptions, Route } from "../../../../types/fastify";
+import { sources } from "cache";
+import { Branch } from "git/branch";
+import { FastifyPluginOptions, Route } from "types/fastify";
import { getBranch, getBranches } from "../data";
const branches: FastifyPluginCallback<FastifyPluginOptions> = (fastify, opts, done) => {
diff --git a/packages/server/src/routes/api/v1/repo/index.ts b/packages/server/src/routes/api/v1/repo/index.ts
index f8e01d3..bc66b10 100644
--- a/packages/server/src/routes/api/v1/repo/index.ts
+++ b/packages/server/src/routes/api/v1/repo/index.ts
@@ -1,15 +1,15 @@
-import { CoolFastifyRequest, Route, FastifyPluginOptions } from "../../../../types/fastify";
+import { CoolFastifyRequest, Route, FastifyPluginOptions } from "types/fastify";
import { FastifyInstance, FastifyPluginCallback } from "fastify";
-import { Repository } from "../../../../git/repository";
-import { BaseTreeEntry, BlobTreeEntry, TreeEntry } from "../../../../git/tree_entry";
+import { Repository } from "git/repository";
+import { BaseTreeEntry, BlobTreeEntry, TreeEntry } from "git/tree_entry";
import { basename } from "path";
import branches from "./branches";
import log from "./log";
import { verifyRepoName } from "../../util";
import { Tree as APITree, TreeEntry as APITreeEntry } from "api";
-import { ServerError } from "../../../../git/error";
+import { ServerError } from "git/error";
import { getLogCommits, getTags } from "../data";
-import { sources } from "../../../../cache";
+import { sources } from "cache";
declare module "fastify" {
interface FastifyRequest {
diff --git a/packages/server/src/routes/api/v1/repo/log.ts b/packages/server/src/routes/api/v1/repo/log.ts
index 7ad1e11..019f579 100644
--- a/packages/server/src/routes/api/v1/repo/log.ts
+++ b/packages/server/src/routes/api/v1/repo/log.ts
@@ -1,7 +1,7 @@
import { FastifyPluginCallback } from "fastify";
-import { sources } from "../../../../cache";
-import { Commit } from "../../../../git/commit";
-import { Route, FastifyPluginOptions } from "../../../../types/fastify";
+import { sources } from "cache";
+import { Commit } from "git/commit";
+import { Route, FastifyPluginOptions } from "types/fastify";
import { verifySHA } from "../../util";
import { getCommit, getLogCommits } from "../data";
diff --git a/packages/server/src/routes/repo.ts b/packages/server/src/routes/repo.ts
index 1088e6b..fadcaf0 100644
--- a/packages/server/src/routes/repo.ts
+++ b/packages/server/src/routes/repo.ts
@@ -1,9 +1,9 @@
-import { Repository } from "../git/repository";
-import { CoolFastifyRequest, Route, FastifyPluginOptions } from "../types/fastify";
-import { Tag } from "../git/tag";
+import { Repository } from "git/repository";
+import { CoolFastifyRequest, Route, FastifyPluginOptions } from "types/fastify";
+import { Tag } from "git/tag";
import { FastifyPluginCallback } from "fastify";
-import { verifyRepoName } from "../routes/api/util";
-import { ServerError } from "../git/error";
+import { verifyRepoName } from "./api/util";
+import { ServerError } from "git/error";
const repo: FastifyPluginCallback<FastifyPluginOptions> = (fastify, opts, done): void => {
fastify.addHook("onRequest", async(req: CoolFastifyRequest, reply) => {
diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json
index 92c94fc..e364a00 100644
--- a/packages/server/tsconfig.json
+++ b/packages/server/tsconfig.json
@@ -1,6 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
+ "baseUrl": "./src",
+ "rootDir": "./src",
"module": "CommonJS",
}
} \ No newline at end of file