Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prettier cli params were not passed correctly #622

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"lint-staged": {
"*.*": [
"npm run lint:eslint --fix",
"npm run lint:prettier --write"
"npm run lint:prettier -- --write"
]
},
"private": true,
Expand All @@ -70,10 +70,10 @@
"generate:bundle-info": "tsx ../packages/tooling/bundle-info.ts",
"generate:sentry-release": "tsx ../packages/tooling/sentry-release.ts api dist",
"lint": "npm run build && npm run lint:alone",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier --check . && npm run lint:tsc && npm run lint:ts-prune",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check . && npm run lint:tsc && npm run lint:ts-prune",
"lint:eslint": "eslint --config ../packages/tooling/eslint.config.mjs",
"lint:fix": "npm run build && npm run lint:fix:alone",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .",
"lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn",
"lint:ts-prune": "tsx ../packages/tooling/setup-ts-prune.ts && ts-prune --error",
"lint:tsc": "tspc --noEmit",
Expand Down
8 changes: 1 addition & 7 deletions api/src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import "reflect-metadata";
import "src/_utils/setup-sentry";

import * as Sentry from "@sentry/node";

import {
RoutingControllersOptions,
createExpressServer,
useContainer,
} from "routing-controllers";

import { RoutingControllersOptions, createExpressServer, useContainer } from "routing-controllers";
import { Application } from "express";
import { ConfigService } from "src/config/service";
import Container from "typedi";
Expand Down
9 changes: 2 additions & 7 deletions api/src/config/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
Environment,
environments,
} from "@dzcode.io/utils/dist/config/environment";
import { Environment, environments } from "@dzcode.io/utils/dist/config/environment";
import { IsOptional, IsString, Matches } from "class-validator";

import { Expose } from "class-transformer";
Expand Down Expand Up @@ -39,9 +36,7 @@ export class EnvRecord {

@Expose()
get MEILISEARCH_URL() {
return this.NODE_ENV === "development"
? "http://localhost:7700/"
: "http://meilisearch:7700/";
return this.NODE_ENV === "development" ? "http://localhost:7700/" : "http://meilisearch:7700/";
}

MEILISEARCH_MASTER_KEY = "default";
Expand Down
45 changes: 17 additions & 28 deletions api/src/digest/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ export class DigestCron {
id: project.slug.replace(/[.]/g, "-"), // NOTE-OB: MeiliSearch doesn't allow dots in ids
name: project.name,
};
const [{ id: projectId }] =
await this.projectsRepository.upsert(projectEntity);
const [{ id: projectId }] = await this.projectsRepository.upsert(projectEntity);
await this.searchService.upsert("project", projectEntity);

let addedRepositoryCount = 0;
Expand All @@ -93,16 +92,15 @@ export class DigestCron {
});

const provider = "github";
const [{ id: repositoryId }] =
await this.repositoriesRepository.upsert({
provider,
name: repoInfo.name,
owner: repoInfo.owner.login,
runId,
projectId,
stars: repoInfo.stargazers_count,
id: `${provider}-${repoInfo.id}`,
});
const [{ id: repositoryId }] = await this.repositoriesRepository.upsert({
provider,
name: repoInfo.name,
owner: repoInfo.owner.login,
runId,
projectId,
stars: repoInfo.stargazers_count,
id: `${provider}-${repoInfo.id}`,
});
addedRepositoryCount++;

