From 5e317390d5cc3d230476df2c486a929de5c4e42b Mon Sep 17 00:00:00 2001
From: Allen Zhang <37892968+zhangtao25@users.noreply.github.com>
Date: Wed, 24 Jul 2024 01:26:43 +0800
Subject: [PATCH] feat: update
---
packages/canyon-backend/gen/main.js | 33 --
.../gen/template/organization.model.ejs | 10 -
.../gen/template/organization.module.ejs | 11 -
.../gen/template/organization.resolver.ejs | 19 -
.../gen/template/organization.service.ejs | 14 -
.../canyon-backend/prisma/create-table.sql | 113 -----
.../20240523025701_init/migration.sql | 113 -----
.../20240524055658_add_filepath/migration.sql | 18 -
.../20240531030159_in/migration.sql | 10 -
.../20240713011341_upd/migration.sql | 41 --
.../20240713143952_up/migration.sql | 39 --
.../20240714033616_update/migration.sql | 10 -
.../prisma/migrations/migration_lock.toml | 3 -
.../canyon-platform/public/langs/Java.svg | 1 -
packages/canyon-platform/public/logo.svg | 1 -
.../canyon-platform/public/welcome-bg.svg | 25 -
tools/coverage-merge/README.md | 7 -
tools/coverage-merge/data/first.json | 405 ----------------
tools/coverage-merge/data/second.json | 439 ------------------
tools/coverage-merge/node.js | 97 ----
tools/coverage-merge/python.py | 49 --
21 files changed, 1458 deletions(-)
delete mode 100644 packages/canyon-backend/gen/main.js
delete mode 100755 packages/canyon-backend/gen/template/organization.model.ejs
delete mode 100755 packages/canyon-backend/gen/template/organization.module.ejs
delete mode 100755 packages/canyon-backend/gen/template/organization.resolver.ejs
delete mode 100644 packages/canyon-backend/gen/template/organization.service.ejs
delete mode 100644 packages/canyon-backend/prisma/create-table.sql
delete mode 100644 packages/canyon-backend/prisma/migrations/20240523025701_init/migration.sql
delete mode 100644 packages/canyon-backend/prisma/migrations/20240524055658_add_filepath/migration.sql
delete mode 100644 packages/canyon-backend/prisma/migrations/20240531030159_in/migration.sql
delete mode 100644 packages/canyon-backend/prisma/migrations/20240713011341_upd/migration.sql
delete mode 100644 packages/canyon-backend/prisma/migrations/20240713143952_up/migration.sql
delete mode 100644 packages/canyon-backend/prisma/migrations/20240714033616_update/migration.sql
delete mode 100644 packages/canyon-backend/prisma/migrations/migration_lock.toml
delete mode 100644 packages/canyon-platform/public/langs/Java.svg
delete mode 100755 packages/canyon-platform/public/logo.svg
delete mode 100755 packages/canyon-platform/public/welcome-bg.svg
delete mode 100644 tools/coverage-merge/README.md
delete mode 100644 tools/coverage-merge/data/first.json
delete mode 100644 tools/coverage-merge/data/second.json
delete mode 100644 tools/coverage-merge/node.js
delete mode 100644 tools/coverage-merge/python.py
diff --git a/packages/canyon-backend/gen/main.js b/packages/canyon-backend/gen/main.js
deleted file mode 100644
index d2be0826..00000000
--- a/packages/canyon-backend/gen/main.js
+++ /dev/null
@@ -1,33 +0,0 @@
-const ejs = require('ejs');
-const fs = require('fs');
-function capitalizeFirstLetter(str) {
- return str.charAt(0).toUpperCase() + str.slice(1);
-}
-
-// 定义模版name
-const name = 'usage';
-
-const arr = ['model', 'module', 'resolver', 'service'];
-for (let i = 0; i < arr.length; i++) {
- try {
- const a = arr[i];
- const organizationModel = fs.readFileSync(
- `./gen/template/organization.${a}.ejs`,
- 'utf8',
- );
-
- const template = ejs.compile(organizationModel, {});
- fs.mkdirSync(`./gen/${name}`, { recursive: true });
-
- fs.writeFileSync(
- `./gen/${name}/${name}.${a}.ts`,
- template({
- dname: `${capitalizeFirstLetter(name)}`,
- xname: `${name}`,
- }),
- );
- console.log('123');
- } catch (e) {
- // console.log(e)
- }
-}
diff --git a/packages/canyon-backend/gen/template/organization.model.ejs b/packages/canyon-backend/gen/template/organization.model.ejs
deleted file mode 100755
index 4f86ff74..00000000
--- a/packages/canyon-backend/gen/template/organization.model.ejs
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Field, ID, ObjectType } from '@nestjs/graphql';
-
-@ObjectType()
-export class <%= dname %>Model {
- @Field(() => ID)
- id: string;
-
- @Field(() => String)
- name: string;
-}
diff --git a/packages/canyon-backend/gen/template/organization.module.ejs b/packages/canyon-backend/gen/template/organization.module.ejs
deleted file mode 100755
index 0df4003a..00000000
--- a/packages/canyon-backend/gen/template/organization.module.ejs
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Module } from '@nestjs/common';
-import { PrismaModule } from 'src/prisma/prisma.module';
-import { <%= dname %>Service } from './<%= xname %>.service';
-import { <%= dname %>Resolver } from './<%= xname %>.resolver';
-@Module({
- imports: [PrismaModule],
- controllers: [],
- providers: [<%= dname %>Resolver, <%= dname %>Service],
- exports: [],
-})
-export class <%= dname %>Module {}
diff --git a/packages/canyon-backend/gen/template/organization.resolver.ejs b/packages/canyon-backend/gen/template/organization.resolver.ejs
deleted file mode 100755
index 3ead447e..00000000
--- a/packages/canyon-backend/gen/template/organization.resolver.ejs
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Args, ID, Int, Mutation, Query, Resolver } from '@nestjs/graphql';
-import { PaginationArgs, SorterArgs } from '../types/input-types.args';
-import { <%= dname %>Model } from './<%= xname %>.model';
-import { <%= dname %>Service } from './<%= xname %>.service';
-
-@Resolver(() => 'Project')
-export class <%= dname %>Resolver {
- constructor(private readonly <%= xname %>Service: <%= dname %>Service) {}
- @Query(() => <%= dname %>Model, {
- description: '获取所有组织列表',
- })
- get<%= dname %>s() // @Args('keyword', { type: () => String }) keyword: string,
- // @Args('bu', { type: () => [String] }) bu: string[],
- // @Args() paginationArgs: PaginationArgs,
- // @Args() sorterArgs: SorterArgs,
- : Promise<<%= dname %>Model> {
- return this.<%= xname %>Service.get<%= dname %>s();
- }
-}
diff --git a/packages/canyon-backend/gen/template/organization.service.ejs b/packages/canyon-backend/gen/template/organization.service.ejs
deleted file mode 100644
index dc3e4cb0..00000000
--- a/packages/canyon-backend/gen/template/organization.service.ejs
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Injectable } from '@nestjs/common';
-import { PrismaService } from '../prisma/prisma.service';
-
-@Injectable()
-export class <%= dname %>Service {
- constructor(private readonly prisma: PrismaService) {}
-
- async get<%= dname %>s() {
- return {
- name: 'test',
- id: '1',
- };
- }
-}
diff --git a/packages/canyon-backend/prisma/create-table.sql b/packages/canyon-backend/prisma/create-table.sql
deleted file mode 100644
index 17183cdb..00000000
--- a/packages/canyon-backend/prisma/create-table.sql
+++ /dev/null
@@ -1,113 +0,0 @@
--- CreateTable
-CREATE TABLE "user" (
- "id" INTEGER NOT NULL,
- "username" TEXT NOT NULL,
- "password" TEXT NOT NULL,
- "nickname" TEXT NOT NULL,
- "avatar" TEXT NOT NULL,
- "refresh_token" TEXT NOT NULL,
- "access_token" TEXT NOT NULL,
- "email" TEXT NOT NULL,
- "favor" TEXT NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "user_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "Git" (
- "id" TEXT NOT NULL,
- "userID" TEXT NOT NULL,
- "provider" TEXT NOT NULL,
- "providerAccountId" TEXT NOT NULL,
- "providerRefreshToken" TEXT NOT NULL,
- "providerAccessToken" TEXT NOT NULL,
- "providerScope" TEXT NOT NULL,
- "loggedIn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "Git_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "GitProvider" (
- "id" TEXT NOT NULL,
- "url" TEXT NOT NULL,
- "clientID" TEXT NOT NULL,
- "clientSecret" TEXT NOT NULL,
- "type" TEXT NOT NULL,
- "name" TEXT NOT NULL,
- "disabled" BOOLEAN NOT NULL,
-
- CONSTRAINT "GitProvider_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "coverage" (
- "id" TEXT NOT NULL,
- "key" TEXT NOT NULL,
- "sha" TEXT NOT NULL,
- "branch" TEXT NOT NULL,
- "compare_target" TEXT NOT NULL,
- "provider" TEXT NOT NULL,
- "project_id" TEXT NOT NULL,
- "instrument_cwd" TEXT NOT NULL,
- "reporter" TEXT NOT NULL,
- "report_id" TEXT NOT NULL,
- "cov_type" TEXT NOT NULL,
- "relation_id" JSONB NOT NULL,
- "summary" JSONB NOT NULL,
- "tag" JSONB NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
- "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "coverage_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "coveragedata" (
- "id" TEXT NOT NULL,
- "compresseddata" TEXT NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "coveragedata_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "project" (
- "id" TEXT NOT NULL,
- "name" TEXT NOT NULL,
- "path_with_namespace" TEXT NOT NULL,
- "description" TEXT NOT NULL,
- "bu" TEXT NOT NULL,
- "tag" TEXT NOT NULL,
- "tags" JSONB NOT NULL,
- "coverage" TEXT NOT NULL,
- "default_branch" TEXT NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "project_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "codechange" (
- "id" TEXT NOT NULL,
- "project_id" TEXT NOT NULL,
- "compare_target" TEXT NOT NULL,
- "sha" TEXT NOT NULL,
- "path" TEXT NOT NULL,
- "additions" INTEGER[],
- "deletions" INTEGER[],
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "codechange_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "distributedlock" (
- "lockName" TEXT NOT NULL,
- "isLocked" BOOLEAN NOT NULL DEFAULT false,
- "lockTimestamp" TIMESTAMP(3),
- "lockExpiration" TIMESTAMP(3),
-
- CONSTRAINT "distributedlock_pkey" PRIMARY KEY ("lockName")
-);
diff --git a/packages/canyon-backend/prisma/migrations/20240523025701_init/migration.sql b/packages/canyon-backend/prisma/migrations/20240523025701_init/migration.sql
deleted file mode 100644
index 17183cdb..00000000
--- a/packages/canyon-backend/prisma/migrations/20240523025701_init/migration.sql
+++ /dev/null
@@ -1,113 +0,0 @@
--- CreateTable
-CREATE TABLE "user" (
- "id" INTEGER NOT NULL,
- "username" TEXT NOT NULL,
- "password" TEXT NOT NULL,
- "nickname" TEXT NOT NULL,
- "avatar" TEXT NOT NULL,
- "refresh_token" TEXT NOT NULL,
- "access_token" TEXT NOT NULL,
- "email" TEXT NOT NULL,
- "favor" TEXT NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "user_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "Git" (
- "id" TEXT NOT NULL,
- "userID" TEXT NOT NULL,
- "provider" TEXT NOT NULL,
- "providerAccountId" TEXT NOT NULL,
- "providerRefreshToken" TEXT NOT NULL,
- "providerAccessToken" TEXT NOT NULL,
- "providerScope" TEXT NOT NULL,
- "loggedIn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "Git_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "GitProvider" (
- "id" TEXT NOT NULL,
- "url" TEXT NOT NULL,
- "clientID" TEXT NOT NULL,
- "clientSecret" TEXT NOT NULL,
- "type" TEXT NOT NULL,
- "name" TEXT NOT NULL,
- "disabled" BOOLEAN NOT NULL,
-
- CONSTRAINT "GitProvider_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "coverage" (
- "id" TEXT NOT NULL,
- "key" TEXT NOT NULL,
- "sha" TEXT NOT NULL,
- "branch" TEXT NOT NULL,
- "compare_target" TEXT NOT NULL,
- "provider" TEXT NOT NULL,
- "project_id" TEXT NOT NULL,
- "instrument_cwd" TEXT NOT NULL,
- "reporter" TEXT NOT NULL,
- "report_id" TEXT NOT NULL,
- "cov_type" TEXT NOT NULL,
- "relation_id" JSONB NOT NULL,
- "summary" JSONB NOT NULL,
- "tag" JSONB NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
- "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "coverage_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "coveragedata" (
- "id" TEXT NOT NULL,
- "compresseddata" TEXT NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "coveragedata_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "project" (
- "id" TEXT NOT NULL,
- "name" TEXT NOT NULL,
- "path_with_namespace" TEXT NOT NULL,
- "description" TEXT NOT NULL,
- "bu" TEXT NOT NULL,
- "tag" TEXT NOT NULL,
- "tags" JSONB NOT NULL,
- "coverage" TEXT NOT NULL,
- "default_branch" TEXT NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "project_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "codechange" (
- "id" TEXT NOT NULL,
- "project_id" TEXT NOT NULL,
- "compare_target" TEXT NOT NULL,
- "sha" TEXT NOT NULL,
- "path" TEXT NOT NULL,
- "additions" INTEGER[],
- "deletions" INTEGER[],
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "codechange_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "distributedlock" (
- "lockName" TEXT NOT NULL,
- "isLocked" BOOLEAN NOT NULL DEFAULT false,
- "lockTimestamp" TIMESTAMP(3),
- "lockExpiration" TIMESTAMP(3),
-
- CONSTRAINT "distributedlock_pkey" PRIMARY KEY ("lockName")
-);
diff --git a/packages/canyon-backend/prisma/migrations/20240524055658_add_filepath/migration.sql b/packages/canyon-backend/prisma/migrations/20240524055658_add_filepath/migration.sql
deleted file mode 100644
index 100dcfcd..00000000
--- a/packages/canyon-backend/prisma/migrations/20240524055658_add_filepath/migration.sql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- Warnings:
-
- - Added the required column `language` to the `project` table without a default value. This is not possible if the table is not empty.
-
-*/
--- AlterTable
-ALTER TABLE "project" ADD COLUMN "language" TEXT NOT NULL;
-
--- CreateTable
-CREATE TABLE "filepath" (
- "id" TEXT NOT NULL,
- "project_id" TEXT NOT NULL,
- "sha" TEXT NOT NULL,
- "path" TEXT NOT NULL,
-
- CONSTRAINT "filepath_pkey" PRIMARY KEY ("id")
-);
diff --git a/packages/canyon-backend/prisma/migrations/20240531030159_in/migration.sql b/packages/canyon-backend/prisma/migrations/20240531030159_in/migration.sql
deleted file mode 100644
index f644d6bd..00000000
--- a/packages/canyon-backend/prisma/migrations/20240531030159_in/migration.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- Warnings:
-
- - You are about to drop the column `tag` on the `project` table. All the data in the column will be lost.
- - Added the required column `members` to the `project` table without a default value. This is not possible if the table is not empty.
-
-*/
--- AlterTable
-ALTER TABLE "project" DROP COLUMN "tag",
-ADD COLUMN "members" JSONB NOT NULL;
diff --git a/packages/canyon-backend/prisma/migrations/20240713011341_upd/migration.sql b/packages/canyon-backend/prisma/migrations/20240713011341_upd/migration.sql
deleted file mode 100644
index 7c7997d7..00000000
--- a/packages/canyon-backend/prisma/migrations/20240713011341_upd/migration.sql
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Warnings:
-
- - Added the required column `instrument_cwd` to the `project` table without a default value. This is not possible if the table is not empty.
-
-*/
--- CreateEnum
-CREATE TYPE "DimType" AS ENUM ('b', 'f', 's');
-
--- CreateTable
-CREATE TABLE "reckoning" (
- "id" TEXT NOT NULL,
- "dim_type" "DimType" NOT NULL,
- "map_index" INTEGER NOT NULL,
- "branch_index" INTEGER NOT NULL,
- "hits" INTEGER NOT NULL,
- "path" TEXT NOT NULL,
- "sha" TEXT NOT NULL,
- "project_id" TEXT NOT NULL,
- "report_id" TEXT NOT NULL,
- "rule" TEXT NOT NULL,
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
- "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
-
- CONSTRAINT "reckoning_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "file_map" (
- "id" TEXT NOT NULL,
- "map_json" TEXT NOT NULL,
- "path" TEXT NOT NULL,
- "sha" TEXT NOT NULL,
- "project_id" TEXT NOT NULL,
- "branch" TEXT NOT NULL,
- "compare_target" TEXT NOT NULL,
- "provider" TEXT NOT NULL,
- "reporter" TEXT NOT NULL,
-
- CONSTRAINT "file_map_pkey" PRIMARY KEY ("id")
-);
diff --git a/packages/canyon-backend/prisma/migrations/20240713143952_up/migration.sql b/packages/canyon-backend/prisma/migrations/20240713143952_up/migration.sql
deleted file mode 100644
index f93e019f..00000000
--- a/packages/canyon-backend/prisma/migrations/20240713143952_up/migration.sql
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- Warnings:
-
- - You are about to drop the `coveragedata` table. If the table is not empty, all the data it contains will be lost.
- - You are about to drop the `file_map` table. If the table is not empty, all the data it contains will be lost.
- - You are about to drop the `reckoning` table. If the table is not empty, all the data it contains will be lost.
- - Added the required column `instrument_cwd` to the `project` table without a default value. This is not possible if the table is not empty.
-
-*/
--- AlterTable
-ALTER TABLE "project" ADD COLUMN "instrument_cwd" TEXT NOT NULL;
-
--- DropTable
-DROP TABLE "coveragedata";
-
--- DropTable
-DROP TABLE "file_map";
-
--- DropTable
-DROP TABLE "reckoning";
-
--- DropEnum
-DROP TYPE "DimType";
-
--- CreateTable
-CREATE TABLE "CovMap" (
- "id" TEXT NOT NULL,
- "map_json_str_zstd" TEXT NOT NULL,
-
- CONSTRAINT "CovMap_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "CovHit" (
- "id" TEXT NOT NULL,
- "map_json_str" TEXT NOT NULL,
-
- CONSTRAINT "CovHit_pkey" PRIMARY KEY ("id")
-);
diff --git a/packages/canyon-backend/prisma/migrations/20240714033616_update/migration.sql b/packages/canyon-backend/prisma/migrations/20240714033616_update/migration.sql
deleted file mode 100644
index 9d81867f..00000000
--- a/packages/canyon-backend/prisma/migrations/20240714033616_update/migration.sql
+++ /dev/null
@@ -1,10 +0,0 @@
--- CreateTable
-CREATE TABLE "CovMapTest" (
- "id" TEXT NOT NULL,
- "map_json_str" TEXT NOT NULL,
- "project_id" TEXT NOT NULL,
- "sha" TEXT NOT NULL,
- "path" TEXT NOT NULL,
-
- CONSTRAINT "CovMapTest_pkey" PRIMARY KEY ("id")
-);
diff --git a/packages/canyon-backend/prisma/migrations/migration_lock.toml b/packages/canyon-backend/prisma/migrations/migration_lock.toml
deleted file mode 100644
index fbffa92c..00000000
--- a/packages/canyon-backend/prisma/migrations/migration_lock.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-# Please do not edit this file manually
-# It should be added in your version-control system (i.e. Git)
-provider = "postgresql"
\ No newline at end of file
diff --git a/packages/canyon-platform/public/langs/Java.svg b/packages/canyon-platform/public/langs/Java.svg
deleted file mode 100644
index a6410a04..00000000
--- a/packages/canyon-platform/public/langs/Java.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/canyon-platform/public/logo.svg b/packages/canyon-platform/public/logo.svg
deleted file mode 100755
index 092881cd..00000000
--- a/packages/canyon-platform/public/logo.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/canyon-platform/public/welcome-bg.svg b/packages/canyon-platform/public/welcome-bg.svg
deleted file mode 100755
index cf73914e..00000000
--- a/packages/canyon-platform/public/welcome-bg.svg
+++ /dev/null
@@ -1,25 +0,0 @@
-
diff --git a/tools/coverage-merge/README.md b/tools/coverage-merge/README.md
deleted file mode 100644
index 12c9a8de..00000000
--- a/tools/coverage-merge/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# 工具包
-
-不同语言合并istanbul 覆盖率的工具包,mergeFileCoverage合并一个文件内容,mergeCoverage合并整体项目对象
-
-现在支持的语言有:
-- [x] JavaScript
-- [x] Python
diff --git a/tools/coverage-merge/data/first.json b/tools/coverage-merge/data/first.json
deleted file mode 100644
index aca07a8b..00000000
--- a/tools/coverage-merge/data/first.json
+++ /dev/null
@@ -1,405 +0,0 @@
-{
- "/builds/canyon/canyon-demo/src/pages/Home.tsx": {
- "path": "/builds/canyon/canyon-demo/src/pages/Home.tsx",
- "statementMap": {
- "0": {
- "start": {
- "line": 4,
- "column": 30
- },
- "end": {
- "line": 4,
- "column": 41
- }
- },
- "1": {
- "start": {
- "line": 7,
- "column": 8
- },
- "end": {
- "line": 12,
- "column": 9
- }
- },
- "2": {
- "start": {
- "line": 8,
- "column": 12
- },
- "end": {
- "line": 8,
- "column": 39
- }
- },
- "3": {
- "start": {
- "line": 10,
- "column": 12
- },
- "end": {
- "line": 10,
- "column": 29
- }
- },
- "4": {
- "start": {
- "line": 11,
- "column": 12
- },
- "end": {
- "line": 11,
- "column": 31
- }
- },
- "5": {
- "start": {
- "line": 14,
- "column": 4
- },
- "end": {
- "line": 34,
- "column": 5
- }
- },
- "6": {
- "start": {
- "line": 17,
- "column": 64
- },
- "end": {
- "line": 17,
- "column": 94
- }
- },
- "7": {
- "start": {
- "line": 17,
- "column": 84
- },
- "end": {
- "line": 17,
- "column": 93
- }
- },
- "8": {
- "start": {
- "line": 23,
- "column": 20
- },
- "end": {
- "line": 23,
- "column": 53
- }
- },
- "9": {
- "start": {
- "line": 28,
- "column": 20
- },
- "end": {
- "line": 28,
- "column": 43
- }
- }
- },
- "fnMap": {
- "0": {
- "name": "Home",
- "decl": {
- "start": {
- "line": 3,
- "column": 9
- },
- "end": {
- "line": 3,
- "column": 13
- }
- },
- "loc": {
- "start": {
- "line": 3,
- "column": 16
- },
- "end": {
- "line": 35,
- "column": 1
- }
- },
- "line": 3
- },
- "1": {
- "name": "tips",
- "decl": {
- "start": {
- "line": 6,
- "column": 13
- },
- "end": {
- "line": 6,
- "column": 17
- }
- },
- "loc": {
- "start": {
- "line": 6,
- "column": 28
- },
- "end": {
- "line": 13,
- "column": 5
- }
- },
- "line": 6
- },
- "2": {
- "name": "(anonymous_2)",
- "decl": {
- "start": {
- "line": 17,
- "column": 58
- },
- "end": {
- "line": 17,
- "column": 59
- }
- },
- "loc": {
- "start": {
- "line": 17,
- "column": 64
- },
- "end": {
- "line": 17,
- "column": 94
- }
- },
- "line": 17
- },
- "3": {
- "name": "(anonymous_3)",
- "decl": {
- "start": {
- "line": 17,
- "column": 73
- },
- "end": {
- "line": 17,
- "column": 74
- }
- },
- "loc": {
- "start": {
- "line": 17,
- "column": 84
- },
- "end": {
- "line": 17,
- "column": 93
- }
- },
- "line": 17
- },
- "4": {
- "name": "(anonymous_4)",
- "decl": {
- "start": {
- "line": 22,
- "column": 45
- },
- "end": {
- "line": 22,
- "column": 46
- }
- },
- "loc": {
- "start": {
- "line": 22,
- "column": 49
- },
- "end": {
- "line": 24,
- "column": 17
- }
- },
- "line": 22
- },
- "5": {
- "name": "(anonymous_5)",
- "decl": {
- "start": {
- "line": 27,
- "column": 46
- },
- "end": {
- "line": 27,
- "column": 47
- }
- },
- "loc": {
- "start": {
- "line": 27,
- "column": 50
- },
- "end": {
- "line": 29,
- "column": 17
- }
- },
- "line": 27
- }
- },
- "branchMap": {
- "0": {
- "loc": {
- "start": {
- "line": 7,
- "column": 8
- },
- "end": {
- "line": 12,
- "column": 9
- }
- },
- "type": "if",
- "locations": [
- {
- "start": {
- "line": 7,
- "column": 8
- },
- "end": {
- "line": 12,
- "column": 9
- }
- },
- {
- "start": {
- "line": 9,
- "column": 15
- },
- "end": {
- "line": 12,
- "column": 9
- }
- }
- ],
- "line": 7
- }
- },
- "s": {
- "0": 1,
- "1": 1,
- "2": 0,
- "3": 1,
- "4": 1,
- "5": 1,
- "6": 0,
- "7": 0,
- "8": 0,
- "9": 0
- },
- "f": {
- "0": 1,
- "1": 1,
- "2": 0,
- "3": 0,
- "4": 0,
- "5": 0
- },
- "b": {
- "0": [
- 0,
- 1
- ]
- },
- "_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
- "hash": "281cf50578a4f2383ee67388ed5a85fa3354e30c"
- },
- "/builds/canyon/canyon-demo/src/App.tsx": {
- "path": "/builds/canyon/canyon-demo/src/App.tsx",
- "statementMap": {
- "0": {
- "start": {
- "line": 7,
- "column": 26
- },
- "end": {
- "line": 7,
- "column": 49
- }
- },
- "1": {
- "start": {
- "line": 8,
- "column": 2
- },
- "end": {
- "line": 12,
- "column": 3
- }
- }
- },
- "fnMap": {
- "0": {
- "name": "App",
- "decl": {
- "start": {
- "line": 6,
- "column": 9
- },
- "end": {
- "line": 6,
- "column": 12
- }
- },
- "loc": {
- "start": {
- "line": 6,
- "column": 15
- },
- "end": {
- "line": 13,
- "column": 1
- }
- },
- "line": 6
- }
- },
- "branchMap": {},
- "s": {
- "0": 1,
- "1": 1
- },
- "f": {
- "0": 1
- },
- "b": {},
- "_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
- "hash": "1454065cc7fb2c09d5dcdbb82b046335a719923d"
- },
- "/builds/canyon/canyon-demo/src/main.tsx": {
- "path": "/builds/canyon/canyon-demo/src/main.tsx",
- "statementMap": {
- "0": {
- "start": {
- "line": 7,
- "column": 0
- },
- "end": {
- "line": 12,
- "column": 1
- }
- }
- },
- "fnMap": {},
- "branchMap": {},
- "s": {
- "0": 1
- },
- "f": {},
- "b": {},
- "_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
- "hash": "2ca7e398b7e7ea1ee9480ada2f5111a10d111593"
- }
-}
diff --git a/tools/coverage-merge/data/second.json b/tools/coverage-merge/data/second.json
deleted file mode 100644
index 20799f31..00000000
--- a/tools/coverage-merge/data/second.json
+++ /dev/null
@@ -1,439 +0,0 @@
-{
- "/builds/canyon/canyon-demo/src/pages/Welcome.tsx": {
- "path": "/builds/canyon/canyon-demo/src/pages/Welcome.tsx",
- "statementMap": {
- "0": {
- "start": {
- "line": 3,
- "column": 16
- },
- "end": {
- "line": 10,
- "column": 1
- }
- },
- "1": {
- "start": {
- "line": 4,
- "column": 17
- },
- "end": {
- "line": 4,
- "column": 30
- }
- },
- "2": {
- "start": {
- "line": 5,
- "column": 0
- },
- "end": {
- "line": 9,
- "column": 6
- }
- },
- "3": {
- "start": {
- "line": 7,
- "column": 8
- },
- "end": {
- "line": 7,
- "column": 20
- }
- }
- },
- "fnMap": {
- "0": {
- "name": "(anonymous_0)",
- "decl": {
- "start": {
- "line": 3,
- "column": 16
- },
- "end": {
- "line": 3,
- "column": 17
- }
- },
- "loc": {
- "start": {
- "line": 3,
- "column": 22
- },
- "end": {
- "line": 10,
- "column": 1
- }
- },
- "line": 3
- },
- "1": {
- "name": "(anonymous_1)",
- "decl": {
- "start": {
- "line": 6,
- "column": 21
- },
- "end": {
- "line": 6,
- "column": 22
- }
- },
- "loc": {
- "start": {
- "line": 6,
- "column": 25
- },
- "end": {
- "line": 8,
- "column": 5
- }
- },
- "line": 6
- }
- },
- "branchMap": {},
- "s": {
- "0": 1,
- "1": 0,
- "2": 0,
- "3": 0
- },
- "f": {
- "0": 0,
- "1": 0
- },
- "b": {},
- "_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
- "hash": "44a06ed36306fbbfd189234db0541dd6d0488999"
- },
- "/builds/canyon/canyon-demo/src/pages/Home.tsx": {
- "path": "/builds/canyon/canyon-demo/src/pages/Home.tsx",
- "statementMap": {
- "0": {
- "start": {
- "line": 4,
- "column": 30
- },
- "end": {
- "line": 4,
- "column": 41
- }
- },
- "1": {
- "start": {
- "line": 7,
- "column": 8
- },
- "end": {
- "line": 12,
- "column": 9
- }
- },
- "2": {
- "start": {
- "line": 8,
- "column": 12
- },
- "end": {
- "line": 8,
- "column": 39
- }
- },
- "3": {
- "start": {
- "line": 10,
- "column": 12
- },
- "end": {
- "line": 10,
- "column": 29
- }
- },
- "4": {
- "start": {
- "line": 11,
- "column": 12
- },
- "end": {
- "line": 11,
- "column": 31
- }
- },
- "5": {
- "start": {
- "line": 14,
- "column": 4
- },
- "end": {
- "line": 34,
- "column": 5
- }
- },
- "6": {
- "start": {
- "line": 17,
- "column": 64
- },
- "end": {
- "line": 17,
- "column": 94
- }
- },
- "7": {
- "start": {
- "line": 17,
- "column": 84
- },
- "end": {
- "line": 17,
- "column": 93
- }
- },
- "8": {
- "start": {
- "line": 23,
- "column": 20
- },
- "end": {
- "line": 23,
- "column": 53
- }
- },
- "9": {
- "start": {
- "line": 28,
- "column": 20
- },
- "end": {
- "line": 28,
- "column": 43
- }
- }
- },
- "fnMap": {
- "0": {
- "name": "Home",
- "decl": {
- "start": {
- "line": 3,
- "column": 9
- },
- "end": {
- "line": 3,
- "column": 13
- }
- },
- "loc": {
- "start": {
- "line": 3,
- "column": 16
- },
- "end": {
- "line": 35,
- "column": 1
- }
- },
- "line": 3
- },
- "1": {
- "name": "tips",
- "decl": {
- "start": {
- "line": 6,
- "column": 13
- },
- "end": {
- "line": 6,
- "column": 17
- }
- },
- "loc": {
- "start": {
- "line": 6,
- "column": 28
- },
- "end": {
- "line": 13,
- "column": 5
- }
- },
- "line": 6
- },
- "2": {
- "name": "(anonymous_2)",
- "decl": {
- "start": {
- "line": 17,
- "column": 58
- },
- "end": {
- "line": 17,
- "column": 59
- }
- },
- "loc": {
- "start": {
- "line": 17,
- "column": 64
- },
- "end": {
- "line": 17,
- "column": 94
- }
- },
- "line": 17
- },
- "3": {
- "name": "(anonymous_3)",
- "decl": {
- "start": {
- "line": 17,
- "column": 73
- },
- "end": {
- "line": 17,
- "column": 74
- }
- },
- "loc": {
- "start": {
- "line": 17,
- "column": 84
- },
- "end": {
- "line": 17,
- "column": 93
- }
- },
- "line": 17
- },
- "4": {
- "name": "(anonymous_4)",
- "decl": {
- "start": {
- "line": 22,
- "column": 45
- },
- "end": {
- "line": 22,
- "column": 46
- }
- },
- "loc": {
- "start": {
- "line": 22,
- "column": 49
- },
- "end": {
- "line": 24,
- "column": 17
- }
- },
- "line": 22
- },
- "5": {
- "name": "(anonymous_5)",
- "decl": {
- "start": {
- "line": 27,
- "column": 46
- },
- "end": {
- "line": 27,
- "column": 47
- }
- },
- "loc": {
- "start": {
- "line": 27,
- "column": 50
- },
- "end": {
- "line": 29,
- "column": 17
- }
- },
- "line": 27
- }
- },
- "branchMap": {
- "0": {
- "loc": {
- "start": {
- "line": 7,
- "column": 8
- },
- "end": {
- "line": 12,
- "column": 9
- }
- },
- "type": "if",
- "locations": [
- {
- "start": {
- "line": 7,
- "column": 8
- },
- "end": {
- "line": 12,
- "column": 9
- }
- },
- {
- "start": {
- "line": 9,
- "column": 15
- },
- "end": {
- "line": 12,
- "column": 9
- }
- }
- ],
- "line": 7
- }
- },
- "s": {
- "0": 1,
- "1": 1,
- "2": 0,
- "3": 1,
- "4": 1,
- "5": 1,
- "6": 0,
- "7": 0,
- "8": 0,
- "9": 0
- },
- "f": {
- "0": 1,
- "1": 1,
- "2": 0,
- "3": 0,
- "4": 0,
- "5": 0
- },
- "b": {
- "0": [
- 0,
- 1
- ]
- },
- "_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
- "hash": "281cf50578a4f2383ee67388ed5a85fa3354e30c"
- },
- "/builds/canyon/canyon-demo/src/routers/index.tsx": {
- "path": "/builds/canyon/canyon-demo/src/routers/index.tsx",
- "statementMap": {},
- "fnMap": {},
- "branchMap": {},
- "s": {},
- "f": {},
- "b": {},
- "_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
- "hash": "331bbffdd38304ac26edcd0f159b967d23f5bdcd"
- }
-}
diff --git a/tools/coverage-merge/node.js b/tools/coverage-merge/node.js
deleted file mode 100644
index 6f1952fb..00000000
--- a/tools/coverage-merge/node.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 合并两个相同文件的文件覆盖对象实例,确保执行计数正确。
- *
- * @method mergeFileCoverage
- * @static
- * @param {Object} first 给定文件的第一个文件覆盖对象
- * @param {Object} second 相同文件的第二个文件覆盖对象
- * @return {Object} 合并后的结果对象。请注意,输入对象不会被修改。
- */
-function mergeFileCoverage(first, second) {
- const ret = JSON.parse(JSON.stringify(first));
-
- delete ret.l; // 移除派生信息
-
- Object.keys(second.s).forEach(function (k) {
- ret.s[k] += second.s[k];
- });
-
- Object.keys(second.f).forEach(function (k) {
- ret.f[k] += second.f[k];
- });
-
- Object.keys(second.b).forEach(function (k) {
- const retArray = ret.b[k];
- const secondArray = second.b[k];
- for (let i = 0; i < retArray.length; i += 1) {
- retArray[i] += secondArray[i];
- }
- });
-
- return ret;
-}
-
-/**
- * 合并两个覆盖对象,确保执行计数正确。
- *
- * @method mergeCoverage
- * @static
- * @param {Object} first 第一个覆盖对象
- * @param {Object} second 第二个覆盖对象
- * @return {Object} 合并后的结果对象。请注意,输入对象不会被修改。
- */
-function mergeCoverage(first, second) {
- if (!second) {
- return first;
- }
-
- const mergedCoverage = JSON.parse(JSON.stringify(first)); // 深拷贝 coverage,这样修改出来的是两个的合集
- Object.keys(second).forEach(function (filePath) {
- const original = first[filePath];
- const added = second[filePath];
- let result;
-
- if (original) {
- result = mergeFileCoverage(original, added);
- } else {
- result = added;
- }
-
- mergedCoverage[filePath] = result;
- });
-
- return mergedCoverage;
-}
-
-const fs=require('fs');
-const first=fs.readFileSync('./data/first.json','utf-8');
-const second=fs.readFileSync('./data/second.json','utf-8');
-console.log(JSON.parse(first)["/builds/canyon/canyon-demo/src/pages/Home.tsx"]['s']);
-console.log(mergeCoverage(JSON.parse(first),JSON.parse(second))["/builds/canyon/canyon-demo/src/pages/Home.tsx"]['s']);
-
-// 期望
-
-// {
-// '0': 1,
-// '1': 1,
-// '2': 0,
-// '3': 1,
-// '4': 1,
-// '5': 1,
-// '6': 0,
-// '7': 0,
-// '8': 0,
-// '9': 0
-// }
-// {
-// '0': 2,
-// '1': 2,
-// '2': 0,
-// '3': 2,
-// '4': 2,
-// '5': 2,
-// '6': 0,
-// '7': 0,
-// '8': 0,
-// '9': 0
-// }
diff --git a/tools/coverage-merge/python.py b/tools/coverage-merge/python.py
deleted file mode 100644
index a2c0bbca..00000000
--- a/tools/coverage-merge/python.py
+++ /dev/null
@@ -1,49 +0,0 @@
-import copy
-import json
-
-def merge_file_coverage(first, second):
- ret = copy.deepcopy(first)
- ret.pop('l', None) # 移除派生信息
-
- for key in second['s']:
- ret['s'][key] += second['s'][key]
-
- for key in second['f']:
- ret['f'][key] += second['f'][key]
-
- for key in second['b']:
- ret_array = ret['b'][key]
- second_array = second['b'][key]
- for i in range(len(ret_array)):
- ret_array[i] += second_array[i]
-
- return ret
-
-def merge_coverage(first, second):
- if not second:
- return first
-
- merged_coverage = copy.deepcopy(first) # 深拷贝 coverage,这样修改出来的是两个的合集
- for file_path, added in second.items():
- original = first.get(file_path)
- if original:
- result = merge_file_coverage(original, added)
- else:
- result = added
- merged_coverage[file_path] = result
-
- return merged_coverage
-
-
-with open("./data/first.json",'r') as load_f:
- first_load_dict = json.load(load_f)
-
-with open("./data/second.json",'r') as load_f:
- second_load_dict = json.load(load_f)
-
-print(first_load_dict["/builds/canyon/canyon-demo/src/pages/Home.tsx"]['s'])
-print(merge_coverage(first_load_dict,second_load_dict)["/builds/canyon/canyon-demo/src/pages/Home.tsx"]['s'])
-
-# 期望
-# {'0': 1, '1': 1, '2': 0, '3': 1, '4': 1, '5': 1, '6': 0, '7': 0, '8': 0, '9': 0}
-# {'0': 2, '1': 2, '2': 0, '3': 2, '4': 2, '5': 2, '6': 0, '7': 0, '8': 0, '9': 0}