Skip to content

Commit

Permalink
chore: Improved prettier, eslint and vitest config and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
spuxx-dev committed Jul 29, 2024
1 parent 4501386 commit ed8fc15
Show file tree
Hide file tree
Showing 22 changed files with 54 additions and 78 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ jobs:
uses: spuxx1701/ci-cd/.github/workflows/[email protected]
needs:
- install_deps
with:
PNPM_FLAGS: --recursive

run_unit_tests:
name: Run unit tests
uses: spuxx1701/ci-cd/.github/workflows/[email protected]
needs:
- install_deps
with:
PNPM_FLAGS: --recursive
COVERAGE_FILENAME: reports/vitest/coverage/cobertura-coverage.xml
COVERAGE_FAIL_BELOW_MIN: 100
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
name: Run code checks
uses: spuxx1701/ci-cd/.github/workflows/[email protected]
needs:
- install_deps
- install_deps

run_unit_tests:
name: Run unit tests
uses: spuxx1701/ci-cd/.github/workflows/[email protected]
needs:
- install_deps
- install_deps
with:
COVERAGE_FILENAME: reports/vitest/coverage/cobertura-coverage.xml
COVERAGE_FAIL_BELOW_MIN: 100
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
tags:
- v*
- v*

jobs:
install_deps:
Expand All @@ -15,13 +15,13 @@ jobs:
name: Run code checks
uses: spuxx1701/ci-cd/.github/workflows/[email protected]
needs:
- install_deps
- install_deps

run_unit_tests:
name: Run unit tests
uses: spuxx1701/ci-cd/.github/workflows/[email protected]
needs:
- install_deps
- install_deps
with:
COVERAGE_FILENAME: reports/vitest/coverage/cobertura-coverage.xml
COVERAGE_FAIL_BELOW_MIN: 100
Expand All @@ -30,13 +30,13 @@ jobs:
name: Build artifact
uses: spuxx1701/ci-cd/.github/workflows/[email protected]
needs:
- run_checks
- run_unit_tests
- run_checks
- run_unit_tests

publish:
name: Publish artifact
uses: spuxx1701/ci-cd/.github/workflows/[email protected]
needs:
- build
- build
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dist-ssr
*.local

# Reports
coverage/
reports/
pnpm-publish-summary.json

Expand Down
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
pnpm-lock.yaml
pnpm-lock.yaml
reports/
dist/
.github/
10 changes: 5 additions & 5 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports ={
"singleQuote": true,
"trailingComma": "all",
"printWidth": 120
}
module.exports = {
singleQuote: true,
trailingComma: 'all',
printWidth: 120,
};
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# web-libs

A metarepository containing various libraries I maintain for my typical web stack.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
"url": "https://github.com/spuxx1701/web-libs/issues"
},
"packageManager": "[email protected]",
"scripts": {
"test": "pnpm run test:unit",
"test:unit": "vitest run --coverage",
"check": "pnpm types && pnpm run lint && pnpm run prettier-check",
"types": "tsc --noEmit",
"lint": "eslint . --ext ts,tsx",
"prettier-check": "prettier --check .",
"format": "prettier --write ."
},
"devDependencies": {
"typescript": "5.5.4",
"@types/node": "22.0.0",
Expand Down
5 changes: 0 additions & 5 deletions packages/browser-utils/.eslintrc.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions packages/browser-utils/.prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions packages/browser-utils/.prettierrc.cjs

This file was deleted.

10 changes: 1 addition & 9 deletions packages/browser-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,7 @@
"package.json"
],
"scripts": {
"start": "vite dev app",
"build": "vite build",
"test": "pnpm run test:unit",
"test:unit": "vitest run --coverage --reporter=default --reporter=junit --outputFile='reports/junit/junit.xml'",
"check": "pnpm types && pnpm run lint && pnpm run prettier-check",
"types": "tsc --noEmit",
"lint": "eslint . --ext ts,tsx",
"prettier-check": "prettier --check .",
"format": "prettier --write ."
"build": "vite build"
},
"peerDependencies": {
"@modyfi/vite-plugin-yaml": "^1.1.0"
Expand Down
5 changes: 0 additions & 5 deletions packages/js-utils/.eslintrc.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions packages/js-utils/.prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions packages/js-utils/.prettierrc.cjs

This file was deleted.

9 changes: 1 addition & 8 deletions packages/js-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@
"package.json"
],
"scripts": {
"build": "vite build",
"test": "pnpm run test:unit",
"test:unit": "vitest run --coverage --reporter=default --reporter=junit --outputFile='reports/junit/junit.xml'",
"check": "pnpm types && pnpm run lint && pnpm run prettier-check",
"types": "tsc --noEmit",
"lint": "eslint . --ext ts,tsx",
"prettier-check": "prettier --check .",
"format": "prettier --write ."
"build": "vite build"
},
"peerDependencies": {
"@modyfi/vite-plugin-yaml": "^1.1.0"
Expand Down
4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- 'packages/*'
- 'test-apps/*'
- 'packages/*'
- 'test-apps/*'
5 changes: 0 additions & 5 deletions test-apps/react/.eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion test-apps/react/.prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions test-apps/react/.prettierrc.cjs

This file was deleted.

7 changes: 1 addition & 6 deletions test-apps/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
"type": "module",
"private": true,
"scripts": {
"dev": "vite dev",
"check": "pnpm types && pnpm run lint && pnpm run prettier-check",
"types": "tsc --noEmit",
"lint": "eslint . --ext ts,tsx",
"prettier-check": "prettier --check .",
"format": "prettier --write ."
"dev": "vite dev"
},
"dependencies": {
"@spuxx/js-utils": "workspace:@spuxx/browser-utils@*",
Expand Down
22 changes: 22 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference types="vitest" />
import baseConfig from './vite.config';
import { mergeConfig, defineConfig } from 'vite';

export default mergeConfig(
baseConfig,
defineConfig({
test: {
setupFiles: ['tests/vitest/vitest.setup.ts'],
reporters: ['default', 'junit'],
outputFile: 'reports/junit/junit.xml',
coverage: {
provider: 'v8',
all: true,
include: ['packages/**/*.ts'],
exclude: ['src/main.ts', '**/*types.ts'],
reportsDirectory: 'reports/vitest/coverage',
reporter: ['text', 'cobertura'],
},
},
}),
);

0 comments on commit ed8fc15

Please sign in to comment.