From ed8b9c905da693b4ba7a9a1558c704ddaed1d5f4 Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 17 Jul 2024 13:49:22 +0200 Subject: [PATCH 1/8] Switched to modern tools --- .eslintrc | 20 - .github/workflows/pull-request.yaml | 76 ++++ .prettierrc | 3 - .vscode/settings.json | 34 ++ biome.json | 55 +++ lefthook.yml | 10 + package-lock.json | 569 +++++++++++++++------------- package.json | 19 +- vitest.config.ts | 2 + 9 files changed, 489 insertions(+), 299 deletions(-) delete mode 100644 .eslintrc create mode 100644 .github/workflows/pull-request.yaml delete mode 100644 .prettierrc create mode 100644 .vscode/settings.json create mode 100644 biome.json create mode 100644 lefthook.yml diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 6c4e71b..0000000 --- a/.eslintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true - }, - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - - "plugins": ["@typescript-eslint", "unused-imports"], - "rules": { - "quotes": ["error", "double"], - "semi": ["error", "always"], - "@typescript-eslint/no-explicit-any": "off", - "unused-imports/no-unused-imports": "error" - } -} diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..9d45324 --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,76 @@ +name: 🚀 PR + +concurrency: + group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: [pull_request] # Run only on pull_request, to also get status updates in PRs. We omit push because this would run the steps two times (for push and pull_request). + +permissions: + actions: write + contents: read + # Required to put a comment into the pull-request + pull-requests: write + +jobs: + lint: + name: ⬣ Linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: biomejs/setup-biome@v2 + - run: biome ci . --reporter=github + + typecheck: + name: 🔎 Type check + runs-on: ubuntu-latest + steps: + - name: 🛑 Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + + - name: ⎔ Setup node + uses: actions/setup-node@v4 + with: + node-version-file: "package.json" + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: 🔎 Type check + run: npm run typecheck + + vitest: + name: ⚡ Unit Tests + runs-on: ubuntu-latest + steps: + - name: 🛑 Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + + - name: ⎔ Setup node + uses: actions/setup-node@v4 + with: + node-version-file: "package.json" + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: Install dotenv cli + run: npm install -g dotenv-cli + + - name: ⚡ Run vitest + run: npm run test:cov + + - name: "Report Coverage" + # Only works if you set `reportOnFailure: true` in your vite config as specified above + if: always() + uses: davelosert/vitest-coverage-report-action@v2 diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 94d737c..0000000 --- a/.prettierrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "printWidth": 120 -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..193bdf2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,34 @@ +{ + "biome.enabled": true, + "editor.defaultFormatter": "biomejs.biome", + "editor.formatOnSave": true, + "javascript.format.enable": false, + "javascript.suggest.autoImports": true, + "javascript.suggest.paths": true, + "typescript.format.enable": false, + "typescript.suggest.paths": true, + "typescript.suggest.autoImports": true, + "editor.renderWhitespace": "all", + "editor.rulers": [120, 160], + "editor.codeActionsOnSave": { + "source.fixAll": "always", + "source.organizeImports": "never", + "source.organizeImports.biome": "always", + "quickfix.biome": "always" + }, + "editor.insertSpaces": false, + "editor.detectIndentation": true, + "editor.trimAutoWhitespace": true, + "files.trimTrailingWhitespace": true, + "files.trimTrailingWhitespaceInRegexAndStrings": true, + "files.trimFinalNewlines": true, + "explorer.fileNesting.patterns": { + "*.ts": "${basename}.*.${extname}", + ".env": ".env.*", + "*.tsx": "${basename}.*.${extname},${basename}.*.ts", + "package.json": "*.json, *.yml, *.config.js, *.config.ts, *.yaml" + }, + "eslint.enable": false, + "eslint.format.enable": false, + "prettier.enable": false +} diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..1d0b8f5 --- /dev/null +++ b/biome.json @@ -0,0 +1,55 @@ +{ + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "defaultBranch": "main", + "useIgnoreFile": true + }, + "formatter": { + "enabled": true, + "formatWithErrors": false, + "indentStyle": "tab", + "lineEnding": "lf", + "lineWidth": 120 + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "suspicious": { + "recommended": true + }, + "style": { + "recommended": true + }, + "complexity": { + "recommended": true + }, + "security": { + "recommended": true + }, + "performance": { + "recommended": true + }, + "correctness": { + "recommended": true + }, + "a11y": { + "recommended": true + }, + "nursery": { + "recommended": true + } + } + }, + "javascript": { + "formatter": { + "semicolons": "asNeeded", + "trailingCommas": "es5" + } + } +} \ No newline at end of file diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..e93e218 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,10 @@ +pre-commit: + parallel: true + commands: + check: + run: npm run check -- --staged --fix --no-errors-on-unmatched + stage_fixed: true + typecheck: + run: npm run typecheck + test: + run: npm run test diff --git a/package-lock.json b/package-lock.json index 3c07573..a08190d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,14 +13,11 @@ "test-apps/*" ], "devDependencies": { + "@biomejs/biome": "^1.8.3", "@types/node": "^20.12.7", - "@typescript-eslint/eslint-plugin": "^7.5.0", - "@typescript-eslint/parser": "^7.5.0", "@vitest/coverage-v8": "^1.5.2", - "eslint": "8.56", - "eslint-plugin-unused-imports": "^3.1.0", "happy-dom": "^14.7.1", - "husky": "^9.0.11", + "lefthook": "^1.7.2", "npm-run-all": "^4.1.5", "tsup": "^8.0.2", "typescript": "^5.4.5", @@ -683,6 +680,161 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@biomejs/biome": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.8.3.tgz", + "integrity": "sha512-/uUV3MV+vyAczO+vKrPdOW0Iaet7UnJMU4bNMinggGJTAnBPjCoLEYcyYtYHNnUNYlv4xZMH6hVIQCAozq8d5w==", + "dev": true, + "hasInstallScript": true, + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.8.3", + "@biomejs/cli-darwin-x64": "1.8.3", + "@biomejs/cli-linux-arm64": "1.8.3", + "@biomejs/cli-linux-arm64-musl": "1.8.3", + "@biomejs/cli-linux-x64": "1.8.3", + "@biomejs/cli-linux-x64-musl": "1.8.3", + "@biomejs/cli-win32-arm64": "1.8.3", + "@biomejs/cli-win32-x64": "1.8.3" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.8.3.tgz", + "integrity": "sha512-9DYOjclFpKrH/m1Oz75SSExR8VKvNSSsLnVIqdnKexj6NwmiMlKk94Wa1kZEdv6MCOHGHgyyoV57Cw8WzL5n3A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.8.3.tgz", + "integrity": "sha512-UeW44L/AtbmOF7KXLCoM+9PSgPo0IDcyEUfIoOXYeANaNXXf9mLUwV1GeF2OWjyic5zj6CnAJ9uzk2LT3v/wAw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.8.3.tgz", + "integrity": "sha512-fed2ji8s+I/m8upWpTJGanqiJ0rnlHOK3DdxsyVLZQ8ClY6qLuPc9uehCREBifRJLl/iJyQpHIRufLDeotsPtw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.8.3.tgz", + "integrity": "sha512-9yjUfOFN7wrYsXt/T/gEWfvVxKlnh3yBpnScw98IF+oOeCYb5/b/+K7YNqKROV2i1DlMjg9g/EcN9wvj+NkMuQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.8.3.tgz", + "integrity": "sha512-I8G2QmuE1teISyT8ie1HXsjFRz9L1m5n83U1O6m30Kw+kPMPSKjag6QGUn+sXT8V+XWIZxFFBoTDEDZW2KPDDw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.8.3.tgz", + "integrity": "sha512-UHrGJX7PrKMKzPGoEsooKC9jXJMa28TUSMjcIlbDnIO4EAavCoVmNQaIuUSH0Ls2mpGMwUIf+aZJv657zfWWjA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.8.3.tgz", + "integrity": "sha512-J+Hu9WvrBevfy06eU1Na0lpc7uR9tibm9maHynLIoAjLZpQU3IW+OKHUtyL8p6/3pT2Ju5t5emReeIS2SAxhkQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.8.3.tgz", + "integrity": "sha512-/PJ59vA1pnQeKahemaQf4Nyj7IKUvGQSc3Ze1uIGi+Wvr1xF7rGobSrAAG01T/gUDG21vkDsZYM03NAmPiVkqg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, "node_modules/@emotion/hash": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.1.tgz", @@ -2511,220 +2663,6 @@ "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", "dev": true }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.5.0.tgz", - "integrity": "sha512-HpqNTH8Du34nLxbKgVMGljZMG0rJd2O9ecvr2QLYp+7512ty1j42KnsFwspPXg1Vh8an9YImf6CokUBltisZFQ==", - "dev": true, - "dependencies": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.5.0", - "@typescript-eslint/type-utils": "7.5.0", - "@typescript-eslint/utils": "7.5.0", - "@typescript-eslint/visitor-keys": "7.5.0", - "debug": "^4.3.4", - "graphemer": "^1.4.0", - "ignore": "^5.2.4", - "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^7.0.0", - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.5.0.tgz", - "integrity": "sha512-cj+XGhNujfD2/wzR1tabNsidnYRaFfEkcULdcIyVBYcXjBvBKOes+mpMBP7hMpOyk+gBcfXsrg4NBGAStQyxjQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/scope-manager": "7.5.0", - "@typescript-eslint/types": "7.5.0", - "@typescript-eslint/typescript-estree": "7.5.0", - "@typescript-eslint/visitor-keys": "7.5.0", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.5.0.tgz", - "integrity": "sha512-Z1r7uJY0MDeUlql9XJ6kRVgk/sP11sr3HKXn268HZyqL7i4cEfrdFuSSY/0tUqT37l5zT0tJOsuDP16kio85iA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.5.0", - "@typescript-eslint/visitor-keys": "7.5.0" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.5.0.tgz", - "integrity": "sha512-A021Rj33+G8mx2Dqh0nMO9GyjjIBK3MqgVgZ2qlKf6CJy51wY/lkkFqq3TqqnH34XyAHUkq27IjlUkWlQRpLHw==", - "dev": true, - "dependencies": { - "@typescript-eslint/typescript-estree": "7.5.0", - "@typescript-eslint/utils": "7.5.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/types": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.5.0.tgz", - "integrity": "sha512-tv5B4IHeAdhR7uS4+bf8Ov3k793VEVHd45viRRkehIUZxm0WF82VPiLgHzA/Xl4TGPg1ZD49vfxBKFPecD5/mg==", - "dev": true, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.5.0.tgz", - "integrity": "sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.5.0", - "@typescript-eslint/visitor-keys": "7.5.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/utils": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.5.0.tgz", - "integrity": "sha512-3vZl9u0R+/FLQcpy2EHyRGNqAS/ofJ3Ji8aebilfJe+fobK8+LbIFmrHciLVDxjDoONmufDcnVSF38KwMEOjzw==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.5.0", - "@typescript-eslint/types": "7.5.0", - "@typescript-eslint/typescript-estree": "7.5.0", - "semver": "^7.5.4" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.5.0.tgz", - "integrity": "sha512-mcuHM/QircmA6O7fy6nn2w/3ditQkj+SgtOc8DW3uQ10Yfj42amm2i+6F2K4YAOPNNTmE6iM1ynM6lrSwdendA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.5.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", @@ -4940,36 +4878,6 @@ "semver": "bin/semver.js" } }, - "node_modules/eslint-plugin-unused-imports": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.1.0.tgz", - "integrity": "sha512-9l1YFCzXKkw1qtAru1RWUtG2EVDZY0a0eChKXcL+EZ5jitG7qxdctu4RnvhOJHv4xfmUf7h+JJPINlVpGhZMrw==", - "dev": true, - "dependencies": { - "eslint-rule-composer": "^0.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "@typescript-eslint/eslint-plugin": "6 - 7", - "eslint": "8" - }, - "peerDependenciesMeta": { - "@typescript-eslint/eslint-plugin": { - "optional": true - } - } - }, - "node_modules/eslint-rule-composer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", - "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", - "dev": true, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -6020,21 +5928,6 @@ "node": ">=10.17.0" } }, - "node_modules/husky": { - "version": "9.0.11", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", - "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", - "dev": true, - "bin": { - "husky": "bin.mjs" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/typicode" - } - }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -6935,6 +6828,154 @@ "node": ">=0.10" } }, + "node_modules/lefthook": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook/-/lefthook-1.7.2.tgz", + "integrity": "sha512-QCCq6KyVAVYBuxWf338TjMAjjGesyNRtfxJhjYV+kpUkd5ST2yr8ZUJrcEKe+0cUfziPOQ9Hz+1JZniXJx+JqA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "lefthook": "bin/index.js" + }, + "optionalDependencies": { + "lefthook-darwin-arm64": "1.7.2", + "lefthook-darwin-x64": "1.7.2", + "lefthook-freebsd-arm64": "1.7.2", + "lefthook-freebsd-x64": "1.7.2", + "lefthook-linux-arm64": "1.7.2", + "lefthook-linux-x64": "1.7.2", + "lefthook-windows-arm64": "1.7.2", + "lefthook-windows-x64": "1.7.2" + } + }, + "node_modules/lefthook-darwin-arm64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.7.2.tgz", + "integrity": "sha512-E3Ouk04/yeD8IBLGJkyzL0NMYIrjADQvaDbf4yNSq6HWGnUC0R2KpYxrZno2yahZnvQ0vYTDta7Egw6cqcYGlQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "bin": { + "lefthook": "bin/lefthook" + } + }, + "node_modules/lefthook-darwin-x64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook-darwin-x64/-/lefthook-darwin-x64-1.7.2.tgz", + "integrity": "sha512-Am6ZNmjItQSqKbK8/spFIj5GDWNHJ47PM0vpT1PnBHrgWanjz0iLw6adwpMu8u7+CkZlHjp08lbvjBPGHIu3dg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "bin": { + "lefthook": "bin/lefthook" + } + }, + "node_modules/lefthook-freebsd-arm64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.7.2.tgz", + "integrity": "sha512-o1LBgHhwnUOLs9iVbi1GhvXMQlzYSKnyFcc061iADxHMJk1xWMD6RUyyohmLbfEU0gTWxkRfkdAFvbvwNqQiww==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "bin": { + "lefthook": "bin/lefthook" + } + }, + "node_modules/lefthook-freebsd-x64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.7.2.tgz", + "integrity": "sha512-vxB3FeeFYDfk4vAahaZdGJ7gbViGOkOyL5JRBDWlFjUfZJLGwVauf6GhtysdO1dgxs9K3ECdEtXgW+uOB872rQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "bin": { + "lefthook": "bin/lefthook" + } + }, + "node_modules/lefthook-linux-arm64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook-linux-arm64/-/lefthook-linux-arm64-1.7.2.tgz", + "integrity": "sha512-4dbVj5Jjy12flAyOcVWvWQ6gJoQ6X7HJ3qfsrM8/GIfLQBlkw+YRcLuWHUI3H9qsQFpkpYZsLcmUXoVM77z5mw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "bin": { + "lefthook": "bin/lefthook" + } + }, + "node_modules/lefthook-linux-x64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook-linux-x64/-/lefthook-linux-x64-1.7.2.tgz", + "integrity": "sha512-lT0IRp1pGtbua8IWVeIVCSAxKex9fOyAexHaEmBZytfqr/94lpjzWWEQdLFQAlpZthuyCkuaJp5kLgMj6/IySQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "bin": { + "lefthook": "bin/lefthook" + } + }, + "node_modules/lefthook-windows-arm64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook-windows-arm64/-/lefthook-windows-arm64-1.7.2.tgz", + "integrity": "sha512-DxWLmcNI3NICd4rFqTPgXf+G/97ztl+ONvYuNE/ELAxVp338xAUFvzZCQvDZDzeTLrT1C4hZZ4zDvEhnOOECXg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "bin": { + "lefthook": "bin/lefthook" + } + }, + "node_modules/lefthook-windows-x64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/lefthook-windows-x64/-/lefthook-windows-x64-1.7.2.tgz", + "integrity": "sha512-fL4F8/XXoYUJJ6GSYCwFL+bRufzbkeMSGYZKUDr6ZKOI4KafIEcgFNwlnQF03gY6vkUrYKksXQofOVlOfv3vPA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "bin": { + "lefthook": "bin/lefthook" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", diff --git a/package.json b/package.json index adebed6..08c68f8 100644 --- a/package.json +++ b/package.json @@ -31,12 +31,11 @@ "build:dev:cjs:watch": "npm run build:dev -- --watch", "dev": "npm-run-all -s build:dev -p remix:dev build:dev:watch", "dev:cjs": "npm-run-all -s build:dev -p remix:cjs:dev build:dev:cjs:watch", - "lint": "eslint src/**/*.ts", - "lint:fix": "eslint src/**/*.ts --fix", "prepublishOnly": "npm run build", + "check": "biome check .", + "check:fix": "biome check --fix .", "tsc": "tsc", - "validate": "npm run lint && npm run tsc && npm run test", - "prepare": "husky" + "validate": "npm run check && npm run tsc && npm run test" }, "author": "", "license": "ISC", @@ -55,17 +54,13 @@ "test-apps/*" ], "homepage": "https://github.com/forge42dev/open-source-stack#readme", - "dependencies": {}, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^7.5.0", - "@typescript-eslint/parser": "^7.5.0", - "@vitest/coverage-v8": "^1.5.2", - "eslint": "8.56", - "eslint-plugin-unused-imports": "^3.1.0", - "npm-run-all": "^4.1.5", + "@biomejs/biome": "^1.8.3", "@types/node": "^20.12.7", + "@vitest/coverage-v8": "^1.5.2", "happy-dom": "^14.7.1", - "husky": "^9.0.11", + "lefthook": "^1.7.2", + "npm-run-all": "^4.1.5", "tsup": "^8.0.2", "typescript": "^5.4.5", "vitest": "^1.5.2" diff --git a/vitest.config.ts b/vitest.config.ts index c4bf590..47f46b5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,7 +6,9 @@ export default defineConfig({ setupFiles: ["./tests/setup.ts"], environment: "node", globals: true, + coverage: { + all: false, provider: "v8", }, }, From 03be46a1d3c1546e2dcf32df8b6191ca0214bee6 Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 17 Jul 2024 13:57:28 +0200 Subject: [PATCH 2/8] Switched to modern tools --- .husky/_/pre-commit | 63 +++++++++++++++++ .husky/_/prepare-commit-msg | 63 +++++++++++++++++ package-lock.json | 16 +---- package.json | 132 ++++++++++++++++++------------------ 4 files changed, 194 insertions(+), 80 deletions(-) create mode 100644 .husky/_/pre-commit create mode 100644 .husky/_/prepare-commit-msg diff --git a/.husky/_/pre-commit b/.husky/_/pre-commit new file mode 100644 index 0000000..a1fe9b4 --- /dev/null +++ b/.husky/_/pre-commit @@ -0,0 +1,63 @@ +#!/bin/sh + +if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then + set -x +fi + +if [ "$LEFTHOOK" = "0" ]; then + exit 0 +fi + +call_lefthook() +{ + if test -n "$LEFTHOOK_BIN" + then + "$LEFTHOOK_BIN" "$@" + elif lefthook.exe -h >/dev/null 2>&1 + then + lefthook.exe "$@" + elif lefthook.bat -h >/dev/null 2>&1 + then + lefthook.bat "$@" + else + dir="$(git rev-parse --show-toplevel)" + osArch=$(uname | tr '[:upper:]' '[:lower:]') + cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') + if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" + then + "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" + then + "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" + then + "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@" + elif test -f "$dir/node_modules/lefthook/bin/index.js" + then + "$dir/node_modules/lefthook/bin/index.js" "$@" + + elif bundle exec lefthook -h >/dev/null 2>&1 + then + bundle exec lefthook "$@" + elif yarn lefthook -h >/dev/null 2>&1 + then + yarn lefthook "$@" + elif pnpm lefthook -h >/dev/null 2>&1 + then + pnpm lefthook "$@" + elif swift package plugin lefthook >/dev/null 2>&1 + then + swift package --disable-sandbox plugin lefthook "$@" + elif command -v mint >/dev/null 2>&1 + then + mint run csjones/lefthook-plugin "$@" + elif command -v npx >/dev/null 2>&1 + then + npx lefthook "$@" + else + echo "Can't find lefthook in PATH" + fi + fi +} + +call_lefthook run "pre-commit" "$@" diff --git a/.husky/_/prepare-commit-msg b/.husky/_/prepare-commit-msg new file mode 100644 index 0000000..f182dfd --- /dev/null +++ b/.husky/_/prepare-commit-msg @@ -0,0 +1,63 @@ +#!/bin/sh + +if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then + set -x +fi + +if [ "$LEFTHOOK" = "0" ]; then + exit 0 +fi + +call_lefthook() +{ + if test -n "$LEFTHOOK_BIN" + then + "$LEFTHOOK_BIN" "$@" + elif lefthook.exe -h >/dev/null 2>&1 + then + lefthook.exe "$@" + elif lefthook.bat -h >/dev/null 2>&1 + then + lefthook.bat "$@" + else + dir="$(git rev-parse --show-toplevel)" + osArch=$(uname | tr '[:upper:]' '[:lower:]') + cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') + if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" + then + "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" + then + "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" + then + "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@" + elif test -f "$dir/node_modules/lefthook/bin/index.js" + then + "$dir/node_modules/lefthook/bin/index.js" "$@" + + elif bundle exec lefthook -h >/dev/null 2>&1 + then + bundle exec lefthook "$@" + elif yarn lefthook -h >/dev/null 2>&1 + then + yarn lefthook "$@" + elif pnpm lefthook -h >/dev/null 2>&1 + then + pnpm lefthook "$@" + elif swift package plugin lefthook >/dev/null 2>&1 + then + swift package --disable-sandbox plugin lefthook "$@" + elif command -v mint >/dev/null 2>&1 + then + mint run csjones/lefthook-plugin "$@" + elif command -v npx >/dev/null 2>&1 + then + npx lefthook "$@" + else + echo "Can't find lefthook in PATH" + fi + fi +} + +call_lefthook run "prepare-commit-msg" "$@" diff --git a/package-lock.json b/package-lock.json index a08190d..e4491bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,9 @@ "tsup": "^8.0.2", "typescript": "^5.4.5", "vitest": "^1.5.2" + }, + "optionalDependencies": { + "@rollup/rollup-linux-x64-gnu": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -2466,19 +2469,6 @@ "linux" ] }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.0.tgz", - "integrity": "sha512-v6eiam/1w3HUfU/ZjzIDodencqgrSqzlNuNtiwH7PFJHYSo1ezL0/UIzmS2lpSJF1ORNaplXeKHYmmdt81vV2g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, "node_modules/@rollup/rollup-linux-x64-musl": { "version": "4.17.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.0.tgz", diff --git a/package.json b/package.json index 08c68f8..b46dc1a 100644 --- a/package.json +++ b/package.json @@ -1,68 +1,66 @@ { - "name": "open-source-stack", - "version": "1.0.0", - "description": "Minimal open-source stack to help you ship an open-source package in TS", - "main": "./dist/index.js", - "module": "./dist/index.mjs", - "types": "./dist/index.d.mts", - "exports": { - ".": { - "import": { - "import": "./dist/index.mjs", - "default": "./dist/index.mjs", - "types": "./dist/index.d.mts" - }, - "require": { - "import": "./dist/index.js", - "require": "./dist/index.js", - "default": "./dist/index.js", - "types": "./dist/index.d.ts" - } - } - }, - "scripts": { - "test": "vitest run", - "test:cov": "vitest run --coverage", - "build": "tsup src/index.ts --dts --format esm,cjs --outDir dist --minify --clean", - "remix:dev": "npm run dev -w test-apps/remix-vite", - "remix:cjs:dev": "npm run dev -w test-apps/remix-vite-cjs", - "build:dev": "tsup src/index.ts --dts --format cjs,esm --outDir dist", - "build:dev:watch": "npm run build:dev -- --watch", - "build:dev:cjs:watch": "npm run build:dev -- --watch", - "dev": "npm-run-all -s build:dev -p remix:dev build:dev:watch", - "dev:cjs": "npm-run-all -s build:dev -p remix:cjs:dev build:dev:cjs:watch", - "prepublishOnly": "npm run build", - "check": "biome check .", - "check:fix": "biome check --fix .", - "tsc": "tsc", - "validate": "npm run check && npm run tsc && npm run test" - }, - "author": "", - "license": "ISC", - "repository": { - "type": "git", - "url": "git+https://github.com/forge42dev/open-source-stack.git" - }, - "bugs": { - "url": "https://github.com/forge42dev/open-source-stack/issues" - }, - "files": [ - "dist" - ], - "workspaces": [ - ".", - "test-apps/*" - ], - "homepage": "https://github.com/forge42dev/open-source-stack#readme", - "devDependencies": { - "@biomejs/biome": "^1.8.3", - "@types/node": "^20.12.7", - "@vitest/coverage-v8": "^1.5.2", - "happy-dom": "^14.7.1", - "lefthook": "^1.7.2", - "npm-run-all": "^4.1.5", - "tsup": "^8.0.2", - "typescript": "^5.4.5", - "vitest": "^1.5.2" - } -} \ No newline at end of file + "name": "open-source-stack", + "version": "1.0.0", + "description": "Minimal open-source stack to help you ship an open-source package in TS", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "exports": { + ".": { + "import": { + "import": "./dist/index.mjs", + "default": "./dist/index.mjs", + "types": "./dist/index.d.mts" + }, + "require": { + "import": "./dist/index.js", + "require": "./dist/index.js", + "default": "./dist/index.js", + "types": "./dist/index.d.ts" + } + } + }, + "scripts": { + "test": "vitest run", + "test:cov": "vitest run --coverage", + "build": "tsup src/index.ts --dts --format esm,cjs --outDir dist --minify --clean", + "remix:dev": "npm run dev -w test-apps/remix-vite", + "remix:cjs:dev": "npm run dev -w test-apps/remix-vite-cjs", + "build:dev": "tsup src/index.ts --dts --format cjs,esm --outDir dist", + "build:dev:watch": "npm run build:dev -- --watch", + "build:dev:cjs:watch": "npm run build:dev -- --watch", + "dev": "npm-run-all -s build:dev -p remix:dev build:dev:watch", + "dev:cjs": "npm-run-all -s build:dev -p remix:cjs:dev build:dev:cjs:watch", + "prepublishOnly": "npm run build", + "check": "biome check .", + "check:fix": "biome check --fix .", + "typecheck": "tsc", + "validate": "npm run check && npm run tsc && npm run test" + }, + "author": "", + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/forge42dev/open-source-stack.git" + }, + "bugs": { + "url": "https://github.com/forge42dev/open-source-stack/issues" + }, + "files": ["dist"], + "workspaces": [".", "test-apps/*"], + "homepage": "https://github.com/forge42dev/open-source-stack#readme", + "devDependencies": { + "@biomejs/biome": "^1.8.3", + "@types/node": "^20.12.7", + "@vitest/coverage-v8": "^1.5.2", + "happy-dom": "^14.7.1", + "lefthook": "^1.7.2", + "npm-run-all": "^4.1.5", + "tsup": "^8.0.2", + "typescript": "^5.4.5", + "vitest": "^1.5.2" + }, + "optionalDependencies": { + "@rollup/rollup-linux-x64-gnu": "^4.18.1" + } +} From 379c20a4835ffabe01befe1453e885d886ac404d Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 17 Jul 2024 13:58:37 +0200 Subject: [PATCH 3/8] Switched to modern tools --- .github/workflows/pull-request.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 9d45324..cdbd2d6 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -64,9 +64,6 @@ jobs: with: useLockFile: false - - name: Install dotenv cli - run: npm install -g dotenv-cli - - name: ⚡ Run vitest run: npm run test:cov From 14705fa02367787cb3182f153a3aacf6f5380cad Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 17 Jul 2024 14:01:53 +0200 Subject: [PATCH 4/8] Switched to modern tools --- package.json | 9 ++++++++- vitest.config.ts | 23 ++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index b46dc1a..e4116af 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,13 @@ "vitest": "^1.5.2" }, "optionalDependencies": { - "@rollup/rollup-linux-x64-gnu": "^4.18.1" + "@rollup/rollup-linux-x64-gnu": "^4.18.1", + "@rollup/rollup-linux-x64-musl": "^4.18.1", + "@rollup/rollup-win32-arm64-msvc": "4.18.1", + "@rollup/rollup-win32-x64-msvc": "4.18.1", + "@rollup/rollup-win32-x64-musl": "4.18.1", + "@rollup/rollup-darwin-x64-gnu": "4.18.1", + "@rollup/rollup-darwin-x64-musl": "4.18.1", + "@rollup/rollup-linux-arm64-gnu": "4.18.1" } } diff --git a/vitest.config.ts b/vitest.config.ts index 47f46b5..e926d1f 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,15 +1,16 @@ /// -import { defineConfig } from "vitest/config"; +import { defineConfig } from "vitest/config" export default defineConfig({ - test: { - setupFiles: ["./tests/setup.ts"], - environment: "node", - globals: true, + test: { + setupFiles: ["./tests/setup.ts"], + environment: "node", + globals: true, - coverage: { - all: false, - provider: "v8", - }, - }, -}); + coverage: { + all: false, + provider: "v8", + reporter: ["json-summary", "html"], + }, + }, +}) From 12ba7b1552f33fb97c68ddcf17ab0d59610ff9c7 Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 17 Jul 2024 14:05:19 +0200 Subject: [PATCH 5/8] Switched to modern tools --- .vscode/settings.json | 64 ++++++++++++------------ biome.json | 111 ++++++++++++++++++++++-------------------- src/index.test.ts | 10 ++-- src/index.ts | 2 +- tests/setup.ts | 2 +- tsconfig.json | 30 ++++++------ 6 files changed, 111 insertions(+), 108 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 193bdf2..a0c9bf7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,34 +1,34 @@ { - "biome.enabled": true, - "editor.defaultFormatter": "biomejs.biome", - "editor.formatOnSave": true, - "javascript.format.enable": false, - "javascript.suggest.autoImports": true, - "javascript.suggest.paths": true, - "typescript.format.enable": false, - "typescript.suggest.paths": true, - "typescript.suggest.autoImports": true, - "editor.renderWhitespace": "all", - "editor.rulers": [120, 160], - "editor.codeActionsOnSave": { - "source.fixAll": "always", - "source.organizeImports": "never", - "source.organizeImports.biome": "always", - "quickfix.biome": "always" - }, - "editor.insertSpaces": false, - "editor.detectIndentation": true, - "editor.trimAutoWhitespace": true, - "files.trimTrailingWhitespace": true, - "files.trimTrailingWhitespaceInRegexAndStrings": true, - "files.trimFinalNewlines": true, - "explorer.fileNesting.patterns": { - "*.ts": "${basename}.*.${extname}", - ".env": ".env.*", - "*.tsx": "${basename}.*.${extname},${basename}.*.ts", - "package.json": "*.json, *.yml, *.config.js, *.config.ts, *.yaml" - }, - "eslint.enable": false, - "eslint.format.enable": false, - "prettier.enable": false + "biome.enabled": true, + "editor.defaultFormatter": "biomejs.biome", + "editor.formatOnSave": true, + "javascript.format.enable": false, + "javascript.suggest.autoImports": true, + "javascript.suggest.paths": true, + "typescript.format.enable": false, + "typescript.suggest.paths": true, + "typescript.suggest.autoImports": true, + "editor.renderWhitespace": "all", + "editor.rulers": [120, 160], + "editor.codeActionsOnSave": { + "source.fixAll": "always", + "source.organizeImports": "never", + "source.organizeImports.biome": "always", + "quickfix.biome": "always" + }, + "editor.insertSpaces": false, + "editor.detectIndentation": true, + "editor.trimAutoWhitespace": true, + "files.trimTrailingWhitespace": true, + "files.trimTrailingWhitespaceInRegexAndStrings": true, + "files.trimFinalNewlines": true, + "explorer.fileNesting.patterns": { + "*.ts": "${basename}.*.${extname}", + ".env": ".env.*", + "*.tsx": "${basename}.*.${extname},${basename}.*.ts", + "package.json": "*.json, *.yml, *.config.js, *.config.ts, *.yaml" + }, + "eslint.enable": false, + "eslint.format.enable": false, + "prettier.enable": false } diff --git a/biome.json b/biome.json index 1d0b8f5..b9f0581 100644 --- a/biome.json +++ b/biome.json @@ -1,55 +1,58 @@ { - "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", - "vcs": { - "enabled": true, - "clientKind": "git", - "defaultBranch": "main", - "useIgnoreFile": true - }, - "formatter": { - "enabled": true, - "formatWithErrors": false, - "indentStyle": "tab", - "lineEnding": "lf", - "lineWidth": 120 - }, - "organizeImports": { - "enabled": true - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true, - "suspicious": { - "recommended": true - }, - "style": { - "recommended": true - }, - "complexity": { - "recommended": true - }, - "security": { - "recommended": true - }, - "performance": { - "recommended": true - }, - "correctness": { - "recommended": true - }, - "a11y": { - "recommended": true - }, - "nursery": { - "recommended": true - } - } - }, - "javascript": { - "formatter": { - "semicolons": "asNeeded", - "trailingCommas": "es5" - } - } -} \ No newline at end of file + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "defaultBranch": "main", + "useIgnoreFile": true + }, + "formatter": { + "ignore": ["test-apps"], + "enabled": true, + "formatWithErrors": false, + "indentStyle": "tab", + "lineEnding": "lf", + "lineWidth": 120 + }, + "organizeImports": { + "ignore": ["test-apps"], + "enabled": true + }, + "linter": { + "ignore": ["test-apps"], + "enabled": true, + "rules": { + "recommended": true, + "suspicious": { + "recommended": true + }, + "style": { + "recommended": true + }, + "complexity": { + "recommended": true + }, + "security": { + "recommended": true + }, + "performance": { + "recommended": true + }, + "correctness": { + "recommended": true + }, + "a11y": { + "recommended": true + }, + "nursery": { + "recommended": true + } + } + }, + "javascript": { + "formatter": { + "semicolons": "asNeeded", + "trailingCommas": "es5" + } + } +} diff --git a/src/index.test.ts b/src/index.test.ts index 1410c5e..e588e86 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,7 +1,7 @@ -import { test } from "."; +import { test } from "." describe("test", () => { - it("should work", () => { - expect(test()).toBeUndefined(); - }); -}); + it("should work", () => { + expect(test()).toBeUndefined() + }) +}) diff --git a/src/index.ts b/src/index.ts index 162f468..85c2530 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,2 @@ // This is your packages entry point, everything exported from here will be accessible to the end-user. -export const test = (): void => {}; +export const test = (): void => {} diff --git a/tests/setup.ts b/tests/setup.ts index aefa3e4..dd6668c 100644 --- a/tests/setup.ts +++ b/tests/setup.ts @@ -1 +1 @@ -// Setup your test environment here \ No newline at end of file +// Setup your test environment here diff --git a/tsconfig.json b/tsconfig.json index 398f63e..3dac5f6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,17 @@ { - "compilerOptions": { - "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - "moduleResolution": "Bundler", - "module": "ESNext" /* Specify what module code is generated. */, - "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - "strict": true /* Enable all strict type-checking options. */, - "skipLibCheck": true /* Skip type checking all .d.ts files. */, - "types": ["vitest/globals"], - "rootDir": ".", - "outDir": "./dist", - "noEmit": true - }, - "include": ["src/**/*", "tests/**/*"], - "exclude": ["node_modules", "dist"] + "compilerOptions": { + "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "moduleResolution": "Bundler", + "module": "ESNext" /* Specify what module code is generated. */, + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + "strict": true /* Enable all strict type-checking options. */, + "skipLibCheck": true /* Skip type checking all .d.ts files. */, + "types": ["vitest/globals"], + "rootDir": ".", + "outDir": "./dist", + "noEmit": true + }, + "include": ["src/**/*", "tests/**/*"], + "exclude": ["node_modules", "dist"] } From 81c1b86fa1a8542770e7a618adfe69223c68d6f4 Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 17 Jul 2024 14:06:27 +0200 Subject: [PATCH 6/8] Switched to modern tools --- .github/workflows/publish-commit.yaml | 2 +- vitest.config.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-commit.yaml b/.github/workflows/publish-commit.yaml index c72b4b4..828e3ce 100644 --- a/.github/workflows/publish-commit.yaml +++ b/.github/workflows/publish-commit.yaml @@ -1,4 +1,4 @@ -name: Publish Any Commit +name: Publish pkg-pr-new on commit on: [push, pull_request] jobs: diff --git a/vitest.config.ts b/vitest.config.ts index e926d1f..e9ac264 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -11,6 +11,12 @@ export default defineConfig({ all: false, provider: "v8", reporter: ["json-summary", "html"], + thresholds: { + statements: 80, + branches: 80, + functions: 80, + lines: 80, + }, }, }, }) From bac0e6ec6192f8616d89f35228866d584ac6338a Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 17 Jul 2024 14:07:35 +0200 Subject: [PATCH 7/8] Switched to modern tools --- .github/workflows/publish-commit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-commit.yaml b/.github/workflows/publish-commit.yaml index 828e3ce..750a771 100644 --- a/.github/workflows/publish-commit.yaml +++ b/.github/workflows/publish-commit.yaml @@ -1,4 +1,4 @@ -name: Publish pkg-pr-new on commit +name: 🚀 pkg-pr-new on: [push, pull_request] jobs: From fd2ac7975aad5e184927f2e11ec20b9602f5fd25 Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Wed, 17 Jul 2024 14:10:06 +0200 Subject: [PATCH 8/8] Switched to modern tools --- .husky/_/pre-commit | 63 ------------------------------------- .husky/_/prepare-commit-msg | 63 ------------------------------------- 2 files changed, 126 deletions(-) delete mode 100644 .husky/_/pre-commit delete mode 100644 .husky/_/prepare-commit-msg diff --git a/.husky/_/pre-commit b/.husky/_/pre-commit deleted file mode 100644 index a1fe9b4..0000000 --- a/.husky/_/pre-commit +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then - set -x -fi - -if [ "$LEFTHOOK" = "0" ]; then - exit 0 -fi - -call_lefthook() -{ - if test -n "$LEFTHOOK_BIN" - then - "$LEFTHOOK_BIN" "$@" - elif lefthook.exe -h >/dev/null 2>&1 - then - lefthook.exe "$@" - elif lefthook.bat -h >/dev/null 2>&1 - then - lefthook.bat "$@" - else - dir="$(git rev-parse --show-toplevel)" - osArch=$(uname | tr '[:upper:]' '[:lower:]') - cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') - if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" - then - "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@" - elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" - then - "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@" - elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" - then - "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@" - elif test -f "$dir/node_modules/lefthook/bin/index.js" - then - "$dir/node_modules/lefthook/bin/index.js" "$@" - - elif bundle exec lefthook -h >/dev/null 2>&1 - then - bundle exec lefthook "$@" - elif yarn lefthook -h >/dev/null 2>&1 - then - yarn lefthook "$@" - elif pnpm lefthook -h >/dev/null 2>&1 - then - pnpm lefthook "$@" - elif swift package plugin lefthook >/dev/null 2>&1 - then - swift package --disable-sandbox plugin lefthook "$@" - elif command -v mint >/dev/null 2>&1 - then - mint run csjones/lefthook-plugin "$@" - elif command -v npx >/dev/null 2>&1 - then - npx lefthook "$@" - else - echo "Can't find lefthook in PATH" - fi - fi -} - -call_lefthook run "pre-commit" "$@" diff --git a/.husky/_/prepare-commit-msg b/.husky/_/prepare-commit-msg deleted file mode 100644 index f182dfd..0000000 --- a/.husky/_/prepare-commit-msg +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then - set -x -fi - -if [ "$LEFTHOOK" = "0" ]; then - exit 0 -fi - -call_lefthook() -{ - if test -n "$LEFTHOOK_BIN" - then - "$LEFTHOOK_BIN" "$@" - elif lefthook.exe -h >/dev/null 2>&1 - then - lefthook.exe "$@" - elif lefthook.bat -h >/dev/null 2>&1 - then - lefthook.bat "$@" - else - dir="$(git rev-parse --show-toplevel)" - osArch=$(uname | tr '[:upper:]' '[:lower:]') - cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') - if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" - then - "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@" - elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" - then - "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@" - elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" - then - "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@" - elif test -f "$dir/node_modules/lefthook/bin/index.js" - then - "$dir/node_modules/lefthook/bin/index.js" "$@" - - elif bundle exec lefthook -h >/dev/null 2>&1 - then - bundle exec lefthook "$@" - elif yarn lefthook -h >/dev/null 2>&1 - then - yarn lefthook "$@" - elif pnpm lefthook -h >/dev/null 2>&1 - then - pnpm lefthook "$@" - elif swift package plugin lefthook >/dev/null 2>&1 - then - swift package --disable-sandbox plugin lefthook "$@" - elif command -v mint >/dev/null 2>&1 - then - mint run csjones/lefthook-plugin "$@" - elif command -v npx >/dev/null 2>&1 - then - npx lefthook "$@" - else - echo "Can't find lefthook in PATH" - fi - fi -} - -call_lefthook run "prepare-commit-msg" "$@"