Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beerose/tsc-diagnostics-diff-action
https://github.com/beerose/tsc-diagnostics-diff-action
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/beerose/tsc-diagnostics-diff-action
- Owner: beerose
- License: mit
- Created: 2023-05-09T15:34:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-17T17:19:32.000Z (about 1 year ago)
- Last Synced: 2024-10-20T10:13:21.567Z (2 months ago)
- Language: TypeScript
- Size: 741 KB
- Stars: 65
- Watchers: 1
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# TypeScript Performance Diagnostics Diff Action
This GitHub action allows you to measure and track TypeScript performance regressions in your projects by comparing `tsc --diagnostics` (or `--extendedDiagnostics` based on your configuration) outputs between the base branch and the current branch.
## Inputs
- `base-branch`: The branch that the actions should use to compare TSC performance (default: 'main').
- `custom-command`: Allows to override the default type check command. Your custom command should print either --diagnostics or --extendedDiagnostics output. (default: `yarn tsc --noEmit --incremental false --diagnostics/--extendedDiagnostics`).
- `leave-comment`: Indicates whether the action should leave a comment on a PR. Enabling this requires providing the github-token input (default: false).
- `github-token`: GitHub API token. Necessary to leave comments on your PRs.
- `extended`: Indicates whether the actions should use --extendedDiagnostics over --diagnostics (default: false).## Usage
You can add this action to your workflow file like this:
```yaml
name: Check TypeScript Performanceon:
pull_request:jobs:
check-performance:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: npm ci
- name: TSC Diagnostics Diff
uses: beerose/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
leave-comment: true
```This example uses `GITHUB_TOKEN` to leave a comment on PRs with the diagnostics comparison.
## Example output
## Development
Install the dependencies
```bash
$ npm install
```Build the typescript and package it for distribution
```bash
$ npm run build && npm run package
```Run the tests :heavy_check_mark:
```bash
$ npm testPASS ./index.test.js
✓ throws invalid number (3ms)
✓ wait 500 ms (504ms)
✓ test runs (95ms)...
```## Publish to a distribution branch
Actions are run from GitHub repos so we will checkin the packed dist folder.
Then run [ncc](https://github.com/zeit/ncc) and push the results:
```bash
$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1
```## Validate
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml))
```yaml
uses: ./
with: ...
```See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket: