├── .all-contributorsrc ├── .eslintignore ├── .eslintrc ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── documentation.md │ └── feature_request.md ├── pull_request_template.md ├── release-drafter.yml └── workflows │ ├── ci.yml │ ├── docs-deploy.yml │ ├── draft-release.yml │ ├── rebuild.yml │ └── test.yml ├── .gitignore ├── .prettierrc ├── .vscode └── settings.json ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── __mocks__ ├── @actions │ ├── core │ │ └── index.ts │ ├── exec │ │ └── index.ts │ └── github │ │ └── index.ts ├── c12 │ └── index.ts ├── fs-extra │ └── index.ts └── path │ └── index.ts ├── action.yml ├── dist ├── index.js ├── index.js.LICENSE.txt └── index.js.map ├── docs ├── .gitignore ├── assets │ ├── annotation-example.jpg │ ├── blob1.svg │ ├── coverage-annotation-example.jpg │ ├── coverage-comment-example.jpg │ ├── dots.svg │ ├── failed-test-annotation-example.jpg │ ├── logo-single-background.svg │ └── logo.svg ├── mdx.d.ts ├── next-env.d.ts ├── next.config.js ├── package-lock.json ├── package.json ├── public │ ├── analytics.js │ ├── favicon.ico │ └── robots.txt ├── src │ ├── components │ │ ├── BotLogo.tsx │ │ ├── CoverageComment.module.scss │ │ ├── CoverageComment.tsx │ │ ├── EditorWithCopy.tsx │ │ ├── Footer.tsx │ │ ├── FooterLink.tsx │ │ ├── FooterSection.tsx │ │ ├── GradientHeading.tsx │ │ ├── Header.module.scss │ │ ├── Header.tsx │ │ ├── HomeExample.module.scss │ │ ├── HomeExample.tsx │ │ ├── LinkProps.ts │ │ ├── Rating.tsx │ │ ├── ResponsiveImage.tsx │ │ ├── fake-github-parts │ │ │ ├── CheckItem.tsx │ │ │ ├── Checks.tsx │ │ │ └── PrFooter.tsx │ │ ├── landing │ │ │ ├── InfoImageScreen.tsx │ │ │ ├── InfoScreen.tsx │ │ │ └── ScreenContainer.tsx │ │ ├── layouts │ │ │ ├── LayoutDocs.tsx │ │ │ └── LayoutProps.ts │ │ └── markdown │ │ │ ├── Code.module.scss │ │ │ ├── Code.tsx │ │ │ ├── MarkdownHeading.module.scss │ │ │ ├── MarkdownHeading.tsx │ │ │ ├── MarkdownWrapper.tsx │ │ │ ├── MdLink.tsx │ │ │ └── components.tsx │ ├── pages │ │ ├── Home.module.scss │ │ ├── _app.tsx │ │ ├── _document.tsx │ │ ├── configuration.md │ │ ├── index.tsx │ │ ├── migrate.md │ │ └── quick-start.md │ └── theme.ts ├── styles │ └── globals.css ├── tools │ ├── .eslintrc │ ├── loaders │ │ └── md-loader.js │ └── scripts │ │ └── deploy.js └── tsconfig.json ├── esbuild.cjs ├── fileTransformer.js ├── img ├── Github-comment-screenshot.jpg └── Rejected-PR-screenshot.jpg ├── index.d.ts ├── jest.config.js ├── package-lock.json ├── package.json ├── pull-request.json ├── run.sh ├── src ├── annotations │ ├── Annotation.ts │ ├── __mocks__ │ │ ├── createCoverageAnnotations.ts │ │ └── createFailedTestsAnnotations.ts │ ├── createCoverageAnnotations.ts │ ├── createFailedTestsAnnotations.ts │ └── isAnnotationEnabled.ts ├── constants │ ├── GITHUB_MESSAGE_SIZE_LIMIT.ts │ ├── REPORT_PATH.ts │ └── getReportTag.ts ├── filters │ └── onlyChanged.ts ├── format │ ├── annotations │ │ ├── CreateCheckOptions.ts │ │ ├── __mocks__ │ │ │ ├── formatCoverageAnnotations.ts │ │ │ └── formatFailedTestsAnnotations.ts │ │ ├── formatCoverageAnnotations.ts │ │ ├── formatFailedTestsAnnotations.ts │ │ └── getFailedAnnotationsSummary.ts │ ├── counters.ts │ ├── details │ │ ├── findCommonPath.ts │ │ ├── formatCoverageDetails.ts │ │ ├── formatCoverageDetailsPart.ts │ │ ├── getDecreasedCoverage.ts │ │ ├── getFileCoverageDetailRow.ts │ │ ├── getNewFilesCoverage.ts │ │ ├── parseDetails.ts │ │ └── shrinkLongPath.ts │ ├── formatCoverage.ts │ ├── formatErrors.ts │ ├── formatRunReport.ts │ ├── formatThresholdResults.ts │ ├── getFailureDetails.ts │ ├── getFormattedCoverage.ts │ ├── getPercents.ts │ ├── strings.json │ ├── summary │ │ ├── formatCoverageSummary.ts │ │ ├── getSummary.ts │ │ └── parseSummary.ts │ └── template.md ├── index.ts ├── report │ ├── __mocks__ │ │ ├── generateCommitReport.ts │ │ └── generatePRReport.ts │ ├── fetchPreviousReport.ts │ ├── generateCommitReport.ts │ └── generatePRReport.ts ├── run.ts ├── stages │ ├── __mocks__ │ │ ├── createReport.ts │ │ ├── getCoverage.ts │ │ └── switchBranch.ts │ ├── checkThreshold.ts │ ├── collectCoverage.ts │ ├── createReport.ts │ ├── createRunReport.ts │ ├── getCoverage.ts │ ├── installDependencies.ts │ ├── parseCoverage.ts │ ├── runTest.ts │ └── switchBranch.ts ├── typings │ ├── ActionError.ts │ ├── Coverage.ts │ ├── JestThreshold.ts │ ├── JsonReport.ts │ ├── Options.ts │ ├── Report.ts │ ├── ThresholdResult.ts │ └── __mocks__ │ │ └── Options.ts └── utils │ ├── DataCollector.ts │ ├── __mocks__ │ └── removeDirectory.ts │ ├── accumulateCoverageDetails.ts │ ├── checkSingleThreshold.ts │ ├── createMarkdownSpoiler.ts │ ├── decimalToString.ts │ ├── formatPercentage.ts │ ├── formatPercentageDelta.ts │ ├── getConsoleLink.ts │ ├── getCoverageForDirectory.ts │ ├── getFileCoverageMap.ts │ ├── getNormalThreshold.ts │ ├── getPrPatch.ts │ ├── getStatusOfPercents.ts │ ├── getTestCommand.ts │ ├── i18n.ts │ ├── insertArgs.ts │ ├── isOldScript.ts │ ├── isValidNumber.ts │ ├── joinPaths.ts │ ├── markdownTable.ts │ ├── parseJestConfig.ts │ ├── removeDirectory.ts │ ├── runStage.ts │ ├── tryGetJestThreshold.ts │ ├── upsertCheck.ts │ └── withExplanation.ts ├── tests ├── .eslintrc ├── annotations │ ├── __snapshots__ │ │ ├── createCoverageAnnotations.test.ts.snap │ │ └── createFailedTestsAnnotations.test.ts.snap │ ├── createCoverageAnnotations.test.ts │ ├── createFailedTestsAnnotations.test.ts │ └── isAnnotationEnabled.test.ts ├── constants │ ├── GITHUB_MESSAGE_SIZE_LIMIT.test.ts │ ├── REPORT_PATH.test.ts │ └── getReportTag.test.ts ├── filters │ └── onlyChanged.test.ts ├── format │ ├── __snapshots__ │ │ ├── formatCoverage.test.ts.snap │ │ ├── formatErrors.test.ts.snap │ │ ├── formatRunReport.test.ts.snap │ │ └── getFormattedCoverage.test.ts.snap │ ├── annotations │ │ ├── __snapshots__ │ │ │ ├── formatCoverageAnnotations.test.ts.snap │ │ │ └── formatFailedTestsAnnotations.test.ts.snap │ │ ├── formatCoverageAnnotations.test.ts │ │ ├── formatFailedTestsAnnotations.test.ts │ │ └── getFailedAnnotationsSummary.test.ts │ ├── counters.test.ts │ ├── details │ │ ├── __snapshots__ │ │ │ ├── formatCoverageDetails.test.ts.snap │ │ │ ├── getFileCoverageDetailRow.test.ts.snap │ │ │ └── parseDetails.test.ts.snap │ │ ├── findCommonPath.test.ts │ │ ├── formatCoverageDetails.test.ts │ │ ├── getDecreasedCoverage.test.ts │ │ ├── getFileCoverageDetailRow.test.ts │ │ ├── getNewFilesCoverage.test.ts │ │ ├── parseDetails.test.ts │ │ └── shrinkLongPath.test.ts │ ├── formatCoverage.test.ts │ ├── formatErrors.test.ts │ ├── formatRunReport.test.ts │ ├── getFailureDetails.test.ts │ ├── getFormattedCoverage.test.ts │ ├── getPercents.test.ts │ └── summary │ │ ├── __snapshots__ │ │ ├── formatCoverageSummary.test.ts.snap │ │ └── parseSummary.test.ts.snap │ │ ├── formatCoverageSummary.test.ts │ │ ├── getSummary.test.ts │ │ └── parseSummary.test.ts ├── mock-data │ ├── jsonReport.json │ ├── jsonReport2.json │ └── jsonReport3.json ├── report │ ├── fetchPreviousReport.test.ts │ ├── generateCommitReport.test.ts │ └── generatePRReport.test.ts ├── run.test.ts ├── stages │ ├── __snapshots__ │ │ └── createReport.test.ts.snap │ ├── collectCoverage.test.ts │ ├── createReport.test.ts │ ├── getCoverage.test.ts │ ├── installDependencies.test.ts │ ├── parseCoverage.test.ts │ ├── runTest.test.ts │ └── switchBranch.test.ts ├── typings │ ├── Options.test.ts │ └── Report.test.ts └── utils │ ├── DataCollector.test.ts │ ├── createMarkdownSpoiler.test.ts │ ├── decimalToString.test.ts │ ├── formatPercentage.test.ts │ ├── formatPercentageDelta.test.ts │ ├── getConsoleLink.test.ts │ ├── getStatusOfPercents.test.ts │ ├── getTestCommand.test.ts │ ├── i18n.test.ts │ ├── insertArgs.test.ts │ ├── isOldScript.test.ts │ ├── joinPaths.test.ts │ ├── removeDirectory.test.ts │ ├── runStage.test.ts │ └── withExplanation.test.ts └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | *.config.js -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "env": { 4 | "node": true, 5 | "commonjs": true 6 | }, 7 | "parser": "@typescript-eslint/parser", 8 | "parserOptions": { 9 | "ecmaVersion": 2020, 10 | "sourceType": "module" 11 | }, 12 | "plugins": [ 13 | "@typescript-eslint", 14 | "simple-import-sort" 15 | ], 16 | "extends": [ 17 | "prettier/@typescript-eslint", 18 | "plugin:prettier/recommended", 19 | "eslint:recommended", 20 | "plugin:@typescript-eslint/eslint-recommended", 21 | "plugin:@typescript-eslint/recommended" 22 | ], 23 | "rules": { 24 | "@typescript-eslint/no-namespace": "off", 25 | "@typescript-eslint/explicit-module-boundary-types": "off", 26 | "@typescript-eslint/explicit-function-return-type": "off", 27 | "@typescript-eslint/no-empty-interface": "off", 28 | "@typescript-eslint/no-non-null-assertion": "off", 29 | "@typescript-eslint/ban-types": "off", 30 | "no-console": "off", 31 | "prettier/prettier": [ 32 | "error", 33 | { 34 | "endOfLine": "auto" 35 | } 36 | ], 37 | "simple-import-sort/imports": [ 38 | "warn", 39 | { 40 | "groups": [ 41 | // Node.js builtins. 42 | [ 43 | "^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|typescript|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)" 44 | ], 45 | // Packages. 46 | [ 47 | "markdown-table", 48 | "^@?\\w" 49 | ], 50 | // Side effect imports. 51 | [ 52 | "^\\u0000" 53 | ], 54 | // Parent imports. 55 | [ 56 | "^src", 57 | "^\\./(?=.*/)(?!/?$)", 58 | "^\\.(?!/?$)", 59 | "^\\./?$", 60 | "^\\.\\.(?!/?$)", 61 | "^\\.\\./?$" 62 | ] 63 | ] 64 | } 65 | ] 66 | } 67 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [ArtiomTr] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: ArtiomTr 7 | 8 | --- 9 | 10 | 21 | 22 | ### Describe a bug 23 | 24 | 25 | 26 | ### Expected behavior 27 | 28 | 29 | 30 | ### Details 31 | 32 | - Action version: 33 | - OS, where your action is running (windows, linux): 34 | -
action.yml file 35 | 36 | ```yml 37 | # Insert your action.yml file here. Don't forget to remove all sensitive information (e.g. tokens) 38 | ``` 39 | 40 |
41 | 42 | -
Screenshots 43 | 44 | 45 | 46 | 47 | 48 |
49 | 50 | ### Additional context 51 | 52 | 53 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Question 3 | url: https://github.com/ArtiomTr/jest-coverage-report-action/discussions/new?category=q-a 4 | about: Please ask and answer questions here. 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation 3 | about: Suggest improvement for documentation 4 | title: '' 5 | labels: documentation 6 | assignees: '' 7 | 8 | --- 9 | 10 | 19 | 20 | ### Describe 21 | 22 | 23 | 24 | ### Additional context 25 | 26 | 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | 19 | 20 | ### Idea 21 | 22 | 23 | 24 | ### Description 25 | 26 | 27 | 28 | ### Alternatives 29 | 30 | 31 | 32 | ### Additional context 33 | 34 | 35 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | This PR fixes # 10 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: v$NEXT_PATCH_VERSION 2 | tag-template: v$NEXT_PATCH_VERSION 3 | categories: 4 | - title: 💥 Breaking changes 5 | label: chore 6 | - title: 📰 Documentation 7 | label: documentation 8 | - title: 🚀 Features 9 | label: enhancement 10 | - title: 🐛 Bug Fixes 11 | label: bug 12 | template: | 13 | ## Changes 14 | 15 | $CHANGES 16 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | pull_request: 4 | branches: [main] 5 | workflow_dispatch: 6 | 7 | jobs: 8 | ci: 9 | name: Building, linting, testing on node ${{ matrix.node }} and ${{ matrix.os }} 10 | runs-on: ${{ matrix.os }} 11 | strategy: 12 | matrix: 13 | node: ['14.x', '16.x', '18.x', '20.x'] 14 | os: [ubuntu-latest] 15 | steps: 16 | - name: Checkout repo 17 | uses: actions/checkout@v2 18 | 19 | - name: Use Node ${{ matrix.node }} 20 | uses: actions/setup-node@v2 21 | with: 22 | node-version: ${{ matrix.node }} 23 | 24 | - name: Setup npm@6.12.0 25 | run: npm i -g npm@6.12.0 26 | 27 | - name: Install deps and build (with cache) 28 | uses: bahmutov/npm-install@v1 29 | 30 | - name: Lint 31 | run: npm run lint 32 | 33 | - name: Test 34 | run: npm test -- --ci --coverage --maxWorkers=2 35 | 36 | - name: Build 37 | run: npm run build 38 | -------------------------------------------------------------------------------- /.github/workflows/docs-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Documentation deployment 2 | on: 3 | push: 4 | paths: 5 | - 'docs/**' 6 | branches: [main] 7 | 8 | workflow_dispatch: 9 | 10 | jobs: 11 | deploy: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Begin job... 15 | uses: actions/checkout@v2 16 | 17 | - name: Use Node 12 18 | uses: actions/setup-node@v2 19 | with: 20 | node-version: '12' 21 | cache: 'npm' 22 | 23 | - name: Install deps (with cache) 24 | uses: bahmutov/npm-install@v1 25 | with: 26 | working-directory: ./docs 27 | 28 | - name: Building 29 | run: npm run build 30 | working-directory: ./docs 31 | 32 | - name: Publishing to github-pages 33 | run: | 34 | git config --global user.name 'Jest Coverage Report bot' 35 | git config --global user.email 'covbot@users.noreply.github.com' 36 | git remote set-url origin https://${github_token}@github.com/${repository} 37 | npm run deploy 38 | working-directory: ./docs 39 | env: 40 | github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} 41 | repository: ${{ github.repository }} 42 | NODE_ENV: 'production' 43 | -------------------------------------------------------------------------------- /.github/workflows/draft-release.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | workflow_dispatch: 8 | 9 | jobs: 10 | update_release_draft: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: release-drafter/release-drafter@v5 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | disable-autolabeler: true 17 | -------------------------------------------------------------------------------- /.github/workflows/rebuild.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'src/**' 7 | branches: [main] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build: 12 | name: Build 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - name: Use Node.js 18.x 18 | uses: actions/setup-node@v2 19 | with: 20 | node-version: '18' 21 | cache: 'npm' 22 | 23 | - name: Installing dependencies 24 | run: npm install 25 | 26 | - name: Building 27 | run: npm run build 28 | 29 | - name: Committing & pushing 30 | run: | 31 | git config --global user.name 'Jest Coverage Report bot' 32 | git config --global user.email 'covbot@users.noreply.github.com' 33 | git commit -am "Build $(date +'%F %T')" 34 | git push origin main 35 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Coverage 2 | 3 | # Skip job run if PR updated 4 | concurrency: 5 | group: ${{ github.workflow }}-${{ github.ref }} 6 | cancel-in-progress: true 7 | 8 | on: 9 | pull_request_target: 10 | paths-ignore: 11 | - 'docs/**' 12 | workflow_dispatch: 13 | 14 | jobs: 15 | coverage: 16 | runs-on: ubuntu-latest 17 | name: Coverage report 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v2 21 | - name: Test coverage 22 | uses: ./ # Uses an action in the root directory 23 | with: 24 | annotations: failed-tests 25 | test-script: npm run test:coverage 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .DS_Store 3 | node_modules 4 | .cache 5 | build 6 | .rpt2_cache 7 | coverage 8 | 9 | # misc 10 | .DS_Store 11 | .env 12 | .env.local 13 | .env.development.local 14 | .env.test.local 15 | .env.production.local 16 | 17 | npm-debug.log* 18 | yarn-debug.log* 19 | yarn-error.log* 20 | 21 | coverage 22 | 23 | # TypeScript cache 24 | *.tsbuildinfo 25 | 26 | # Intellij IDE automatically generated folder 27 | .idea 28 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "printWidth": 80, 4 | "singleQuote": true, 5 | "endOfLine": "auto" 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.codeActionsOnSave": { 3 | "source.fixAll": "explicit" 4 | }, 5 | "files.associations": { 6 | "*.md": "mdx" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Artiom Tretjakovas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Supported | 6 | | -------- | ------------------ | 7 | | 2.x | :white_check_mark: | 8 | | 2.0-rc.x | :x: | 9 | | 1.x | :x: | 10 | 11 | ## Reporting a Vulnerability 12 | 13 | You can report the vulnerability by sending an email to security@covbot.dev. Let us know as much information as possible: which version you are using, how and when you encountered this vulnerability, how to reproduce that vulnerability. 14 | 15 | All further information on the progress / status / possible workarounds for this vulnerability will be provided in response to your email. 16 | -------------------------------------------------------------------------------- /__mocks__/@actions/core/index.ts: -------------------------------------------------------------------------------- 1 | const input: Record = {}; 2 | 3 | export const getInput = (name: string) => input[name]; 4 | 5 | export const mockInput = (newInput: Record) => { 6 | Object.assign(input, newInput); 7 | }; 8 | 9 | export const clearInputMock = () => { 10 | Object.keys(input).map((key) => { 11 | delete input[key]; 12 | }); 13 | }; 14 | 15 | export const error = jest.fn(); 16 | export const info = jest.fn(); 17 | export const setFailed = jest.fn(); 18 | -------------------------------------------------------------------------------- /__mocks__/@actions/exec/index.ts: -------------------------------------------------------------------------------- 1 | export const exec = jest.fn(); 2 | -------------------------------------------------------------------------------- /__mocks__/@actions/github/index.ts: -------------------------------------------------------------------------------- 1 | export const context: Record = {}; 2 | 3 | export const mockContext = (newContext: Record) => { 4 | Object.assign(context, newContext); 5 | }; 6 | 7 | export const clearContextMock = () => { 8 | Object.keys(context).map((key) => { 9 | delete context[key]; 10 | }); 11 | }; 12 | 13 | export const getOctokit = jest.fn(); 14 | -------------------------------------------------------------------------------- /__mocks__/c12/index.ts: -------------------------------------------------------------------------------- 1 | export const loadConfig = jest.fn(); 2 | -------------------------------------------------------------------------------- /__mocks__/fs-extra/index.ts: -------------------------------------------------------------------------------- 1 | export const readFile = jest.fn(); 2 | 3 | export const rmdir = jest.fn(); 4 | 5 | export const rm = jest.fn(); 6 | -------------------------------------------------------------------------------- /__mocks__/path/index.ts: -------------------------------------------------------------------------------- 1 | const realPath = jest.requireActual('path'); 2 | 3 | export const relative = jest.fn(realPath.relative); 4 | -------------------------------------------------------------------------------- /dist/index.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * is-plain-object 3 | * 4 | * Copyright (c) 2014-2017, Jon Schlinkert. 5 | * Released under the MIT License. 6 | */ 7 | 8 | /*! 9 | * repeat-string 10 | * 11 | * Copyright (c) 2014-2015, Jon Schlinkert. 12 | * Licensed under the MIT License. 13 | */ 14 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | .next 2 | out -------------------------------------------------------------------------------- /docs/assets/annotation-example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArtiomTr/jest-coverage-report-action/262a7bb0b20c4d1d6b6b026af0f008f78da72788/docs/assets/annotation-example.jpg -------------------------------------------------------------------------------- /docs/assets/blob1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/assets/coverage-annotation-example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArtiomTr/jest-coverage-report-action/262a7bb0b20c4d1d6b6b026af0f008f78da72788/docs/assets/coverage-annotation-example.jpg -------------------------------------------------------------------------------- /docs/assets/coverage-comment-example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArtiomTr/jest-coverage-report-action/262a7bb0b20c4d1d6b6b026af0f008f78da72788/docs/assets/coverage-comment-example.jpg -------------------------------------------------------------------------------- /docs/assets/dots.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/assets/failed-test-annotation-example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArtiomTr/jest-coverage-report-action/262a7bb0b20c4d1d6b6b026af0f008f78da72788/docs/assets/failed-test-annotation-example.jpg -------------------------------------------------------------------------------- /docs/assets/logo-single-background.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/mdx.d.ts: -------------------------------------------------------------------------------- 1 | declare module '@mdx-js/react' { 2 | import * as React from 'react'; 3 | type ComponentType = 4 | | 'blockquote' 5 | | 'code' 6 | | 'delete' 7 | | 'em' 8 | | 'hr' 9 | | 'img' 10 | | 'inlineCode' 11 | | 'li' 12 | | 'ol' 13 | | 'p' 14 | | 'pre' 15 | | 'strong' 16 | | 'sup' 17 | | 'table' 18 | | 'td' 19 | | 'th' 20 | | 'tbody' 21 | | 'thead' 22 | | 'thematicBreak' 23 | | 'tr' 24 | | 'ul'; 25 | 26 | type HeadingProps = { 27 | id: string; 28 | }; 29 | 30 | export type CodeProps = { 31 | children: string; 32 | className: string; 33 | metastring: string; 34 | [key: string]: boolean | string; 35 | }; 36 | 37 | export type Components = { 38 | [key in ComponentType]?: React.ComponentType<{ 39 | children: React.ReactNode; 40 | }>; 41 | } & { 42 | [key: string]: React.ComponentType; 43 | } & { 44 | a?: React.ComponentType<{ href: string }>; 45 | h1?: React.ComponentType; 46 | h2?: React.ComponentType; 47 | h3?: React.ComponentType; 48 | h4?: React.ComponentType; 49 | h5?: React.ComponentType; 50 | h6?: React.ComponentType; 51 | code?: React.ComponentType; 52 | }; 53 | export interface MDXProviderProps { 54 | children: React.ReactNode; 55 | components: Components; 56 | } 57 | export class MDXProvider extends React.Component {} 58 | } 59 | -------------------------------------------------------------------------------- /docs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | declare module '*.svg' { 5 | const SvgComponent: React.ComponentType>; 6 | 7 | export default SvgComponent; 8 | } 9 | 10 | type ResponsiveImageSource = { 11 | srcSet: string; 12 | images: Array<{ width: number; height: number; path: string }>; 13 | src: string; 14 | toString: () => string; 15 | }; 16 | 17 | declare module '*.jpeg' { 18 | const value: ResponsiveImageSource; 19 | 20 | export = value; 21 | } 22 | 23 | declare module '*.jpg' { 24 | const value: ResponsiveImageSource; 25 | export = value; 26 | } 27 | -------------------------------------------------------------------------------- /docs/next.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | const remarkPlugins = [require('remark-slug')]; 4 | 5 | module.exports = { 6 | pageExtensions: ['tsx', 'jsx', 'md', 'mdx'], 7 | webpack(config, { defaultLoaders }) { 8 | config.module.rules.push({ 9 | test: /.mdx?$/, 10 | use: [ 11 | defaultLoaders.babel, 12 | { 13 | loader: '@mdx-js/loader', 14 | options: { 15 | remarkPlugins, 16 | }, 17 | }, 18 | path.join(__dirname, './tools/loaders/md-loader'), 19 | ], 20 | }); 21 | 22 | config.module.rules.push({ 23 | test: /\.(jpe?g|png|webp)$/i, 24 | use: [ 25 | { 26 | loader: 'responsive-loader', 27 | options: { 28 | adapter: require('responsive-loader/sharp'), 29 | sizes: [320, 640, 960, 1200, 1800, 2400], 30 | outputPath: 'static', 31 | publicPath: '_next/static', 32 | }, 33 | }, 34 | ], 35 | }); 36 | 37 | config.module.rules.push({ 38 | test: /\.svg$/, 39 | issuer: { 40 | test: /\.(js|ts)x?$/, 41 | }, 42 | use: ['@svgr/webpack'], 43 | }); 44 | 45 | return config; 46 | }, 47 | }; 48 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "", 6 | "main": "index.js", 7 | "scripts": { 8 | "dev": "next dev", 9 | "build": "next build && next export && echo \"This file tells github not to use jekyll. It is required because jekyll not resolves underscore folders, like _next\" > out/.nojekyll && echo \"www.covbot.dev\" > out/CNAME", 10 | "deploy": "node tools/scripts/deploy.js", 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "author": "Artiom Tretjakovas", 14 | "license": "MIT", 15 | "dependencies": { 16 | "@chakra-ui/react": "^1.6.3", 17 | "@emotion/react": "^11.4.0", 18 | "@emotion/styled": "^11.3.0", 19 | "@monaco-editor/react": "^4.2.0", 20 | "@primer/components": "^28.2.3", 21 | "@primer/octicons-react": "^14.2.2", 22 | "framer-motion": "^4.1.17", 23 | "gray-matter": "^4.0.3", 24 | "next": "^12.1.0", 25 | "react": "^17.0.2", 26 | "react-dom": "^17.0.2", 27 | "sass": "^1.34.1", 28 | "styled-components": "^5.3.0" 29 | }, 30 | "devDependencies": { 31 | "@mdx-js/loader": "^1.6.22", 32 | "@svgr/webpack": "^5.5.0", 33 | "@types/babel__core": "^7.1.14", 34 | "@types/react": "^17.0.11", 35 | "gh-pages": "^3.2.1", 36 | "remark-slug": "^6.0.0", 37 | "responsive-loader": "^2.3.0", 38 | "sharp": "^0.30.5", 39 | "typescript": "^4.3.2" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /docs/public/analytics.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | 3 | window.dataLayer = window.dataLayer || []; 4 | function gtag() { 5 | dataLayer.push(arguments); 6 | } 7 | 8 | gtag('js', new Date()); 9 | 10 | gtag('config', 'G-BT9580VG7N'); 11 | -------------------------------------------------------------------------------- /docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArtiomTr/jest-coverage-report-action/262a7bb0b20c4d1d6b6b026af0f008f78da72788/docs/public/favicon.ico -------------------------------------------------------------------------------- /docs/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: -------------------------------------------------------------------------------- /docs/src/components/BotLogo.tsx: -------------------------------------------------------------------------------- 1 | import CircleBadge from '@primer/components/lib/CircleBadge'; 2 | import { MarkGithubIcon } from '@primer/octicons-react'; 3 | import React from 'react'; 4 | 5 | export type BotLogoProps = { 6 | size?: number; 7 | }; 8 | 9 | export const BotLogo = ({ size = 32 }: BotLogoProps) => ( 10 | 11 | 16 | 17 | ); 18 | -------------------------------------------------------------------------------- /docs/src/components/CoverageComment.module.scss: -------------------------------------------------------------------------------- 1 | .table { 2 | &, 3 | th, 4 | td { 5 | border: 1px solid #e0e3e6; 6 | } 7 | 8 | th, 9 | td { 10 | padding: 5px 10px; 11 | } 12 | 13 | td:nth-child(1), 14 | th:nth-child(1), 15 | td:nth-child(4), 16 | th:nth-child(4) { 17 | text-align: center; 18 | } 19 | 20 | tbody > tr:nth-child(even) { 21 | background-color: #f6f8fa; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /docs/src/components/Footer.tsx: -------------------------------------------------------------------------------- 1 | import { Box, Container, Divider, Grid, HStack, Text } from '@chakra-ui/react'; 2 | import React from 'react'; 3 | 4 | import { FooterLink } from './FooterLink'; 5 | import { FooterSection } from './FooterSection'; 6 | import Logo from '../../assets/logo.svg'; 7 | 8 | export const Footer = () => ( 9 | 10 | 11 | 12 | 13 | 14 | {/* TODO */} 15 | 16 | {/* TODO */} 17 | 18 | {/* TODO */} 19 | 20 | 21 | 22 | 26 | 30 | 34 | 38 | 39 | 40 | 44 | 48 | 49 | 50 | 51 | 52 | 53 | Copyright © 2020 54 | 55 | 56 | 57 | ); 58 | -------------------------------------------------------------------------------- /docs/src/components/FooterLink.tsx: -------------------------------------------------------------------------------- 1 | import { Link as ChakraLink, ListItem } from '@chakra-ui/layout'; 2 | import NextLink from 'next/link'; 3 | import React from 'react'; 4 | 5 | import { LinkProps } from './LinkProps'; 6 | 7 | export const FooterLink = ({ label, href }: LinkProps) => ( 8 | 9 | 10 | {label} 11 | 12 | 13 | ); 14 | -------------------------------------------------------------------------------- /docs/src/components/FooterSection.tsx: -------------------------------------------------------------------------------- 1 | import { GridItem, Heading, List } from '@chakra-ui/layout'; 2 | import React from 'react'; 3 | 4 | export type FooterSectionProps = { 5 | heading: string; 6 | children?: React.ReactNode; 7 | }; 8 | 9 | export const FooterSection = ({ heading, children }: FooterSectionProps) => ( 10 | 11 | 18 | {heading} 19 | 20 | {children} 21 | 22 | ); 23 | -------------------------------------------------------------------------------- /docs/src/components/GradientHeading.tsx: -------------------------------------------------------------------------------- 1 | import { Heading, HeadingProps } from '@chakra-ui/react'; 2 | import React from 'react'; 3 | 4 | export type GradientHeadingProps = { 5 | gradient: string; 6 | } & HeadingProps; 7 | 8 | export const GradientHeading = ({ 9 | gradient, 10 | sx, 11 | ...other 12 | }: GradientHeadingProps) => ( 13 | 23 | ); 24 | -------------------------------------------------------------------------------- /docs/src/components/Header.module.scss: -------------------------------------------------------------------------------- 1 | .logo { 2 | cursor: pointer; 3 | } 4 | -------------------------------------------------------------------------------- /docs/src/components/HomeExample.module.scss: -------------------------------------------------------------------------------- 1 | @keyframes appearPart { 2 | 0% { 3 | transform: translateX(-25px); 4 | opacity: 0; 5 | } 6 | 70% { 7 | transform: translateX(0); 8 | } 9 | 100% { 10 | opacity: 1; 11 | } 12 | } 13 | 14 | .part1, 15 | .part2, 16 | .part3 { 17 | animation: appearPart 1s ease-in-out forwards; 18 | opacity: 0; 19 | } 20 | 21 | .part1 { 22 | animation-delay: 0.2s; 23 | } 24 | 25 | .part2 { 26 | animation-delay: 0.7s; 27 | } 28 | 29 | .part3 { 30 | animation-delay: 1.2s; 31 | } 32 | -------------------------------------------------------------------------------- /docs/src/components/HomeExample.tsx: -------------------------------------------------------------------------------- 1 | import { Box, Grid, GridItem } from '@chakra-ui/react'; 2 | import StyledOcticon from '@primer/components/lib/StyledOcticon'; 3 | import Timeline from '@primer/components/lib/Timeline'; 4 | import { GitCommitIcon } from '@primer/octicons-react'; 5 | import React from 'react'; 6 | 7 | import { PrFooter } from './fake-github-parts/PrFooter'; 8 | import classes from './HomeExample.module.scss'; 9 | import { CoverageComment } from '../components/CoverageComment'; 10 | 11 | type TransformProps = { 12 | translate: { 13 | x: string; 14 | y: string; 15 | }; 16 | scale: number; 17 | }; 18 | 19 | const createTransforms = (transforms: Record) => 20 | Object.entries(transforms).reduce((acc, [key, { translate, scale }]) => { 21 | acc[ 22 | key 23 | ] = `skew(-32deg, 0deg) rotate(15deg) translate(${translate.x}, ${translate.y}) scale(${scale})`; 24 | 25 | return acc; 26 | }, {}); 27 | 28 | const transforms = createTransforms({ 29 | base: { 30 | translate: { 31 | x: 'calc(-50% + 41vw)', 32 | y: '0', 33 | }, 34 | scale: 0.6, 35 | }, 36 | md: { 37 | translate: { 38 | x: 'calc(-50% + 41vw)', 39 | y: '-10%', 40 | }, 41 | scale: 0.7, 42 | }, 43 | lg: { 44 | translate: { 45 | x: '-54%', 46 | y: '-8%', 47 | }, 48 | scale: 0.7, 49 | }, 50 | }); 51 | 52 | export const HomeExample = () => ( 53 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | New commit 69 | 70 | 71 | 72 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | ); 94 | -------------------------------------------------------------------------------- /docs/src/components/LinkProps.ts: -------------------------------------------------------------------------------- 1 | export type LinkProps = { 2 | href: string; 3 | label: string; 4 | }; 5 | -------------------------------------------------------------------------------- /docs/src/components/Rating.tsx: -------------------------------------------------------------------------------- 1 | import { Flex, IconButton } from '@chakra-ui/react'; 2 | import { ThumbsdownIcon, ThumbsupIcon } from '@primer/octicons-react'; 3 | import React, { useCallback, useState } from 'react'; 4 | 5 | export const Rating = () => { 6 | const [isPageUseful, setIsPageUseful] = useState(); 7 | 8 | const like = useCallback(() => setIsPageUseful(true), []); 9 | const dislike = useCallback(() => setIsPageUseful(false), []); 10 | 11 | return ( 12 | 13 | {isPageUseful === undefined ? ( 14 | 15 | Is this page useful? 16 | } 21 | /> 22 | } 27 | /> 28 | 29 | ) : ( 30 | Thanks for letting us know! 31 | )} 32 | 33 | ); 34 | }; 35 | -------------------------------------------------------------------------------- /docs/src/components/ResponsiveImage.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export type ResponsiveImageProps = { 4 | images: ImageSrc[]; 5 | } & Omit, 'src'>; 6 | 7 | export type ImageSrc = { 8 | height: number; 9 | width: number; 10 | path: string; 11 | }; 12 | 13 | export const ResponsiveImage = ({ images, ...other }: ResponsiveImageProps) => { 14 | return ( 15 | 16 | {images 17 | .sort((a, b) => b.width - a.width) 18 | .slice(0, -1) 19 | .map((image, key) => ( 20 | 25 | ))} 26 | 27 | 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /docs/src/components/fake-github-parts/CheckItem.tsx: -------------------------------------------------------------------------------- 1 | import { GridItem } from '@chakra-ui/react'; 2 | import StyledOcticon from '@primer/components/lib/StyledOcticon'; 3 | import { XIcon } from '@primer/octicons-react'; 4 | import React, { PropsWithChildren } from 'react'; 5 | 6 | import { BotLogo } from '../BotLogo'; 7 | 8 | export type CheckItemProps = PropsWithChildren<{ 9 | last?: boolean; 10 | }>; 11 | 12 | export const CheckItem = ({ children, last }: CheckItemProps) => ( 13 | 14 | 23 | 24 | 25 | 34 | 35 | {children} 36 | 37 | 38 | ); 39 | -------------------------------------------------------------------------------- /docs/src/components/fake-github-parts/Checks.tsx: -------------------------------------------------------------------------------- 1 | import { Box, Grid, VStack } from '@chakra-ui/react'; 2 | import React, { PropsWithChildren } from 'react'; 3 | 4 | export type ChecksProps = PropsWithChildren<{}>; 5 | 6 | export const Checks = ({ children }: ChecksProps) => ( 7 | 8 | 9 | {children} 10 | 11 | 12 | ); 13 | -------------------------------------------------------------------------------- /docs/src/components/landing/InfoImageScreen.tsx: -------------------------------------------------------------------------------- 1 | // import Image from 'next/image'; 2 | import React from 'react'; 3 | 4 | import { InfoScreen, InfoScreenProps } from './InfoScreen'; 5 | import { ImageSrc, ResponsiveImage } from '../ResponsiveImage'; 6 | 7 | export type InfoImageScreenProps = Omit & { 8 | images: ImageSrc[]; 9 | alt: string; 10 | }; 11 | 12 | export const InfoImageScreen = ({ 13 | images, 14 | alt, 15 | ...infoScreenProps 16 | }: InfoImageScreenProps) => ( 17 | 18 | 19 | 20 | ); 21 | -------------------------------------------------------------------------------- /docs/src/components/landing/InfoScreen.tsx: -------------------------------------------------------------------------------- 1 | import { Heading } from '@chakra-ui/layout'; 2 | import React, { PropsWithChildren } from 'react'; 3 | 4 | import { ScreenContainer, ScreenContainerProps } from './ScreenContainer'; 5 | import { GradientHeading } from '../GradientHeading'; 6 | 7 | export type InfoScreenProps = PropsWithChildren< 8 | Omit & { 9 | even?: boolean; 10 | shadow?: boolean; 11 | title: string; 12 | description: string; 13 | subtitle?: string; 14 | } 15 | >; 16 | 17 | export const InfoScreen = ({ 18 | even, 19 | children, 20 | title, 21 | description, 22 | shadow, 23 | subtitle, 24 | ...screenContainerProps 25 | }: InfoScreenProps) => ( 26 | 41 | {subtitle && {subtitle}} 42 | 50 | {title} 51 | 52 | 61 | {description} 62 | 63 | {children} 64 | 65 | ); 66 | -------------------------------------------------------------------------------- /docs/src/components/landing/ScreenContainer.tsx: -------------------------------------------------------------------------------- 1 | import { Box, BoxProps, Container, ContainerProps } from '@chakra-ui/react'; 2 | import React, { ComponentProps, PropsWithChildren } from 'react'; 3 | 4 | export type ScreenContainerProps = PropsWithChildren<{ boxProps?: BoxProps }> & 5 | ContainerProps; 6 | 7 | export const ScreenContainer = ({ 8 | height = '100vh', 9 | children, 10 | boxProps = {}, 11 | ...other 12 | }: ScreenContainerProps) => ( 13 | )}> 14 | 20 | {children} 21 | 22 | 23 | ); 24 | -------------------------------------------------------------------------------- /docs/src/components/layouts/LayoutDocs.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | Container, 3 | Divider, 4 | Flex, 5 | Heading, 6 | List, 7 | ListItem, 8 | } from '@chakra-ui/react'; 9 | import { Box } from '@primer/components'; 10 | import { useRouter } from 'next/dist/client/router'; 11 | import Head from 'next/head'; 12 | import NextLink from 'next/link'; 13 | import React from 'react'; 14 | 15 | import { LayoutProps } from './LayoutProps'; 16 | import { MarkdownWrapper } from '../markdown/MarkdownWrapper'; 17 | import { MdLink } from '../markdown/MdLink'; 18 | import { Rating } from '../Rating'; 19 | 20 | export const LayoutDocs = ({ children, meta }: LayoutProps) => { 21 | const { pathname } = useRouter(); 22 | 23 | return ( 24 | 25 | 26 | {meta.title} | Jest Coverage Report action 27 | 28 | 29 | 30 | {children} 31 | 32 | 33 | 34 | 35 | 36 | {Array.isArray(meta.related) && ( 37 | 38 | 43 | Related 44 | 45 | 46 | {meta.related.map((link: string) => ( 47 | 48 | 49 | {link 50 | .split('/') 51 | .reverse()[0] 52 | .split('-') 53 | .join(' ')} 54 | 55 | 56 | ))} 57 | 58 | 59 | )} 60 | 61 | 64 | View this page on GitHub 65 | 66 | 67 | 68 | 69 | ); 70 | }; 71 | -------------------------------------------------------------------------------- /docs/src/components/layouts/LayoutProps.ts: -------------------------------------------------------------------------------- 1 | import { PropsWithChildren } from 'react'; 2 | 3 | export type LayoutProps = PropsWithChildren<{ 4 | meta: Record; 5 | }>; 6 | -------------------------------------------------------------------------------- /docs/src/components/markdown/Code.module.scss: -------------------------------------------------------------------------------- 1 | .code { 2 | border-radius: var(--chakra-sizes-2); 3 | overflow: hidden; 4 | margin: var(--chakra-sizes-2) 0; 5 | } 6 | -------------------------------------------------------------------------------- /docs/src/components/markdown/Code.tsx: -------------------------------------------------------------------------------- 1 | import { Box, CircularProgress } from '@chakra-ui/react'; 2 | import { CodeProps } from '@mdx-js/react'; 3 | import { DiffEditor, DiffEditorProps } from '@monaco-editor/react'; 4 | import React from 'react'; 5 | 6 | import classes from './Code.module.scss'; 7 | import { EditorWithCopy } from '../EditorWithCopy'; 8 | 9 | const staticProps = { 10 | options: { 11 | readOnly: true, 12 | scrollBeyondLastLine: false, 13 | scrollbar: { 14 | vertical: 'hidden', 15 | handleMouseWheel: false, 16 | }, 17 | }, 18 | blockClassName: classes['code'], 19 | } as const; 20 | 21 | const additionsRegex = /^\+(\s[^\n]*\n)/gm; 22 | const deletionsRegex = /^-(\s[^\n]*\n)/gm; 23 | 24 | const getOriginalCode = (code: string) => 25 | code.replace(additionsRegex, '').replace(deletionsRegex, ' $1'); 26 | const getModifiedCode = (code: string) => 27 | code.replace(deletionsRegex, '').replace(additionsRegex, ' $1'); 28 | 29 | const WrappedDiffEditor = ({ 30 | blockClassName, 31 | ...other 32 | }: DiffEditorProps & { blockClassName?: string }) => ( 33 | 38 | 39 | 40 | ); 41 | 42 | export const Code = ({ children, className, diff }: CodeProps) => { 43 | const Component = diff ? WrappedDiffEditor : EditorWithCopy; 44 | 45 | const language = className.replace('language-', ''); 46 | 47 | let lineCount; 48 | 49 | if (diff) { 50 | lineCount = Math.max( 51 | getOriginalCode(children).split('\n').length, 52 | getModifiedCode(children).split('\n').length 53 | ); 54 | } else { 55 | lineCount = children.split('\n').length; 56 | } 57 | 58 | return ( 59 | } 62 | theme="vs-dark" 63 | height={Math.max(lineCount * 19, 80) + 'px'} 64 | value={children} 65 | original={diff && getOriginalCode(children)} 66 | modified={diff && getModifiedCode(children)} 67 | language={language} 68 | originalLanguage={language} 69 | modifiedLanguage={language} 70 | /> 71 | ); 72 | }; 73 | -------------------------------------------------------------------------------- /docs/src/components/markdown/MarkdownHeading.module.scss: -------------------------------------------------------------------------------- 1 | .heading { 2 | $parent-name: &; 3 | cursor: pointer; 4 | &__anchor { 5 | transform: translateY(-65px); 6 | align-self: flex-start; 7 | } 8 | &__icon { 9 | color: var(--chakra-colors-gray-900); 10 | opacity: 0; 11 | margin: 0 5px; 12 | opacity: 0.6; 13 | } 14 | &:hover { 15 | #{$parent-name}__icon { 16 | opacity: 0.85; 17 | } 18 | } 19 | &:active { 20 | #{$parent-name}__icon { 21 | opacity: 1; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docs/src/components/markdown/MarkdownHeading.tsx: -------------------------------------------------------------------------------- 1 | import { Flex, Heading, HeadingProps, useStyleConfig } from '@chakra-ui/react'; 2 | import { HashIcon } from '@primer/octicons-react'; 3 | import Link from 'next/link'; 4 | import React from 'react'; 5 | 6 | import classes from './MarkdownHeading.module.scss'; 7 | 8 | export type MarkdownHeadingProps = HeadingProps; 9 | 10 | export const MarkdownHeading = ({ 11 | id, 12 | children, 13 | ...props 14 | }: MarkdownHeadingProps) => { 15 | const { fontSize } = useStyleConfig('Heading', props); 16 | 17 | return ( 18 | 19 | 27 | 28 | 29 | 35 | {children} 36 | 37 | 38 | 39 | ); 40 | }; 41 | -------------------------------------------------------------------------------- /docs/src/components/markdown/MarkdownWrapper.tsx: -------------------------------------------------------------------------------- 1 | import { MDXProvider } from '@mdx-js/react'; 2 | import React, { PropsWithChildren } from 'react'; 3 | 4 | import { components } from './components'; 5 | 6 | export const MarkdownWrapper = ({ children }: PropsWithChildren<{}>) => ( 7 | {children} 8 | ); 9 | -------------------------------------------------------------------------------- /docs/src/components/markdown/MdLink.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | Link as ChakraLink, 3 | LinkProps as ChakraLinkProps, 4 | } from '@chakra-ui/react'; 5 | import NextLink from 'next/link'; 6 | import React from 'react'; 7 | 8 | export type MdLinkProps = ChakraLinkProps & { 9 | href: string; 10 | }; 11 | 12 | export const MdLink = ({ href, ...other }: MdLinkProps) => ( 13 | 14 | 15 | 16 | ); 17 | -------------------------------------------------------------------------------- /docs/src/components/markdown/components.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | Code as ChakraInlineCode, 3 | ListItem, 4 | OrderedList, 5 | Text, 6 | UnorderedList, 7 | } from '@chakra-ui/react'; 8 | import { Components } from '@mdx-js/react'; 9 | import React from 'react'; 10 | 11 | import { Code } from './Code'; 12 | import { MarkdownHeading } from './MarkdownHeading'; 13 | import { MdLink } from './MdLink'; 14 | import { ResponsiveImage } from '../ResponsiveImage'; 15 | 16 | export const components: Components = { 17 | h1: (props) => , 18 | h2: (props) => , 19 | h3: (props) => , 20 | h4: (props) => , 21 | h5: (props) => , 22 | h6: (props) => , 23 | ol: OrderedList, 24 | ul: UnorderedList, 25 | li: ListItem, 26 | a: MdLink, 27 | p: Text, 28 | code: Code, 29 | inlineCode: (props) => ( 30 | 34 | ), 35 | ResponsiveImage, 36 | }; 37 | -------------------------------------------------------------------------------- /docs/src/pages/Home.module.scss: -------------------------------------------------------------------------------- 1 | @keyframes text-clip { 2 | from { 3 | opacity: 0; 4 | transform: translateX(-10px); 5 | } 6 | to { 7 | opacity: 1; 8 | transform: translateX(0); 9 | } 10 | } 11 | 12 | .accentText, 13 | .tryIt { 14 | opacity: 0; 15 | animation: text-clip 0.5s ease-in-out forwards; 16 | animation-delay: 0.5s; 17 | } 18 | 19 | .tryIt { 20 | animation-delay: 0.7s; 21 | } 22 | 23 | .readonlyEditor { 24 | border-radius: 10px 10px 0 0; 25 | overflow: hidden; 26 | } 27 | 28 | .blob { 29 | position: absolute; 30 | bottom: 5px; 31 | max-width: 1000px; 32 | min-width: 400px; 33 | left: 0; 34 | transform: translateX(-50%) translateY(50%); 35 | z-index: 0; 36 | } 37 | 38 | .dots-grid { 39 | position: absolute; 40 | bottom: -5px; 41 | right: -10px; 42 | z-index: 0; 43 | pointer-events: none; 44 | } 45 | -------------------------------------------------------------------------------- /docs/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { ChakraProvider } from '@chakra-ui/react'; 2 | import ThemeProvider from '@primer/components/lib/ThemeProvider'; 3 | import { AppProps } from 'next/app'; 4 | import React from 'react'; 5 | 6 | import '../../styles/globals.css'; 7 | 8 | import { LinkProps } from 'src/components/LinkProps'; 9 | import { Footer } from '../components/Footer'; 10 | import { Header } from '../components/Header'; 11 | import { theme } from '../theme'; 12 | 13 | const links: Array = [ 14 | { 15 | label: 'Home', 16 | href: '/', 17 | }, 18 | { 19 | label: 'Quick start', 20 | href: '/quick-start', 21 | }, 22 | { 23 | label: 'Upgrading to v2', 24 | href: '/migrate', 25 | }, 26 | { 27 | label: 'Configuration', 28 | href: '/configuration', 29 | }, 30 | ]; 31 | 32 | const App = ({ Component, pageProps }: AppProps) => ( 33 | 34 | 35 |
36 |
37 | 38 |
39 |