mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
ci: upload eslint annotations (#490)
* ci: upload eslint annotations * ci: update `upload-annotations.yml`
This commit is contained in:
parent
71465ca999
commit
4a904f2953
8 changed files with 54 additions and 0 deletions
34
.github/workflows/upload-annotations.yml
vendored
Normal file
34
.github/workflows/upload-annotations.yml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
name: Upload Annotations
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
upload-annotations:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node and pnpm
|
||||
uses: logto-io/actions-node-pnpm-run-steps@v1.0.2
|
||||
|
||||
- name: Prepack
|
||||
run: pnpm prepack
|
||||
|
||||
- name: Lint with Report
|
||||
run: pnpm -- lerna run --parallel lint:report && node merge-eslint-reports.js
|
||||
|
||||
- name: Annotate Code Linting Results
|
||||
uses: ataylorme/eslint-annotate-action@1.2.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload ESLint report
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: eslint_report.json
|
||||
path: eslint_report.json
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -8,6 +8,10 @@ node_modules
|
|||
# testing
|
||||
/packages/*/coverage
|
||||
|
||||
# report
|
||||
/report.json
|
||||
/packages/*/report.json
|
||||
|
||||
# production
|
||||
/packages/*/build
|
||||
/packages/*/lib
|
||||
|
|
11
merge-eslint-reports.js
Normal file
11
merge-eslint-reports.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const fs = require('fs');
|
||||
|
||||
const directories = fs.readdirSync('./packages');
|
||||
const reports = directories.map((dir) => fs.readFileSync(`./packages/${dir}/report.json`, { encoding: 'utf-8' }));
|
||||
const merged = [];
|
||||
|
||||
for (const report of reports) {
|
||||
merged.push(...JSON.parse(report));
|
||||
}
|
||||
|
||||
fs.writeFileSync('./eslint_report.json', JSON.stringify(merged));
|
|
@ -14,6 +14,7 @@
|
|||
"check": "tsc --noEmit",
|
||||
"build": "pnpm check && rm -rf dist && pnpm copyfiles && parcel build src/index.html --no-autoinstall --public-url /console",
|
||||
"lint": "eslint --ext .ts --ext .tsx src",
|
||||
"lint:report": "pnpm lint -- --format json --output-file report.json",
|
||||
"stylelint": "stylelint \"src/**/*.scss\""
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
"copyfiles": "copyfiles -u 1 src/**/*.md build",
|
||||
"build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm run copyfiles",
|
||||
"lint": "eslint --ext .ts src",
|
||||
"lint:report": "pnpm lint -- --format json --output-file report.json",
|
||||
"dev": "rm -rf build/ && pnpm run copyfiles && tsc-watch -p tsconfig.build.json --preserveWatchOutput --onSuccess \"node ./build/index.js\"",
|
||||
"start": "NODE_ENV=production node build/index.js",
|
||||
"test": "jest",
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
"precommit": "lint-staged",
|
||||
"build": "rm -rf lib/ && tsc",
|
||||
"lint": "eslint --ext .ts src",
|
||||
"lint:report": "pnpm lint -- --format json --output-file report.json",
|
||||
"prepack": "pnpm build"
|
||||
},
|
||||
"bugs": {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"generate": "rm -rf src/db-entries && ts-node src/gen/index.ts && eslint \"src/db-entries/**\" --fix",
|
||||
"build": "pnpm generate && rm -rf lib/ && tsc --p tsconfig.build.json",
|
||||
"lint": "eslint --ext .ts src",
|
||||
"lint:report": "pnpm lint -- --format json --output-file report.json",
|
||||
"prepack": "pnpm build"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"check": "tsc --noEmit",
|
||||
"build": "pnpm check && rm -rf dist && parcel build src/index.html --no-autoinstall",
|
||||
"lint": "eslint --ext .ts --ext .tsx src",
|
||||
"lint:report": "pnpm lint -- --format json --output-file report.json",
|
||||
"stylelint": "stylelint \"src/**/*.scss\"",
|
||||
"test": "jest"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue