-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Allen Zhang
committed
Dec 5, 2023
0 parents
commit f153489
Showing
186 changed files
with
9,917 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#-----------------------System Config------------------------------# | ||
SYSTEM_QUESTION_LINK=https://github.com/canyon-project/canyon | ||
|
||
#-----------------------Backend Config------------------------------# | ||
# Prisma Config | ||
DATABASE_URL=postgress://canyon:canyon@localhost:5432/canyon | ||
|
||
# Gitlab Config | ||
GITLAB_URL="***" | ||
GITLAB_CLIENT_ID="***" | ||
GITLAB_CLIENT_SECRET="***" | ||
COVERAGE_DATA_URL=http://s3.xxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
- run: pnpm install | ||
- run: pnpm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Npm Publish | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
install: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
publish-npm: | ||
needs: [install] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: pnpm install | ||
# - run: pnpm --filter=@arextest/arex-common publish -f --no-git-checks --access=public --filter | ||
- run: pnpm --filter=canyon-cli publish -f --no-git-checks --access=public --filter | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: push docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: zhangtao25/canyon:main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# IDE / Editor | ||
.idea/* | ||
!.idea/rcb-settings.xml | ||
|
||
# PNPM | ||
.pnpm-store | ||
|
||
|
||
pnpm-lock.yaml | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:lts | ||
|
||
MAINTAINER wr_zhang25 | ||
|
||
RUN mkdir -p /app | ||
COPY . /app/ | ||
WORKDIR /app | ||
|
||
RUN npm install pnpm -g | ||
RUN pnpm i | ||
RUN pnpm run build | ||
|
||
EXPOSE 8080 | ||
CMD ["node", "packages/canyon-backend/dist/main.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Canyon Platforms, Inc. and affiliates. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Canyon [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/canyon-project/canyon/blob/main/LICENSE) [![build status](https://github.com/canyon-project/canyon/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/canyon-project/canyon/actions/workflows/ci.yml) | ||
|
||
👋 Canyon is a JavaScript code coverage solution | ||
|
||
![](./screenshots/overview1.jpg) | ||
|
||
### **Introduction** | ||
|
||
JavaScript 代码覆盖率解决方案。在前端工程构建阶段,将代码探针及工程信息插桩进产物中;在前端应用运行时,将内存中的覆盖率数据上报至服务端。支持覆盖率聚合、报告生成、新增行覆盖率。 | ||
|
||
主要用于端到端的UI测试用例覆盖率数据收集(也支持node或者UT覆盖率上报收集)。 | ||
|
||
### **Features** | ||
|
||
**Bundling:** 多种生态的bundling方案。 | ||
|
||
- `vite` - vite-plugin-istanbul | ||
- `babel` - babel-plugin-istanbul | ||
- `swc` - swc-coverage-instrument | ||
|
||
**React Native:** 支持React Native覆盖率数据收集。 | ||
|
||
**File:** 支持多种文件类型,例如js、jsx、ts、tsx。 | ||
|
||
**源码回溯:** 开启sourceMap选项来回溯源码覆盖率信息。 | ||
|
||
**CI** 提供覆盖率接口,方便CI工具集成。 | ||
|
||
**变更代码:** 通过配置想要对比的基线Commit Sha或者分支名,过滤筛选出变更代码文件的覆盖率以及计算出整体新增代码行覆盖率。 | ||
|
||
**Commit:** 使用oauth2登陆与github、gitlab等代码仓库链接,根据Commit Sha拉取代码进行覆盖率详情绘制。 | ||
|
||
**聚合:** 根据上报的报告ID进行实时聚合覆盖率数据聚合。 | ||
|
||
**报告组件:** 构建最小原生JavasScript的npm包,提供现代化前端报告水合方案以代替传统istanbul report。 | ||
|
||
**浏览器插件:** 提供浏览器插件,供开发人员实时检测应用覆盖率详情。 | ||
|
||
### Screenshots | ||
|
||
![报告](./screenshots/report1.jpg) | ||
|
||
![覆盖率](./screenshots/demo1.jpg) | ||
|
||
![新增行](./screenshots/codechange1.jpg) | ||
|
||
![配置](./screenshots/ci1.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import fs from 'fs/promises'; | ||
import path from 'path'; | ||
|
||
const sourceFilePath = path.join(new URL('.', import.meta.url).pathname, '.env.example'); | ||
const destinationFilePath = path.join(new URL('.', import.meta.url).pathname, '.env'); | ||
|
||
// 检查目标文件是否存在 | ||
(async () => { | ||
try { | ||
await fs.access(destinationFilePath); | ||
console.log('.env文件已存在'); | ||
} catch (err) { | ||
// 目标文件不存在,复制.en.example文件为.env文件 | ||
try { | ||
await fs.copyFile(sourceFilePath, destinationFilePath); | ||
console.log('.env文件已成功创建'); | ||
} catch (error) { | ||
console.error('复制文件时出错:', error); | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "canyon", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
"test": "pnpm -r do-test", | ||
"dev": "pnpm -r do-dev", | ||
"build": "pnpm -r do-build", | ||
"migrate": "npx prisma migrate dev --schema ./packages/canyon-backend/prisma/schema.prisma", | ||
"rm": "find ./ -type d \\( -name \"dist\" -o -name \"node_modules\" \\) -exec rm -rf {} +", | ||
"preinstall": "node ./check.js" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
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', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
Oops, something went wrong.