diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..569fa85 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,34 @@ +name: Lint + +on: workflow_call + +jobs: + unit: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Deno + uses: denoland/setup-deno@v2 + + - name: Get pnpm store directory + id: deno-cache + shell: bash + run: | + echo "DENO_DIR=$(deno info | grep DENO_DIR | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | cut -d ':' -f 2 | xargs)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + name: Setup Deno cache + with: + path: ${{ steps.deno-cache.outputs.DENO_DIR }} + key: ${{ runner.os }}-deno-cache + restore-keys: | + ${{ runner.os }}-deno-cache + + - name: Biome CI + id: biome-ci + run: | + deno task ci diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index e61cce6..b05bbd6 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,7 +7,11 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: + lint: + uses: ./.github/workflows/lint.yml + test: + needs: lint uses: ./.github/workflows/test.yml secrets: GIST_SECRET: ${{ secrets.GIST_SECRET }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4f5f551..4e15fa4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: - name: Run tests id: tests run: | - cd paseri-lib && deno test --coverage + deno test --coverage echo "CODE_COVERAGE=$(deno coverage | grep "All files" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | cut -d '|' -f 2 | xargs)" >> $GITHUB_OUTPUT echo "GIST_PATH=$(echo "${{ github.repository }}/${{ github.ref_name }}" | sed 's/\//_/g')-coverage.svg" >> $GITHUB_OUTPUT diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..f4566c8 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +deno task lint-staged diff --git a/biome.json b/biome.json index ac32a2a..9c3a738 100644 --- a/biome.json +++ b/biome.json @@ -1,7 +1,7 @@ { "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", "files": { - "ignore": ["dist"] + "ignore": [".astro"] }, "organizeImports": { "enabled": true diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..f849a87 --- /dev/null +++ b/deno.json @@ -0,0 +1,10 @@ +{ + "tasks": { + "init": "deno run --allow-env --allow-read --allow-write --allow-run npm:husky", + "lint-staged": "deno run --allow-env --allow-read --allow-write --allow-sys --allow-run npm:lint-staged", + "ci": "deno run --allow-env --allow-read --allow-run npm:@biomejs/biome ci", + "check": "deno run --allow-env --allow-read --allow-run npm:@biomejs/biome check" + }, + "workspace": ["paseri-lib"], + "nodeModulesDir": "auto" +} diff --git a/deno.lock b/deno.lock new file mode 100644 index 0000000..dbf9bad --- /dev/null +++ b/deno.lock @@ -0,0 +1,411 @@ +{ + "version": "4", + "specifiers": { + "jsr:@badrap/valita@*": "0.4.2", + "jsr:@std/assert@^1.0.10": "1.0.10", + "jsr:@std/expect@*": "1.0.10", + "jsr:@std/internal@^1.0.5": "1.0.5", + "npm:@biomejs/biome@*": "1.9.4", + "npm:expect-type@*": "1.1.0", + "npm:fast-check@*": "3.23.2", + "npm:husky@*": "9.1.7", + "npm:lint-staged@*": "15.3.0", + "npm:recheck@*": "4.4.5", + "npm:type-fest@4.30.0": "4.30.0", + "npm:zod@*": "3.24.1" + }, + "jsr": { + "@badrap/valita@0.4.2": { + "integrity": "af8a829e82eac71adbc7b60352798f94dcc66d19fab16b657957ca9e646c25fd" + }, + "@std/assert@1.0.10": { + "integrity": "59b5cbac5bd55459a19045d95cc7c2ff787b4f8527c0dd195078ff6f9481fbb3", + "dependencies": [ + "jsr:@std/internal" + ] + }, + "@std/expect@1.0.10": { + "integrity": "7659b640447887cd1735f866962e10e434f12443b13595b149970c806e6f08db", + "dependencies": [ + "jsr:@std/assert", + "jsr:@std/internal" + ] + }, + "@std/internal@1.0.5": { + "integrity": "54a546004f769c1ac9e025abd15a76b6671ddc9687e2313b67376125650dc7ba" + } + }, + "npm": { + "@biomejs/biome@1.9.4": { + "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", + "dependencies": [ + "@biomejs/cli-darwin-arm64", + "@biomejs/cli-darwin-x64", + "@biomejs/cli-linux-arm64", + "@biomejs/cli-linux-arm64-musl", + "@biomejs/cli-linux-x64", + "@biomejs/cli-linux-x64-musl", + "@biomejs/cli-win32-arm64", + "@biomejs/cli-win32-x64" + ] + }, + "@biomejs/cli-darwin-arm64@1.9.4": { + "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==" + }, + "@biomejs/cli-darwin-x64@1.9.4": { + "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==" + }, + "@biomejs/cli-linux-arm64-musl@1.9.4": { + "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==" + }, + "@biomejs/cli-linux-arm64@1.9.4": { + "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==" + }, + "@biomejs/cli-linux-x64-musl@1.9.4": { + "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==" + }, + "@biomejs/cli-linux-x64@1.9.4": { + "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==" + }, + "@biomejs/cli-win32-arm64@1.9.4": { + "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==" + }, + "@biomejs/cli-win32-x64@1.9.4": { + "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==" + }, + "ansi-escapes@7.0.0": { + "integrity": "sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==", + "dependencies": [ + "environment" + ] + }, + "ansi-regex@6.1.0": { + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==" + }, + "ansi-styles@6.2.1": { + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==" + }, + "braces@3.0.3": { + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": [ + "fill-range" + ] + }, + "chalk@5.4.1": { + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==" + }, + "cli-cursor@5.0.0": { + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "dependencies": [ + "restore-cursor" + ] + }, + "cli-truncate@4.0.0": { + "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", + "dependencies": [ + "slice-ansi@5.0.0", + "string-width" + ] + }, + "colorette@2.0.20": { + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==" + }, + "commander@12.1.0": { + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==" + }, + "cross-spawn@7.0.6": { + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dependencies": [ + "path-key@3.1.1", + "shebang-command", + "which" + ] + }, + "debug@4.4.0": { + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dependencies": [ + "ms" + ] + }, + "emoji-regex@10.4.0": { + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==" + }, + "environment@1.1.0": { + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==" + }, + "eventemitter3@5.0.1": { + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, + "execa@8.0.1": { + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dependencies": [ + "cross-spawn", + "get-stream", + "human-signals", + "is-stream", + "merge-stream", + "npm-run-path", + "onetime@6.0.0", + "signal-exit", + "strip-final-newline" + ] + }, + "expect-type@1.1.0": { + "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==" + }, + "fast-check@3.23.2": { + "integrity": "sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==", + "dependencies": [ + "pure-rand" + ] + }, + "fill-range@7.1.1": { + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": [ + "to-regex-range" + ] + }, + "get-east-asian-width@1.3.0": { + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==" + }, + "get-stream@8.0.1": { + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==" + }, + "human-signals@5.0.0": { + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==" + }, + "husky@9.1.7": { + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==" + }, + "is-fullwidth-code-point@4.0.0": { + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==" + }, + "is-fullwidth-code-point@5.0.0": { + "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", + "dependencies": [ + "get-east-asian-width" + ] + }, + "is-number@7.0.0": { + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-stream@3.0.0": { + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==" + }, + "isexe@2.0.0": { + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "lilconfig@3.1.3": { + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==" + }, + "lint-staged@15.3.0": { + "integrity": "sha512-vHFahytLoF2enJklgtOtCtIjZrKD/LoxlaUusd5nh7dWv/dkKQJY74ndFSzxCdv7g0ueGg1ORgTSt4Y9LPZn9A==", + "dependencies": [ + "chalk", + "commander", + "debug", + "execa", + "lilconfig", + "listr2", + "micromatch", + "pidtree", + "string-argv", + "yaml" + ] + }, + "listr2@8.2.5": { + "integrity": "sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ==", + "dependencies": [ + "cli-truncate", + "colorette", + "eventemitter3", + "log-update", + "rfdc", + "wrap-ansi" + ] + }, + "log-update@6.1.0": { + "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==", + "dependencies": [ + "ansi-escapes", + "cli-cursor", + "slice-ansi@7.1.0", + "strip-ansi", + "wrap-ansi" + ] + }, + "merge-stream@2.0.0": { + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "micromatch@4.0.8": { + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dependencies": [ + "braces", + "picomatch" + ] + }, + "mimic-fn@4.0.0": { + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==" + }, + "mimic-function@5.0.1": { + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==" + }, + "ms@2.1.3": { + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "npm-run-path@5.3.0": { + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dependencies": [ + "path-key@4.0.0" + ] + }, + "onetime@6.0.0": { + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dependencies": [ + "mimic-fn" + ] + }, + "onetime@7.0.0": { + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dependencies": [ + "mimic-function" + ] + }, + "path-key@3.1.1": { + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-key@4.0.0": { + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==" + }, + "picomatch@2.3.1": { + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "pidtree@0.6.0": { + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==" + }, + "pure-rand@6.1.0": { + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==" + }, + "recheck-jar@4.4.5": { + "integrity": "sha512-a2kMzcfr+ntT0bObNLY22EUNV6Z6WeZ+DybRmPOUXVWzGcqhRcrK74tpgrYt3FdzTlSh85pqoryAPmrNkwLc0g==" + }, + "recheck-linux-x64@4.4.5": { + "integrity": "sha512-s8OVPCpiSGw+tLCxH3eei7Zp2AoL22kXqLmEtWXi0AnYNwfuTjZmeLn2aQjW8qhs8ZPSkxS7uRIRTeZqR5Fv/Q==" + }, + "recheck-macos-x64@4.4.5": { + "integrity": "sha512-Ouup9JwwoKCDclt3Na8+/W2pVbt8FRpzjkDuyM32qTR2TOid1NI+P1GA6/VQAKEOjvaxgGjxhcP/WqAjN+EULA==" + }, + "recheck-windows-x64@4.4.5": { + "integrity": "sha512-mkpzLHu9G9Ztjx8HssJh9k/Xm1d1d/4OoT7etHqFk+k1NGzISCRXBD22DqYF9w8+J4QEzTAoDf8icFt0IGhOEQ==" + }, + "recheck@4.4.5": { + "integrity": "sha512-J80Ykhr+xxWtvWrfZfPpOR/iw2ijvb4WY8d9AVoN8oHsPP07JT1rCAalUSACMGxM1cvSocb6jppWFjVS6eTTrA==", + "dependencies": [ + "recheck-jar", + "recheck-linux-x64", + "recheck-macos-x64", + "recheck-windows-x64" + ] + }, + "restore-cursor@5.1.0": { + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dependencies": [ + "onetime@7.0.0", + "signal-exit" + ] + }, + "rfdc@1.4.1": { + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==" + }, + "shebang-command@2.0.0": { + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": [ + "shebang-regex" + ] + }, + "shebang-regex@3.0.0": { + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit@4.1.0": { + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==" + }, + "slice-ansi@5.0.0": { + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dependencies": [ + "ansi-styles", + "is-fullwidth-code-point@4.0.0" + ] + }, + "slice-ansi@7.1.0": { + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", + "dependencies": [ + "ansi-styles", + "is-fullwidth-code-point@5.0.0" + ] + }, + "string-argv@0.3.2": { + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==" + }, + "string-width@7.2.0": { + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dependencies": [ + "emoji-regex", + "get-east-asian-width", + "strip-ansi" + ] + }, + "strip-ansi@7.1.0": { + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": [ + "ansi-regex" + ] + }, + "strip-final-newline@3.0.0": { + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==" + }, + "to-regex-range@5.0.1": { + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": [ + "is-number" + ] + }, + "type-fest@4.30.0": { + "integrity": "sha512-G6zXWS1dLj6eagy6sVhOMQiLtJdxQBHIA9Z6HFUNLOlr6MFOgzV8wvmidtPONfPtEUv0uZsy77XJNzTAfwPDaA==" + }, + "which@2.0.2": { + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": [ + "isexe" + ] + }, + "wrap-ansi@9.0.0": { + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "dependencies": [ + "ansi-styles", + "string-width", + "strip-ansi" + ] + }, + "yaml@2.6.1": { + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==" + }, + "zod@3.24.1": { + "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==" + } + }, + "workspace": { + "members": { + "paseri-lib": { + "dependencies": [ + "jsr:@badrap/valita@*", + "jsr:@std/expect@*", + "npm:expect-type@*", + "npm:fast-check@*", + "npm:recheck@*", + "npm:type-fest@4.30.0", + "npm:zod@*" + ] + } + } + } +} diff --git a/lint-staged.config.mjs b/lint-staged.config.mjs new file mode 100644 index 0000000..a0f0852 --- /dev/null +++ b/lint-staged.config.mjs @@ -0,0 +1,5 @@ +const config = { + '*': 'deno task check --write --no-errors-on-unmatched', +}; + +export default config; diff --git a/paseri-docs/src/content/config.ts b/paseri-docs/src/content/config.ts index 45f60b0..77b6646 100644 --- a/paseri-docs/src/content/config.ts +++ b/paseri-docs/src/content/config.ts @@ -2,5 +2,5 @@ import { defineCollection } from 'astro:content'; import { docsSchema } from '@astrojs/starlight/schema'; export const collections = { - docs: defineCollection({ schema: docsSchema() }), + docs: defineCollection({ schema: docsSchema() }), }; diff --git a/paseri-docs/src/styles/custom.css b/paseri-docs/src/styles/custom.css index 035ea74..a1440e8 100644 --- a/paseri-docs/src/styles/custom.css +++ b/paseri-docs/src/styles/custom.css @@ -1,31 +1,31 @@ /* Dark mode colors. */ :root { - --sl-color-accent-low: #002d0f; - --sl-color-accent: #007f39; - --sl-color-accent-high: #9edaaa; - --sl-color-white: #ffffff; - --sl-color-gray-1: #edeeed; - --sl-color-gray-2: #c1c2c1; - --sl-color-gray-3: #898c8a; - --sl-color-gray-4: #565957; - --sl-color-gray-5: #363937; - --sl-color-gray-6: #252725; - --sl-color-black: #171818; + --sl-color-accent-low: #002d0f; + --sl-color-accent: #007f39; + --sl-color-accent-high: #9edaaa; + --sl-color-white: #ffffff; + --sl-color-gray-1: #edeeed; + --sl-color-gray-2: #c1c2c1; + --sl-color-gray-3: #898c8a; + --sl-color-gray-4: #565957; + --sl-color-gray-5: #363937; + --sl-color-gray-6: #252725; + --sl-color-black: #171818; } /* Light mode colors. */ -:root[data-theme='light'] { - --sl-color-accent-low: #b8e4c0; - --sl-color-accent: #00823a; - --sl-color-accent-high: #003e18; - --sl-color-white: #171818; - --sl-color-gray-1: #252725; - --sl-color-gray-2: #363937; - --sl-color-gray-3: #565957; - --sl-color-gray-4: #898c8a; - --sl-color-gray-5: #c1c2c1; - --sl-color-gray-6: #edeeed; - --sl-color-gray-7: #f6f6f6; - --sl-color-black: #ffffff; +:root[data-theme="light"] { + --sl-color-accent-low: #b8e4c0; + --sl-color-accent: #00823a; + --sl-color-accent-high: #003e18; + --sl-color-white: #171818; + --sl-color-gray-1: #252725; + --sl-color-gray-2: #363937; + --sl-color-gray-3: #565957; + --sl-color-gray-4: #898c8a; + --sl-color-gray-5: #c1c2c1; + --sl-color-gray-6: #edeeed; + --sl-color-gray-7: #f6f6f6; + --sl-color-black: #ffffff; } .title-wrapper { @@ -41,7 +41,8 @@ outline-color: var(--sl-color-accent); } -summary, li a { +summary, +li a { margin-top: 0.2em; margin-bottom: 0.2em; } diff --git a/paseri-lib/README.md b/paseri-lib/README.md index de0f13c..d1d7f1e 100644 --- a/paseri-lib/README.md +++ b/paseri-lib/README.md @@ -42,6 +42,35 @@ The list may be expanded in time, but for now the objectives are the following: https://paseri.dev +## Developer guide + +Paseri uses the [Deno](https://deno.com/) runtime rather than Node, and requires Deno 2.1.4 or later. Packages are +published to the [JSR registry](https://jsr.io/) only, and publishing is performed automatically by CI. + +* `paseri-lib` contains the sources for the library. +* `paseri-docs` contains the documentation, built with [Astro](https://astro.build/) and +[Starlight](https://starlight.astro.build/). + +### Setup + +After cloning the repository, be sure you set up the git hooks using the following command: + +```shell +deno task init +``` + +### Running tests + +```shell +deno test +``` + +### Running benchmarks + +```shell +deno bench +``` + --- [^1]: An [excellent article](https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/) on the concept of diff --git a/paseri-lib/deno.json b/paseri-lib/deno.json index e96ff04..cda898c 100644 --- a/paseri-lib/deno.json +++ b/paseri-lib/deno.json @@ -9,7 +9,6 @@ }, "imports": { "@badrap/valita": "jsr:@badrap/valita", - "@biomejs/biome": "npm:@biomejs/biome", "@std/expect": "jsr:@std/expect", "expect-type": "npm:expect-type", "fast-check": "npm:fast-check", @@ -18,8 +17,6 @@ "zod": "npm:zod" }, "tasks": { - "lint": "deno run --allow-env --allow-read --allow-run npm:@biomejs/biome lint src", - "format": "deno run --allow-env --allow-read --allow-run npm:@biomejs/biome format src", "generate_emoji": "deno run --allow-net --allow-write bin/generate_emoji.ts" }, "lint": { @@ -29,6 +26,5 @@ }, "publish": { "exclude": ["bench"] - }, - "nodeModulesDir": "auto" + } } diff --git a/paseri-lib/deno.lock b/paseri-lib/deno.lock deleted file mode 100644 index bf291bb..0000000 --- a/paseri-lib/deno.lock +++ /dev/null @@ -1,126 +0,0 @@ -{ - "version": "4", - "specifiers": { - "jsr:@badrap/valita@*": "0.4.2", - "jsr:@std/assert@^1.0.10": "1.0.10", - "jsr:@std/expect@*": "1.0.10", - "jsr:@std/internal@^1.0.5": "1.0.5", - "npm:@biomejs/biome@*": "1.9.4", - "npm:expect-type@*": "1.1.0", - "npm:fast-check@*": "3.23.2", - "npm:recheck@*": "4.4.5", - "npm:type-fest@4.30.0": "4.30.0", - "npm:zod@*": "3.24.1" - }, - "jsr": { - "@badrap/valita@0.4.2": { - "integrity": "af8a829e82eac71adbc7b60352798f94dcc66d19fab16b657957ca9e646c25fd" - }, - "@std/assert@1.0.10": { - "integrity": "59b5cbac5bd55459a19045d95cc7c2ff787b4f8527c0dd195078ff6f9481fbb3", - "dependencies": [ - "jsr:@std/internal" - ] - }, - "@std/expect@1.0.10": { - "integrity": "7659b640447887cd1735f866962e10e434f12443b13595b149970c806e6f08db", - "dependencies": [ - "jsr:@std/assert", - "jsr:@std/internal" - ] - }, - "@std/internal@1.0.5": { - "integrity": "54a546004f769c1ac9e025abd15a76b6671ddc9687e2313b67376125650dc7ba" - } - }, - "npm": { - "@biomejs/biome@1.9.4": { - "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", - "dependencies": [ - "@biomejs/cli-darwin-arm64", - "@biomejs/cli-darwin-x64", - "@biomejs/cli-linux-arm64", - "@biomejs/cli-linux-arm64-musl", - "@biomejs/cli-linux-x64", - "@biomejs/cli-linux-x64-musl", - "@biomejs/cli-win32-arm64", - "@biomejs/cli-win32-x64" - ] - }, - "@biomejs/cli-darwin-arm64@1.9.4": { - "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==" - }, - "@biomejs/cli-darwin-x64@1.9.4": { - "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==" - }, - "@biomejs/cli-linux-arm64-musl@1.9.4": { - "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==" - }, - "@biomejs/cli-linux-arm64@1.9.4": { - "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==" - }, - "@biomejs/cli-linux-x64-musl@1.9.4": { - "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==" - }, - "@biomejs/cli-linux-x64@1.9.4": { - "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==" - }, - "@biomejs/cli-win32-arm64@1.9.4": { - "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==" - }, - "@biomejs/cli-win32-x64@1.9.4": { - "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==" - }, - "expect-type@1.1.0": { - "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==" - }, - "fast-check@3.23.2": { - "integrity": "sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==", - "dependencies": [ - "pure-rand" - ] - }, - "pure-rand@6.1.0": { - "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==" - }, - "recheck-jar@4.4.5": { - "integrity": "sha512-a2kMzcfr+ntT0bObNLY22EUNV6Z6WeZ+DybRmPOUXVWzGcqhRcrK74tpgrYt3FdzTlSh85pqoryAPmrNkwLc0g==" - }, - "recheck-linux-x64@4.4.5": { - "integrity": "sha512-s8OVPCpiSGw+tLCxH3eei7Zp2AoL22kXqLmEtWXi0AnYNwfuTjZmeLn2aQjW8qhs8ZPSkxS7uRIRTeZqR5Fv/Q==" - }, - "recheck-macos-x64@4.4.5": { - "integrity": "sha512-Ouup9JwwoKCDclt3Na8+/W2pVbt8FRpzjkDuyM32qTR2TOid1NI+P1GA6/VQAKEOjvaxgGjxhcP/WqAjN+EULA==" - }, - "recheck-windows-x64@4.4.5": { - "integrity": "sha512-mkpzLHu9G9Ztjx8HssJh9k/Xm1d1d/4OoT7etHqFk+k1NGzISCRXBD22DqYF9w8+J4QEzTAoDf8icFt0IGhOEQ==" - }, - "recheck@4.4.5": { - "integrity": "sha512-J80Ykhr+xxWtvWrfZfPpOR/iw2ijvb4WY8d9AVoN8oHsPP07JT1rCAalUSACMGxM1cvSocb6jppWFjVS6eTTrA==", - "dependencies": [ - "recheck-jar", - "recheck-linux-x64", - "recheck-macos-x64", - "recheck-windows-x64" - ] - }, - "type-fest@4.30.0": { - "integrity": "sha512-G6zXWS1dLj6eagy6sVhOMQiLtJdxQBHIA9Z6HFUNLOlr6MFOgzV8wvmidtPONfPtEUv0uZsy77XJNzTAfwPDaA==" - }, - "zod@3.24.1": { - "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==" - } - }, - "workspace": { - "dependencies": [ - "jsr:@badrap/valita@*", - "jsr:@std/expect@*", - "npm:@biomejs/biome@*", - "npm:expect-type@*", - "npm:fast-check@*", - "npm:recheck@*", - "npm:type-fest@4.30.0", - "npm:zod@*" - ] - } -}