const issues = await this.githubService.listRepositoryIssues({
Expand Down Expand Up @@ -144,26 +142,19 @@ export class DigestCron {
updatedAt: issue.updated_at,
activityCount: issue.comments,
runId,
url:
type === "PULL_REQUEST"
? issue.pull_request.html_url
: issue.html_url,
url: type === "PULL_REQUEST" ? issue.pull_request.html_url : issue.html_url,
repositoryId,
contributorId,
id: `${provider}-${issue.id}`,
};
await this.contributionsRepository.upsert(contributionEntity);
await this.searchService.upsert(
"contribution",
contributionEntity,
);
await this.searchService.upsert("contribution", contributionEntity);
}

const repoContributors =
await this.githubService.listRepositoryContributors({
owner: repository.owner,
repository: repository.name,
});
const repoContributors = await this.githubService.listRepositoryContributors({
owner: repository.owner,
repository: repository.name,
});

const repoContributorsFiltered = repoContributors.filter(
(contributor) => contributor.type === "User",
Expand Down Expand Up @@ -207,9 +198,7 @@ export class DigestCron {
}

try {
await this.contributorsRepository.deleteAllRelationWithRepositoryButWithRunId(
runId,
);
await this.contributorsRepository.deleteAllRelationWithRepositoryButWithRunId(runId);
await this.contributionsRepository.deleteAllButWithRunId(runId);
await this.contributorsRepository.deleteAllButWithRunId(runId);
await this.repositoriesRepository.deleteAllButWithRunId(runId);
Expand Down
25 changes: 6 additions & 19 deletions api/src/search/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export class SearchService {
private readonly logger: LoggerService,
) {
this.logger.info({ message: "Initializing MeiliSearch client" });
const { MEILISEARCH_URL, MEILISEARCH_MASTER_KEY } =
this.configService.env();
const { MEILISEARCH_URL, MEILISEARCH_MASTER_KEY } = this.configService.env();

this.meilisearch = new MeiliSearch({
host: MEILISEARCH_URL,
Expand All @@ -33,21 +32,15 @@ export class SearchService {
};
};

public upsert = async <T extends BaseEntity>(
index: SearchType,
data: T,
): Promise<void> => {
public upsert = async <T extends BaseEntity>(index: SearchType, data: T): Promise<void> => {
this.logger.info({
message: `Upserting "${data.id}" item to ${index}`,
});
await this.meilisearch.index(index).updateDocuments([data]);
this.logger.info({ message: `Upserted "${data.id}" item to ${index}` });
};

public deleteAllButWithRunId = async (
index: SearchType,
runId: string,
): Promise<void> => {
public deleteAllButWithRunId = async (index: SearchType, runId: string): Promise<void> => {
this.logger.info({
message: `Deleting all ${index} but with runId ${runId}`,
});
Expand Down Expand Up @@ -83,14 +76,8 @@ export class SearchService {
}

private async updateFilterableAttributes(): Promise<void> {
await this.meilisearch
.index("project")
.updateFilterableAttributes(["runId"]);
await this.meilisearch
.index("contribution")
.updateFilterableAttributes(["runId"]);
await this.meilisearch
.index("contributor")
.updateFilterableAttributes(["runId"]);
await this.meilisearch.index("project").updateFilterableAttributes(["runId"]);
await this.meilisearch.index("contribution").updateFilterableAttributes(["runId"]);
await this.meilisearch.index("contributor").updateFilterableAttributes(["runId"]);
}
}
6 changes: 3 additions & 3 deletions data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"lint-staged": {
"*.*": [
"npm run lint:eslint --fix",
"npm run lint:prettier --write"
"npm run lint:prettier -- --write"
]
},
"private": true,
Expand All @@ -37,10 +37,10 @@
"clean": "lerna run clean:alone --scope=@dzcode.io/api --include-dependencies --stream",
"clean:alone": "del dist coverage",
"lint": "npm run build && npm run lint:alone",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier --check . && npm run lint:tsc && npm run lint:ts-prune",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check . && npm run lint:tsc && npm run lint:ts-prune",
"lint:eslint": "eslint --config ../packages/tooling/eslint.config.mjs",
"lint:fix": "npm run build && npm run lint:fix:alone",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .",
"lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn",
"lint:ts-prune": "tsx ../packages/tooling/setup-ts-prune.ts && ts-prune --error",
"lint:tsc": "tsc --noEmit",
Expand Down
6 changes: 3 additions & 3 deletions packages/models/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lint-staged": {
"*.*": [
"npm run lint:eslint --fix",
"npm run lint:prettier --write"
"npm run lint:prettier -- --write"
]
},
"main": "dist",
Expand All @@ -30,10 +30,10 @@
"clean": "lerna run clean:alone --scope=@dzcode.io/models --include-dependencies --stream",
"clean:alone": "del dist coverage",
"lint": "npm run build && npm run lint:alone",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier --check .",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check .",
"lint:eslint": "eslint --config ../tooling/eslint.config.mjs",
"lint:fix": "npm run build && npm run lint:fix:alone",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .",
"lint:prettier": "prettier --config ../tooling/.prettierrc --ignore-path ../tooling/.prettierignore --log-level warn",
"test": "npm run build && npm run test:alone",
"test:alone": "jest --config ../tooling/jest.config.ts --rootDir .",
Expand Down
1 change: 1 addition & 0 deletions packages/tooling/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dist

# api
oracle-cloud/build
db

# web
bundle
Expand Down
6 changes: 3 additions & 3 deletions packages/tooling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
"lint-staged": {
"*.*": [
"npm run lint:eslint --fix",
"npm run lint:prettier --write"
"npm run lint:prettier -- --write"
]
},
"private": true,
"scripts": {
"lint": "npm run lint:alone",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier --check .",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check .",
"lint:eslint": "eslint --config eslint.config.mjs",
"lint:fix": "npm run lint:fix:alone",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .",
"lint:prettier": "prettier --config .prettierrc --ignore-path .prettierignore --log-level warn"
}
}
6 changes: 3 additions & 3 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint-staged": {
"*.*": [
"npm run lint:eslint --fix",
"npm run lint:prettier --write"
"npm run lint:prettier -- --write"
]
},
"main": "dist",
Expand All @@ -27,10 +27,10 @@
"clean": "lerna run clean:alone --scope=@dzcode.io/utils --include-dependencies --stream",
"clean:alone": "del dist coverage",
"lint": "npm run build && npm run lint:alone",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier --check .",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check .",
"lint:eslint": "eslint --config ../tooling/eslint.config.mjs",
"lint:fix": "npm run build && npm run lint:fix:alone",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .",
"lint:prettier": "prettier --config ../tooling/.prettierrc --ignore-path ../tooling/.prettierignore --log-level warn",
"test": "npm run build && npm run test:alone",
"test:alone": "jest --config ../tooling/jest.config.ts --rootDir .",
Expand Down
6 changes: 3 additions & 3 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"lint-staged": {
"*.*": [
"npm run lint:eslint --fix",
"npm run lint:prettier --write"
"npm run lint:prettier -- --write"
]
},
"private": true,
Expand Down Expand Up @@ -79,10 +79,10 @@
"lh:collect": "npx --yes @lhci/cli collect",
"lh:upload": "npx --yes @lhci/cli upload",
"lint": "npm run build && npm run lint:alone",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier --check . && npm run lint:tsc && npm run lint:ts-prune",
"lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check . && npm run lint:tsc && npm run lint:ts-prune",
"lint:eslint": "eslint --config ../packages/tooling/eslint.config.mjs",
"lint:fix": "npm run build && npm run lint:fix:alone",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .",
"lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .",
"lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn",
"lint:ts-prune": "tsx ../packages/tooling/setup-ts-prune.ts && ts-prune --error",
"lint:tsc": "tsc --noEmit",
Expand Down
Loading