Skip to content

Commit adf56db

Browse files
committed
Merge remote-tracking branch 'upstream/main' into refactor/861-detail-render-performance
2 parents 9926391 + 3583f7b commit adf56db

37 files changed

Lines changed: 418 additions & 245 deletions

package-lock.json

Lines changed: 84 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/analysis-engine/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"@octokit/plugin-throttling": "^4.1.0",
7474
"@octokit/rest": "^19.0.3",
7575
"@octokit/types": "^13.5.0",
76-
"reflect-metadata": "^0.1.13",
77-
"tsyringe": "^4.7.0"
76+
"inversify": "^7.10.0",
77+
"reflect-metadata": "^0.2.2"
7878
}
7979
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import "reflect-metadata";
2+
3+
import { Container } from "inversify";
4+
5+
import PluginOctokit from "./pluginOctokit";
6+
7+
export const diContainer = new Container();
8+
diContainer.bind(PluginOctokit).toSelf().inSingletonScope();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const DI_IDENTIFIERS = {
2+
OctokitOptions: Symbol.for("OctokitOptions"),
3+
} as const;

packages/analysis-engine/src/index.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import "reflect-metadata";
22

3-
import { container } from "tsyringe";
4-
53
import { buildCommitDict } from "./commit.util";
4+
import { diContainer } from "./container";
65
import { buildCSMDict } from "./csm";
6+
import { DI_IDENTIFIERS } from "./diIdentifiers";
77
import getCommitRaws from "./parser";
88
import { PluginOctokit } from "./pluginOctokit";
99
import { buildStemDict } from "./stem";
@@ -36,24 +36,20 @@ export class AnalysisEngine {
3636
this.gitLog = gitLog;
3737
this.baseBranchName = baseBranchName;
3838
this.isDebugMode = isDebugMode;
39-
container.register("OctokitOptions", {
40-
useValue: {
41-
owner,
42-
repo,
43-
options: {
44-
auth,
45-
},
46-
},
39+
diContainer.rebindSync(DI_IDENTIFIERS.OctokitOptions).toConstantValue({
40+
owner,
41+
repo,
42+
options: { auth },
4743
});
48-
this.octokit = container.resolve(PluginOctokit);
44+
this.octokit = diContainer.get(PluginOctokit);
4945
};
5046

5147
public analyzeGit = async () => {
5248
let isPRSuccess = true;
5349
if (this.isDebugMode) console.log("baseBranchName: ", this.baseBranchName);
5450

5551
const commitRaws = getCommitRaws(this.gitLog);
56-
if (this.isDebugMode){
52+
if (this.isDebugMode) {
5753
console.log("commitRaws: ", commitRaws);
5854
}
5955

@@ -88,7 +84,6 @@ export class AnalysisEngine {
8884
};
8985

9086
public updateArgs = (args: AnalysisEngineArgs) => {
91-
if (container.isRegistered("OctokitOptions")) container.clearInstances();
9287
this.insertArgs(args);
9388
};
9489
}

packages/analysis-engine/src/pluginOctokit.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@ import type { OctokitOptions } from "@octokit/core/dist-types/types";
22
import { throttling } from "@octokit/plugin-throttling";
33
import type { ThrottlingOptions } from "@octokit/plugin-throttling/dist-types/types";
44
import { Octokit, type RestEndpointMethodTypes } from "@octokit/rest";
5-
import { inject, singleton } from "tsyringe";
5+
import { inject, injectable } from "inversify";
6+
7+
import { DI_IDENTIFIERS } from "./diIdentifiers";
68

79
type PullsListResponseData = RestEndpointMethodTypes["pulls"]["get"]["response"];
810
type PullsListCommitsResponseData = RestEndpointMethodTypes["pulls"]["listCommits"]["response"];
911

10-
@singleton()
12+
@injectable()
1113
export class PluginOctokit extends Octokit.plugin(throttling) {
1214
private owner: string;
1315

1416
private repo: string;
1517

1618
constructor(
17-
@inject("OctokitOptions")
19+
@inject(DI_IDENTIFIERS.OctokitOptions)
1820
props: {
1921
owner: string;
2022
repo: string;
@@ -55,13 +57,13 @@ export class PluginOctokit extends Octokit.plugin(throttling) {
5557
private _getPullRequest = async (pullNumber: number) => {
5658
const { owner, repo } = this;
5759

58-
const pullRequestDetail:PullsListResponseData = await this.rest.pulls.get({
60+
const pullRequestDetail: PullsListResponseData = await this.rest.pulls.get({
5961
owner,
6062
repo,
6163
pull_number: pullNumber,
6264
});
6365

64-
const pullRequestCommits:PullsListCommitsResponseData = await this.rest.pulls.listCommits({
66+
const pullRequestCommits: PullsListCommitsResponseData = await this.rest.pulls.listCommits({
6567
owner,
6668
repo,
6769
pull_number: pullNumber,
@@ -73,11 +75,12 @@ export class PluginOctokit extends Octokit.plugin(throttling) {
7375
};
7476
};
7577

76-
77-
public getPullRequests = async (): Promise<{
78-
detail: PullsListResponseData,
79-
commitDetails: PullsListCommitsResponseData
80-
}[]> => {
78+
public getPullRequests = async (): Promise<
79+
{
80+
detail: PullsListResponseData;
81+
commitDetails: PullsListCommitsResponseData;
82+
}[]
83+
> => {
8184
const { owner, repo } = this;
8285

8386
const { data } = await this.rest.pulls.list({

packages/view/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@
101101
"classnames": "^2.3.2",
102102
"d3": "^7.6.1",
103103
"dayjs": "^1.11.5",
104+
"inversify": "^7.10.0",
104105
"jest": "^29.6.4",
105106
"md5": "^2.3.0",
106107
"nanoid": "^4.0.0",
107108
"react": "^18.1.0",
108109
"react-dom": "^18.1.0",
109110
"react-spinners": "^0.13.8",
110111
"react-virtualized": "^9.22.5",
111-
"reflect-metadata": "^0.1.13",
112+
"reflect-metadata": "^0.2.2",
112113
"svg-parser": "^2.0.4",
113114
"ts-jest": "^29.1.1",
114-
"tsyringe": "^4.7.0",
115115
"zustand": "^4.5.5"
116116
}
117117
}

packages/view/src/App.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import "reflect-metadata";
2-
import { container } from "tsyringe";
32
import { useEffect, useRef } from "react";
43
import BounceLoader from "react-spinners/BounceLoader";
54

65
import MonoLogo from "assets/monoLogo.svg";
76
import { BranchSelector, Statistics, TemporalFilter, ThemeSelector, VerticalClusterList } from "components";
87
import "./App.scss";
9-
import type IDEPort from "ide/IDEPort";
108
import { useAnalayzedData } from "hooks";
119
import { RefreshButton } from "components/RefreshButton";
1210
import type { IDESentEvents } from "types/IDESentEvents";
1311
import { useBranchStore, useDataStore, useGithubInfo, useLoadingStore, useThemeStore } from "store";
1412
import { THEME_INFO } from "components/ThemeSelector/ThemeSelector.const";
13+
import { initializeIDEConnection } from "services";
1514

1615
const App = () => {
1716
const initRef = useRef<boolean>(false);
@@ -21,7 +20,6 @@ const App = () => {
2120
const { handleGithubInfo } = useGithubInfo();
2221
const { loading, setLoading } = useLoadingStore();
2322
const { theme } = useThemeStore();
24-
const ideAdapter = container.resolve<IDEPort>("IDEAdapter");
2523

2624
useEffect(() => {
2725
if (initRef.current === false) {
@@ -31,13 +29,10 @@ const App = () => {
3129
handleGithubInfo,
3230
};
3331
setLoading(true);
34-
ideAdapter.addIDESentEventListener(callbacks);
35-
ideAdapter.sendFetchAnalyzedDataMessage();
36-
ideAdapter.sendFetchBranchListMessage();
37-
ideAdapter.sendFetchGithubInfo();
32+
initializeIDEConnection(callbacks);
3833
initRef.current = true;
3934
}
40-
}, [handleChangeAnalyzedData, handleChangeBranchList, handleGithubInfo, ideAdapter, setLoading]);
35+
}, [handleChangeAnalyzedData, handleChangeBranchList, handleGithubInfo, setLoading]);
4136

4237
if (loading) {
4338
return (

packages/view/src/components/@common/Author/Author.const.ts renamed to packages/view/src/components/Common/Author/Author.const.ts

File renamed without changes.

packages/view/src/components/@common/Author/Author.tsx renamed to packages/view/src/components/Common/Author/Author.tsx

File renamed without changes.

0 commit comments

Comments
 (0)