diff --git a/index.ts b/index.ts index 29e041a..c87dee8 100644 --- a/index.ts +++ b/index.ts @@ -1,4 +1,4 @@ -import { groupBy } from "lodash-es"; +import { groupBy, trimEnd } from "lodash-es"; import { Entry, Metric, Plots } from "./types"; import { initDataSource } from "./data-source"; import "./style.css"; @@ -125,9 +125,9 @@ async function main() { return; } let repoUrl = - (data.points[0] as any).data.repoUrl; - const url = repoUrl ? `${repoUrl.trimEnd("/")}/commit/${commit_hash}` : commit_hash; - const notification_text = `Commit ${commit_hash} URL copied to clipboard`; + (data.points[0] as any).data.repoUrl ?? "https://github.com/rolldown/rolldown"; + const url = repoUrl ? `${trimEnd(repoUrl, '/')}/commit/${commit_hash}` : commit_hash; + const notification_text = `URL of commit ${url} copied to clipboard`; navigator.clipboard.writeText(url); show_notification(notification_text); }); diff --git a/package.json b/package.json index 922bb03..9f0b224 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "@types/lodash-es": "^4.17.12", "@types/node": "^20.14.8", "@types/plotly.js": "^1.54.22", + "husky": "^9.1.4", "typescript": "^4.5.2", "vite": "^5.3.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2417d20..1b41ea1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,6 +22,9 @@ devDependencies: '@types/plotly.js': specifier: ^1.54.22 version: 1.54.22 + husky: + specifier: ^9.1.4 + version: 9.1.4 typescript: specifier: ^4.5.2 version: 4.9.5 @@ -1283,6 +1286,12 @@ packages: resolution: {integrity: sha512-08iL2VyCRbkQKBySkSh6m8zMUa3sADAxGVWs3Z1aPcUkTJeK0ETG4Fc27tEmQBGUAXZjIsXOZqBvacuVNSC/fQ==} dev: false + /husky@9.1.4: + resolution: {integrity: sha512-bho94YyReb4JV7LYWRWxZ/xr6TtOTt8cMfmQ39MQYJ7f/YE268s3GdghGwi+y4zAeqewE5zYLvuhV0M0ijsDEA==} + engines: {node: '>=18'} + hasBin: true + dev: true + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'}