Skip to content

Commit 45109a9

Browse files
dependabot[bot]neilime
authored andcommitted
build(deps): bump inversify in the npm-production-dependencies group
Bumps the npm-production-dependencies group with 1 update: - [inversify](https://github.com/inversify/monorepo) Updates `inversify` from 7.11.0 to 8.1.0 - [Release notes](https://github.com/inversify/monorepo/releases) - [Changelog](https://github.com/inversify/monorepo/blob/main/docs/release.md) --- updated-dependencies: - dependency-name: inversify dependency-version: 8.1.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: npm-production-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent 7477086 commit 45109a9

File tree

9 files changed

+5459
-243
lines changed

9 files changed

+5459
-243
lines changed

dist/index.js

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

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"dependencies": {
9191
"@actions/core": "^3.0.0",
9292
"@actions/github": "^9.0.0",
93-
"inversify": "^7.11.0",
93+
"inversify": "^8.1.0",
9494
"reflect-metadata": "^0.2.2",
9595
"zod": "^4.3.6",
9696
"zod-validation-error": "^5.0.0"

src/container.ts

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Container } from "inversify";
1+
import { Container, ContainerModule } from "inversify";
22
import { LoggerService } from "./services/logger.service.js";
33
import { CORE_SERVICE_IDENTIFIER, coreService, CoreService } from "./services/core.service.js";
44
import { InputService } from "./services/input.service.js";
@@ -17,26 +17,40 @@ import { DriveLinkLinterAdapter } from "./linter/adapter/drive-link-linter.adapt
1717
import { CNCFLinkLinterAdapter } from "./linter/adapter/cncf-link-linter.adapter.js";
1818
import { LabelsLinterAdapter } from "./linter/adapter/labels-linter.adapter.js";
1919

20-
const container = new Container();
21-
22-
container.bind<CoreService>(CORE_SERVICE_IDENTIFIER).toConstantValue(coreService);
23-
24-
container.bind(GitHubService).toSelf();
25-
container.bind(InputService).toSelf();
26-
container.bind(LinterService).toSelf();
27-
container.bind(LoggerService).toSelf();
28-
container.bind(MeetupIssueService).toSelf();
29-
30-
// Linters
31-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(EventDateLinterAdapter);
32-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(EventTitleLinterAdapter);
33-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(TitleLinterAdapter);
34-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(HosterLinterAdapter);
35-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(EventDescriptionLinterAdapter);
36-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(AgendaLinterAdapter);
37-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(MeetupLinkLinterAdapter);
38-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(CNCFLinkLinterAdapter);
39-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(DriveLinkLinterAdapter);
40-
container.bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(LabelsLinterAdapter);
20+
const linterAdapters = [
21+
EventDateLinterAdapter,
22+
EventTitleLinterAdapter,
23+
TitleLinterAdapter,
24+
HosterLinterAdapter,
25+
EventDescriptionLinterAdapter,
26+
AgendaLinterAdapter,
27+
MeetupLinkLinterAdapter,
28+
CNCFLinkLinterAdapter,
29+
DriveLinkLinterAdapter,
30+
LabelsLinterAdapter,
31+
] as const;
32+
33+
const applicationModule = new ContainerModule(({ bind }) => {
34+
bind<CoreService>(CORE_SERVICE_IDENTIFIER).toConstantValue(coreService);
35+
36+
bind(GitHubService).toSelf();
37+
bind(InputService).toSelf();
38+
bind(LinterService).toSelf();
39+
bind(LoggerService).toSelf();
40+
bind(MeetupIssueService).toSelf();
41+
42+
for (const linterAdapter of linterAdapters) {
43+
bind<LinterAdapter>(LINTER_ADAPTER_IDENTIFIER).to(linterAdapter);
44+
}
45+
});
46+
47+
export function createContainer(): Container {
48+
const container = new Container();
49+
container.load(applicationModule);
50+
51+
return container;
52+
}
53+
54+
const container = createContainer();
4155

4256
export { container };

src/index-runner.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("run", () => {
3535
const hosters = getHostersFixture();
3636
const speakers = getSpeakersFixture();
3737

38-
beforeEach(async () => {
38+
beforeEach(() => {
3939
jest.clearAllMocks();
4040

4141
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
@@ -45,12 +45,9 @@ describe("run", () => {
4545

4646
container.snapshot();
4747

48-
await container.unbind(InputService);
49-
container.bind(InputService).toConstantValue(inputServiceMock);
50-
await container.unbind(CORE_SERVICE_IDENTIFIER);
51-
container.bind<CoreService>(CORE_SERVICE_IDENTIFIER).toConstantValue(coreServiceMock);
52-
await container.unbind(GitHubService);
53-
container.bind<GitHubService>(GitHubService).toConstantValue(githubServiceMock);
48+
container.rebind(InputService).toConstantValue(inputServiceMock);
49+
container.rebind<CoreService>(CORE_SERVICE_IDENTIFIER).toConstantValue(coreServiceMock);
50+
container.rebind<GitHubService>(GitHubService).toConstantValue(githubServiceMock);
5451

5552
inputServiceMock.getIssueNumber.mockReturnValue(1);
5653
inputServiceMock.getShouldFix.mockReturnValue(true);

src/index.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("index", () => {
3131
let coreServiceMock: MockProxy<CoreService>;
3232
let githubServiceMock: MockProxy<GitHubService>;
3333

34-
beforeEach(async () => {
34+
beforeEach(() => {
3535
jest.clearAllMocks();
3636

3737
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
@@ -41,12 +41,9 @@ describe("index", () => {
4141

4242
container.snapshot();
4343

44-
await container.unbind(InputService);
45-
container.bind(InputService).toConstantValue(inputServiceMock);
46-
await container.unbind(CORE_SERVICE_IDENTIFIER);
47-
container.bind(CORE_SERVICE_IDENTIFIER).toConstantValue(coreServiceMock);
48-
await container.unbind(GitHubService);
49-
container.bind(GitHubService).toConstantValue(githubServiceMock);
44+
container.rebind(InputService).toConstantValue(inputServiceMock);
45+
container.rebind(CORE_SERVICE_IDENTIFIER).toConstantValue(coreServiceMock);
46+
container.rebind(GitHubService).toConstantValue(githubServiceMock);
5047
});
5148

5249
afterEach(() => {

src/linter/linter.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { inject, injectable, multiInject } from "inversify";
1+
import { injectable, multiInject } from "inversify";
22
import { LINTER_ADAPTER_IDENTIFIER, LinterAdapter } from "./adapter/linter.adapter.js";
33
import { MeetupIssue, MeetupIssueService } from "../services/meetup-issue.service.js";
44
import { LintError } from "./lint.error.js";
@@ -13,7 +13,7 @@ type LintResult = {
1313
export class LinterService {
1414
constructor(
1515
@multiInject(LINTER_ADAPTER_IDENTIFIER) private readonly linters: LinterAdapter[],
16-
@inject(MeetupIssueService) private readonly meetupIssueService: MeetupIssueService
16+
private readonly meetupIssueService: MeetupIssueService
1717
) {}
1818

1919
async lint(meetupIssue: MeetupIssue, shouldFix: boolean): Promise<void> {

src/services/github.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { context, getOctokit } from "@actions/github";
22
import { GitHub } from "@actions/github/lib/utils";
3-
import { inject, injectable } from "inversify";
3+
import { injectable } from "inversify";
44

55
import { InputService } from "./input.service.js";
66

@@ -25,7 +25,7 @@ export const UpdatableGithubIssueFields = Object.keys({
2525
export class GitHubService {
2626
private octokit: Octokit | undefined;
2727

28-
constructor(@inject(InputService) private readonly inputService: InputService) {}
28+
constructor(private readonly inputService: InputService) {}
2929

3030
async getIssue(issueNumber: number): Promise<GithubIssue> {
3131
const { data: issue } = await this.getOctokit().rest.issues.get({

src/services/meetup-issue.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { inject, injectable } from "inversify";
1+
import { injectable } from "inversify";
22
import {
33
GitHubService,
44
UpdatableGithubIssue,
@@ -39,7 +39,7 @@ export const MEETUP_ISSUE_BODY_FIELD_LABELS: Record<MeetupIssueBodyFields, strin
3939

4040
@injectable()
4141
export class MeetupIssueService {
42-
constructor(@inject(GitHubService) private readonly githubService: GitHubService) {}
42+
constructor(private readonly githubService: GitHubService) {}
4343

4444
async getMeetupIssue(
4545
issueNumber: number,

0 commit comments

Comments
 (0)