aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/client/tsconfig.json72
-rw-r--r--packages/server/src/git/http.ts1
-rw-r--r--packages/server/src/git/patch.ts4
-rw-r--r--packages/server/src/git/repository.ts4
-rw-r--r--packages/server/tsconfig.json8
-rw-r--r--test/int/api.int.test.ts10
-rw-r--r--test/teardown.ts5
-rw-r--r--test/tsconfig.json6
-rw-r--r--test/unit/patch.unit.test.ts4
-rw-r--r--test/unit/tree.unit.test.ts2
-rw-r--r--tsconfig.json8
11 files changed, 69 insertions, 55 deletions
diff --git a/packages/client/tsconfig.json b/packages/client/tsconfig.json
index eedafcb..d8f08d5 100644
--- a/packages/client/tsconfig.json
+++ b/packages/client/tsconfig.json
@@ -1,40 +1,36 @@
{
- "compilerOptions": {
- "target": "ES2020",
- "module": "ES2020",
- "strict": true,
- "jsx": "preserve",
- "moduleResolution": "node",
- "experimentalDecorators": true,
- "esModuleInterop": true,
- "allowSyntheticDefaultImports": true,
- "forceConsistentCasingInFileNames": true,
- "useDefineForClassFields": true,
- "sourceMap": true,
- "baseUrl": ".",
- "types": [
- "webpack-env"
- ],
- "paths": {
- "@/*": [
- "src/*"
- ]
- },
- "lib": [
- "esnext",
- "dom",
- "dom.iterable",
- "scripthost"
- ]
- },
- "include": [
- "src/**/*.ts",
- "src/**/*.tsx",
- "src/**/*.vue",
- "tests/**/*.ts",
- "tests/**/*.tsx"
- ],
- "exclude": [
- "node_modules"
- ]
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "module": "ES2020",
+ "jsx": "preserve",
+ "experimentalDecorators": true,
+ "allowSyntheticDefaultImports": true,
+ "useDefineForClassFields": true,
+ "sourceMap": true,
+ "baseUrl": ".",
+ "types": [
+ "webpack-env"
+ ],
+ "paths": {
+ "@/*": [
+ "src/*"
+ ]
+ },
+ "lib": [
+ "esnext",
+ "dom",
+ "dom.iterable",
+ "scripthost"
+ ]
+ },
+ "include": [
+ "src/**/*.ts",
+ "src/**/*.tsx",
+ "src/**/*.vue",
+ "tests/**/*.ts",
+ "tests/**/*.tsx"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
}
diff --git a/packages/server/src/git/http.ts b/packages/server/src/git/http.ts
index c2654e7..183c6df 100644
--- a/packages/server/src/git/http.ts
+++ b/packages/server/src/git/http.ts
@@ -3,6 +3,7 @@ import { Repository } from "./repository";
import { Route } from "../types/fastify";
import { join } from "path";
import { spawn } from "child_process";
+import { URL } from "url";
export interface Request extends FastifyRequest {
params: Route["Params"],
diff --git a/packages/server/src/git/patch.ts b/packages/server/src/git/patch.ts
index 45ffe23..4239ce4 100644
--- a/packages/server/src/git/patch.ts
+++ b/packages/server/src/git/patch.ts
@@ -130,12 +130,12 @@ export class Patch {
*
* @returns An array of hunk instances
*/
- public async getHunks(): Promise<Hunk[] | null> {
+ public async getHunks(): Promise<Hunk[]> {
const content = (await this._content()).split("\n");
const hunks = await this._ng_patch.hunks();
if(hunks.length === 0) {
- return null;
+ return [];
}
const hunks_data = hunks.reduce((result: Hunks, hunk, hunk_index) => {
diff --git a/packages/server/src/git/repository.ts b/packages/server/src/git/repository.ts
index 4250af0..ccc8bcc 100644
--- a/packages/server/src/git/repository.ts
+++ b/packages/server/src/git/repository.ts
@@ -183,11 +183,11 @@ export class Repository {
* @param base_dir - The directory that contains the repositories
* @returns An array of repository instances
*/
- public static async openAll(base_dir: string): Promise<Repository[] | null> {
+ public static async openAll(base_dir: string): Promise<Repository[]> {
const dir_content = await getDirectory(base_dir);
if(dir_content.length === 0) {
- return null;
+ return [];
}
const repositories = dir_content.filter(dir_entry => dir_entry.endsWith(".git"));
diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json
index 272318b..a98cc40 100644
--- a/packages/server/tsconfig.json
+++ b/packages/server/tsconfig.json
@@ -1,12 +1,6 @@
{
+ "extends": "../../tsconfig.json",
"compilerOptions": {
- "target": "ES2020",
"module": "CommonJS",
- "outDir": "dist",
- "strict": true,
- "esModuleInterop": true,
- "moduleResolution": "node",
- "skipLibCheck": true,
- "forceConsistentCasingInFileNames": true
}
}
diff --git a/test/int/api.int.test.ts b/test/int/api.int.test.ts
index b93a947..11478ad 100644
--- a/test/int/api.int.test.ts
+++ b/test/int/api.int.test.ts
@@ -265,7 +265,15 @@ describe("API", () => {
beforeAll(async() => {
const body = new Readable({ read: () => null });
- const head = /^[a-f0-9]+/.exec((await readFile(`${env.BASE_DIR}/${env.AVAIL_REPO}/FETCH_HEAD`)).toString())[0];
+ let head = (await readFile(`${env.BASE_DIR}/${env.AVAIL_REPO}/FETCH_HEAD`)).toString();
+
+ const find_head = /^[a-f0-9]+/.exec(head);
+
+ if(!find_head) {
+ throw(new Error("Failed to get repository head!"));
+ }
+
+ head = find_head[0];
body.push(`0098want ${head} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta deepen-since deepen-not agent=git/2.32.0\n00000009done\n`);
body.push(null);
diff --git a/test/teardown.ts b/test/teardown.ts
index 290c478..c5b49e3 100644
--- a/test/teardown.ts
+++ b/test/teardown.ts
@@ -1,5 +1,8 @@
import { remove } from "fs-extra";
+import { EnvironmentVariables } from "./util";
+
+const env = process.env as EnvironmentVariables;
export default async function(): Promise<void> {
- await remove(process.env.BASE_DIR);
+ await remove(env.BASE_DIR);
} \ No newline at end of file
diff --git a/test/tsconfig.json b/test/tsconfig.json
new file mode 100644
index 0000000..a397e7d
--- /dev/null
+++ b/test/tsconfig.json
@@ -0,0 +1,6 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "module": "CommonJS",
+ }
+} \ No newline at end of file
diff --git a/test/unit/patch.unit.test.ts b/test/unit/patch.unit.test.ts
index e4aa8d3..3197059 100644
--- a/test/unit/patch.unit.test.ts
+++ b/test/unit/patch.unit.test.ts
@@ -89,7 +89,7 @@ describe("Patch", () => {
}
});
- it("Should get the hunks of an empty patch and respond with null", async() => {
+ it("Should get the hunks of an empty patch and respond with an ampty array", async() => {
expect.assertions(2);
const other_commit = await Commit.lookup(repository, "ef256e9e40b5fd0cc741c509e611808cc66bafad");
@@ -98,7 +98,7 @@ describe("Patch", () => {
const hunks = await other_patch.getHunks();
expect(hunks).toBeDefined();
- expect(hunks).toBeNull();
+ expect(hunks).toHaveLength(0);
});
});
}); \ No newline at end of file
diff --git a/test/unit/tree.unit.test.ts b/test/unit/tree.unit.test.ts
index d34c93e..3fe49f3 100644
--- a/test/unit/tree.unit.test.ts
+++ b/test/unit/tree.unit.test.ts
@@ -82,7 +82,7 @@ describe("Tree", () => {
// Extract the archive entries to an array of entries
const entries = await new Promise((resolve: (value: Entry[]) => void) => {
- const entries = [];
+ const entries: Entry[] = [];
extract_archive.on("finish", () => {
resolve(entries);
diff --git a/tsconfig.json b/tsconfig.json
index 42d4f57..daa3bb9 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,5 +1,11 @@
{
"compilerOptions": {
- "esModuleInterop": true
+ "target": "ES2020",
+ "lib": ["ES2020"],
+ "strict": true,
+ "esModuleInterop": true,
+ "moduleResolution": "node",
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true
}
} \ No newline at end of file