Skip to content

Commit f54c099

Browse files
author
“chae-dahee”
committed
Merge branch 'main' into core/CSMDict
2 parents aa3e763 + b263149 commit f54c099

47 files changed

Lines changed: 823 additions & 450 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 95 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: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import "reflect-metadata";
22

3-
import { container } from "tsyringe";
4-
3+
import { diContainer } from "./container";
4+
import { DI_IDENTIFIERS } from "./diIdentifiers";
55
import { buildCommitDict } from "./commit.util";
66
import { buildCSMDict, buildPaginatedCSMDict } from "./csm";
77
import getCommitRaws from "./parser";
@@ -45,16 +45,12 @@ export class AnalysisEngine {
4545
this.gitLog = gitLog;
4646
this.baseBranchName = baseBranchName;
4747
this.isDebugMode = isDebugMode;
48-
container.register("OctokitOptions", {
49-
useValue: {
50-
owner,
51-
repo,
52-
options: {
53-
auth,
54-
},
55-
},
48+
diContainer.rebindSync(DI_IDENTIFIERS.OctokitOptions).toConstantValue({
49+
owner,
50+
repo,
51+
options: { auth },
5652
});
57-
this.octokit = container.resolve(PluginOctokit);
53+
this.octokit = diContainer.get(PluginOctokit);
5854
};
5955

6056
public init = async () => {
@@ -132,7 +128,6 @@ export class AnalysisEngine {
132128
};
133129

134130
public updateArgs = (args: AnalysisEngineArgs) => {
135-
if (container.isRegistered("OctokitOptions")) container.clearInstances();
136131
this.insertArgs(args);
137132
// Clear cached data
138133
this.commitDict = undefined;

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/.eslintrc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@
7676
"react/react-in-jsx-scope": "off",
7777
"react/require-default-props": "off",
7878
"react/prop-types": "off",
79-
"consistent-return": "off"
79+
"consistent-return": "off",
80+
"no-param-reassign": [
81+
"error",
82+
{
83+
"props": true,
84+
"ignorePropertyModificationsFor": ["acc", "accumulator", "state"]
85+
}
86+
]
8087
},
8188
"settings": {
8289
"import/resolver": {

packages/view/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,18 @@
101101
"classnames": "^2.3.2",
102102
"d3": "^7.6.1",
103103
"dayjs": "^1.11.5",
104+
"immer": "^10.1.3",
105+
"inversify": "^7.10.0",
104106
"jest": "^29.6.4",
105107
"md5": "^2.3.0",
106108
"nanoid": "^4.0.0",
107109
"react": "^18.1.0",
108110
"react-dom": "^18.1.0",
109111
"react-spinners": "^0.13.8",
110112
"react-virtualized": "^9.22.5",
111-
"reflect-metadata": "^0.1.13",
113+
"reflect-metadata": "^0.2.2",
112114
"svg-parser": "^2.0.4",
113115
"ts-jest": "^29.1.1",
114-
"tsyringe": "^4.7.0",
115116
"zustand": "^4.5.5"
116117
}
117118
}

0 commit comments

Comments
 (0)