diff --git a/.vscode/settings.json b/.vscode/settings.json index 1d3e444..d926b8a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,7 @@ "**/node_modules": true, "**/*.code-search": true }, + "vitest.commandLine": "npx vitest", "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.organizeImports": "explicit" diff --git a/README.md b/README.md index 09314e2..8175dd5 100644 --- a/README.md +++ b/README.md @@ -53,14 +53,6 @@ pnpm dev pnpm build ``` -### Testing - -We use [Jest](https://github.com/facebook/jest) to write tests. Run our test suite with this command: - -```sh -pnpm test -``` - ### Code Style We use [Prettier](https://prettier.io/) and tslint to maintain code style and best practices. diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index 422b194..0000000 --- a/commitlint.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: ['@commitlint/config-conventional'] }; diff --git a/commitlint.config.mjs b/commitlint.config.mjs new file mode 100644 index 0000000..3f5e287 --- /dev/null +++ b/commitlint.config.mjs @@ -0,0 +1 @@ +export default { extends: ['@commitlint/config-conventional'] }; diff --git a/jest.config.ts b/jest.config.ts deleted file mode 100644 index ccbc0aa..0000000 --- a/jest.config.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Config } from 'jest'; - -const config: Config = { - transform: { - '^.+\\.(t|j)s?$': 'ts-jest', - }, - testEnvironment: 'node', - testPathIgnorePatterns: ['/node_modules/', '/dist/'], - collectCoverage: false, -}; - -export default config; diff --git a/package.json b/package.json index e5c5059..7c6c4c2 100644 --- a/package.json +++ b/package.json @@ -29,39 +29,36 @@ "url": "https://ko-fi.com/thilllon" } ], - "type": "commonjs", + "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { ".": { "require": { "types": "./dist/index.d.ts", - "default": "./dist/index.js" + "default": "./dist/index.cjs" }, "import": { "types": "./dist/index.d.ts", - "default": "./dist/index.mjs" + "default": "./dist/index.js" } } }, "bin": { - "gitarist": "./dist/cli.mjs" + "gitarist": "./dist/cli.js" }, "files": [ "dist" ], "scripts": { + "prepare": "husky install && chmod +x .husky/*", "typecheck": "tsc --noEmit", - "build:tsc": "tsc", "build": "tsup", + "test": "vitest", "format": "prettier --write --list-different .", - "prerelease": "pnpm format && pnpm lint && pnpm build", - "release": "release-it", "lint": "eslint --fix .", - "test": "jest", - "test:esm": "cross-env NODE_OPTIONS=--experimental-vm-modules npx jest", - "test:cov": "jest --coverage", - "prepare": "husky install && chmod +x .husky/*" + "prerelease": "pnpm format && pnpm lint && pnpm build", + "release": "release-it" }, "dependencies": { "@faker-js/faker": "^8.4.1", @@ -83,8 +80,6 @@ "@commitlint/config-conventional": "^19.2.2", "@eslint/js": "^9.3.0", "@swc/core": "^1.5.7", - "@swc/jest": "^0.2.36", - "@types/jest": "^29.5.12", "@types/lodash": "^4.17.4", "@types/node": "^20.12.12", "@types/parse-git-config": "^3.0.4", @@ -94,15 +89,14 @@ "eslint": "^9.3.0", "git-cz": "^4.9.0", "husky": "^9.0.11", - "jest": "^29.7.0", "lint-staged": "^15.2.2", "prettier": "^3.2.5", "release-it": "^17.3.0", - "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tsup": "^8.0.2", "tsx": "^4.10.5", "typescript": "^5.4.5", - "typescript-eslint": "^7.10.0" + "typescript-eslint": "^7.10.0", + "vitest": "^1.6.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1c8349d..f6e5b5c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -113,7 +113,7 @@ importers: version: 10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5) tsup: specifier: ^8.0.2 - version: 8.0.2(@swc/core@1.5.7)(ts-node@10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5))(typescript@5.4.5) + version: 8.0.2(@swc/core@1.5.7)(postcss@8.4.39)(ts-node@10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5))(typescript@5.4.5) tsx: specifier: ^4.10.5 version: 4.10.5 @@ -123,6 +123,9 @@ importers: typescript-eslint: specifier: ^7.10.0 version: 7.10.0(eslint@9.3.0)(typescript@5.4.5) + vitest: + specifier: ^1.6.0 + version: 1.6.0(@types/node@20.12.12) packages: @@ -382,6 +385,12 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/aix-ppc64@0.21.5': + resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + '@esbuild/android-arm64@0.19.12': resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} engines: {node: '>=12'} @@ -394,6 +403,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm64@0.21.5': + resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm@0.19.12': resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} engines: {node: '>=12'} @@ -406,6 +421,12 @@ packages: cpu: [arm] os: [android] + '@esbuild/android-arm@0.21.5': + resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + '@esbuild/android-x64@0.19.12': resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} engines: {node: '>=12'} @@ -418,6 +439,12 @@ packages: cpu: [x64] os: [android] + '@esbuild/android-x64@0.21.5': + resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + '@esbuild/darwin-arm64@0.19.12': resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} engines: {node: '>=12'} @@ -430,6 +457,12 @@ packages: cpu: [arm64] os: [darwin] + '@esbuild/darwin-arm64@0.21.5': + resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-x64@0.19.12': resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} engines: {node: '>=12'} @@ -442,6 +475,12 @@ packages: cpu: [x64] os: [darwin] + '@esbuild/darwin-x64@0.21.5': + resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + '@esbuild/freebsd-arm64@0.19.12': resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} engines: {node: '>=12'} @@ -454,6 +493,12 @@ packages: cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-arm64@0.21.5': + resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-x64@0.19.12': resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} engines: {node: '>=12'} @@ -466,6 +511,12 @@ packages: cpu: [x64] os: [freebsd] + '@esbuild/freebsd-x64@0.21.5': + resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + '@esbuild/linux-arm64@0.19.12': resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} engines: {node: '>=12'} @@ -478,6 +529,12 @@ packages: cpu: [arm64] os: [linux] + '@esbuild/linux-arm64@0.21.5': + resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm@0.19.12': resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} engines: {node: '>=12'} @@ -490,6 +547,12 @@ packages: cpu: [arm] os: [linux] + '@esbuild/linux-arm@0.21.5': + resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + '@esbuild/linux-ia32@0.19.12': resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} engines: {node: '>=12'} @@ -502,6 +565,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-ia32@0.21.5': + resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-loong64@0.19.12': resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} engines: {node: '>=12'} @@ -514,6 +583,12 @@ packages: cpu: [loong64] os: [linux] + '@esbuild/linux-loong64@0.21.5': + resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-mips64el@0.19.12': resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} engines: {node: '>=12'} @@ -526,6 +601,12 @@ packages: cpu: [mips64el] os: [linux] + '@esbuild/linux-mips64el@0.21.5': + resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-ppc64@0.19.12': resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} engines: {node: '>=12'} @@ -538,6 +619,12 @@ packages: cpu: [ppc64] os: [linux] + '@esbuild/linux-ppc64@0.21.5': + resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-riscv64@0.19.12': resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} engines: {node: '>=12'} @@ -550,6 +637,12 @@ packages: cpu: [riscv64] os: [linux] + '@esbuild/linux-riscv64@0.21.5': + resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-s390x@0.19.12': resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} engines: {node: '>=12'} @@ -562,6 +655,12 @@ packages: cpu: [s390x] os: [linux] + '@esbuild/linux-s390x@0.21.5': + resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-x64@0.19.12': resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} engines: {node: '>=12'} @@ -574,6 +673,12 @@ packages: cpu: [x64] os: [linux] + '@esbuild/linux-x64@0.21.5': + resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + '@esbuild/netbsd-x64@0.19.12': resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} engines: {node: '>=12'} @@ -586,6 +691,12 @@ packages: cpu: [x64] os: [netbsd] + '@esbuild/netbsd-x64@0.21.5': + resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + '@esbuild/openbsd-x64@0.19.12': resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} engines: {node: '>=12'} @@ -598,6 +709,12 @@ packages: cpu: [x64] os: [openbsd] + '@esbuild/openbsd-x64@0.21.5': + resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + '@esbuild/sunos-x64@0.19.12': resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} engines: {node: '>=12'} @@ -610,6 +727,12 @@ packages: cpu: [x64] os: [sunos] + '@esbuild/sunos-x64@0.21.5': + resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + '@esbuild/win32-arm64@0.19.12': resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} engines: {node: '>=12'} @@ -622,6 +745,12 @@ packages: cpu: [arm64] os: [win32] + '@esbuild/win32-arm64@0.21.5': + resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-ia32@0.19.12': resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} engines: {node: '>=12'} @@ -634,6 +763,12 @@ packages: cpu: [ia32] os: [win32] + '@esbuild/win32-ia32@0.21.5': + resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-x64@0.19.12': resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} engines: {node: '>=12'} @@ -646,6 +781,12 @@ packages: cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.21.5': + resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-utils@4.4.0': resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1302,6 +1443,21 @@ packages: resolution: {integrity: sha512-9ntIVgsi6gg6FIq9xjEO4VQJvwOqA3jaBFQJ/6TK5AvEup2+cECI6Fh7QiBxmfMHXU0V0J4RyPeOU1VDNzl9cg==} engines: {node: ^18.18.0 || >=20.0.0} + '@vitest/expect@1.6.0': + resolution: {integrity: sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==} + + '@vitest/runner@1.6.0': + resolution: {integrity: sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==} + + '@vitest/snapshot@1.6.0': + resolution: {integrity: sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==} + + '@vitest/spy@1.6.0': + resolution: {integrity: sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==} + + '@vitest/utils@1.6.0': + resolution: {integrity: sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==} + JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} hasBin: true @@ -1404,6 +1560,9 @@ packages: resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} engines: {node: '>= 0.4'} + assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + ast-types@0.13.4: resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==} engines: {node: '>=4'} @@ -1557,6 +1716,10 @@ packages: caniuse-lite@1.0.30001620: resolution: {integrity: sha512-WJvYsOjd1/BYUY6SNGUosK9DUidBPDTnOARHp3fSmFO1ekdxaY6nKRttEVrfMmYi80ctS0kz1wiWmm14fVc3ew==} + chai@4.4.1: + resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==} + engines: {node: '>=4'} + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -1576,6 +1739,9 @@ packages: chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + chokidar@3.6.0: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} @@ -1682,6 +1848,9 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + confbox@0.1.7: + resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} + config-chain@1.1.13: resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} @@ -1798,6 +1967,10 @@ packages: babel-plugin-macros: optional: true + deep-eql@4.1.4: + resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} + engines: {node: '>=6'} + deep-extend@0.6.0: resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} engines: {node: '>=4.0.0'} @@ -1949,6 +2122,11 @@ packages: engines: {node: '>=12'} hasBin: true + esbuild@0.21.5: + resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} + engines: {node: '>=12'} + hasBin: true + escalade@3.1.2: resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} engines: {node: '>=6'} @@ -2016,6 +2194,9 @@ packages: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -2177,6 +2358,9 @@ packages: resolution: {integrity: sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==} engines: {node: '>=18'} + get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + get-intrinsic@1.2.4: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} @@ -2804,6 +2988,9 @@ packages: js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + js-tokens@9.0.0: + resolution: {integrity: sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==} + js-yaml@3.14.1: resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} hasBin: true @@ -2893,6 +3080,10 @@ packages: resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + local-pkg@0.5.0: + resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} + engines: {node: '>=14'} + locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -2972,6 +3163,9 @@ packages: resolution: {integrity: sha512-Ajzxb8CM6WAnFjgiloPsI3bF+WCxcvhdIG3KNA2KN962+tdBsHcuQ4k4qX/EcS/2CRkcc0iAkR956Nib6aXU/Q==} engines: {node: '>=0.10.0'} + loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + lowercase-keys@3.0.0: resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -2991,6 +3185,9 @@ packages: resolution: {integrity: sha512-fSErXALFNsnowREYZ49XCdOHF8wOPWuFOGQrAhP7x5J/BqQv+B02cNsTykGpDgRVx43EKg++6ANmTaGTtW+hUA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + magic-string@0.30.10: + resolution: {integrity: sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==} + make-dir@4.0.0: resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} engines: {node: '>=10'} @@ -3060,6 +3257,9 @@ packages: resolution: {integrity: sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA==} engines: {node: '>=16 || 14 >=14.17'} + mlly@1.7.1: + resolution: {integrity: sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==} + ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} @@ -3073,6 +3273,11 @@ packages: mz@2.7.0: resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} @@ -3184,6 +3389,10 @@ packages: resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + p-limit@5.0.0: + resolution: {integrity: sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==} + engines: {node: '>=18'} + p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -3269,6 +3478,12 @@ packages: resolution: {integrity: sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==} engines: {node: '>=12'} + pathe@1.1.2: + resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + + pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} @@ -3293,6 +3508,9 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} + pkg-types@1.1.3: + resolution: {integrity: sha512-+JrgthZG6m3ckicaOB74TwQ+tBWsFl3qVQg7mN8ulwSOElJ7gBhKzj2VkCPnZ4NlF6kEquYU+RIYNVAvzd54UA==} + possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} @@ -3309,6 +3527,10 @@ packages: ts-node: optional: true + postcss@8.4.39: + resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} + engines: {node: ^10 || ^12 || >=14} + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -3540,6 +3762,9 @@ packages: resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} engines: {node: '>= 0.4'} + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -3578,6 +3803,10 @@ packages: resolution: {integrity: sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==} engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + source-map-js@1.2.0: + resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} + engines: {node: '>=0.10.0'} + source-map-support@0.5.13: resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} @@ -3603,6 +3832,12 @@ packages: resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} engines: {node: '>=10'} + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@3.7.0: + resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} + stdin-discarder@0.2.2: resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==} engines: {node: '>=18'} @@ -3673,6 +3908,9 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} + strip-literal@2.1.0: + resolution: {integrity: sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==} + sucrase@3.35.0: resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} engines: {node: '>=16 || 14 >=14.17'} @@ -3715,6 +3953,17 @@ packages: through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + tinybench@2.8.0: + resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==} + + tinypool@0.8.4: + resolution: {integrity: sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==} + engines: {node: '>=14.0.0'} + + tinyspy@2.2.1: + resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==} + engines: {node: '>=14.0.0'} + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -3862,6 +4111,9 @@ packages: engines: {node: '>=14.17'} hasBin: true + ufo@1.5.3: + resolution: {integrity: sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==} + unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} @@ -3916,6 +4168,64 @@ packages: resolution: {integrity: sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==} engines: {node: '>=10.12.0'} + vite-node@1.6.0: + resolution: {integrity: sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + + vite@5.3.3: + resolution: {integrity: sha512-NPQdeCU0Dv2z5fu+ULotpuq5yfCS1BzKUIPhNbP3YBfAMGJXbt2nS+sbTFu+qchaqWTD+H3JK++nRwr6XIcp6A==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + + vitest@1.6.0: + resolution: {integrity: sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': 1.6.0 + '@vitest/ui': 1.6.0 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} @@ -3948,6 +4258,11 @@ packages: engines: {node: '>= 8'} hasBin: true + why-is-node-running@2.2.2: + resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} + engines: {node: '>=8'} + hasBin: true + widest-line@4.0.1: resolution: {integrity: sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==} engines: {node: '>=12'} @@ -4363,138 +4678,207 @@ snapshots: '@esbuild/aix-ppc64@0.20.2': optional: true + '@esbuild/aix-ppc64@0.21.5': + optional: true + '@esbuild/android-arm64@0.19.12': optional: true '@esbuild/android-arm64@0.20.2': optional: true + '@esbuild/android-arm64@0.21.5': + optional: true + '@esbuild/android-arm@0.19.12': optional: true '@esbuild/android-arm@0.20.2': optional: true + '@esbuild/android-arm@0.21.5': + optional: true + '@esbuild/android-x64@0.19.12': optional: true '@esbuild/android-x64@0.20.2': optional: true + '@esbuild/android-x64@0.21.5': + optional: true + '@esbuild/darwin-arm64@0.19.12': optional: true '@esbuild/darwin-arm64@0.20.2': optional: true + '@esbuild/darwin-arm64@0.21.5': + optional: true + '@esbuild/darwin-x64@0.19.12': optional: true '@esbuild/darwin-x64@0.20.2': optional: true + '@esbuild/darwin-x64@0.21.5': + optional: true + '@esbuild/freebsd-arm64@0.19.12': optional: true '@esbuild/freebsd-arm64@0.20.2': optional: true + '@esbuild/freebsd-arm64@0.21.5': + optional: true + '@esbuild/freebsd-x64@0.19.12': optional: true '@esbuild/freebsd-x64@0.20.2': optional: true + '@esbuild/freebsd-x64@0.21.5': + optional: true + '@esbuild/linux-arm64@0.19.12': optional: true '@esbuild/linux-arm64@0.20.2': optional: true + '@esbuild/linux-arm64@0.21.5': + optional: true + '@esbuild/linux-arm@0.19.12': optional: true '@esbuild/linux-arm@0.20.2': optional: true + '@esbuild/linux-arm@0.21.5': + optional: true + '@esbuild/linux-ia32@0.19.12': optional: true '@esbuild/linux-ia32@0.20.2': optional: true + '@esbuild/linux-ia32@0.21.5': + optional: true + '@esbuild/linux-loong64@0.19.12': optional: true '@esbuild/linux-loong64@0.20.2': optional: true + '@esbuild/linux-loong64@0.21.5': + optional: true + '@esbuild/linux-mips64el@0.19.12': optional: true '@esbuild/linux-mips64el@0.20.2': optional: true + '@esbuild/linux-mips64el@0.21.5': + optional: true + '@esbuild/linux-ppc64@0.19.12': optional: true '@esbuild/linux-ppc64@0.20.2': optional: true + '@esbuild/linux-ppc64@0.21.5': + optional: true + '@esbuild/linux-riscv64@0.19.12': optional: true '@esbuild/linux-riscv64@0.20.2': optional: true + '@esbuild/linux-riscv64@0.21.5': + optional: true + '@esbuild/linux-s390x@0.19.12': optional: true '@esbuild/linux-s390x@0.20.2': optional: true + '@esbuild/linux-s390x@0.21.5': + optional: true + '@esbuild/linux-x64@0.19.12': optional: true '@esbuild/linux-x64@0.20.2': optional: true + '@esbuild/linux-x64@0.21.5': + optional: true + '@esbuild/netbsd-x64@0.19.12': optional: true '@esbuild/netbsd-x64@0.20.2': optional: true + '@esbuild/netbsd-x64@0.21.5': + optional: true + '@esbuild/openbsd-x64@0.19.12': optional: true '@esbuild/openbsd-x64@0.20.2': optional: true + '@esbuild/openbsd-x64@0.21.5': + optional: true + '@esbuild/sunos-x64@0.19.12': optional: true '@esbuild/sunos-x64@0.20.2': optional: true + '@esbuild/sunos-x64@0.21.5': + optional: true + '@esbuild/win32-arm64@0.19.12': optional: true '@esbuild/win32-arm64@0.20.2': optional: true + '@esbuild/win32-arm64@0.21.5': + optional: true + '@esbuild/win32-ia32@0.19.12': optional: true '@esbuild/win32-ia32@0.20.2': optional: true + '@esbuild/win32-ia32@0.21.5': + optional: true + '@esbuild/win32-x64@0.19.12': optional: true '@esbuild/win32-x64@0.20.2': optional: true + '@esbuild/win32-x64@0.21.5': + optional: true + '@eslint-community/eslint-utils@4.4.0(eslint@9.3.0)': dependencies: eslint: 9.3.0 @@ -5280,6 +5664,35 @@ snapshots: '@typescript-eslint/types': 7.10.0 eslint-visitor-keys: 3.4.3 + '@vitest/expect@1.6.0': + dependencies: + '@vitest/spy': 1.6.0 + '@vitest/utils': 1.6.0 + chai: 4.4.1 + + '@vitest/runner@1.6.0': + dependencies: + '@vitest/utils': 1.6.0 + p-limit: 5.0.0 + pathe: 1.1.2 + + '@vitest/snapshot@1.6.0': + dependencies: + magic-string: 0.30.10 + pathe: 1.1.2 + pretty-format: 29.7.0 + + '@vitest/spy@1.6.0': + dependencies: + tinyspy: 2.2.1 + + '@vitest/utils@1.6.0': + dependencies: + diff-sequences: 29.6.3 + estree-walker: 3.0.3 + loupe: 2.3.7 + pretty-format: 29.7.0 + JSONStream@1.3.5: dependencies: jsonparse: 1.3.1 @@ -5388,6 +5801,8 @@ snapshots: is-array-buffer: 3.0.4 is-shared-array-buffer: 1.0.3 + assertion-error@1.1.0: {} + ast-types@0.13.4: dependencies: tslib: 2.6.2 @@ -5573,6 +5988,16 @@ snapshots: caniuse-lite@1.0.30001620: {} + chai@4.4.1: + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.4 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.0.8 + chalk@2.4.2: dependencies: ansi-styles: 3.2.1 @@ -5590,6 +6015,10 @@ snapshots: chardet@0.7.0: {} + check-error@1.0.3: + dependencies: + get-func-name: 2.0.2 + chokidar@3.6.0: dependencies: anymatch: 3.1.3 @@ -5702,6 +6131,8 @@ snapshots: concat-map@0.0.1: {} + confbox@0.1.7: {} + config-chain@1.1.13: dependencies: ini: 1.3.8 @@ -5831,6 +6262,10 @@ snapshots: dedent@1.5.3: {} + deep-eql@4.1.4: + dependencies: + type-detect: 4.0.8 + deep-extend@0.6.0: {} deep-is@0.1.4: {} @@ -6053,6 +6488,32 @@ snapshots: '@esbuild/win32-ia32': 0.20.2 '@esbuild/win32-x64': 0.20.2 + esbuild@0.21.5: + optionalDependencies: + '@esbuild/aix-ppc64': 0.21.5 + '@esbuild/android-arm': 0.21.5 + '@esbuild/android-arm64': 0.21.5 + '@esbuild/android-x64': 0.21.5 + '@esbuild/darwin-arm64': 0.21.5 + '@esbuild/darwin-x64': 0.21.5 + '@esbuild/freebsd-arm64': 0.21.5 + '@esbuild/freebsd-x64': 0.21.5 + '@esbuild/linux-arm': 0.21.5 + '@esbuild/linux-arm64': 0.21.5 + '@esbuild/linux-ia32': 0.21.5 + '@esbuild/linux-loong64': 0.21.5 + '@esbuild/linux-mips64el': 0.21.5 + '@esbuild/linux-ppc64': 0.21.5 + '@esbuild/linux-riscv64': 0.21.5 + '@esbuild/linux-s390x': 0.21.5 + '@esbuild/linux-x64': 0.21.5 + '@esbuild/netbsd-x64': 0.21.5 + '@esbuild/openbsd-x64': 0.21.5 + '@esbuild/sunos-x64': 0.21.5 + '@esbuild/win32-arm64': 0.21.5 + '@esbuild/win32-ia32': 0.21.5 + '@esbuild/win32-x64': 0.21.5 + escalade@3.1.2: {} escape-goat@4.0.0: {} @@ -6139,6 +6600,10 @@ snapshots: estraverse@5.3.0: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.5 + esutils@2.0.3: {} eventemitter3@5.0.1: {} @@ -6321,6 +6786,8 @@ snapshots: get-east-asian-width@1.2.0: {} + get-func-name@2.0.2: {} + get-intrinsic@1.2.4: dependencies: es-errors: 1.3.0 @@ -7156,6 +7623,8 @@ snapshots: js-tokens@4.0.0: {} + js-tokens@9.0.0: {} + js-yaml@3.14.1: dependencies: argparse: 1.0.10 @@ -7240,6 +7709,11 @@ snapshots: load-tsconfig@0.2.5: {} + local-pkg@0.5.0: + dependencies: + mlly: 1.7.1 + pkg-types: 1.1.3 + locate-path@5.0.0: dependencies: p-locate: 4.1.0 @@ -7306,6 +7780,10 @@ snapshots: longest@2.0.1: {} + loupe@2.3.7: + dependencies: + get-func-name: 2.0.2 + lowercase-keys@3.0.0: {} lru-cache@10.2.2: {} @@ -7318,6 +7796,10 @@ snapshots: macos-release@3.2.0: {} + magic-string@0.30.10: + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + make-dir@4.0.0: dependencies: semver: 7.6.2 @@ -7369,6 +7851,13 @@ snapshots: minipass@7.1.1: {} + mlly@1.7.1: + dependencies: + acorn: 8.11.3 + pathe: 1.1.2 + pkg-types: 1.1.3 + ufo: 1.5.3 + ms@2.1.2: {} mute-stream@0.0.8: {} @@ -7381,6 +7870,8 @@ snapshots: object-assign: 4.1.1 thenify-all: 1.6.0 + nanoid@3.3.7: {} + natural-compare@1.4.0: {} netmask@2.0.2: {} @@ -7512,6 +8003,10 @@ snapshots: dependencies: yocto-queue: 1.0.0 + p-limit@5.0.0: + dependencies: + yocto-queue: 1.0.0 + p-locate@4.1.0: dependencies: p-limit: 2.3.0 @@ -7598,6 +8093,10 @@ snapshots: path-type@5.0.0: {} + pathe@1.1.2: {} + + pathval@1.1.1: {} + picocolors@1.0.1: {} picomatch-browser@2.2.6: {} @@ -7612,15 +8111,28 @@ snapshots: dependencies: find-up: 4.1.0 + pkg-types@1.1.3: + dependencies: + confbox: 0.1.7 + mlly: 1.7.1 + pathe: 1.1.2 + possible-typed-array-names@1.0.0: {} - postcss-load-config@4.0.2(ts-node@10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5)): + postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5)): dependencies: lilconfig: 3.1.1 yaml: 2.4.2 optionalDependencies: + postcss: 8.4.39 ts-node: 10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5) + postcss@8.4.39: + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.1 + source-map-js: 1.2.0 + prelude-ls@1.2.1: {} prettier@3.2.5: {} @@ -7898,6 +8410,8 @@ snapshots: get-intrinsic: 1.2.4 object-inspect: 1.13.1 + siginfo@2.0.0: {} + signal-exit@3.0.7: {} signal-exit@4.1.0: {} @@ -7933,6 +8447,8 @@ snapshots: ip-address: 9.0.5 smart-buffer: 4.2.0 + source-map-js@1.2.0: {} + source-map-support@0.5.13: dependencies: buffer-from: 1.1.2 @@ -7954,6 +8470,10 @@ snapshots: dependencies: escape-string-regexp: 2.0.0 + stackback@0.0.2: {} + + std-env@3.7.0: {} + stdin-discarder@0.2.2: {} stop-iteration-iterator@1.0.0: @@ -8026,6 +8546,10 @@ snapshots: strip-json-comments@3.1.1: {} + strip-literal@2.1.0: + dependencies: + js-tokens: 9.0.0 + sucrase@3.35.0: dependencies: '@jridgewell/gen-mapping': 0.3.5 @@ -8070,6 +8594,12 @@ snapshots: through@2.3.8: {} + tinybench@2.8.0: {} + + tinypool@0.8.4: {} + + tinyspy@2.2.1: {} + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -8134,7 +8664,7 @@ snapshots: tslib@2.6.2: {} - tsup@8.0.2(@swc/core@1.5.7)(ts-node@10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5))(typescript@5.4.5): + tsup@8.0.2(@swc/core@1.5.7)(postcss@8.4.39)(ts-node@10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5))(typescript@5.4.5): dependencies: bundle-require: 4.1.0(esbuild@0.19.12) cac: 6.7.14 @@ -8144,7 +8674,7 @@ snapshots: execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 4.0.2(ts-node@10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5)) + postcss-load-config: 4.0.2(postcss@8.4.39)(ts-node@10.9.2(@swc/core@1.5.7)(@types/node@20.12.12)(typescript@5.4.5)) resolve-from: 5.0.0 rollup: 4.17.2 source-map: 0.8.0-beta.0 @@ -8152,6 +8682,7 @@ snapshots: tree-kill: 1.2.2 optionalDependencies: '@swc/core': 1.5.7 + postcss: 8.4.39 typescript: 5.4.5 transitivePeerDependencies: - supports-color @@ -8225,6 +8756,8 @@ snapshots: typescript@5.4.5: {} + ufo@1.5.3: {} + unbox-primitive@1.0.2: dependencies: call-bind: 1.0.7 @@ -8285,6 +8818,65 @@ snapshots: '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 + vite-node@1.6.0(@types/node@20.12.12): + dependencies: + cac: 6.7.14 + debug: 4.3.4 + pathe: 1.1.2 + picocolors: 1.0.1 + vite: 5.3.3(@types/node@20.12.12) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + + vite@5.3.3(@types/node@20.12.12): + dependencies: + esbuild: 0.21.5 + postcss: 8.4.39 + rollup: 4.17.2 + optionalDependencies: + '@types/node': 20.12.12 + fsevents: 2.3.3 + + vitest@1.6.0(@types/node@20.12.12): + dependencies: + '@vitest/expect': 1.6.0 + '@vitest/runner': 1.6.0 + '@vitest/snapshot': 1.6.0 + '@vitest/spy': 1.6.0 + '@vitest/utils': 1.6.0 + acorn-walk: 8.3.2 + chai: 4.4.1 + debug: 4.3.4 + execa: 8.0.1 + local-pkg: 0.5.0 + magic-string: 0.30.10 + pathe: 1.1.2 + picocolors: 1.0.1 + std-env: 3.7.0 + strip-literal: 2.1.0 + tinybench: 2.8.0 + tinypool: 0.8.4 + vite: 5.3.3(@types/node@20.12.12) + vite-node: 1.6.0(@types/node@20.12.12) + why-is-node-running: 2.2.2 + optionalDependencies: + '@types/node': 20.12.12 + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + walker@1.0.8: dependencies: makeerror: 1.0.12 @@ -8327,6 +8919,11 @@ snapshots: dependencies: isexe: 2.0.0 + why-is-node-running@2.2.2: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + widest-line@4.0.1: dependencies: string-width: 5.1.2 diff --git a/src/cli.ts b/src/cli.mts similarity index 100% rename from src/cli.ts rename to src/cli.mts diff --git a/src/github.spec.ts b/src/github.spec.ts index 707fef6..d8ad3a2 100644 --- a/src/github.spec.ts +++ b/src/github.spec.ts @@ -3,26 +3,24 @@ import dotenv from 'dotenv'; import { mkdirSync, rmdirSync } from 'fs'; import { mkdir, writeFile } from 'fs/promises'; import { Octokit } from 'octokit'; -import { dirname, join } from 'path'; +import path, { dirname, join } from 'path'; import { chdir } from 'process'; +import { beforeAll, describe, expect, it, test } from 'vitest'; import { Gitarist, IssueItem } from './github'; -jest.setTimeout(999999999); - describe('gitarist', () => { - dotenv.config({ path: '.env.test' }); + dotenv.config({ path: path.join(process.cwd(), '..', '.env.test') }); let gitarist: Gitarist; let octokit: Octokit; - const owner = process.env.GITHUB_OWNER; - const repo = process.env.GITHUB_REPO; - const token = process.env.GITHUB_TOKEN; + const owner = process.env.GITHUB_OWNER ?? 'thilllon'; + const repo = process.env.GITHUB_REPO ?? 'turing'; + const token = process.env.GITHUB_TOKEN ?? ''; beforeAll(async () => { gitarist = new Gitarist({ owner, repo, token }); octokit = new Octokit({ auth: token }); - jest.resetAllMocks(); }); it.skip('setup', async () => { @@ -37,10 +35,7 @@ describe('gitarist', () => { rmdirSync(targetDir); }); - it.skip('simulate active user', async () => { - const deleteOldWorkflowLogsSpy = jest.spyOn(gitarist, 'deleteOldWorkflowLogs'); - const deleteOldFilesSpy = jest.spyOn(gitarist, 'deleteOldFiles'); - + it.skip('simulate active user', { timeout: 300 * 1000 }, async () => { await gitarist.simulateActiveUser({ // maxCommits: 3, // minCommits: 3, @@ -51,9 +46,6 @@ describe('gitarist', () => { // numberOfIssues: 3, // stale: 7, }); - - expect(deleteOldWorkflowLogsSpy).toHaveBeenCalledTimes(1); - expect(deleteOldFilesSpy).toHaveBeenCalledTimes(1); }); it.skip('findWastedActionsOverAllRepositories', async () => { @@ -64,13 +56,13 @@ describe('gitarist', () => { await gitarist.deleteFolder({ folderPaths: [] }); }); - it.skip('resolve all unresolved review comments', async () => { + it.skip('resolveAllReviewComments', async () => { await gitarist.resolveAllReviewComments(); expect(true).toBeTruthy(); }); - it('delete old issues', async () => { + it.skip('deleteOldIssues', async () => { await gitarist.deleteOldIssues({ olderThan: new Date('2023-12-06'), }); @@ -78,7 +70,7 @@ describe('gitarist', () => { expect(true).toBeTruthy(); }); - it.skip('deleteOldFilesAndCommit', async () => { + it('deleteOldFilesAndCommit', async () => { await gitarist.deleteOldFiles({ olderThan: new Date(Date.now() - 28 * 86400 * 1000), mainBranch: 'main', @@ -87,7 +79,7 @@ describe('gitarist', () => { expect(true).toBeTruthy(); }); - it.skip('listBranches', async () => { + it('listBranches', async () => { const branches = await gitarist.listBranches({ ref: 'heads/ISSUE-', }); @@ -96,9 +88,7 @@ describe('gitarist', () => { }); it.skip('deleteBranches', async () => { - await gitarist.deleteBranches({ - ref: 'heads/bug-', - }); + await gitarist.deleteBranches({ ref: 'heads/bug-' }); expect(true).toBeTruthy(); }); @@ -126,7 +116,7 @@ describe('gitarist', () => { } }); - it.skip('createMultipleIssues', async () => { + it('createMultipleIssues', async () => { const issueItems: IssueItem[] = [ { title: 'lorem ipsum', @@ -138,7 +128,7 @@ describe('gitarist', () => { await gitarist.createMultipleIssues({ issueItems }); }); - it.skip('createIssuesFromJson', async () => { + test('createIssuesFromJson', { timeout: 60 * 1000 }, async () => { const issues: IssueItem[] = Array.from({ length: 4 }).map((_, index) => ({ title: 'title ' + index, body: 'body ' + index, @@ -148,7 +138,6 @@ describe('gitarist', () => { await writeFile(filePath, JSON.stringify(issues), 'utf-8'); await gitarist.createIssuesFromJson({ relativePath: filePath }); - const errorSpy = jest.spyOn(console, 'error'); const invalidIssues: IssueItem[] = [ { title: 'invalid title', @@ -160,56 +149,46 @@ describe('gitarist', () => { await mkdir(dirname(invalidFilePath), { recursive: true }); await writeFile(invalidFilePath, JSON.stringify(invalidIssues), 'utf-8'); await gitarist.createIssuesFromJson({ relativePath: invalidFilePath }); - expect(errorSpy).toHaveBeenCalledTimes(1); - expect(errorSpy).toHaveBeenCalledWith( - 'Validation Failed: {"resource":"Label","field":"name","code":"missing_field"}', - ); }); describe('cli test', () => { - it.skip('version', async () => { - const version = execSync('npx ts-node ./src/cli.ts --version', { + it('version', async () => { + const version = execSync('npx tsx ../src/cli.mts --version', { encoding: 'utf8', }); expect(typeof version === 'string').toBeTruthy(); expect(version?.split('.')).toHaveLength(3); }); - it.skip('bad credentials error', async () => { - const token = 'fake_token'; + it('bad credentials error', async () => { + const token = 'invalid_token'; - try { + expect(() => execSync( [ - `npx ts-node ./src/cli.ts start`, - `-o ${owner}`, - `-r ${repo}`, - `-t ${token}`, - `--max-commits 1 --min-commits 1 --max-files 1 --min-files 1 --issues 1 --stale 7`, + `npx tsx ../src/cli.mts start`, + `--owner ${owner}`, + `--repo ${repo}`, + `--token ${token}`, ].join(' '), { encoding: 'utf8' }, - ); - fail('test fails'); - } catch (err: any) { - expect(err.message).toContain('Bad credentials'); - } + ), + ).toThrow('Bad credentials'); }); it.skip('start', async () => { - try { + expect(() => execSync( [ - `npx ts-node ./src/cli.ts start`, + `npx tsx ../src/cli.mts start`, `-o ${owner}`, `-r ${repo}`, `-t ${token}`, `--max-commits 1 --min-commits 1 --max-files 1 --min-files 1 --issues 1 --stale 7`, ].join(' '), { encoding: 'utf8' }, - ); - } catch (error) { - fail('test fails'); - } + ), + ).toThrow('Bad credentials'); }); }); }); diff --git a/src/github.ts b/src/github.ts index 436d0cd..7ef96f2 100644 --- a/src/github.ts +++ b/src/github.ts @@ -218,8 +218,8 @@ jobs: # ${Gitarist.getEnvSettingPageUrl({ owner, repo })} GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 - run: npx gitarist start `; @@ -345,6 +345,8 @@ GITHUB_TOKEN="${token}" stale?: number; language?: Language; }) { + const olderThan = new Date(Date.now() - stale * 86400 * 1000); + for (const key of Array(numberOfIssues).keys()) { console.debug(`issue: ${key + 1}/${numberOfIssues}`); await this.createCommitAndMakePullRequest({ @@ -356,12 +358,11 @@ GITHUB_TOKEN="${token}" }); } - const olderThan = new Date(Date.now() - stale * 86400 * 1000); await this.deleteOldWorkflowLogs({ olderThan }); await this.deleteOldFiles({ olderThan, mainBranch }); await this.resolveAllReviewComments(); await this.deleteOldIssues({ olderThan }); - await this.deleteCommentsAtIssueByBot(); + await this.deleteCommentsOnIssueCreatedByBot(); await this.deleteBranches({ ref: `heads/${workingBranchPrefix}` }); await this.closeStaleIssues({ olderThan }); } @@ -427,7 +428,7 @@ GITHUB_TOKEN="${token}" console.debug(result, issue.pull_request?.url); } catch (error: any) { // try-catch를 써야하는 이유는 다음과 같다. 깃헙은 이슈와 PR이 연동되어있다. 이슈에서 PR을 생성한 경우 이슈가 PR로 넘어가게되며 이슈는 더이상 삭제할 수 없게된다. 그리고 삭제 시도시 에러가 발생한다. - console.debug(error?.message, issue.pull_request?.url); + console.debug(`message: ${error?.message}, url: ${issue.pull_request?.url}`); } } } @@ -449,37 +450,32 @@ GITHUB_TOKEN="${token}" } /** - * ref와 부분일치하는 브랜치 - * @example 'heads/feat' 이걸로 시작하는 모든 브랜치 삭제 + * ref와 부분일치하는 브랜치 삭제 + * @example 'heads/feat' 으로 시작하는 모든 브랜치 삭제 */ - async deleteBranches({ - ref, - mainBranch = DEFAULT.mainBranch, - }: { - ref: string; - mainBranch?: MainBranch; - }) { + async deleteBranches({ ref }: { ref: `heads/${string}` }) { const { data: refs } = await this.octokit.rest.git.listMatchingRefs({ owner: this.owner, repo: this.repo, ref, }); - console.debug(`branche names starts with ${ref}: [${refs.map(({ ref }) => ref).join()}]`); + console.debug( + `found branch names starting with ${ref}: [${refs.map(({ ref }) => ref).join()}]`, + ); for (let { ref } of refs) { if (ref.startsWith('refs/heads/')) { ref = ref.replace('refs/', ''); } - console.debug(`delete branch. ref: ${ref}`); - - await this.octokit.rest.git.updateRef({ + const { data } = await this.octokit.rest.git.deleteRef({ owner: this.owner, repo: this.repo, - sha: '', // empty SHA denotes deletion of the branch - ref: `heads/${mainBranch}`, + ref, }); + console.debug(data); + console.debug(`delete branch. ref: ${ref}`); } } @@ -506,29 +502,36 @@ GITHUB_TOKEN="${token}" } } - async deleteCommentsAtIssueByBot() { + async deleteCommentsOnIssueCreatedByBot() { for await (const issue of await this.octokit.paginate(this.octokit.rest.issues.list, { owner: this.owner, repo: this.repo, filter: 'all', })) { - for await (const comment of await this.octokit.paginate( - this.octokit.rest.issues.listComments, - { - owner: this.owner, - repo: this.repo, - issue_number: issue.number, - per_page: 100, - }, - )) { - if (comment.user?.login?.includes('[bot]')) { - console.debug(`remove comment issue. issue: ${issue.number}, comment: ${comment.id}`); - await this.octokit.rest.issues.deleteComment({ + try { + for await (const comment of await this.octokit.paginate( + this.octokit.rest.issues.listComments, + { owner: this.owner, repo: this.repo, - comment_id: comment.id, - }); + issue_number: issue.number, + // per_page: 100, + }, + )) { + if (comment.user?.login?.includes('[bot]')) { + await this.octokit.rest.issues.deleteComment({ + owner: this.owner, + repo: this.repo, + comment_id: comment.id, + }); + console.debug( + `comment on issue deleted. issue: ${issue.number}, author: ${comment.user?.login}, comment: ${comment.id},`, + ); + } + // } + } catch (error) { + // NOTE: this.octokit.rest.issues.listComments 에서 comments가 없는 경우 emtpry array가 아닌 404를 반환하므로 try-catch가 필요하다. } } } @@ -550,7 +553,6 @@ GITHUB_TOKEN="${token}" ref: `heads/${mainBranch}`, }); const latestCommitSha = branchRef.object.sha; // Get the latest commit SHA of the branch - const { data: currentTree } = await this.octokit.rest.git.getTree({ owner: this.owner, repo: this.repo, @@ -569,7 +571,7 @@ GITHUB_TOKEN="${token}" return flag; }) .map((tree) => { - console.debug(`will be deleted. ${tree.path}}`); + console.debug(`will be deleted. path: ${tree.path}}`); return tree.path; }); @@ -1080,7 +1082,7 @@ GITHUB_TOKEN="${token}" commentTargetFilePath: `${relativePath}/${path.basename(createdFilePathList[0])}`, // first file path is used for comment }); - console.debug(`delete the source branch. heads/${mainBranch}`); + console.debug(`delete the source branch. ref: heads/${mainBranch}`); await this.octokit.rest.git .deleteRef({ owner: this.owner, @@ -1282,7 +1284,7 @@ GITHUB_TOKEN="${token}" pull_number: pullRequest.number, merge_method: 'squash', }); - console.debug(`merged. ${mergeResult.sha} ${mergeResult.message}`); + console.debug(`${mergeResult.message}; sha: ${mergeResult.sha}`); } private createFiles({ diff --git a/src/gitlab.spec.ts b/src/gitlab.spec.ts index b4ae35b..e14e3c2 100644 --- a/src/gitlab.spec.ts +++ b/src/gitlab.spec.ts @@ -1,10 +1,9 @@ import dotenv from 'dotenv'; import { existsSync, readFileSync } from 'fs'; import path from 'path'; +import { beforeAll, describe, expect, it } from 'vitest'; import { Gitlaborator } from './gitlab'; -jest.setTimeout(3600000); - describe.skip('gitlaborator', () => { dotenv.config({ path: '.env.test' }); @@ -32,15 +31,13 @@ describe.skip('gitlaborator', () => { }); it('createEnvByProjectVariables', async () => { - await gitlaborator.createDotEnvFileByProjectVariables({ - clean: true, - }); + await gitlaborator.createDotEnvFileByProjectVariables({ clean: true }); const expectedFilePath = path.join(process.cwd(), '.gitlaborator/.env'); expect(existsSync(expectedFilePath)).toBeTruthy(); expect(typeof readFileSync(expectedFilePath, 'utf-8')).toBe('string'); }); - it('findCommentsByAuthor', async () => { + it.skip('findCommentsByAuthor', async () => { const mergeRequestIid = 1673; const comments = await gitlaborator.findCommentsByAuthor({ mergeRequestIid }); diff --git a/src/gitlab.ts b/src/gitlab.ts index 2978c6e..00764a4 100644 --- a/src/gitlab.ts +++ b/src/gitlab.ts @@ -5,6 +5,24 @@ import { existsSync, writeFileSync } from 'fs'; import { mkdir, rm } from 'fs/promises'; import path, { join } from 'path'; +type CreateDotEnvFileByProjectVariablesParams = { + /** + * name of the file + * @default .env + */ + filename?: string; + /** + * relative path to the current working directory + * @default ./.gitlaborator + */ + directory?: string; + /** + * clean up the existing files + * @default false + */ + clean?: boolean; +}; + export class Gitlaborator { private readonly _token: string; private readonly _projectId: string; @@ -30,30 +48,15 @@ export class Gitlaborator { } } + /** + * project variables를 이용하여 .env 파일을 생성합니다. + */ async createDotEnvFileByProjectVariables({ filename = '.env', directory = './.gitlaborator', clean = false, - }: { - /** - * name of the file - * @default .env - */ - filename?: string; - /** - * relative path to the current working directory - * @default ./.gitlaborator - */ - directory?: string; - /** - * clean up the existing files - * @default false - */ - clean?: boolean; - }) { - const variables = await new Gitlab({ - ...this._options, - }).ProjectVariables.all(this._projectId); + }: CreateDotEnvFileByProjectVariablesParams) { + const variables = await new Gitlab({ ...this._options }).ProjectVariables.all(this._projectId); if (!variables) { console.debug(`No variables found`); diff --git a/src/jira.spec.ts b/src/jira.spec.ts index 8d0a2b5..d3a274d 100644 --- a/src/jira.spec.ts +++ b/src/jira.spec.ts @@ -1,8 +1,7 @@ import dotenv from 'dotenv'; +import { beforeAll, describe, expect, it } from 'vitest'; import { JiraClient, Jiralyzer } from './jira'; -jest.setTimeout(86400 * 1000); - describe.skip('jira', () => { dotenv.config({ path: '.env.test' }); diff --git a/src/libs/env-example.spec.ts b/src/libs/env-example.spec.ts index 96c48d7..7d02e61 100644 --- a/src/libs/env-example.spec.ts +++ b/src/libs/env-example.spec.ts @@ -1,3 +1,5 @@ +import { afterAll, describe, it } from 'vitest'; + describe('env-example', () => { it('should create an example .env file', async () => { // // Arrange diff --git a/src/vercel.spec.ts b/src/vercel.spec.ts index 574e505..6535202 100644 --- a/src/vercel.spec.ts +++ b/src/vercel.spec.ts @@ -1,12 +1,13 @@ +import { describe, expect, it } from 'vitest'; import { VercelClient } from './vercel'; -describe.skip('vercel', () => { - it('should be true', () => { +describe('vercel', () => { + it.skip('should be true', () => { const vercel = new VercelClient(); expect(vercel).toBeTruthy(); }); - it('deleteDeployment', async () => { + it.skip('deleteDeployment', async () => { const vercel = new VercelClient(); const deploymentId = 'foobar'; await vercel.deployment.delete({ deploymentId }); diff --git a/tsconfig.json b/tsconfig.json index 2708de4..16d6c22 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,10 +11,10 @@ "resolveJsonModule": true, "removeComments": true, "allowJs": true, - "types": ["node", "jest"], + "types": ["node"], "skipLibCheck": true, "typeRoots": ["node_modules/@types", "src/@types"] }, - "include": ["src/**/*.ts", "src/**/*.d.ts"], + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/cli.mts"], "exclude": ["dist"] } diff --git a/tsup.config.ts b/tsup.config.ts index 416807a..413dedc 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,12 +1,12 @@ import { defineConfig } from 'tsup'; export default defineConfig({ - entry: ['src/index.ts', 'src/cli.ts', 'src/github-action.ts'], - sourcemap: true, + entry: ['src/index.ts', 'src/cli.mts', 'src/github-action.ts'], + sourcemap: false, clean: true, dts: true, treeshake: true, - minify: false, + minify: true, format: ['esm', 'cjs'], tsconfig: 'tsconfig.json', });