diff --git a/packages/canyon-collect/.eslintrc.js b/packages/canyon-collect/.eslintrc.js index 259de13c..9ade1ea0 100644 --- a/packages/canyon-collect/.eslintrc.js +++ b/packages/canyon-collect/.eslintrc.js @@ -1,25 +1,25 @@ module.exports = { - parser: '@typescript-eslint/parser', + parser: "@typescript-eslint/parser", parserOptions: { - project: 'tsconfig.json', + project: "tsconfig.json", tsconfigRootDir: __dirname, - sourceType: 'module', + sourceType: "module", }, - plugins: ['@typescript-eslint/eslint-plugin'], + plugins: ["@typescript-eslint/eslint-plugin"], extends: [ - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended", ], root: true, env: { node: true, jest: true, }, - ignorePatterns: ['.eslintrc.js'], + ignorePatterns: [".eslintrc.js"], rules: { - '@typescript-eslint/interface-name-prefix': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-explicit-any': 'off', + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-explicit-any": "off", }, }; diff --git a/packages/canyon-collect/.prettierrc b/packages/canyon-collect/.prettierrc index dcb72794..0967ef42 100644 --- a/packages/canyon-collect/.prettierrc +++ b/packages/canyon-collect/.prettierrc @@ -1,4 +1 @@ -{ - "singleQuote": true, - "trailingComma": "all" -} \ No newline at end of file +{} diff --git a/packages/canyon-collect/package.json b/packages/canyon-collect/package.json index 533310d4..5595473d 100644 --- a/packages/canyon-collect/package.json +++ b/packages/canyon-collect/package.json @@ -9,7 +9,8 @@ "vercel-build": "prisma generate && nest build", "build": "prisma generate && nest build", "start": "prisma generate && nest start", - "preinstall": "prisma generate" + "preinstall": "prisma generate", + "format": "prettier --write ." }, "dependencies": { "@mongodb-js/zstd": "^1.2.2", diff --git a/packages/canyon-collect/src/app.controller.ts b/packages/canyon-collect/src/app.controller.ts index ada4478a..f7e2dde4 100644 --- a/packages/canyon-collect/src/app.controller.ts +++ b/packages/canyon-collect/src/app.controller.ts @@ -1,11 +1,11 @@ -import { Controller, Get } from '@nestjs/common'; -import { AppService } from './app.service'; +import { Controller, Get } from "@nestjs/common"; +import { AppService } from "./app.service"; @Controller() export class AppController { constructor(private readonly appService: AppService) {} - @Get('api/vi/health') + @Get("api/vi/health") getHello(): string { return this.appService.getHello(); } diff --git a/packages/canyon-collect/src/app.module.ts b/packages/canyon-collect/src/app.module.ts index d470631f..e5b85ce6 100644 --- a/packages/canyon-collect/src/app.module.ts +++ b/packages/canyon-collect/src/app.module.ts @@ -1,15 +1,15 @@ -import { Module } from '@nestjs/common'; -import { AppController } from './app.controller'; -import { AppService } from './app.service'; -import { CollectModule } from './apps/collect/collect.module'; -import { PrismaService } from './prisma/prisma.service'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { CoveragediskEntity } from './apps/collect/entity/coveragedisk.entity'; +import { Module } from "@nestjs/common"; +import { AppController } from "./app.controller"; +import { AppService } from "./app.service"; +import { CollectModule } from "./apps/collect/collect.module"; +import { PrismaService } from "./prisma/prisma.service"; +import { TypeOrmModule } from "@nestjs/typeorm"; +import { CoveragediskEntity } from "./apps/collect/entity/coveragedisk.entity"; @Module({ imports: [ TypeOrmModule.forRoot({ - type: 'sqlite', - database: 'db/sql', + type: "sqlite", + database: "db/sql", synchronize: true, entities: [CoveragediskEntity], }), diff --git a/packages/canyon-collect/src/app.service.ts b/packages/canyon-collect/src/app.service.ts index 927d7cca..b00a6679 100644 --- a/packages/canyon-collect/src/app.service.ts +++ b/packages/canyon-collect/src/app.service.ts @@ -1,8 +1,8 @@ -import { Injectable } from '@nestjs/common'; +import { Injectable } from "@nestjs/common"; @Injectable() export class AppService { getHello(): string { - return 'Hello World!'; + return "Hello World!"; } } diff --git a/packages/canyon-collect/src/apps/collect/collect.controller.ts b/packages/canyon-collect/src/apps/collect/collect.controller.ts index 230c42c8..e8be2147 100644 --- a/packages/canyon-collect/src/apps/collect/collect.controller.ts +++ b/packages/canyon-collect/src/apps/collect/collect.controller.ts @@ -4,14 +4,14 @@ import { Post, UploadedFile, UseInterceptors, -} from '@nestjs/common'; -import { PrismaService } from '../../prisma/prisma.service'; -import { CoverageClientService } from './services/coverage-client.service'; -import { CoverageClientDto } from './dto/coverage-client.dto'; -import { FileInterceptor } from '@nestjs/platform-express'; -import { CoverageMapClientService } from './services/coverage-map-client.service'; -import { CoverageMapClientDto } from './dto/coverage-map-client.dto'; -import zlib from 'zlib'; +} from "@nestjs/common"; +import { PrismaService } from "../../prisma/prisma.service"; +import { CoverageClientService } from "./services/coverage-client.service"; +import { CoverageClientDto } from "./dto/coverage-client.dto"; +import { FileInterceptor } from "@nestjs/platform-express"; +import { CoverageMapClientService } from "./services/coverage-map-client.service"; +import { CoverageMapClientDto } from "./dto/coverage-map-client.dto"; +import zlib from "zlib"; // 解压 GZIP 的 Buffer 数据 async function decompressData(buffer) { return new Promise((resolve, reject) => { @@ -19,7 +19,7 @@ async function decompressData(buffer) { if (err) { return reject(err); } - resolve(decompressed.toString('utf-8')); // 转换为字符串返回 + resolve(decompressed.toString("utf-8")); // 转换为字符串返回 }); }); } @@ -39,8 +39,8 @@ export class CollectController { 4. 经过测试在macbookpro上compressDataWithStream压缩1600kb的数据,压缩后64kb左右,耗时8ms左右 TODO 得调研8ms对navigator.sendBeacon有没有影响 */ - @UseInterceptors(FileInterceptor('coverage')) - @Post('coverage/client') + @UseInterceptors(FileInterceptor("coverage")) + @Post("coverage/client") async coverageClient( @UploadedFile() cov: any, @Body() coverageClientDto: CoverageClientDto, @@ -50,7 +50,7 @@ export class CollectController { return this.coverageClientService.invoke(coverageClientDto); } let coverage = {}; - if (cov.mimetype === 'application/octet-stream') { + if (cov.mimetype === "application/octet-stream") { coverage = await decompressData(cov.buffer).then((jsonString: any) => JSON.parse(jsonString), ); @@ -67,7 +67,7 @@ export class CollectController { }); } - @Post('coverage/map/client') + @Post("coverage/map/client") coverageMapClient(@Body() coverageMapClientDto: CoverageMapClientDto) { return this.coverageMapClientService.invoke(coverageMapClientDto); } diff --git a/packages/canyon-collect/src/apps/collect/collect.module.ts b/packages/canyon-collect/src/apps/collect/collect.module.ts index ddd74734..40b0fde8 100644 --- a/packages/canyon-collect/src/apps/collect/collect.module.ts +++ b/packages/canyon-collect/src/apps/collect/collect.module.ts @@ -1,12 +1,12 @@ -import { Module } from '@nestjs/common'; -import { CollectController } from './collect.controller'; -import { CoverageClientService } from './services/coverage-client.service'; -import { CoverageMapClientService } from './services/coverage-map-client.service'; -import { CoveragediskService } from './services/core/coveragedisk.service'; -import { ConsumerCoverageService } from './services/core/consumer-coverage.service'; -import { CoveragediskEntity } from './entity/coveragedisk.entity'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { PrismaService } from '../../prisma/prisma.service'; +import { Module } from "@nestjs/common"; +import { CollectController } from "./collect.controller"; +import { CoverageClientService } from "./services/coverage-client.service"; +import { CoverageMapClientService } from "./services/coverage-map-client.service"; +import { CoveragediskService } from "./services/core/coveragedisk.service"; +import { ConsumerCoverageService } from "./services/core/consumer-coverage.service"; +import { CoveragediskEntity } from "./entity/coveragedisk.entity"; +import { TypeOrmModule } from "@nestjs/typeorm"; +import { PrismaService } from "../../prisma/prisma.service"; @Module({ imports: [TypeOrmModule.forFeature([CoveragediskEntity])], diff --git a/packages/canyon-collect/src/apps/collect/dto/coverage-client.dto.ts b/packages/canyon-collect/src/apps/collect/dto/coverage-client.dto.ts index 4392ba54..5d5f4584 100755 --- a/packages/canyon-collect/src/apps/collect/dto/coverage-client.dto.ts +++ b/packages/canyon-collect/src/apps/collect/dto/coverage-client.dto.ts @@ -4,14 +4,14 @@ import { Matches, MinLength, Validate, -} from 'class-validator'; -import { IsValidCoverage } from '../valids/is-valid-coverage'; +} from "class-validator"; +import { IsValidCoverage } from "../valids/is-valid-coverage"; export class CoverageClientDto { // git仓库相关 @IsString() - @Matches(/^[a-f0-9]{40}$/i, { message: 'sha格式不正确' }) - @IsNotEmpty({ message: 'sha 不能为空' }) + @Matches(/^[a-f0-9]{40}$/i, { message: "sha格式不正确" }) + @IsNotEmpty({ message: "sha 不能为空" }) sha: string; // @IsString() @@ -41,7 +41,7 @@ export class CoverageClientDto { // key: string; @IsString() - @IsNotEmpty({ message: 'projectID 不能为空' }) + @IsNotEmpty({ message: "projectID 不能为空" }) projectID: string; // // 单次 case 触发相关 @@ -52,8 +52,8 @@ export class CoverageClientDto { // istanbul覆盖率相关 @IsString() - @MinLength(1, { message: 'reportID长度最小为1' }) - @IsNotEmpty({ message: 'instrumentCwd不能为空' }) + @MinLength(1, { message: "reportID长度最小为1" }) + @IsNotEmpty({ message: "instrumentCwd不能为空" }) instrumentCwd: string; // @IsNotEmpty({ message: 'coverage不能为空' }) diff --git a/packages/canyon-collect/src/apps/collect/dto/coverage-map-client.dto.ts b/packages/canyon-collect/src/apps/collect/dto/coverage-map-client.dto.ts index 5e9e31bb..39a921bf 100755 --- a/packages/canyon-collect/src/apps/collect/dto/coverage-map-client.dto.ts +++ b/packages/canyon-collect/src/apps/collect/dto/coverage-map-client.dto.ts @@ -5,19 +5,19 @@ import { Matches, MinLength, Validate, -} from 'class-validator'; -import { IsValidCoverage } from '../valids/is-valid-coverage-map'; +} from "class-validator"; +import { IsValidCoverage } from "../valids/is-valid-coverage-map"; export class CoverageMapClientDto { // git仓库相关 @IsString() - @Matches(/^[a-f0-9]{40}$/i, { message: 'sha格式不正确' }) - @IsNotEmpty({ message: 'sha 不能为空' }) + @Matches(/^[a-f0-9]{40}$/i, { message: "sha格式不正确" }) + @IsNotEmpty({ message: "sha 不能为空" }) sha: string; @IsString() - @MinLength(1, { message: 'branch长度最小为1' }) - @IsOptional({ message: 'branch 可以为空' }) + @MinLength(1, { message: "branch长度最小为1" }) + @IsOptional({ message: "branch 可以为空" }) branch: string; // @IsString() @@ -42,7 +42,7 @@ export class CoverageMapClientDto { // key: string; @IsString() - @IsNotEmpty({ message: 'projectID 不能为空' }) + @IsNotEmpty({ message: "projectID 不能为空" }) projectID: string; // // 单次 case 触发相关 @@ -53,11 +53,11 @@ export class CoverageMapClientDto { // istanbul覆盖率相关 @IsString() - @MinLength(1, { message: 'reportID长度最小为1' }) - @IsNotEmpty({ message: 'instrumentCwd不能为空' }) + @MinLength(1, { message: "reportID长度最小为1" }) + @IsNotEmpty({ message: "instrumentCwd不能为空" }) instrumentCwd: string; - @IsNotEmpty({ message: 'coverage不能为空' }) + @IsNotEmpty({ message: "coverage不能为空" }) @Validate(IsValidCoverage) coverage: any; diff --git a/packages/canyon-collect/src/apps/collect/entity/coveragedisk.entity.ts b/packages/canyon-collect/src/apps/collect/entity/coveragedisk.entity.ts index 88e67af5..23f2fb19 100644 --- a/packages/canyon-collect/src/apps/collect/entity/coveragedisk.entity.ts +++ b/packages/canyon-collect/src/apps/collect/entity/coveragedisk.entity.ts @@ -1,6 +1,6 @@ -import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; +import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"; -@Entity('coveragedisk') +@Entity("coveragedisk") export class CoveragediskEntity { @PrimaryGeneratedColumn() id: number; diff --git a/packages/canyon-collect/src/apps/collect/models/coverage.model.ts b/packages/canyon-collect/src/apps/collect/models/coverage.model.ts index a110dc85..10c61357 100644 --- a/packages/canyon-collect/src/apps/collect/models/coverage.model.ts +++ b/packages/canyon-collect/src/apps/collect/models/coverage.model.ts @@ -1,21 +1,21 @@ export const coverageObj = { // id: require('cuid')(), // 假设这里有类似cuid的函数来生成唯一ID,需根据实际情况引入相应库 - branch: '-', - compareTarget: '', - provider: '', - buildProvider: '', - buildID: '', - projectID: '', - sha: '', - reporter: '', - reportID: '', - covType: '', + branch: "-", + compareTarget: "", + provider: "", + buildProvider: "", + buildID: "", + projectID: "", + sha: "", + reporter: "", + reportID: "", + covType: "", statementsTotal: 0, statementsCovered: 0, - summary: '', - hit: '', - map: '', - instrumentCwd: '', + summary: "", + hit: "", + map: "", + instrumentCwd: "", // createdAt: new Date(), // updatedAt: new Date(), }; diff --git a/packages/canyon-collect/src/apps/collect/services/core/consumer-coverage.service.ts b/packages/canyon-collect/src/apps/collect/services/core/consumer-coverage.service.ts index efaa7d15..2857fd03 100644 --- a/packages/canyon-collect/src/apps/collect/services/core/consumer-coverage.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/core/consumer-coverage.service.ts @@ -1,21 +1,21 @@ -import { Injectable } from '@nestjs/common'; +import { Injectable } from "@nestjs/common"; import { genSummaryMapByCoverageMap, getSummaryByPath, -} from '../../../../canyon-data/src'; +} from "../../../../canyon-data/src"; -import { CoveragediskService } from './coveragedisk.service'; -import { PrismaService } from '../../../../prisma/prisma.service'; -import { removeNullKeys } from '../../../../utils/utils'; -import { compressedData, decompressedData } from '../../../../utils/zstd'; -import { coverageObj } from '../../models/coverage.model'; -import { mergeCoverageMap } from 'canyon-data'; +import { CoveragediskService } from "./coveragedisk.service"; +import { PrismaService } from "../../../../prisma/prisma.service"; +import { removeNullKeys } from "../../../../utils/utils"; +import { compressedData, decompressedData } from "../../../../utils/zstd"; +import { coverageObj } from "../../models/coverage.model"; +import { mergeCoverageMap } from "canyon-data"; // import { resetCoverageDataMap } from 'canyon-data2'; import { remapCoverageWithInstrumentCwd, reorganizeCompleteCoverageObjects, resetCoverageDataMap, -} from 'canyon-data2'; +} from "canyon-data2"; const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); @@ -35,7 +35,7 @@ export class ConsumerCoverageService { ) {} async invoke() { - console.log('ConsumerCoverageService start!!!'); + console.log("ConsumerCoverageService start!!!"); while (true) { try { // 获取将要消费的队列数据,sha和projectID相同,并且已经聚合 @@ -43,7 +43,7 @@ export class ConsumerCoverageService { await this.coveragediskService.getQueueWithSameShaAndProjectID(); // 如果存在 if (queueDataToBeConsumed) { - const _lockName = 'consumer_coverage'; + const _lockName = "consumer_coverage"; const lockName = `${_lockName}_${queueDataToBeConsumed.projectID}_${queueDataToBeConsumed.sha}`; const lockAcquired = await this.acquireLock(lockName, 1000 * 60 * 2); @@ -65,11 +65,11 @@ export class ConsumerCoverageService { try { await this.consume( dataFormatAndCheckQueueDataToBeConsumed, - 'agg', + "agg", ); await this.consume( dataFormatAndCheckQueueDataToBeConsumed, - 'all', + "all", ); // 这里有需要补偿变更行覆盖率,因为一些懒加载的原因,可能导致每个agg类型的变更行数量不一样。所以每次更新后,需要更新一下所有agg的变更行覆盖率summary // await this.compensationChangeLineCoverageSummary( @@ -101,7 +101,7 @@ export class ConsumerCoverageService { sha: queueDataToBeConsumed.sha, projectID: queueDataToBeConsumed.projectID, covType: covType, - reportID: covType === 'agg' ? queueDataToBeConsumed.reportID : null, + reportID: covType === "agg" ? queueDataToBeConsumed.reportID : null, }), }); const { map, instrumentCwd } = await this.prisma.coverage @@ -109,7 +109,7 @@ export class ConsumerCoverageService { where: { sha: queueDataToBeConsumed.sha, projectID: queueDataToBeConsumed.projectID, - covType: 'all', + covType: "all", }, }) .then(async (res) => { @@ -150,7 +150,7 @@ export class ConsumerCoverageService { newCoverage, codechanges, ); - const sum: any = getSummaryByPath('', summary); + const sum: any = getSummaryByPath("", summary); const summaryZstd = await compressedData(summary); // 实际存储不能用全量数据,大10倍 @@ -257,7 +257,7 @@ export class ConsumerCoverageService { return true; // 锁获取成功 } } catch (error) { - console.error('Error acquiring lock:', error); + console.error("Error acquiring lock:", error); return false; // 锁获取失败 } } diff --git a/packages/canyon-collect/src/apps/collect/services/core/coveragedisk.service.ts b/packages/canyon-collect/src/apps/collect/services/core/coveragedisk.service.ts index 56b940de..ed560355 100644 --- a/packages/canyon-collect/src/apps/collect/services/core/coveragedisk.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/core/coveragedisk.service.ts @@ -1,8 +1,8 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { CoveragediskEntity } from '../../entity/coveragedisk.entity'; -import { Repository } from 'typeorm'; -import { mergeCoverageMap } from 'canyon-data'; +import { Injectable } from "@nestjs/common"; +import { InjectRepository } from "@nestjs/typeorm"; +import { CoveragediskEntity } from "../../entity/coveragedisk.entity"; +import { Repository } from "typeorm"; +import { mergeCoverageMap } from "canyon-data"; /* 开发本地覆盖率存储服务,pushQueue用于存储覆盖率数据,getQueueWithSameShaAndProjectID用于获取相同sha和projectID的覆盖率数据 @@ -35,7 +35,7 @@ export class CoveragediskService { pid: String(process.pid), }, order: { - createdAt: 'ASC', + createdAt: "ASC", }, select: { pid: true, diff --git a/packages/canyon-collect/src/apps/collect/services/coverage-client.service.ts b/packages/canyon-collect/src/apps/collect/services/coverage-client.service.ts index e2a24190..13ce6b27 100755 --- a/packages/canyon-collect/src/apps/collect/services/coverage-client.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/coverage-client.service.ts @@ -1,13 +1,13 @@ -import { HttpException, Injectable } from '@nestjs/common'; -import { PrismaService } from '../../../prisma/prisma.service'; -import { IstanbulHitMapSchema } from '../../../zod/istanbul.zod'; -import { decompressedData } from '../../../utils/zstd'; -import { formatReportObject, regularData } from '../../../utils/coverage'; -import { CoveragediskService } from './core/coveragedisk.service'; +import { HttpException, Injectable } from "@nestjs/common"; +import { PrismaService } from "../../../prisma/prisma.service"; +import { IstanbulHitMapSchema } from "../../../zod/istanbul.zod"; +import { decompressedData } from "../../../utils/zstd"; +import { formatReportObject, regularData } from "../../../utils/coverage"; +import { CoveragediskService } from "./core/coveragedisk.service"; import { remapCoverageWithInstrumentCwd, reorganizeCompleteCoverageObjects, -} from 'canyon-data2'; +} from "canyon-data2"; // 此代码重中之重、核心中的核心!!! @Injectable() @@ -29,7 +29,7 @@ export class CoverageClientService { where: { projectID: projectID, sha: sha, - covType: 'all', + covType: "all", }, select: { map: true, @@ -38,13 +38,13 @@ export class CoverageClientService { }); if (!coverageFromDatabase) { - throw new HttpException('coverage map not found', 400); + throw new HttpException("coverage map not found", 400); } // #endregion // #region == Step x: 解析出上报上来的覆盖率数据 const CoverageFromExternalReport = - typeof coverage === 'string' ? JSON.parse(coverage) : coverage; + typeof coverage === "string" ? JSON.parse(coverage) : coverage; // #endregion // #region == Step x: db查找出对应的map数据 diff --git a/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts b/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts index a775f7dc..40ebd782 100755 --- a/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts @@ -1,26 +1,26 @@ -import { PrismaService } from '../../../prisma/prisma.service'; -import { Injectable } from '@nestjs/common'; +import { PrismaService } from "../../../prisma/prisma.service"; +import { Injectable } from "@nestjs/common"; import { IstanbulHitMapSchema, IstanbulMapMapSchema, -} from '../../../zod/istanbul.zod'; -import { compressedData } from '../../../utils/zstd'; +} from "../../../zod/istanbul.zod"; +import { compressedData } from "../../../utils/zstd"; import { formatReportObject, regularData, removeStartEndNull, resetCoverageData, -} from '../../../utils/coverage'; -import { coverageObj } from '../models/coverage.model'; +} from "../../../utils/coverage"; +import { coverageObj } from "../models/coverage.model"; // import { resetCoverageDataMap } from 'canyon-data2'; import { remapCoverageWithInstrumentCwd, resetCoverageDataMap, -} from 'canyon-data2'; +} from "canyon-data2"; import { genSummaryMapByCoverageMap, getSummaryByPath, -} from '../../../canyon-data/src'; +} from "../../../canyon-data/src"; @Injectable() export class CoverageMapClientService { @@ -31,7 +31,7 @@ export class CoverageMapClientService { where: { sha: sha, projectID: projectID, - covType: 'all', + covType: "all", }, }); @@ -46,7 +46,7 @@ export class CoverageMapClientService { } const coverageObject = - typeof coverage === 'string' ? JSON.parse(coverage) : coverage; + typeof coverage === "string" ? JSON.parse(coverage) : coverage; const { coverage: formatedCoverage } = await formatReportObject({ coverage: resetCoverageData(regularData(coverageObject)), @@ -76,7 +76,7 @@ export class CoverageMapClientService { inithitMapCWanzhen, [], ); - const sum: any = getSummaryByPath('', summary); + const sum: any = getSummaryByPath("", summary); const summaryZstd = await compressedData(summary); // ****************************************************** // ****************************************************** @@ -90,16 +90,16 @@ export class CoverageMapClientService { .create({ data: { ...coverageObj, - branch: branch || '-', + branch: branch || "-", compareTarget: sha, - provider: 'github', - buildProvider: 'github', - buildID: '', + provider: "github", + buildProvider: "github", + buildID: "", projectID: projectID, sha: sha, - reporter: 'canyon', + reporter: "canyon", reportID: sha, - covType: 'all', //map都是all + covType: "all", //map都是all statementsCovered: 0, statementsTotal: sum.statements.total, //空bytes diff --git a/packages/canyon-collect/src/apps/collect/valids/is-valid-coverage-map.ts b/packages/canyon-collect/src/apps/collect/valids/is-valid-coverage-map.ts index 54dbd190..d5b653d9 100755 --- a/packages/canyon-collect/src/apps/collect/valids/is-valid-coverage-map.ts +++ b/packages/canyon-collect/src/apps/collect/valids/is-valid-coverage-map.ts @@ -1,7 +1,7 @@ import { ValidatorConstraint, ValidatorConstraintInterface, -} from 'class-validator'; +} from "class-validator"; /*// 验证流水线上报的覆盖率map对象, @@ -10,15 +10,15 @@ import { function isValidCoverageMap(coverage) { // 检查是否是对象 - if (typeof coverage !== 'object' || coverage === null) { + if (typeof coverage !== "object" || coverage === null) { return false; } // 检查是否有必须的属性 const requiredProperties = [ // "path", - 'statementMap', - 'fnMap', - 'branchMap', + "statementMap", + "fnMap", + "branchMap", // "s", // "f", // "b", @@ -31,9 +31,9 @@ function isValidCoverageMap(coverage) { // 检查属性的类型和结构 if ( // typeof coverage.path !== "string" || - typeof coverage.statementMap !== 'object' || - typeof coverage.fnMap !== 'object' || - typeof coverage.branchMap !== 'object' + typeof coverage.statementMap !== "object" || + typeof coverage.fnMap !== "object" || + typeof coverage.branchMap !== "object" // typeof coverage.s !== "object" || // typeof coverage.f !== "object" || // typeof coverage.b !== "object" @@ -52,14 +52,14 @@ function safeParseJSON(json) { return {}; } } -@ValidatorConstraint({ name: 'isValidCoverage', async: false }) +@ValidatorConstraint({ name: "isValidCoverage", async: false }) export class IsValidCoverage implements ValidatorConstraintInterface { validate(_coverage: unknown) { if (_coverage === null || _coverage === undefined) { return false; } const coverage = - typeof _coverage === 'string' ? safeParseJSON(_coverage) : _coverage; + typeof _coverage === "string" ? safeParseJSON(_coverage) : _coverage; if (Object.keys(coverage).length === 0) { return false; } @@ -69,6 +69,6 @@ export class IsValidCoverage implements ValidatorConstraintInterface { } defaultMessage() { - return 'coverageMap格式不正确'; + return "coverageMap格式不正确"; } } diff --git a/packages/canyon-collect/src/apps/collect/valids/is-valid-coverage.ts b/packages/canyon-collect/src/apps/collect/valids/is-valid-coverage.ts index a5ff1c2a..442345ec 100755 --- a/packages/canyon-collect/src/apps/collect/valids/is-valid-coverage.ts +++ b/packages/canyon-collect/src/apps/collect/valids/is-valid-coverage.ts @@ -1,10 +1,10 @@ import { ValidatorConstraint, ValidatorConstraintInterface, -} from 'class-validator'; +} from "class-validator"; function isValidCoverage(coverage) { // 检查是否是对象 - if (typeof coverage !== 'object' || coverage === null) { + if (typeof coverage !== "object" || coverage === null) { return false; } // 检查是否有必须的属性 @@ -13,9 +13,9 @@ function isValidCoverage(coverage) { // "statementMap", // "fnMap", // "branchMap", - 's', - 'f', - 'b', + "s", + "f", + "b", ]; for (const prop of requiredProperties) { if (!(prop in coverage)) { @@ -28,9 +28,9 @@ function isValidCoverage(coverage) { // typeof coverage.statementMap !== "object" || // typeof coverage.fnMap !== "object" || // typeof coverage.branchMap !== "object" || - typeof coverage.s !== 'object' || - typeof coverage.f !== 'object' || - typeof coverage.b !== 'object' + typeof coverage.s !== "object" || + typeof coverage.f !== "object" || + typeof coverage.b !== "object" ) { return false; } @@ -46,7 +46,7 @@ function safeParseJSON(json) { return {}; } } -@ValidatorConstraint({ name: 'isValidCoverage', async: false }) +@ValidatorConstraint({ name: "isValidCoverage", async: false }) export class IsValidCoverage implements ValidatorConstraintInterface { validate(_coverage: unknown) { if (_coverage === undefined) { @@ -58,7 +58,7 @@ export class IsValidCoverage implements ValidatorConstraintInterface { return false; } const coverage = - typeof _coverage === 'string' ? safeParseJSON(_coverage) : _coverage; + typeof _coverage === "string" ? safeParseJSON(_coverage) : _coverage; if (Object.keys(coverage).length === 0) { return false; } @@ -68,6 +68,6 @@ export class IsValidCoverage implements ValidatorConstraintInterface { } defaultMessage() { - return 'coverage格式不正确'; + return "coverage格式不正确"; } } diff --git a/packages/canyon-collect/src/canyon-data/src/index.ts b/packages/canyon-collect/src/canyon-data/src/index.ts index eb43a42b..a11b70c5 100755 --- a/packages/canyon-collect/src/canyon-data/src/index.ts +++ b/packages/canyon-collect/src/canyon-data/src/index.ts @@ -1,2 +1,2 @@ // export * from './coverage'; -export * from './summary'; +export * from "./summary"; diff --git a/packages/canyon-collect/src/canyon-data/src/summary/helpers.ts b/packages/canyon-collect/src/canyon-data/src/summary/helpers.ts index 0257b0fb..f6d823fa 100755 --- a/packages/canyon-collect/src/canyon-data/src/summary/helpers.ts +++ b/packages/canyon-collect/src/canyon-data/src/summary/helpers.ts @@ -1,32 +1,32 @@ -export const emptySummary = { - functions:{ +export const emptySummary = { + functions: { covered: 0, total: 0, skipped: 0, pct: 0, }, - statements:{ + statements: { covered: 0, total: 0, skipped: 0, pct: 0, }, - branches:{ + branches: { covered: 0, total: 0, skipped: 0, pct: 0, }, - lines:{ + lines: { covered: 0, total: 0, skipped: 0, pct: 0, }, - newlines:{ + newlines: { covered: 0, total: 0, skipped: 0, pct: 0, }, -} +}; diff --git a/packages/canyon-collect/src/canyon-data/src/summary/index.ts b/packages/canyon-collect/src/canyon-data/src/summary/index.ts index 406530f6..d27d22c5 100755 --- a/packages/canyon-collect/src/canyon-data/src/summary/index.ts +++ b/packages/canyon-collect/src/canyon-data/src/summary/index.ts @@ -1,12 +1,12 @@ -import { percent } from '../utils/percent'; +import { percent } from "../utils/percent"; import libCoverage, { CoverageMapData, CoverageSummaryData, Totals, -} from 'istanbul-lib-coverage'; -import { calculateNewLineCoverageForSingleFile } from '../utils/line'; -import { emptySummary } from './helpers'; -import { formatCoverageData } from '../utils/formatCoverageData'; +} from "istanbul-lib-coverage"; +import { calculateNewLineCoverageForSingleFile } from "../utils/line"; +import { emptySummary } from "./helpers"; +import { formatCoverageData } from "../utils/formatCoverageData"; export interface CodeChange { path: string; additions: number[]; @@ -24,12 +24,12 @@ export interface CoverageSummaryDataMap { export function mergeSummary(first: any, second: any): any { const ret = JSON.parse(JSON.stringify(first)); const keys = [ - 'lines', - 'statements', - 'branches', - 'functions', - 'branchesTrue', - 'newlines', + "lines", + "statements", + "branches", + "functions", + "branchesTrue", + "newlines", ]; keys.forEach((key) => { if (second[key]) { @@ -71,7 +71,7 @@ export const getSummaryByPath = ( ) => { let summaryObj = JSON.parse(JSON.stringify(emptySummary)); const filterSummary = Object.keys(summary).reduce((pre: any, cur) => { - if (cur.startsWith(path + '/') || path === '' || cur === path) { + if (cur.startsWith(path + "/") || path === "" || cur === path) { pre[cur] = summary[cur]; } return pre; @@ -96,10 +96,10 @@ export const genSummaryTreeItem = ( }[]; } => { function check(item: string, path: string) { - if (path === '') { + if (path === "") { return true; } - return item.startsWith(path + '/') || item === path; + return item.startsWith(path + "/") || item === path; } // 如果是文件 @@ -115,12 +115,12 @@ export const genSummaryTreeItem = ( const folderLists: string[] = []; Object.keys(summary).forEach((item) => { - const newpath = path === '' ? item : item.replace(path + '/', ''); - if (check(item, path) && !newpath.includes('/')) { + const newpath = path === "" ? item : item.replace(path + "/", ""); + if (check(item, path) && !newpath.includes("/")) { fileLists.push(item); } - if (check(item, path) && newpath.includes('/')) { - folderLists.push((path === '' ? '' : path + '/') + newpath.split('/')[0]); + if (check(item, path) && newpath.includes("/")) { + folderLists.push((path === "" ? "" : path + "/") + newpath.split("/")[0]); } }); diff --git a/packages/canyon-collect/src/canyon-data/src/utils/formatCoverageData.ts b/packages/canyon-collect/src/canyon-data/src/utils/formatCoverageData.ts index 8c6df0f3..b597a306 100644 --- a/packages/canyon-collect/src/canyon-data/src/utils/formatCoverageData.ts +++ b/packages/canyon-collect/src/canyon-data/src/utils/formatCoverageData.ts @@ -1,13 +1,13 @@ -export const formatCoverageData = (coverageData:any):any=>{ - const obj:any = {} - Object.entries(coverageData).forEach(([key, value]:any)=>{ +export const formatCoverageData = (coverageData: any): any => { + const obj: any = {}; + Object.entries(coverageData).forEach(([key, value]: any) => { obj[key] = { path: key, - branchMap:{}, - statementMap:{}, - fnMap:{}, - ...value - } - }) - return obj -} + branchMap: {}, + statementMap: {}, + fnMap: {}, + ...value, + }; + }); + return obj; +}; diff --git a/packages/canyon-collect/src/canyon-data/src/utils/line.ts b/packages/canyon-collect/src/canyon-data/src/utils/line.ts index 955bf55c..8550a73d 100755 --- a/packages/canyon-collect/src/canyon-data/src/utils/line.ts +++ b/packages/canyon-collect/src/canyon-data/src/utils/line.ts @@ -1,5 +1,5 @@ -import { FileCoverageData, Range } from 'istanbul-lib-coverage'; -import { percent } from './percent'; +import { FileCoverageData, Range } from "istanbul-lib-coverage"; +import { percent } from "./percent"; function getLinesFromRanges(ranges) { const lines = []; @@ -41,7 +41,7 @@ function getLineCoverage( function specialLogicByIf(branchRange, index) { if ( - branchRange.type === 'if' && + branchRange.type === "if" && branchRange.locations.length > 1 && Number(index) === 0 ) { @@ -95,7 +95,7 @@ export function calculateNewLineCoverageForSingleFile( }); const noCoveredLines = getLinesFromRanges(noCovered); - console.log(noCoveredLines, 'noCoveredLines'); + console.log(noCoveredLines, "noCoveredLines"); return { total: newLine.length, covered: newLine.filter((line) => !noCoveredLines.includes(line)).length, diff --git a/packages/canyon-collect/src/canyon-data/src/utils/percent.ts b/packages/canyon-collect/src/canyon-data/src/utils/percent.ts index 21b076af..ecc6aa4a 100755 --- a/packages/canyon-collect/src/canyon-data/src/utils/percent.ts +++ b/packages/canyon-collect/src/canyon-data/src/utils/percent.ts @@ -1,4 +1,4 @@ -export function percent(covered:number, total:number) { +export function percent(covered: number, total: number) { let tmp; if (total > 0) { tmp = (1000 * 100 * covered) / total; @@ -6,4 +6,4 @@ export function percent(covered:number, total:number) { } else { return 100.0; } -}; +} diff --git a/packages/canyon-collect/src/canyon-data/src/utils/test/mock.json b/packages/canyon-collect/src/canyon-data/src/utils/test/mock.json index f6286edc..faaa8838 100644 --- a/packages/canyon-collect/src/canyon-data/src/utils/test/mock.json +++ b/packages/canyon-collect/src/canyon-data/src/utils/test/mock.json @@ -1,259 +1,70 @@ { "path": "src/pages/flightList/index.tsx", "b": { - "0": [ - 1, - 0, - 0, - 0 - ], - "1": [ - 0, - 0 - ], - "2": [ - 0, - 0 - ], - "3": [ - 0 - ], - "4": [ - 0 - ], - "5": [ - 0 - ], - "6": [ - 0 - ], - "7": [ - 0 - ], - "8": [ - 0 - ], - "9": [ - 0 - ], - "10": [ - 0, - 0 - ], - "11": [ - 0, - 0 - ], - "12": [ - 0, - 0 - ], - "13": [ - 0, - 0 - ], - "14": [ - 0, - 0 - ], - "15": [ - 0, - 0 - ], - "16": [ - 0, - 0 - ], - "17": [ - 0, - 0 - ], - "18": [ - 0, - 0 - ], - "19": [ - 0, - 0 - ], - "20": [ - 0, - 0 - ], - "21": [ - 0, - 0 - ], - "22": [ - 0, - 0 - ], - "23": [ - 0, - 0 - ], - "24": [ - 0, - 0 - ], - "25": [ - 0, - 0 - ], - "26": [ - 0, - 0 - ], - "27": [ - 0, - 0 - ], - "28": [ - 0, - 0 - ], - "29": [ - 0, - 0, - 0 - ], - "30": [ - 0, - 0 - ], - "31": [ - 0 - ], - "32": [ - 0 - ], - "33": [ - 0 - ], - "34": [ - 0 - ], - "35": [ - 0, - 0 - ], - "36": [ - 0, - 0 - ], - "37": [ - 0, - 0 - ], - "38": [ - 0, - 0, - 0, - 0 - ], - "39": [ - 0, - 0 - ], - "40": [ - 0, - 0 - ], - "41": [ - 0, - 0 - ], - "42": [ - 0, - 0 - ], - "43": [ - 0, - 0 - ], - "44": [ - 0, - 0 - ], - "45": [ - 0, - 0 - ], - "46": [ - 0, - 0 - ], - "47": [ - 0, - 0 - ], - "48": [ - 0, - 0 - ], - "49": [ - 0, - 0, - 0, - 0 - ], - "50": [ - 0, - 0 - ], - "51": [ - 0, - 0, - 0 - ], - "52": [ - 0, - 0 - ], - "53": [ - 0, - 0 - ], - "54": [ - 0, - 0 - ], - "55": [ - 0, - 0 - ], - "56": [ - 0, - 0 - ], - "57": [ - 0, - 0 - ], - "58": [ - 0, - 0 - ], - "59": [ - 0, - 0 - ], - "60": [ - 0, - 0 - ], - "61": [ - 0, - 0 - ], - "62": [ - 0, - 0 - ], - "63": [ - 0, - 0 - ] + "0": [1, 0, 0, 0], + "1": [0, 0], + "2": [0, 0], + "3": [0], + "4": [0], + "5": [0], + "6": [0], + "7": [0], + "8": [0], + "9": [0], + "10": [0, 0], + "11": [0, 0], + "12": [0, 0], + "13": [0, 0], + "14": [0, 0], + "15": [0, 0], + "16": [0, 0], + "17": [0, 0], + "18": [0, 0], + "19": [0, 0], + "20": [0, 0], + "21": [0, 0], + "22": [0, 0], + "23": [0, 0], + "24": [0, 0], + "25": [0, 0], + "26": [0, 0], + "27": [0, 0], + "28": [0, 0], + "29": [0, 0, 0], + "30": [0, 0], + "31": [0], + "32": [0], + "33": [0], + "34": [0], + "35": [0, 0], + "36": [0, 0], + "37": [0, 0], + "38": [0, 0, 0, 0], + "39": [0, 0], + "40": [0, 0], + "41": [0, 0], + "42": [0, 0], + "43": [0, 0], + "44": [0, 0], + "45": [0, 0], + "46": [0, 0], + "47": [0, 0], + "48": [0, 0], + "49": [0, 0, 0, 0], + "50": [0, 0], + "51": [0, 0, 0], + "52": [0, 0], + "53": [0, 0], + "54": [0, 0], + "55": [0, 0], + "56": [0, 0], + "57": [0, 0], + "58": [0, 0], + "59": [0, 0], + "60": [0, 0], + "61": [0, 0], + "62": [0, 0], + "63": [0, 0] }, "f": { "0": 0, diff --git a/packages/canyon-collect/src/canyon-data/src/utils/test/utils.test.ts b/packages/canyon-collect/src/canyon-data/src/utils/test/utils.test.ts index e99c9c15..e6faeb29 100644 --- a/packages/canyon-collect/src/canyon-data/src/utils/test/utils.test.ts +++ b/packages/canyon-collect/src/canyon-data/src/utils/test/utils.test.ts @@ -1,7 +1,9 @@ -import { expect, test } from 'vitest' -import {calculateNewLineCoverageForSingleFile} from "../line.ts"; -import mock from './mock.json' -test('测试变更行覆盖率', () => { +import { expect, test } from "vitest"; +import { calculateNewLineCoverageForSingleFile } from "../line.ts"; +import mock from "./mock.json"; +test("测试变更行覆盖率", () => { // @ts-ignore - expect(calculateNewLineCoverageForSingleFile(mock,[1,2,77,78])).toMatchObject({ total: 4, covered: 2, skipped: 0, pct: 50 }) -}) + expect( + calculateNewLineCoverageForSingleFile(mock, [1, 2, 77, 78]), + ).toMatchObject({ total: 4, covered: 2, skipped: 0, pct: 50 }); +}); diff --git a/packages/canyon-collect/src/main.ts b/packages/canyon-collect/src/main.ts index 047ca7b9..785daf2e 100644 --- a/packages/canyon-collect/src/main.ts +++ b/packages/canyon-collect/src/main.ts @@ -1,19 +1,19 @@ -import { NestFactory } from '@nestjs/core'; -import { json } from 'express'; -import dotenv from 'dotenv'; -import path from 'node:path'; -import fs from 'node:fs'; +import { NestFactory } from "@nestjs/core"; +import { json } from "express"; +import dotenv from "dotenv"; +import path from "node:path"; +import fs from "node:fs"; console.log(fs.chmod); -import { ValidationPipe } from '@nestjs/common'; +import { ValidationPipe } from "@nestjs/common"; dotenv.config({ - path: path.resolve(__dirname, '../../../.env'), + path: path.resolve(__dirname, "../../../.env"), }); async function bootstrap() { - const { AppModule } = await import('./app.module'); + const { AppModule } = await import("./app.module"); const app = await NestFactory.create(AppModule); app.use( json({ - limit: '50mb', + limit: "50mb", }), ); app.useGlobalPipes(new ValidationPipe()); diff --git a/packages/canyon-collect/src/prisma/prisma.service.ts b/packages/canyon-collect/src/prisma/prisma.service.ts index 43bd8f37..bcd4ea3c 100755 --- a/packages/canyon-collect/src/prisma/prisma.service.ts +++ b/packages/canyon-collect/src/prisma/prisma.service.ts @@ -1,5 +1,5 @@ -import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common'; -import { PrismaClient } from '@prisma/client'; +import { Injectable, OnModuleDestroy, OnModuleInit } from "@nestjs/common"; +import { PrismaClient } from "@prisma/client"; @Injectable() export class PrismaService diff --git a/packages/canyon-collect/src/utils/coverage.ts b/packages/canyon-collect/src/utils/coverage.ts index 2d820330..4e321ef8 100644 --- a/packages/canyon-collect/src/utils/coverage.ts +++ b/packages/canyon-collect/src/utils/coverage.ts @@ -1,22 +1,22 @@ -import libCoverage from 'istanbul-lib-coverage'; -import libSourceMaps from 'istanbul-lib-source-maps'; +import libCoverage from "istanbul-lib-coverage"; +import libSourceMaps from "istanbul-lib-source-maps"; function parseInstrumentCwd(instrumentCwd) { - if (instrumentCwd.includes('=>')) { - const instrumentCwdSplit = instrumentCwd.split('=>'); + if (instrumentCwd.includes("=>")) { + const instrumentCwdSplit = instrumentCwd.split("=>"); return [instrumentCwdSplit[0], instrumentCwdSplit[1]]; } else { - return [instrumentCwd, '']; + return [instrumentCwd, ""]; } } function convertInstrumentCwd({ path, instrumentCwd, projectInstrumentCwd }) { if (!projectInstrumentCwd) { - return path.replace(instrumentCwd, ''); + return path.replace(instrumentCwd, ""); } else { // 这里需要解析一下instrumentCwd,如果包含"=>",则需要替换。 const [leftInstrumentCwd, rightInstrumentCwd] = parseInstrumentCwd(projectInstrumentCwd); return path - .replace(instrumentCwd, '') + .replace(instrumentCwd, "") .replace(leftInstrumentCwd, rightInstrumentCwd); } } @@ -24,23 +24,23 @@ function convertInstrumentCwd({ path, instrumentCwd, projectInstrumentCwd }) { export function formatReportObject(c: any) { // 去除斜杠\\ const removeSlash = (x: any) => - JSON.parse(JSON.stringify(x).replace(/\\\\/g, '/')); + JSON.parse(JSON.stringify(x).replace(/\\\\/g, "/")); // 暂时解决方案,需要解决sourceMap问题 const coverage = removeSlash(c.coverage); const instrumentCwd = removeSlash(c.instrumentCwd); - const projectInstrumentCwd = removeSlash(c.projectInstrumentCwd || ''); + const projectInstrumentCwd = removeSlash(c.projectInstrumentCwd || ""); const reversePath = (p: string) => { const a = convertInstrumentCwd({ path: p, instrumentCwd, projectInstrumentCwd, }); - let b = ''; + let b = ""; // 从第二个字符开始 for (let i = 1; i < a.length; i++) { b += a[i]; } - return '' + b; + return "" + b; }; const obj: any = {}; for (const coverageKey in coverage) { @@ -88,7 +88,7 @@ export function regularData(data: any) { // 针对windows电脑,把反斜杠替换成正斜杠 // 做数据过滤,去除 \u0000 字符 for (const coverageKey in coverage) { - if (!coverageKey.includes('\u0000')) { + if (!coverageKey.includes("\u0000")) { obj[coverageKey] = coverage[coverageKey]; } } diff --git a/packages/canyon-collect/src/utils/zstd.ts b/packages/canyon-collect/src/utils/zstd.ts index 0e9ba733..6104148c 100644 --- a/packages/canyon-collect/src/utils/zstd.ts +++ b/packages/canyon-collect/src/utils/zstd.ts @@ -1,4 +1,4 @@ -import * as zlib from 'node:zlib'; +import * as zlib from "node:zlib"; // 输入是一个对象,输出是一个 Buffer export async function compressedData(input: object) { @@ -14,7 +14,7 @@ export async function compressedData(input: object) { export async function decompressedData( compressedData: Buffer, ): Promise { - if (!compressedData||compressedData.length===0) { + if (!compressedData || compressedData.length === 0) { return {}; } // console.log(compressedData.length,'compressedData') diff --git a/packages/canyon-collect/src/zod/istanbul.zod.ts b/packages/canyon-collect/src/zod/istanbul.zod.ts index b50d9470..b8531bc9 100644 --- a/packages/canyon-collect/src/zod/istanbul.zod.ts +++ b/packages/canyon-collect/src/zod/istanbul.zod.ts @@ -1,4 +1,4 @@ -import { z } from 'zod'; +import { z } from "zod"; const Range = z.object({ start: z.object({ line: z.number(), column: z.number() }), diff --git a/packages/canyon-platform/app/api/project/[id]/record/route.ts b/packages/canyon-platform/app/api/project/[id]/record/route.ts index 1433196d..3f53c508 100644 --- a/packages/canyon-platform/app/api/project/[id]/record/route.ts +++ b/packages/canyon-platform/app/api/project/[id]/record/route.ts @@ -27,8 +27,8 @@ export async function GET(request: NextRequest) { return { sha: item.sha, projectID: item.projectID, - times:0, - statements:0, + times: 0, + statements: 0, message: "message", branch: "branch", }; diff --git a/packages/canyon-platform/app/api/user/route.ts b/packages/canyon-platform/app/api/user/route.ts index 0c1bc113..4ae03f69 100644 --- a/packages/canyon-platform/app/api/user/route.ts +++ b/packages/canyon-platform/app/api/user/route.ts @@ -4,5 +4,5 @@ import prisma from "@/lib/prisma"; export async function GET() { // const users = await prisma.user.findMany(); - return Response.json({ data:[] }) + return Response.json({ data: [] }); } diff --git a/packages/canyon-platform/app/globals.css b/packages/canyon-platform/app/globals.css index 4b38e127..d87586c1 100755 --- a/packages/canyon-platform/app/globals.css +++ b/packages/canyon-platform/app/globals.css @@ -20,15 +20,12 @@ body { font-family: Arial, Helvetica, sans-serif; } - - /*antd的样式*/ .ant-menu-light.ant-menu-root.ant-menu-vertical { border-inline-end: none !important; } - a { color: #0071c2 !important; } diff --git a/packages/canyon-platform/app/login/page.tsx b/packages/canyon-platform/app/login/page.tsx index 4dbfa4f7..db7305b7 100644 --- a/packages/canyon-platform/app/login/page.tsx +++ b/packages/canyon-platform/app/login/page.tsx @@ -1,5 +1,5 @@ const LoginPage = () => { - return
LoginPagess
; + return
LoginPagess
; }; export default LoginPage; diff --git a/packages/canyon-platform/app/projects/[provider]/[id]/[slug]/page.tsx b/packages/canyon-platform/app/projects/[provider]/[id]/[slug]/page.tsx index 8bfb0644..71fef860 100644 --- a/packages/canyon-platform/app/projects/[provider]/[id]/[slug]/page.tsx +++ b/packages/canyon-platform/app/projects/[provider]/[id]/[slug]/page.tsx @@ -67,7 +67,6 @@ const fetcher = ({ url, params }: { url: string; params: any }) => const { useToken } = theme; const t = (msg) => msg; - // http://localhost:3000/projects/tripgl/62940/auto const ProjectOverviewPage = () => { diff --git a/packages/canyon-platform/lib/prisma.ts b/packages/canyon-platform/lib/prisma.ts index d7584316..6e513c47 100644 --- a/packages/canyon-platform/lib/prisma.ts +++ b/packages/canyon-platform/lib/prisma.ts @@ -1,8 +1,8 @@ import { PrismaClient } from "@prisma/client"; declare global { - // eslint-disable-next-line no-var - var prisma: PrismaClient | undefined; + // eslint-disable-next-line no-var + var prisma: PrismaClient | undefined; } const prisma = global.prisma || new PrismaClient(); diff --git a/packages/canyon-platform/utils/coverage.ts b/packages/canyon-platform/utils/coverage.ts index 72a93232..a7f423d4 100644 --- a/packages/canyon-platform/utils/coverage.ts +++ b/packages/canyon-platform/utils/coverage.ts @@ -1,7 +1,3 @@ - - - - function parseInstrumentCwd(instrumentCwd) { if (instrumentCwd.includes("=>")) { const instrumentCwdSplit = instrumentCwd.split("=>"); @@ -60,5 +56,4 @@ export function formatReportObject(c: any) { }; } - // 重要方法,回溯源码覆盖率数据