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/publish-commit.yaml b/.github/workflows/publish-commit.yaml index c72b4b4..750a771 100644 --- a/.github/workflows/publish-commit.yaml +++ b/.github/workflows/publish-commit.yaml @@ -1,4 +1,4 @@ -name: Publish Any Commit +name: 🚀 pkg-pr-new on: [push, pull_request] jobs: diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..cdbd2d6 --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,73 @@ +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: ⚡ 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..a0c9bf7 --- /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..b9f0581 --- /dev/null +++ b/biome.json @@ -0,0 +1,58 @@ +{ + "$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/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..e4491bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,18 +13,18 @@ "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", "vitest": "^1.5.2" + }, + "optionalDependencies": { + "@rollup/rollup-linux-x64-gnu": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -683,6 +683,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", @@ -2314,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", @@ -2511,220 +2653,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 +4868,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 +5918,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 +6818,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..e4116af 100644 --- a/package.json +++ b/package.json @@ -1,73 +1,73 @@ { - "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", - "lint": "eslint src/**/*.ts", - "lint:fix": "eslint src/**/*.ts --fix", - "prepublishOnly": "npm run build", - "tsc": "tsc", - "validate": "npm run lint && npm run tsc && npm run test", - "prepare": "husky" - }, - "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", - "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", - "@types/node": "^20.12.7", - "happy-dom": "^14.7.1", - "husky": "^9.0.11", - "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", + "@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/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"] } diff --git a/vitest.config.ts b/vitest.config.ts index c4bf590..e9ac264 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,13 +1,22 @@ /// -import { defineConfig } from "vitest/config"; +import { defineConfig } from "vitest/config" export default defineConfig({ - test: { - setupFiles: ["./tests/setup.ts"], - environment: "node", - globals: true, - coverage: { - provider: "v8", - }, - }, -}); + test: { + setupFiles: ["./tests/setup.ts"], + environment: "node", + globals: true, + + coverage: { + all: false, + provider: "v8", + reporter: ["json-summary", "html"], + thresholds: { + statements: 80, + branches: 80, + functions: 80, + lines: 80, + }, + }, + }, +})