diff options
author | HampusM <hampus@hampusmat.com> | 2021-08-02 17:26:29 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-08-02 17:26:29 +0200 |
commit | 904bd1731447796cf1a2bd992c89f889f2a6263a (patch) | |
tree | c746534149722905792e8a1b0059568ed9cc1c7c | |
parent | 8feb65c5467cc3ad48270183113a121c4a9f86ca (diff) |
Renamed the shared types package to api
24 files changed, 21 insertions, 16 deletions
diff --git a/packages/shared_types/package.json b/packages/api/package.json index df40566..55b33b5 100644 --- a/packages/shared_types/package.json +++ b/packages/api/package.json @@ -1,5 +1,5 @@ { - "name": "shared_types", + "name": "api", "version": "1.0.0", "main": "src/index.d.ts", "author": "HampusMat", diff --git a/packages/shared_types/src/branch.d.ts b/packages/api/src/branch.d.ts index a32515e..a32515e 100644 --- a/packages/shared_types/src/branch.d.ts +++ b/packages/api/src/branch.d.ts diff --git a/packages/shared_types/src/commit.d.ts b/packages/api/src/commit.d.ts index 6eb598c..6eb598c 100644 --- a/packages/shared_types/src/commit.d.ts +++ b/packages/api/src/commit.d.ts diff --git a/packages/shared_types/src/index.d.ts b/packages/api/src/index.d.ts index 71be945..eeb31ad 100644 --- a/packages/shared_types/src/index.d.ts +++ b/packages/api/src/index.d.ts @@ -1,3 +1,8 @@ +/** + * Interfaces and types used both client-side and server-side. + * + * @module api + */ export { Tree, TreeEntry } from "./tree"; export { Commit, Patch, Hunk, LatestCommit, LogCommit } from "./commit"; export { Repository, RepositorySummary } from "./repository"; diff --git a/packages/shared_types/src/info.d.ts b/packages/api/src/info.d.ts index 1101cea..1101cea 100644 --- a/packages/shared_types/src/info.d.ts +++ b/packages/api/src/info.d.ts diff --git a/packages/shared_types/src/misc.d.ts b/packages/api/src/misc.d.ts index e43fae5..e43fae5 100644 --- a/packages/shared_types/src/misc.d.ts +++ b/packages/api/src/misc.d.ts diff --git a/packages/shared_types/src/repository.d.ts b/packages/api/src/repository.d.ts index cb4d246..cb4d246 100644 --- a/packages/shared_types/src/repository.d.ts +++ b/packages/api/src/repository.d.ts diff --git a/packages/shared_types/src/tag.d.ts b/packages/api/src/tag.d.ts index 7c418da..7c418da 100644 --- a/packages/shared_types/src/tag.d.ts +++ b/packages/api/src/tag.d.ts diff --git a/packages/shared_types/src/tree.d.ts b/packages/api/src/tree.d.ts index d2b4708..d2b4708 100644 --- a/packages/shared_types/src/tree.d.ts +++ b/packages/api/src/tree.d.ts diff --git a/packages/client/package.json b/packages/client/package.json index a82dafd..54068d6 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -40,7 +40,7 @@ "eslint-plugin-vue": "^7.14.0", "sass": "^1.26.5", "sass-loader": "^12.1.0", - "shared_types": "^1.0.0", + "api": "^1.0.0", "typescript": "^4.3.5", "vue-eslint-parser": "^7.9.0", "webpack": "^5.46.0" diff --git a/packages/client/src/components/CommitPatch.vue b/packages/client/src/components/CommitPatch.vue index 4a3a999..b0e8086 100644 --- a/packages/client/src/components/CommitPatch.vue +++ b/packages/client/src/components/CommitPatch.vue @@ -2,7 +2,7 @@ import { defineComponent, h, PropType, VNode } from "vue"; import hljs from "highlight.js"; import hljs_languages from "../util/hljs-languages"; -import { Patch } from "shared_types"; +import { Patch } from "api"; export default defineComponent({ name: "CommitPatch", diff --git a/packages/client/src/components/HomeHeader.vue b/packages/client/src/components/HomeHeader.vue index a6e640e..dc266aa 100644 --- a/packages/client/src/components/HomeHeader.vue +++ b/packages/client/src/components/HomeHeader.vue @@ -9,7 +9,7 @@ <script lang="ts"> import { defineComponent, ref } from "vue"; -import { Info } from "shared_types"; +import { Info } from "api"; export default defineComponent({ name: "HomeHeader", diff --git a/packages/client/src/views/Home.vue b/packages/client/src/views/Home.vue index 1d4cfa1..262e346 100644 --- a/packages/client/src/views/Home.vue +++ b/packages/client/src/views/Home.vue @@ -31,7 +31,7 @@ import { defineComponent, Ref, ref } from "vue"; import fetchData from "../util/fetch"; import { formatDistance } from "date-fns"; -import { RepositorySummary } from "shared_types"; +import { RepositorySummary } from "api"; import HomeHeader from "../components/HomeHeader.vue"; import HomeProjectsHeader from "../components/HomeProjectsHeader.vue"; diff --git a/packages/client/src/views/Repository.vue b/packages/client/src/views/Repository.vue index 90578fb..423c0e0 100644 --- a/packages/client/src/views/Repository.vue +++ b/packages/client/src/views/Repository.vue @@ -14,7 +14,7 @@ <script lang="ts"> import { defineComponent, Ref, ref } from "vue"; import { Router } from "vue-router"; -import { Repository } from "shared_types"; +import { Repository } from "api"; import { getParam } from "../util/util"; import RepositoryHeader from "../components/RepositoryHeader.vue"; diff --git a/packages/client/src/views/RepositoryAbout.vue b/packages/client/src/views/RepositoryAbout.vue index c72ee12..d50a081 100644 --- a/packages/client/src/views/RepositoryAbout.vue +++ b/packages/client/src/views/RepositoryAbout.vue @@ -16,7 +16,7 @@ <script lang="ts"> import { defineComponent, Ref, ref } from "vue"; import fetchData from "../util/fetch"; -import { Tree } from "shared_types"; +import { Tree } from "api"; import { getParam } from "../util/util"; import RepositoryTreeBlob from "../components/RepositoryTreeBlob.vue"; diff --git a/packages/client/src/views/RepositoryCommit.vue b/packages/client/src/views/RepositoryCommit.vue index 9818dff..9a41b08 100644 --- a/packages/client/src/views/RepositoryCommit.vue +++ b/packages/client/src/views/RepositoryCommit.vue @@ -53,7 +53,7 @@ import { defineComponent, Ref, ref } from "vue"; import { format } from "date-fns"; import fetchData from "../util/fetch"; -import { Commit } from "shared_types"; +import { Commit } from "api"; import BaseBreadcrumb from "../components/BaseBreadcrumb.vue"; import CommitPatch from "../components/CommitPatch.vue"; diff --git a/packages/client/src/views/RepositoryLog.vue b/packages/client/src/views/RepositoryLog.vue index 83184fa..6b99855 100644 --- a/packages/client/src/views/RepositoryLog.vue +++ b/packages/client/src/views/RepositoryLog.vue @@ -53,7 +53,7 @@ import { defineComponent, Ref, ref } from "vue"; import { format } from "date-fns"; import fetchData from "../util/fetch"; import { getParam } from "../util/util"; -import { LogCommit } from "shared_types"; +import { LogCommit } from "api"; import Loading from "vue-loading-overlay"; import BaseErrorMessage from "../components/BaseErrorMessage.vue"; diff --git a/packages/client/src/views/RepositoryTree.vue b/packages/client/src/views/RepositoryTree.vue index 152b6a4..d84211c 100644 --- a/packages/client/src/views/RepositoryTree.vue +++ b/packages/client/src/views/RepositoryTree.vue @@ -28,7 +28,7 @@ import { defineComponent, Ref, ref } from "vue"; import fetchData from "../util/fetch"; import { getParam } from "../util/util"; -import { Tree, TreeEntry } from "shared_types"; +import { Tree, TreeEntry } from "api"; import BaseBreadcrumb from "../components/BaseBreadcrumb.vue"; import RepositoryTreeBlob from "../components/RepositoryTreeBlob.vue"; diff --git a/packages/server/package.json b/packages/server/package.json index 9026cf4..a29aecc 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -33,7 +33,7 @@ "eslint-plugin-promise": "^5.1.0", "eslint-plugin-tsdoc": "^0.2.14", "nodemon": "^2.0.12", - "shared_types": "^1.0.0", + "api": "^1.0.0", "ts-node": "^10.1.0", "typescript": "^4.3.2" } diff --git a/packages/server/src/routes/api/v1/index.ts b/packages/server/src/routes/api/v1/index.ts index 62ae5d7..9cc20c2 100644 --- a/packages/server/src/routes/api/v1/index.ts +++ b/packages/server/src/routes/api/v1/index.ts @@ -3,7 +3,7 @@ import { Repository } from "../../../git/repository"; import { Route } from "../../../types/fastify"; import repo from "./repo"; import { verifyRepoName } from "../util"; -import { Info as APIInfo, RepositorySummary as APIRepositorySummary, Repository as APIRepository } from "shared_types"; +import { Info as APIInfo, RepositorySummary as APIRepositorySummary, Repository as APIRepository } from "api"; import { BaseError } from "../../../git/error"; function setHandlers(fastify: FastifyInstance): void { diff --git a/packages/server/src/routes/api/v1/repo/branches.ts b/packages/server/src/routes/api/v1/repo/branches.ts index 10ac736..c36463d 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 { FastifyInstance, FastifyPluginOptions } from "fastify"; import { Branch } from "../../../../git/branch"; import { Route } from "../../../../types/fastify"; -import { BranchSummary as APIBranchSummary, Branch as APIBranch } from "shared_types"; +import { BranchSummary as APIBranchSummary, Branch as APIBranch } from "api"; export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, done: (err?: Error) => void): void { fastify.route<Route>({ diff --git a/packages/server/src/routes/api/v1/repo/index.ts b/packages/server/src/routes/api/v1/repo/index.ts index 395c108..1759a29 100644 --- a/packages/server/src/routes/api/v1/repo/index.ts +++ b/packages/server/src/routes/api/v1/repo/index.ts @@ -8,7 +8,7 @@ import { basename } from "path"; import branches from "./branches"; import log from "./log"; import { verifyRepoName } from "../../util"; -import { Tree as APITree, Tag as APITag, TreeEntry as APITreeEntry } from "shared_types"; +import { Tree as APITree, Tag as APITag, TreeEntry as APITreeEntry } from "api"; import { BaseError } from "../../../../git/error"; import { Tree } from "../../../../git/tree"; diff --git a/packages/server/src/routes/api/v1/repo/log.ts b/packages/server/src/routes/api/v1/repo/log.ts index b05487b..76706b3 100644 --- a/packages/server/src/routes/api/v1/repo/log.ts +++ b/packages/server/src/routes/api/v1/repo/log.ts @@ -3,7 +3,7 @@ import { Commit } from "../../../../git/commit"; import { Patch } from "../../../../git/patch"; import { Route } from "../../../../types/fastify"; import { verifySHA } from "../../util"; -import { LogCommit as APILogCommit, Patch as APIPatch, Commit as APICommit } from "shared_types"; +import { LogCommit as APILogCommit, Patch as APIPatch, Commit as APICommit } from "api"; async function commitMap(commit: Commit) { const stats = await commit.stats(); diff --git a/test/int/api.int.test.ts b/test/int/api.int.test.ts index 11478ad..202aa88 100644 --- a/test/int/api.int.test.ts +++ b/test/int/api.int.test.ts @@ -2,7 +2,7 @@ import { FastifyInstance } from "fastify"; import buildApp from "server/src/app"; import { EnvironmentVariables } from "../util"; import { readFile } from "fs-extra"; -import { Info, Repository, RepositorySummary } from "../../packages/shared_types/src"; +import { Info, Repository, RepositorySummary } from "../../packages/api/src"; import axios, { AxiosResponse } from "axios"; import { Unzip } from "zlib"; import { Readable } from "stream"; |