From 1511730d4da9fe92971ccb76cb687ca7ff087b65 Mon Sep 17 00:00:00 2001 From: choisohyun Date: Wed, 11 Sep 2024 21:41:08 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=EA=B8=B0=EC=A1=B4=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20prettier:fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + packages/analysis-engine/src/parser.spec.ts | 76 +++++++++---------- packages/analysis-engine/src/pluginOctokit.ts | 15 ++-- packages/analysis-engine/src/summary.ts | 8 +- .../VerticalClusterList.util.test.ts | 11 +-- packages/vscode/README.md | 19 ++++- packages/vscode/src/setting-repository.ts | 4 +- 7 files changed, 69 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index bdeca1b1..63ab2fc1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # githru-vscode-ext + Lightweight but robust Githru for VSCode Extension ## Getting Started diff --git a/packages/analysis-engine/src/parser.spec.ts b/packages/analysis-engine/src/parser.spec.ts index 50feb085..7308624b 100644 --- a/packages/analysis-engine/src/parser.spec.ts +++ b/packages/analysis-engine/src/parser.spec.ts @@ -1,5 +1,5 @@ import { getCommitMessageType } from "./commit.util"; -import getCommitRaws from "./parser"; +import getCommitRaws from "./parser"; import type { CommitRaw, DifferenceStatistic } from "./types"; describe("commit message type", () => { @@ -34,85 +34,79 @@ describe("commit message type", () => { }); }); -describe('getCommitRaws', () => { +describe("getCommitRaws", () => { const testCommitLines = [ "commit a b (HEAD)", "commit a b (HEAD -> main, origin/main, origin/HEAD)", "commit a b (HEAD, tag: v1.0.0)", "commit a b (HEAD -> main, origin/main, origin/HEAD, tag: v2.0.0)", - "commit a b (HEAD, tag: v2.0.0, tag: v1.4)" + "commit a b (HEAD, tag: v2.0.0, tag: v1.4)", ]; const expectedBranches = [ - ['HEAD'], - ['HEAD', 'main', 'origin/main', 'origin/HEAD'], - ['HEAD'], - ['HEAD', 'main', 'origin/main', 'origin/HEAD'], - ['HEAD'] + ["HEAD"], + ["HEAD", "main", "origin/main", "origin/HEAD"], + ["HEAD"], + ["HEAD", "main", "origin/main", "origin/HEAD"], + ["HEAD"], ]; - const expectedTags = [ - [], - [], - ['v1.0.0'], - ['v2.0.0'], - ['v2.0.0', 'v1.4'] - ]; + const expectedTags = [[], [], ["v1.0.0"], ["v2.0.0"], ["v2.0.0", "v1.4"]]; const testCommitFileChanges = [ "10\t0\ta.ts\n1\t0\tREADME.md", "3\t3\ta.ts", "4\t0\ta.ts", - "0\t6\ta.ts\n2\t0\tb.ts\n3\t3\tc.ts" + "0\t6\ta.ts\n2\t0\tb.ts\n3\t3\tc.ts", ]; - const expectedFileChanged:DifferenceStatistic[] = [ + const expectedFileChanged: DifferenceStatistic[] = [ { totalInsertionCount: 11, totalDeletionCount: 0, fileDictionary: { - 'a.ts': { insertionCount: 10, deletionCount: 0 }, - 'README.md': { insertionCount: 1, deletionCount: 0 }, - } + "a.ts": { insertionCount: 10, deletionCount: 0 }, + "README.md": { insertionCount: 1, deletionCount: 0 }, + }, }, { totalInsertionCount: 3, totalDeletionCount: 3, - fileDictionary: { 'a.ts': { insertionCount: 3, deletionCount: 3 } } + fileDictionary: { "a.ts": { insertionCount: 3, deletionCount: 3 } }, }, { totalInsertionCount: 4, totalDeletionCount: 0, - fileDictionary: { 'a.ts': { insertionCount: 4, deletionCount: 0 } } + fileDictionary: { "a.ts": { insertionCount: 4, deletionCount: 0 } }, }, { totalInsertionCount: 5, totalDeletionCount: 9, fileDictionary: { - 'a.ts': { insertionCount: 0, deletionCount: 6 }, - 'b.ts': { insertionCount: 2, deletionCount: 0 }, - 'c.ts': { insertionCount: 3, deletionCount: 3 }, - } - } + "a.ts": { insertionCount: 0, deletionCount: 6 }, + "b.ts": { insertionCount: 2, deletionCount: 0 }, + "c.ts": { insertionCount: 3, deletionCount: 3 }, + }, + }, ]; - const commonExpectatedResult: CommitRaw={ + const commonExpectatedResult: CommitRaw = { sequence: 0, - id: 'a', - parents: ['b'], - branches: ['HEAD'], + id: "a", + parents: ["b"], + branches: ["HEAD"], tags: [], - author: { name: 'John Park', email: 'mail@gmail.com' }, - authorDate: new Date('Sun Sep 4 20:17:59 2022 +0900'), - committer: { name: 'John Park', email: 'mail@gmail.com' }, - committerDate: new Date('Sun Sep 4 20:17:59 2022 +0900'), - message: 'commit message', + author: { name: "John Park", email: "mail@gmail.com" }, + authorDate: new Date("Sun Sep 4 20:17:59 2022 +0900"), + committer: { name: "John Park", email: "mail@gmail.com" }, + committerDate: new Date("Sun Sep 4 20:17:59 2022 +0900"), + message: "commit message", differenceStatistic: { totalInsertionCount: 0, totalDeletionCount: 0, fileDictionary: {}, }, - commitMessageType: "" + commitMessageType: "", }; testCommitLines.forEach((mockLog, index) => { @@ -125,8 +119,12 @@ CommitDate: Sun Sep 4 20:17:59 2022 +0900 \n\tcommit message `; const result = getCommitRaws(mock); - const expectedResult = { ...commonExpectatedResult, branches: expectedBranches[index], tags: expectedTags[index] }; - + const expectedResult = { + ...commonExpectatedResult, + branches: expectedBranches[index], + tags: expectedTags[index], + }; + expect(result).toEqual([expectedResult]); }); }); diff --git a/packages/analysis-engine/src/pluginOctokit.ts b/packages/analysis-engine/src/pluginOctokit.ts index 4e0e3e5d..89612641 100644 --- a/packages/analysis-engine/src/pluginOctokit.ts +++ b/packages/analysis-engine/src/pluginOctokit.ts @@ -55,13 +55,13 @@ export class PluginOctokit extends Octokit.plugin(throttling) { private _getPullRequest = async (pullNumber: number) => { const { owner, repo } = this; - const pullRequestDetail:PullsListResponseData = await this.rest.pulls.get({ + const pullRequestDetail: PullsListResponseData = await this.rest.pulls.get({ owner, repo, pull_number: pullNumber, }); - const pullRequestCommits:PullsListCommitsResponseData = await this.rest.pulls.listCommits({ + const pullRequestCommits: PullsListCommitsResponseData = await this.rest.pulls.listCommits({ owner, repo, pull_number: pullNumber, @@ -73,11 +73,12 @@ export class PluginOctokit extends Octokit.plugin(throttling) { }; }; - - public getPullRequests = async (): Promise<{ - detail: PullsListResponseData, - commitDetails: PullsListCommitsResponseData - }[]> => { + public getPullRequests = async (): Promise< + { + detail: PullsListResponseData; + commitDetails: PullsListCommitsResponseData; + }[] + > => { const { owner, repo } = this; const { data } = await this.rest.pulls.list({ diff --git a/packages/analysis-engine/src/summary.ts b/packages/analysis-engine/src/summary.ts index 2b91fe4f..d1898dee 100644 --- a/packages/analysis-engine/src/summary.ts +++ b/packages/analysis-engine/src/summary.ts @@ -1,10 +1,10 @@ import type { CommitRaw } from "./types"; -const apiKey = process.env.GEMENI_API_KEY || ''; +const apiKey = process.env.GEMENI_API_KEY || ""; const apiUrl = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key="; export async function getSummary(csmNodes: CommitRaw[]) { - const commitMessages = csmNodes.map((csmNode) => csmNode.message.split('\n')[0]).join(', '); + const commitMessages = csmNodes.map((csmNode) => csmNode.message.split("\n")[0]).join(", "); try { const response = await fetch(apiUrl + apiKey, { @@ -13,7 +13,7 @@ export async function getSummary(csmNodes: CommitRaw[]) { "Content-Type": "application/json", }, body: JSON.stringify({ - contents: [{parts: [{text: `${prompt} \n${commitMessages}`}]}], + contents: [{ parts: [{ text: `${prompt} \n${commitMessages}` }] }], }), }); @@ -53,4 +53,4 @@ Output format: - {prefix (if any)}:{commit summary3} ‘’ -Commits:` +Commits:`; diff --git a/packages/view/src/components/VerticalClusterList/VerticalClusterList.util.test.ts b/packages/view/src/components/VerticalClusterList/VerticalClusterList.util.test.ts index ecbc4bbf..049f6f4c 100644 --- a/packages/view/src/components/VerticalClusterList/VerticalClusterList.util.test.ts +++ b/packages/view/src/components/VerticalClusterList/VerticalClusterList.util.test.ts @@ -1,15 +1,8 @@ -import { - fakeFirstClusterNode, - fakeSecondClusterNode, - fakePrev, -} from "../../../tests/fakeAsset"; +import { fakeFirstClusterNode, fakeSecondClusterNode, fakePrev } from "../../../tests/fakeAsset"; import { selectedDataUpdater } from "./VerticalClusterList.util"; -const EmptyArrayAddSelectedDataUpdater = selectedDataUpdater( - fakeFirstClusterNode, - 0, -); +const EmptyArrayAddSelectedDataUpdater = selectedDataUpdater(fakeFirstClusterNode, 0); const PrevAddSelectedDataUpdater = selectedDataUpdater(fakeFirstClusterNode, 5); const RemoveSelectedDataUpdater = selectedDataUpdater(fakeSecondClusterNode, 1); diff --git a/packages/vscode/README.md b/packages/vscode/README.md index b26206cf..105ecaa4 100644 --- a/packages/vscode/README.md +++ b/packages/vscode/README.md @@ -2,14 +2,16 @@ Githru-vscode-ext is an extension supporting visual analytics to understand the history of GitHub repositories. -The theoretical basis of the extension is `Githru: Visual Analytics for Understanding Software Development History Through Git Metadata Analysis`(https://ieeexplore.ieee.org/document/9222261). +The theoretical basis of the extension is `Githru: Visual Analytics for Understanding Software Development History Through Git Metadata Analysis`(https://ieeexplore.ieee.org/document/9222261). ## Visualization Features ### Summarized Graph -The straightened graph help users understand the complex GitHub commit graph. + +The straightened graph help users understand the complex GitHub commit graph. ### Visual Analytics Components + Visualization components represent statistics for users' interested area. ## Release Notes + ### 0.7.1 + - Theme Selector! - Optimized UI Rendering - Boost up second Loading ### 0.7.0 + - UI enhancement - Patches for UI bugs ### 0.6.1 + - subgraph - launch one panel only ### 0.6.0 + - branch selector - reset github auth - error handling for pr/auth - e2e test ### 0.5.0 + - login by github auth - fix minor ui issues - author avatar in details - error handling ### 0.4.0 + - app loading ui - improved internal architecture - theme color palette ### 0.3.0 + - temporal filter by brushing - refresh - put avatar in author bar chart - improved some UX. ### 0.2.0 + - New Logo! - GitHub User Avatar - GitHub Pull Request Association @@ -76,4 +87,4 @@ Calling out known issues can help limit users opening duplicate issues against y ### 0.1.0 -Initial release. \ No newline at end of file +Initial release. diff --git a/packages/vscode/src/setting-repository.ts b/packages/vscode/src/setting-repository.ts index a82726b4..968578fa 100644 --- a/packages/vscode/src/setting-repository.ts +++ b/packages/vscode/src/setting-repository.ts @@ -14,8 +14,8 @@ export const setGithubToken = async (secrets: vscode.SecretStorage, newGithubTok }; export const deleteGithubToken = async (secrets: vscode.SecretStorage) => { - return await secrets.delete(SETTING_PROPERTY_NAMES.GITHUB_TOKEN); -} + return await secrets.delete(SETTING_PROPERTY_NAMES.GITHUB_TOKEN); +}; export const setPrimaryColor = (color: string) => { const configuration = vscode.workspace.getConfiguration(); From ac28068a6c6fd87b4dc1e3a1a4fb9fb4d11aedfd Mon Sep 17 00:00:00 2001 From: choisohyun Date: Wed, 11 Sep 2024 22:52:08 +0900 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20husky,=20lint-staged=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/pre-commit | 4 + package-lock.json | 684 ++++++++++++++++++++++++++ package.json | 8 +- packages/analysis-engine/package.json | 13 +- packages/analysis-engine/src/index.ts | 2 +- packages/view/package.json | 4 +- 6 files changed, 709 insertions(+), 6 deletions(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..7e154687 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run lint-staged diff --git a/package-lock.json b/package-lock.json index 971b54cc..a26fe53b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8886,6 +8886,112 @@ "node": ">= 0.2.0" } }, + "node_modules/cli-truncate": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", + "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/cli-width": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-1.1.1.tgz", @@ -10831,6 +10937,18 @@ "node": ">=4" } }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/err-code": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", @@ -14057,6 +14175,18 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-east-asian-width": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", + "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-intrinsic": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", @@ -14892,6 +15022,21 @@ "node": ">=0.10.0" } }, + "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, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -18361,11 +18506,307 @@ "immediate": "~3.0.5" } }, + "node_modules/lilconfig": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", + "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "node_modules/lint-staged": { + "version": "15.2.10", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.10.tgz", + "integrity": "sha512-5dY5t743e1byO19P9I4b3x8HJwalIznL5E1FWYnU6OWw33KxNBSLAc6Cy7F2PsFEO8FKnLwjwm5hx7aMF0jzZg==", + "dev": true, + "dependencies": { + "chalk": "~5.3.0", + "commander": "~12.1.0", + "debug": "~4.3.6", + "execa": "~8.0.1", + "lilconfig": "~3.1.2", + "listr2": "~8.2.4", + "micromatch": "~4.0.8", + "pidtree": "~0.6.0", + "string-argv": "~0.3.2", + "yaml": "~2.5.0" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": ">=18.12.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/lint-staged/node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/lint-staged/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/lint-staged/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/yaml": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", + "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/listr2": { + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.2.4.tgz", + "integrity": "sha512-opevsywziHd3zHCVQGAj8zu+Z3yHNkkoYhWIGnq54RrCVwLz0MozotJEDnKsIBLvkfLGN6BLOyAeRrYI0pKA4g==", + "dev": true, + "dependencies": { + "cli-truncate": "^4.0.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^6.1.0", + "rfdc": "^1.4.1", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/listr2/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/listr2/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/listr2/node_modules/emoji-regex": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "dev": true + }, + "node_modules/listr2/node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, + "node_modules/listr2/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -18543,6 +18984,208 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/log-update": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz", + "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==", + "dev": true, + "dependencies": { + "ansi-escapes": "^7.0.0", + "cli-cursor": "^5.0.0", + "slice-ansi": "^7.1.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-escapes": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.0.0.tgz", + "integrity": "sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==", + "dev": true, + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-update/node_modules/cli-cursor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "dev": true, + "dependencies": { + "restore-cursor": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/emoji-regex": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "dev": true + }, + "node_modules/log-update/node_modules/is-fullwidth-code-point": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz", + "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", + "dev": true, + "dependencies": { + "get-east-asian-width": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/onetime": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dev": true, + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/restore-cursor": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dev": true, + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -18990,6 +19633,18 @@ "node": ">=6" } }, + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mimic-response": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", @@ -20962,6 +21617,18 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -22379,6 +23046,12 @@ "node": ">=0.10.0" } }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "dev": true + }, "node_modules/rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -23460,6 +24133,15 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -28282,7 +28964,9 @@ "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-unused-imports": "^3.0.0", + "husky": "^8.0.0", "jest": "^28.1.3", + "lint-staged": "^15.2.10", "prettier": "^3.0.1", "react": "^18.2.0", "rollup": "^2.78.0", diff --git a/package.json b/package.json index d9fffd97..fead609d 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,12 @@ "build:all": "npm run build --workspaces", "deploy:all": "npm run deploy --workspaces", "test:all": "npm run test --workspaces", - "lint": "eslint '**/*.{js,ts,tsx}'", - "lint:fix": "npm run lint --fix", + "lint": "npm run lint --workspaces", + "lint:fix": "npm run lint:fix --workspaces", "prettier": "prettier '**/*.{ts,tsx,json,yaml,md}' --check", - "prettier:fix": "prettier '**/*.{ts,tsx,json,yaml,md}' --write" + "prettier:fix": "prettier '**/*.{ts,tsx,json,yaml,md}' --write", + "prepare": "husky install", + "lint-staged": "npm run lint-staged --workspaces --if-present" }, "author": "githru team", "license": "MIT", diff --git a/packages/analysis-engine/package.json b/packages/analysis-engine/package.json index a6356aab..c76b4203 100644 --- a/packages/analysis-engine/package.json +++ b/packages/analysis-engine/package.json @@ -21,7 +21,8 @@ "test:log": "echo \"jest --verbose --coverage ./src/log\"", "test:DAG": "echo \"jest --verbose --coverage ./src/DAG\"", "test:stem": "jest --verbose --coverage ./src/stem", - "test:CSM": "echo \"jest --verbose --coverage ./src/CSM\"" + "test:CSM": "echo \"jest --verbose --coverage ./src/CSM\"", + "lint-staged": "lint-staged" }, "repository": { "type": "git", @@ -56,7 +57,9 @@ "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-unused-imports": "^3.0.0", + "husky": "^8.0.0", "jest": "^28.1.3", + "lint-staged": "^15.2.10", "prettier": "^3.0.1", "react": "^18.2.0", "rollup": "^2.78.0", @@ -74,5 +77,13 @@ "@octokit/types": "^13.5.0", "reflect-metadata": "^0.1.13", "tsyringe": "^4.7.0" + }, + "lint-staged": { + "packages/**/src/**/*.{ts,tsx}": [ + "eslint" + ], + "**/*.{ts,tsx,json,yaml,md}": [ + "prettier --check" + ] } } diff --git a/packages/analysis-engine/src/index.ts b/packages/analysis-engine/src/index.ts index f6de204b..91bf1899 100644 --- a/packages/analysis-engine/src/index.ts +++ b/packages/analysis-engine/src/index.ts @@ -75,7 +75,7 @@ export class AnalysisEngine { if (this.isDebugMode) console.log("stemDict: ", stemDict); const csmDict = buildCSMDict(commitDict, stemDict, this.baseBranchName, pullRequests); if (this.isDebugMode) console.log("csmDict: ", csmDict); - const nodes = stemDict.get(this.baseBranchName)?.nodes?.map(({commit}) => commit); + const nodes = stemDict.get(this.baseBranchName)?.nodes?.map(({ commit }) => commit); const geminiCommitSummary = await getSummary(nodes ? nodes?.slice(-10) : []); if (this.isDebugMode) console.log("GeminiCommitSummary: ", geminiCommitSummary); diff --git a/packages/view/package.json b/packages/view/package.json index 2def9b48..7665c32b 100644 --- a/packages/view/package.json +++ b/packages/view/package.json @@ -11,7 +11,9 @@ "build": "webpack --config webpack.prod.config.js", "build:dev": "webpack --config webpack.dev.config.js", "test": "jest", - "test:e2e": "playwright test" + "test:e2e": "playwright test", + "lint": "eslint src --ext ts", + "lint:fix": "eslint src --ext ts --fix" }, "eslintConfig": { "extends": [ From bbdbbdac72855c0c2a628ebe53954a5867acc0cd Mon Sep 17 00:00:00 2001 From: choisohyun Date: Wed, 11 Sep 2024 22:58:54 +0900 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20view,=20vscode=EC=97=90=EB=8F=84?= =?UTF-8?q?=20husky,=20lint-staged=20=EC=84=A4=EC=A0=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++++ packages/view/package.json | 13 ++++++++++++- packages/vscode/package.json | 13 ++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a26fe53b..3ffa5bb7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30397,6 +30397,8 @@ "eslint-plugin-react-hooks": "^4.6.0", "fork-ts-checker-webpack-plugin": "^7.2.13", "html-webpack-plugin": "^5.5.0", + "husky": "^8.0.0", + "lint-staged": "^15.2.10", "prettier": "^3.0.1", "sass": "^1.77.4", "sass-loader": "^13.0.2", @@ -30457,6 +30459,8 @@ "eslint-plugin-unused-imports": "^3.0.0", "formdata-polyfill": "^4.0.10", "glob": "^8.0.1", + "husky": "^8.0.0", + "lint-staged": "^15.2.10", "mocha": "^9.2.2", "prettier": "^3.0.1", "ts-loader": "^9.2.8", diff --git a/packages/view/package.json b/packages/view/package.json index 7665c32b..bad41cbb 100644 --- a/packages/view/package.json +++ b/packages/view/package.json @@ -13,7 +13,8 @@ "test": "jest", "test:e2e": "playwright test", "lint": "eslint src --ext ts", - "lint:fix": "eslint src --ext ts --fix" + "lint:fix": "eslint src --ext ts --fix", + "lint-staged": "lint-staged" }, "eslintConfig": { "extends": [ @@ -77,6 +78,8 @@ "eslint-plugin-react-hooks": "^4.6.0", "fork-ts-checker-webpack-plugin": "^7.2.13", "html-webpack-plugin": "^5.5.0", + "husky": "^8.0.0", + "lint-staged": "^15.2.10", "prettier": "^3.0.1", "sass": "^1.77.4", "sass-loader": "^13.0.2", @@ -115,5 +118,13 @@ "ts-jest": "^29.1.1", "tsyringe": "^4.7.0", "zustand": "^4.5.5" + }, + "lint-staged": { + "packages/**/src/**/*.{ts,tsx}": [ + "eslint" + ], + "**/*.{ts,tsx,json,yaml,md}": [ + "prettier --check" + ] } } diff --git a/packages/vscode/package.json b/packages/vscode/package.json index 4f383b53..34159a90 100644 --- a/packages/vscode/package.json +++ b/packages/vscode/package.json @@ -81,7 +81,8 @@ "pretest": "npm run compile-tests && npm run compile && npm run lint", "lint": "eslint src --ext ts", "lint:fix": "eslint src --ext ts --fix", - "test": "node ./out/test/runTest.js" + "test": "node ./out/test/runTest.js", + "lint-staged": "lint-staged" }, "dependencies": { "@githru-vscode-ext/analysis-engine": "^0.7.1", @@ -107,11 +108,21 @@ "eslint-plugin-unused-imports": "^3.0.0", "formdata-polyfill": "^4.0.10", "glob": "^8.0.1", + "husky": "^8.0.0", + "lint-staged": "^15.2.10", "mocha": "^9.2.2", "prettier": "^3.0.1", "ts-loader": "^9.2.8", "typescript": "^4.6.4", "webpack": "^5.70.0", "webpack-cli": "^4.9.2" + }, + "lint-staged": { + "packages/**/src/**/*.{ts,tsx}": [ + "eslint" + ], + "**/*.{ts,tsx,json,yaml,md}": [ + "prettier --check" + ] } }