From 60fe7cd0e3dded8704be08fa9a63edb1a62d5322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B8ssum?= <1959615+nimrossum@users.noreply.github.com> Date: Mon, 10 Feb 2025 21:27:57 +0100 Subject: [PATCH 01/22] Remove unused theme import and console log from Options component (#779) Co-authored-by: joglr <1959615+joglr@users.noreply.github.com> --- src/components/Options.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/Options.tsx b/src/components/Options.tsx index 7f161789..00eebd70 100644 --- a/src/components/Options.tsx +++ b/src/components/Options.tsx @@ -22,7 +22,6 @@ import { } from "@mdi/js" import type { SizeMetricType } from "~/metrics/sizeMetric" import { SizeMetric } from "~/metrics/sizeMetric" -import { useTheme } from "~/styling" export const relatedSizeMetric: Record = { FILE_TYPE: "FILE_SIZE", @@ -33,8 +32,6 @@ export const relatedSizeMetric: Record = { } export const Options = memo(function Options() { - const [theme] = useTheme() - console.log(theme) const { metricType, chartType, sizeMetric, linkMetricAndSizeMetric, setMetricType, setChartType, setSizeMetricType } = useOptions() From d385ace594a206e94e2da3a3dfb4933a348aa869 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Mon, 10 Feb 2025 20:28:10 +0000 Subject: [PATCH 02/22] Bump version to v2.0.4 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8f2830e8..2a7e9b59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.3", + "version": "2.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index 9d3a8c77..0f7d72eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.3", + "version": "2.0.4", "private": false, "description": "Visualizing a Git repository", "license": "MIT", From e2ba0de2e930183f5bf570a72decbe9d93cd9580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B8ssum?= <1959615+nimrossum@users.noreply.github.com> Date: Wed, 26 Feb 2025 14:07:07 +0100 Subject: [PATCH 03/22] Update README.md [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cb75676e..92277983 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ With Git Truck you can: | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | Where has the most work been done recently? | Who worked on different subsystems in the past? | -You can read more about the features in the [feature overview](https://git-truck.github.io/git-truck/GitTruckTeaser), or just try it and start exploring your projects! +You can read more about the features in the [feature overview](https://git-truck.github.io/git-truck/GitTruckTeaser), [in papers about Git Truck](https://github.com/git-truck/papers/blob/master/README.md), or just try it and start exploring your projects! ## [Get started](#get-started) From 50b4c58c54c1ce2629766baf89e45501217d521c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B8ssum?= <1959615+nimrossum@users.noreply.github.com> Date: Fri, 16 May 2025 08:40:43 +0200 Subject: [PATCH 04/22] Document how to run Git Truck using git (#791) --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92277983..114cb8fb 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,11 @@ You can read more about the features in the [feature overview](https://git-truck 1. In your terminal, navigate to a git repository or a folder containing several repositories -2. Run the command `npx -y git-truck` +2. Run the command `npm install -g git-truck@latest` to install or update Git Truck. -3. The application will now open in your default browser. Happy trucking! +3. Now you can run Git Truck using the command `git truck` + +4. The application will now open in your default browser. Happy trucking! > [!NOTE] > To use Git Truck, you will need to have the following programs installed: From 54a279f8ec08f9171325488f911e18fd700f5643 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Fri, 16 May 2025 06:40:53 +0000 Subject: [PATCH 05/22] Bump version to v2.0.5 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2a7e9b59..b11447e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.4", + "version": "2.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.4", + "version": "2.0.5", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index 0f7d72eb..092b19fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.4", + "version": "2.0.5", "private": false, "description": "Visualizing a Git repository", "license": "MIT", From 804ac9af136954a8f36510c9b856337a0bf68c47 Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Fri, 16 May 2025 10:21:22 +0200 Subject: [PATCH 06/22] Fix lint-staged --- .husky/pre-commit | 3 --- package-lock.json | 2 ++ package.json | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 36af2198..2312dc58 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - npx lint-staged diff --git a/package-lock.json b/package-lock.json index b11447e6..ed4e49ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10112,6 +10112,8 @@ }, "node_modules/husky": { "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true, "license": "MIT", "bin": { diff --git a/package.json b/package.json index 092b19fb..02d56ef2 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "check:write": "npm run format:write && npm run lint:fix", "check": "npm run format:check && npm run lint", "format:check": "prettier --check src scripts e2e", - "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint src scripts e2e" + "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint src scripts e2e", + "prepare": "husky" }, "devDependencies": { "@mdi/js": "^7.3.67", From 50a3eeb44aeebec77e4b58ac46e6facaf24c7d70 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Fri, 16 May 2025 08:39:22 +0000 Subject: [PATCH 07/22] Bump version to v2.0.6 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed4e49ad..c226b2df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.5", + "version": "2.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.5", + "version": "2.0.6", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index 02d56ef2..87943259 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.5", + "version": "2.0.6", "private": false, "description": "Visualizing a Git repository", "license": "MIT", From dfa7065d0124f1b80c717055d0b312dfba38477d Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Fri, 16 May 2025 10:31:49 +0200 Subject: [PATCH 08/22] Allow multiple arguments to log methods This resolves an issue with the logging module not conforming to the same API as native console methods like console.log. This commit adds support for passing multiple arguments. The method will then automatically concatenate these arguments in the logged message. This resolves a type error in InstanceManager, where it was expected that this API was supported: ```typescript log.warn("getOrCreateInstance", repo, branch, path) ``` --- src/analyzer/log.server.test.ts | 42 +++++++++++++++++++++++++++++++++ src/analyzer/log.server.ts | 42 ++++++++++++++++++++------------- 2 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 src/analyzer/log.server.test.ts diff --git a/src/analyzer/log.server.test.ts b/src/analyzer/log.server.test.ts new file mode 100644 index 00000000..ef80e27d --- /dev/null +++ b/src/analyzer/log.server.test.ts @@ -0,0 +1,42 @@ +import { log, setLogLevel } from "./log.server" + +describe("log methods array argument concatenation", () => { + setLogLevel("DEBUG") + const consoleError = jest.spyOn(console, "error").mockImplementation(jest.fn()) + const consoleWarn = jest.spyOn(console, "warn").mockImplementation(jest.fn()) + const consoleInfo = jest.spyOn(console, "info").mockImplementation(jest.fn()) + const consoleDebug = jest.spyOn(console, "debug").mockImplementation(jest.fn()) + + beforeEach(() => { + consoleDebug.mockClear() + consoleInfo.mockClear() + consoleWarn.mockClear() + consoleError.mockClear() + }) + + const logArgs = ["foo", 123, { a: 1 }] + + it("log.error forwards array arguments", () => { + log.error(...logArgs) + expect(consoleError).toHaveBeenCalled() + expect(consoleError.mock.calls[0]).toEqual(logArgs) + }) + + it("log.warn forwards array arguments", () => { + log.warn(...logArgs) + expect(consoleWarn).toHaveBeenCalled() + expect(consoleWarn.mock.calls[0]).toEqual(logArgs) + }) + + it("log.info forwards array arguments", () => { + log.info(...logArgs) + expect(consoleInfo).toHaveBeenCalled() + expect(consoleInfo.mock.calls[0]).toEqual(logArgs) + }) + + it("log.debug forwards array arguments", () => { + log.debug(...logArgs) + expect(consoleDebug).toHaveBeenCalled() + expect(consoleDebug.mock.calls[0]).toEqual(logArgs) + }) +}) diff --git a/src/analyzer/log.server.ts b/src/analyzer/log.server.ts index e0af0f3e..c9daccac 100644 --- a/src/analyzer/log.server.ts +++ b/src/analyzer/log.server.ts @@ -53,43 +53,50 @@ export function setLogLevel(level: string) { logLevel = newLevel } -export function error(message: Error | unknown) { +export function error(...messages: unknown[]) { if (logLevel === null) return if (logLevel >= LOG_LEVEL.ERROR) { - const messageString = - message instanceof Error ? `${prefix(ERROR)}${message.message}\n${message.stack}` : `${prefix(ERROR)}${message}` - console.error(messageString) + process.stderr.write(prefix(ERROR)) + console.error(...messages) } } -export function warn(message: unknown) { +export function warn(...messages: unknown[]) { if (logLevel === null) return if (logLevel >= LOG_LEVEL.WARN) { - const messageString = `${prefix(WARN)}${message}` - console.warn(messageString) + process.stderr.write(prefix(WARN)) + console.warn(...messages) } } -export function info(message: unknown) { +export function info(...messages: unknown[]) { if (logLevel === null) return if (logLevel >= LOG_LEVEL.INFO) { - const messageString = `${prefix(INFO)}${message}` - console.info(messageString) + process.stderr.write(prefix(INFO)) + console.info(...messages) } } -export function debug(message: unknown) { +export function time(label: string) { if (logLevel === null) return - if (logLevel >= LOG_LEVEL.DEBUG) { - const messageString = `${prefix(DEBUG)}${message}` - console.debug(messageString) + if (logLevel >= LOG_LEVEL.INFO) { + console.time(label) } } -export function raw(message: unknown) { +export function timeEnd(label: string) { if (logLevel === null) return if (logLevel >= LOG_LEVEL.INFO) { - console.info(message) + process.stderr.write(prefix(INFO)) + console.timeEnd(label) + } +} + +export function debug(...messages: unknown[]) { + if (logLevel === null) return + if (logLevel >= LOG_LEVEL.DEBUG) { + process.stderr.write(prefix(DEBUG)) + console.debug(...messages) } } @@ -117,5 +124,6 @@ export const log = { warn, info, debug, - raw + time, + timeEnd } From 53d4498373e1e6bce593a0f51a67bbf7a79122ba Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Sat, 17 May 2025 15:40:20 +0200 Subject: [PATCH 09/22] Correct usage of logging and remove prod log --- src/components/Providers.tsx | 3 +-- src/routes/$repo.$.tsx | 17 +++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/Providers.tsx b/src/components/Providers.tsx index e3e0231b..32e78528 100644 --- a/src/components/Providers.tsx +++ b/src/components/Providers.tsx @@ -35,14 +35,13 @@ export function Providers({ children, data }: ProvidersProps) { const [clickedObject, setClickedObject] = useState(null) const metricsData: MetricsData = useMemo(() => { - console.time("metrics") const res = createMetricData( data, data.databaseInfo.colorSeed, data.databaseInfo.authorColors, options?.dominantAuthorCutoff ?? 70 ) - console.timeEnd("metrics") + return res }, [data, options?.dominantAuthorCutoff]) diff --git a/src/routes/$repo.$.tsx b/src/routes/$repo.$.tsx index e49d6776..844d2ae4 100644 --- a/src/routes/$repo.$.tsx +++ b/src/routes/$repo.$.tsx @@ -34,6 +34,7 @@ import { cn } from "~/styling" import BarChart from "~/components/BarChart" import { shouldUpdate } from "~/analyzer/RefreshPolicy" import { LoadingIndicator } from "~/components/LoadingIndicator" +import { log } from "~/analyzer/log.server" export interface RepoData { repo: Repository @@ -257,23 +258,23 @@ async function analyze(params: Params) { const prevData = instance.prevResult const prevRes = prevData?.databaseInfo - console.time("fileTree") + log.time("fileTree") const filetree = prevRes && !shouldUpdate(reason, "filetree") ? { rootTree: prevRes.fileTree, fileCount: prevRes.fileCount } : await instance.analyzeTree() - console.timeEnd("fileTree") + log.timeEnd("fileTree") if (!prevRes || shouldUpdate(reason, "rename")) { - console.time("rename") + log.time("rename") await instance.updateRenames() - console.timeEnd("rename") + log.timeEnd("rename") } - console.time("updateCache") + log.time("updateCache") if (!prevRes || shouldUpdate(reason, "cache")) await instance.db.updateCachedResult() - console.timeEnd("updateCache") - console.time("dbQueries") + log.timeEnd("updateCache") + log.time("dbQueries") const dominantAuthors = prevRes && !shouldUpdate(reason, "dominantAuthor") ? prevRes.dominantAuthors @@ -325,7 +326,7 @@ async function analyze(params: Params) { prevRes && !shouldUpdate(reason, "analyzedRepos") ? prevRes.analyzedRepos : await InstanceManager.getOrCreateMetadataDB().getCompletedRepos() - console.timeEnd("dbQueries") + log.timeEnd("dbQueries") const databaseInfo: DatabaseInfo = { dominantAuthors, From 79f2f8088c0ac7024ffc6ff2015c363faaa47dd8 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Sun, 18 May 2025 17:24:38 +0000 Subject: [PATCH 10/22] Bump version to v2.0.7 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index c226b2df..b4e3d39c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.6", + "version": "2.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.6", + "version": "2.0.7", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index 87943259..3692ffb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.6", + "version": "2.0.7", "private": false, "description": "Visualizing a Git repository", "license": "MIT", From fe8c9f25f5351d299fb5216148086ac1c8fcec09 Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Mon, 19 May 2025 21:10:11 +0200 Subject: [PATCH 11/22] Fix workflow failing on main for windows --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index a60aa8eb..f8514c06 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v3 - name: Fetch main branch - run: git fetch origin main:main || exit 0 + run: git fetch origin main:main -u - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 From 092492f68bfc29064ee766d68eb0f71502a2bfa2 Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Mon, 19 May 2025 21:14:41 +0200 Subject: [PATCH 12/22] Check using latest bun version --- .github/workflows/check-bun.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-bun.yml b/.github/workflows/check-bun.yml index 0329795c..85ea5550 100644 --- a/.github/workflows/check-bun.yml +++ b/.github/workflows/check-bun.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - bun-version: [1.2.1] + bun-version: [1.2.1, latest] # See Bun releases at https://github.com/oven-sh/bun/releases steps: From c721dabc9e84fe8f689215add768a0fd66004d37 Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Mon, 19 May 2025 21:19:02 +0200 Subject: [PATCH 13/22] Bump Nodejs versions tested --- .github/workflows/playwright.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index f8514c06..7dd50431 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node: [20, 22] + node: [22, 24] steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 114cb8fb..223d64f1 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ You can read more about the features in the [feature overview](https://git-truck > [!NOTE] > To use Git Truck, you will need to have the following programs installed: > -> - [Node.js](https://nodejs.org/en/) 20.0.0 or newer and npm 10.0 or newer +> - [Node.js](https://nodejs.org/en/) 22.0.0 or newer and npm 10.0 or newer > - [git](https://git-scm.com/downloads) 2.29 or newer > > Check your installed versions using `node --version`, `npm --version` and `git --version`. From faad589e04bb4d7829a5286865bf94edb5f7ac86 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Mon, 19 May 2025 19:32:27 +0000 Subject: [PATCH 14/22] Bump version to v2.0.8 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4e3d39c..f5147ce5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.7", + "version": "2.0.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.7", + "version": "2.0.8", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index 3692ffb6..5261e0ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.7", + "version": "2.0.8", "private": false, "description": "Visualizing a Git repository", "license": "MIT", From 6970061fa967c9a8e4d4839da91a04ddb5c4e3cb Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Sun, 1 Jun 2025 21:37:49 +0200 Subject: [PATCH 15/22] Rename path to repoPath for clarity (#799) --- src/analyzer/InstanceManager.server.ts | 4 ++-- src/analyzer/ServerInstance.server.ts | 4 ++-- src/analyzer/git-caller.server.ts | 28 +++++++++++++------------- src/routes/$repo.$.tsx | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/analyzer/InstanceManager.server.ts b/src/analyzer/InstanceManager.server.ts index 8d6acb24..8a0d58aa 100644 --- a/src/analyzer/InstanceManager.server.ts +++ b/src/analyzer/InstanceManager.server.ts @@ -10,12 +10,12 @@ export default class InstanceManager { return this.metadataDB } - public static getOrCreateInstance(repo: string, branch: string, path: string) { + public static getOrCreateInstance(repo: string, branch: string, repoPath: string) { if (!this.instances) this.instances = new Map() const existing = this.instances.get(repo)?.get(branch) if (existing) return existing - const newInstance = new ServerInstance(repo, branch, path) + const newInstance = new ServerInstance(repo, branch, repoPath) const existingRepo = this.instances.get(repo) if (existingRepo) { existingRepo.set(branch, newInstance) diff --git a/src/analyzer/ServerInstance.server.ts b/src/analyzer/ServerInstance.server.ts index 2845e67b..cd897ccc 100644 --- a/src/analyzer/ServerInstance.server.ts +++ b/src/analyzer/ServerInstance.server.ts @@ -37,11 +37,11 @@ export default class ServerInstance { constructor( public repo: string, public branch: string, - public path: string + public repoPath: string ) { this.repoSanitized = repo.replace(/\W/g, "_") this.branchSanitized = branch.replace(/\W/g, "_") - this.gitCaller = new GitCaller(repo, branch, path) + this.gitCaller = new GitCaller(repo, branch, repoPath) this.db = new DB(repo, branch) } diff --git a/src/analyzer/git-caller.server.ts b/src/analyzer/git-caller.server.ts index 9583c669..3cd66de1 100644 --- a/src/analyzer/git-caller.server.ts +++ b/src/analyzer/git-caller.server.ts @@ -23,7 +23,7 @@ export class GitCaller { constructor( private repo: string, public branch: string, - private path: string + private repoPath: string ) {} static async isGitRepo(path: string): Promise { @@ -84,7 +84,7 @@ export class GitCaller { ...commits ] - const result = (await runProcess(this.path, "git", args)) as string + const result = (await runProcess(this.repoPath, "git", args)) as string return result.trim() } @@ -94,7 +94,7 @@ export class GitCaller { } async lsTree(hash: string) { - return await GitCaller._lsTree(this.path, hash) + return await GitCaller._lsTree(this.repoPath, hash) } static async _lsTree(repo: string, hash: string) { @@ -103,7 +103,7 @@ export class GitCaller { } async revParse(ref: string) { - return await GitCaller._revParse(this.path, ref) + return await GitCaller._revParse(this.repoPath, ref) } static async _revParse(dir: string, ref: string) { @@ -302,7 +302,7 @@ export class GitCaller { '--format="author <|%aN|> date <|%ct %at|> message <|%s|> body <|%b|> hash <|%H|>"' ] - const result = (await runProcess(this.path, "git", args)) as string + const result = (await runProcess(this.repoPath, "git", args)) as string return result.trim() } @@ -318,7 +318,7 @@ export class GitCaller { '--format="<|%aN|><|%ct %at|><|%H|>"' ] - const result = (await runProcess(this.path, "git", args, instance, index)) as string + const result = (await runProcess(this.repoPath, "git", args, instance, index)) as string return result.trim() } @@ -365,7 +365,7 @@ export class GitCaller { } public async commitCountSinceCommit(hash: string, branch: string) { - const result = (await runProcess(this.path, "git", ["rev-list", "--count", `${hash}..${branch}`])) as number + const result = (await runProcess(this.repoPath, "git", ["rev-list", "--count", `${hash}..${branch}`])) as number return result } @@ -379,12 +379,12 @@ export class GitCaller { } private async catFile(hash: string) { - const result = await runProcess(this.path, "git", ["cat-file", "-p", hash]) + const result = await runProcess(this.repoPath, "git", ["cat-file", "-p", hash]) return result as string } async findBranchHead() { - return await GitCaller.findBranchHead(this.path, this.branch) + return await GitCaller.findBranchHead(this.repoPath, this.branch) } async catFileCached(hash: string): Promise { @@ -401,27 +401,27 @@ export class GitCaller { } async getCommitCount() { - const result = await runProcess(this.path, "git", ["rev-list", "--count", this.branch]) + const result = await runProcess(this.repoPath, "git", ["rev-list", "--count", this.branch]) return result as number } async getDefaultGitSettingValue(setting: string) { - const result = await runProcess(this.path, "git", ["config", setting]) + const result = await runProcess(this.repoPath, "git", ["config", setting]) return result as string } async resetGitSetting(settingToReset: string, value: string) { if (!value) { - await runProcess(this.path, "git", ["config", "--unset", settingToReset]) + await runProcess(this.repoPath, "git", ["config", "--unset", settingToReset]) log.debug(`Unset ${settingToReset}`) } else { - await runProcess(this.path, "git", ["config", settingToReset, value]) + await runProcess(this.repoPath, "git", ["config", settingToReset, value]) log.debug(`Reset ${settingToReset} to ${value}`) } } async setGitSetting(setting: string, value: string) { - await runProcess(this.path, "git", ["config", setting, value]) + await runProcess(this.repoPath, "git", ["config", setting, value]) log.debug(`Set ${setting} to ${value}`) } } diff --git a/src/routes/$repo.$.tsx b/src/routes/$repo.$.tsx index 844d2ae4..a6ed7f7f 100644 --- a/src/routes/$repo.$.tsx +++ b/src/routes/$repo.$.tsx @@ -127,7 +127,7 @@ export const action: ActionFunction = async ({ request, params }) => { if (typeof fileToOpen === "string") { instance.prevInvokeReason = "open" - openFile(instance.path, fileToOpen) + openFile(instance.repoPath, fileToOpen) return null } From 0944c6cf58cd6478505bd27c1e53c7980e87fb7c Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Sun, 1 Jun 2025 19:38:05 +0000 Subject: [PATCH 16/22] Bump version to v2.0.9 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f5147ce5..b752503e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.8", + "version": "2.0.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.8", + "version": "2.0.9", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index 5261e0ab..651de921 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.8", + "version": "2.0.9", "private": false, "description": "Visualizing a Git repository", "license": "MIT", From 8d2def1bdde6b766f5555058e298ea7d79deb23e Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Sun, 1 Jun 2025 22:56:53 +0200 Subject: [PATCH 17/22] Test against latest Node.js and Bun versions (#803) --- .github/workflows/check-bun.yml | 2 +- .github/workflows/check-node.yml | 2 +- .github/workflows/playwright.yml | 4 ++-- playwright.config.ts | 10 +--------- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/check-bun.yml b/.github/workflows/check-bun.yml index 85ea5550..0c225723 100644 --- a/.github/workflows/check-bun.yml +++ b/.github/workflows/check-bun.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - bun-version: [1.2.1, latest] + bun-version: [latest] # See Bun releases at https://github.com/oven-sh/bun/releases steps: diff --git a/.github/workflows/check-node.yml b/.github/workflows/check-node.yml index 4bad74af..176194b5 100644 --- a/.github/workflows/check-node.yml +++ b/.github/workflows/check-node.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - node-version: [22.x, 20.x, 18.x] + node-version: [latest] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 7dd50431..682828fd 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node: [22, 24] + node: [latest] steps: - uses: actions/checkout@v3 @@ -33,7 +33,7 @@ jobs: run: npm run build - name: Install Playwright Browsers - run: npx playwright install --with-deps + run: npx playwright install --with-deps chromium - name: Run Playwright tests run: npm run test:e2e diff --git a/playwright.config.ts b/playwright.config.ts index c0df8f57..de06d7e2 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -40,15 +40,7 @@ export default defineConfig({ { name: "chromium", use: { ...devices["Desktop Chrome"] } - }, - ...(process.env.CI - ? [ - { - name: "firefox", - use: { ...devices["Desktop Firefox"] } - } - ] - : []) + } ], /* Run your local dev server before starting the tests */ From 2d8bab2095f657135ed13a2558a8e4b4880f1143 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Sun, 1 Jun 2025 20:57:06 +0000 Subject: [PATCH 18/22] Bump version to v2.0.10 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b752503e..439f18e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.9", + "version": "2.0.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.9", + "version": "2.0.10", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index 651de921..ee465675 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.9", + "version": "2.0.10", "private": false, "description": "Visualizing a Git repository", "license": "MIT", From ff24e6e7437bb9477b942c92a27ece556b577341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B8ssum?= <1959615+joglr@users.noreply.github.com> Date: Sun, 1 Jun 2025 22:05:52 +0200 Subject: [PATCH 19/22] Simplify instructions and add changelog link --- src/cli.ts | 11 ++++++----- src/components/GlobalInfo.tsx | 22 +++++++++++++++++++--- src/util.ts | 10 ++++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 8abae708..4ff10af2 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -10,7 +10,7 @@ import open from "open" import latestVersion from "latest-version" import { GitCaller } from "./analyzer/git-caller.server" import { getArgsWithDefaults, parseArgs } from "./analyzer/args.server" -import { semverCompare, getPathFromRepoAndHead } from "./util" +import { semverCompare, getPathFromRepoAndHead, generateVersionComparisonLink } from "./util" import { describeAsyncJob, getDirName, isValidURI } from "./analyzer/util.server" import { log, setLogLevel } from "./analyzer/log.server" import type { NextFunction } from "express-serve-static-core" @@ -38,12 +38,13 @@ async function main() { To update, run: -npx git-truck@latest - -Or to install globally: - npm install -g git-truck@latest +See what's changed here: ${generateVersionComparisonLink({ + currentVersion: currentV, + latestVersion: latestV + })} + ` : " (latest)" } catch (e) { diff --git a/src/components/GlobalInfo.tsx b/src/components/GlobalInfo.tsx index 52ce7d16..0c3568d6 100644 --- a/src/components/GlobalInfo.tsx +++ b/src/components/GlobalInfo.tsx @@ -1,5 +1,5 @@ import { Form, Link, useLocation, useNavigate, useNavigation } from "@remix-run/react" -import { dateTimeFormatShort, semverCompare } from "~/util" +import { dateTimeFormatShort, generateVersionComparisonLink, semverCompare } from "~/util" import { useData } from "../contexts/DataContext" import { memo, useEffect, useState } from "react" import { RevisionSelect } from "./RevisionSelect" @@ -18,6 +18,7 @@ const UpdateNotifier = memo(function UpdateNotifier() { const { gitTruckInfo } = useData() const [isPopoverOpen, setIsPopoverOpen] = useState(false) const isExperimental = gitTruckInfo.version.includes("0.0.0") + return ( Currently installed: {gitTruckInfo.version}

If you want to use a stable version, close the application and run:{" "} - npx git-truck@latest + npm i -g git-truck@latest

) : ( @@ -44,8 +45,23 @@ const UpdateNotifier = memo(function UpdateNotifier() {

Update available: {gitTruckInfo.latestVersion}

Currently installed: {gitTruckInfo.version}

- To update, close the application and run: npx git-truck@latest + To update, close the application and run: npm install -g git-truck@latest

+ {gitTruckInfo.latestVersion ? ( +

+ + See what's new + +

+ ) : null} )} diff --git a/src/util.ts b/src/util.ts index 1a0bb0b9..787d59a6 100644 --- a/src/util.ts +++ b/src/util.ts @@ -159,3 +159,13 @@ export function getLightness(hex: `#${string}`): number { export const isTree = (d: GitObject | null = null): d is GitTreeObject => d?.type === "tree" export const isBlob = (d: GitObject | null = null): d is GitBlobObject => d?.type === "blob" + +export function generateVersionComparisonLink({ + currentVersion, + latestVersion +}: { + currentVersion: string + latestVersion: string +}): string { + return `https://github.com/git-truck/git-truck/compare/v${currentVersion}...v${latestVersion}` +} From 1c8b278bde7b1b03c664e2519c5217d43dc19fa8 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Sun, 1 Jun 2025 21:05:15 +0000 Subject: [PATCH 20/22] Bump version to v2.0.11 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 439f18e6..a6fc7468 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.10", + "version": "2.0.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.10", + "version": "2.0.11", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index ee465675..6ecfe1e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.10", + "version": "2.0.11", "private": false, "description": "Visualizing a Git repository", "license": "MIT", From ff354419c9c90b4992a2f48ba925e657579f0f4e Mon Sep 17 00:00:00 2001 From: nimrossum <1959615+nimrossum@users.noreply.github.com> Date: Mon, 2 Jun 2025 00:22:39 +0200 Subject: [PATCH 21/22] Cache playwright browsers (#804) --- .github/workflows/playwright.yml | 27 +++++++++++++++++++++++++++ .husky/install.mjs | 8 ++++++++ package.json | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .husky/install.mjs diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 682828fd..17345faf 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -26,6 +26,28 @@ jobs: with: node-version: ${{ matrix.node }} + - name: Get installed Playwright version + id: playwright-version + shell: node {0} + run: | + const fs = require('fs'); + const lock = JSON.parse(fs.readFileSync('./package-lock.json', 'utf8')); + let version = ''; + if (lock.packages && lock.packages['node_modules/@playwright/test']) { + version = lock.packages['node_modules/@playwright/test'].version; + } else if (lock.dependencies && lock.dependencies['@playwright/test']) { + version = lock.dependencies['@playwright/test'].version; + } + require('fs').appendFileSync(process.env.GITHUB_ENV, `PLAYWRIGHT_VERSION=${version}\n`); + + - name: Cache Playwright binaries + uses: actions/cache@v3 + id: playwright-cache + with: + path: | + ${{ github.workspace }}/.pw-browsers + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} + - name: Install dependencies run: npm install @@ -34,9 +56,14 @@ jobs: - name: Install Playwright Browsers run: npx playwright install --with-deps chromium + if: steps.playwright-cache.outputs.cache-hit != 'true' + env: + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.pw-browsers - name: Run Playwright tests run: npm run test:e2e + env: + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.pw-browsers - name: Upload Playwright report uses: actions/upload-artifact@v4 diff --git a/.husky/install.mjs b/.husky/install.mjs new file mode 100644 index 00000000..fcee5d80 --- /dev/null +++ b/.husky/install.mjs @@ -0,0 +1,8 @@ +import { install } from "husky" + +// Skip Husky install in production and CI +if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') { + process.exit(0) +} + +install() diff --git a/package.json b/package.json index 6ecfe1e3..e6ad8ca8 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "check": "npm run format:check && npm run lint", "format:check": "prettier --check src scripts e2e", "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint src scripts e2e", - "prepare": "husky" + "prepare": "node .husky/install.mjs" }, "devDependencies": { "@mdi/js": "^7.3.67", From 89d8b41f769ba4ce81265750837362a773aa74f2 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Sun, 1 Jun 2025 22:22:57 +0000 Subject: [PATCH 22/22] Bump version to v2.0.12 [skip ci] --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a6fc7468..13b49bb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "git-truck", - "version": "2.0.11", + "version": "2.0.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "git-truck", - "version": "2.0.11", + "version": "2.0.12", "license": "MIT", "dependencies": { "@duckdb/node-api": "^1.1.3-alpha.11" diff --git a/package.json b/package.json index e6ad8ca8..2586333f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-truck", - "version": "2.0.11", + "version": "2.0.12", "private": false, "description": "Visualizing a Git repository", "license": "MIT",