diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4f75c95 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +.git +.gitignore +*.md +dist diff --git a/.env b/.env index 1209108..8864594 100644 --- a/.env +++ b/.env @@ -1 +1,3 @@ -BUILD_BASE=/lmgtfy +BUILD_ADAPTER=auto +BUILD_BASE= +BUILD_IPFS=false diff --git a/.eslintignore b/.eslintignore index 8dc4dbd..b0b2aef 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,6 +9,7 @@ vite.config.js.timestamp-* vite.config.ts.timestamp-* # Ignore files for PNPM, NPM and YARN -pnpm-lock.yaml +/.pnpm-store package-lock.json +pnpm-lock.yaml yarn.lock diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d219a81 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +pnpm-lock.yaml linguist-generated diff --git a/.github/FUNDING.yaml b/.github/FUNDING.yaml new file mode 100644 index 0000000..4b298c6 --- /dev/null +++ b/.github/FUNDING.yaml @@ -0,0 +1,2 @@ +patreon: NatoBoram +custom: ['https://paypal.me/NatoBoram/5'] diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 49d4f42..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: NatoBoram # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: ['https://paypal.me/NatoBoram/5'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..1798fc7 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,36 @@ +version: 2 +updates: + - package-ecosystem: npm + directory: / + schedule: + interval: monthly + timezone: America/Toronto + commit-message: + prefix: '⬆️ ' + groups: + patch: + update-types: + - patch + eslint: + patterns: + - '*eslint*' + tailwindcss: + patterns: + - '*heroicons*' + - '*tailwindcss*' + - autoprefixer + - postcss + prettier: + patterns: + - '*prettier*' + svelte: + patterns: + - '*svelte*' + vite: + patterns: + - '*vitejs*' + - vite + typescript: + patterns: + - '*typescript*' + - tslib diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..0cf95e8 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,48 @@ +name: Docker + +on: + push: + branches: main + tags: v* + pull_request: + branches: main + +jobs: + docker: + runs-on: ubuntu-latest + + if: ${{ github.actor != 'nektos/act' }} + + permissions: + packages: write + contents: read + + steps: + - uses: actions/checkout@v3 + + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/${{ github.repository }} + tags: | + type=ref,event=tag + type=semver,pattern={{major}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{version}} + + - uses: docker/build-push-action@v4 + with: + context: . + labels: ${{ steps.meta.outputs.labels }} + push: ${{ github.ref_type == 'tag' }} + tags: ${{ steps.meta.outputs.tags }} + secrets: | + BUILD_BASE= diff --git a/.github/workflows/github-pages.yaml b/.github/workflows/github-pages.yaml index 7cf3096..4c1ded6 100644 --- a/.github/workflows/github-pages.yaml +++ b/.github/workflows/github-pages.yaml @@ -2,12 +2,14 @@ name: GitHub Pages on: push: - branches: [main] + branches: main jobs: build: runs-on: ubuntu-latest + if: ${{ github.actor != 'nektos/act' }} + steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2 @@ -16,10 +18,12 @@ jobs: - uses: actions/setup-node@v3 with: cache: pnpm - node-version: 19 - - run: pnpm install + node-version: 21 + - run: pnpm install --frozen-lockfile - run: pnpm run build - - uses: actions/upload-pages-artifact@v1 + env: + BUILD_BASE: /lmgtfy + - uses: actions/upload-pages-artifact@v2 with: path: build @@ -38,3 +42,4 @@ jobs: steps: - uses: actions/deploy-pages@v1 + id: deployment diff --git a/.github/workflows/node.js.yaml b/.github/workflows/node.js.yaml index 7e24c1f..aba2b13 100644 --- a/.github/workflows/node.js.yaml +++ b/.github/workflows/node.js.yaml @@ -2,9 +2,9 @@ name: Node.js CI on: push: - branches: [main] + branches: main pull_request: - branches: [main] + branches: main jobs: test: @@ -18,12 +18,12 @@ jobs: - uses: actions/setup-node@v3 with: cache: pnpm - node-version: 19 + node-version: 21 # - uses: actions/cache@v3 # with: # path: ~/.cache/ms-playwright # key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} - - run: pnpm install + - run: pnpm install --frozen-lockfile --strict-peer-dependencies #- run: npx playwright install - run: pnpm run build - run: pnpm run check diff --git a/.prettierignore b/.prettierignore index 8dc4dbd..b0b2aef 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,6 +9,7 @@ vite.config.js.timestamp-* vite.config.ts.timestamp-* # Ignore files for PNPM, NPM and YARN -pnpm-lock.yaml +/.pnpm-store package-lock.json +pnpm-lock.yaml yarn.lock diff --git a/.vscode/extensions.json b/.vscode/extensions.json index caf3d9a..5a56b8c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,8 +1,12 @@ { "recommendations": [ + "davidanson.vscode-markdownlint", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", + "github.vscode-github-actions", + "github.vscode-pull-request-github", + "ms-azuretools.vscode-docker", "ms-vscode.live-server", - "davidanson.vscode-markdownlint" + "svelte.svelte-vscode" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index c7e9575..f97a5cf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,9 @@ "editor.minimap.maxColumn": 100, "editor.rulers": [100] }, + "files.associations": { + "*.eslintignore": "ignore", + "*.prettierignore": "ignore" + }, "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1af6bff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:21-slim AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable +COPY . /app +WORKDIR /app + +FROM base AS prod-deps +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile + +FROM base AS build +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile +RUN --mount=type=secret,id=BUILD_BASE BUILD_BASE="$(cat /run/secrets/BUILD_BASE)" BUILD_ADAPTER='node' pnpm run build + +FROM base +COPY --from=prod-deps /app/node_modules /app/node_modules +COPY --from=build /app/build /app/build +EXPOSE 3000 +CMD [ "node", "./build/index.js" ] diff --git a/README.md b/README.md index 297bad2..cde5eed 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LMGTFY -[![Node.js CI](https://github.com/NatoBoram/lmgtfy/actions/workflows/node.js.yaml/badge.svg)](https://github.com/NatoBoram/lmgtfy/actions/workflows/node.js.yaml) +[![Docker](https://github.com/NatoBoram/lmgtfy/actions/workflows/docker.yaml/badge.svg)](https://github.com/NatoBoram/lmgtfy/actions/workflows/docker.yaml) [![GitHub Pages](https://github.com/NatoBoram/lmgtfy/actions/workflows/github-pages.yaml/badge.svg)](https://github.com/NatoBoram/lmgtfy/actions/workflows/github-pages.yaml) [![Node.js CI](https://github.com/NatoBoram/lmgtfy/actions/workflows/node.js.yaml/badge.svg)](https://github.com/NatoBoram/lmgtfy/actions/workflows/node.js.yaml) A _Let Me Google That For You_ clone that's open source and doesn't track you when you share it. diff --git a/package.json b/package.json index 01e57f1..48ea4bc 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,16 @@ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "test:unit": "vitest", "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." + "format": "prettier --plugin-search-dir . --write .", + "docker:build": "docker build --secret id=BUILD_BASE --tag lmgtfy .", + "docker:run": "docker run --publish 127.0.0.1:3000:3000 lmgtfy", + "docker:kill": "docker ps --format '{{.Image}} {{.ID}}' | grep lmgtfy | awk '{print $2}' | xargs docker kill" }, "devDependencies": { "@natoboram/heroicons.svelte": "^1.0.1", "@playwright/test": "^1.31.2", "@sveltejs/adapter-auto": "^2.0.0", + "@sveltejs/adapter-node": "^1.3.1", "@sveltejs/adapter-static": "^2.0.1", "@sveltejs/kit": "^1.15.2", "@typescript-eslint/eslint-plugin": "^5.56.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6381f9e..18e5d85 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ devDependencies: '@sveltejs/adapter-auto': specifier: ^2.0.0 version: 2.0.0(@sveltejs/kit@1.15.2) + '@sveltejs/adapter-node': + specifier: ^1.3.1 + version: 1.3.1(@sveltejs/kit@1.15.2) '@sveltejs/adapter-static': specifier: ^2.0.1 version: 2.0.1(@sveltejs/kit@1.15.2) @@ -338,6 +341,10 @@ packages: resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==} dev: true + /@jridgewell/sourcemap-codec@1.4.15: + resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true + /@jridgewell/trace-mapping@0.3.17: resolution: {integrity: sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==} dependencies: @@ -394,6 +401,70 @@ packages: resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==} dev: true + /@rollup/plugin-commonjs@25.0.7(rollup@3.20.0): + resolution: {integrity: sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.68.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@3.20.0) + commondir: 1.0.1 + estree-walker: 2.0.2 + glob: 8.1.0 + is-reference: 1.2.1 + magic-string: 0.30.5 + rollup: 3.20.0 + dev: true + + /@rollup/plugin-json@6.1.0(rollup@3.20.0): + resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@3.20.0) + rollup: 3.20.0 + dev: true + + /@rollup/plugin-node-resolve@15.2.3(rollup@3.20.0): + resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.78.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@3.20.0) + '@types/resolve': 1.20.2 + deepmerge: 4.3.1 + is-builtin-module: 3.2.1 + is-module: 1.0.0 + resolve: 1.22.1 + rollup: 3.20.0 + dev: true + + /@rollup/pluginutils@5.1.0(rollup@3.20.0): + resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@types/estree': 1.0.5 + estree-walker: 2.0.2 + picomatch: 2.3.1 + rollup: 3.20.0 + dev: true + /@sveltejs/adapter-auto@2.0.0(@sveltejs/kit@1.15.2): resolution: {integrity: sha512-b+gkHFZgD771kgV3aO4avHFd7y1zhmMYy9i6xOK7m/rwmwaRO8gnF5zBc0Rgca80B2PMU1bKNxyBTHA14OzUAQ==} peerDependencies: @@ -403,6 +474,18 @@ packages: import-meta-resolve: 2.2.2 dev: true + /@sveltejs/adapter-node@1.3.1(@sveltejs/kit@1.15.2): + resolution: {integrity: sha512-A0VgRQDCDPzdLNoiAbcOxGw4zT1Mc+n1LwT1OmO350R7WxrEqdMUChPPOd1iMfIDWlP4ie6E2d/WQf5es2d4Zw==} + peerDependencies: + '@sveltejs/kit': ^1.0.0 + dependencies: + '@rollup/plugin-commonjs': 25.0.7(rollup@3.20.0) + '@rollup/plugin-json': 6.1.0(rollup@3.20.0) + '@rollup/plugin-node-resolve': 15.2.3(rollup@3.20.0) + '@sveltejs/kit': 1.15.2(svelte@3.57.0)(vite@4.2.3) + rollup: 3.20.0 + dev: true + /@sveltejs/adapter-static@2.0.1(@sveltejs/kit@1.15.2): resolution: {integrity: sha512-o5/q3YwD/ErxYCFlK1v3ydvldyNKk1lh3oeyxn4mhz+Pkbx/uuxhzmbOpytTlp5aVqNHDVsb04xadUzOFCDDzw==} peerDependencies: @@ -472,6 +555,10 @@ packages: resolution: {integrity: sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==} dev: true + /@types/estree@1.0.5: + resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + dev: true + /@types/json-schema@7.0.11: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true @@ -484,6 +571,10 @@ packages: resolution: {integrity: sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==} dev: true + /@types/resolve@1.20.2: + resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} + dev: true + /@types/semver@7.3.13: resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} dev: true @@ -780,6 +871,12 @@ packages: concat-map: 0.0.1 dev: true + /brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true + /braces@3.0.2: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} engines: {node: '>=8'} @@ -802,6 +899,11 @@ packages: resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} dev: true + /builtin-modules@3.3.0: + resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} + engines: {node: '>=6'} + dev: true + /busboy@1.6.0: resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} engines: {node: '>=10.16.0'} @@ -887,6 +989,10 @@ packages: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true + /commondir@1.0.1: + resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} + dev: true + /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true @@ -1171,6 +1277,10 @@ packages: engines: {node: '>=4.0'} dev: true + /estree-walker@2.0.2: + resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + dev: true + /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -1288,6 +1398,17 @@ packages: path-is-absolute: 1.0.1 dev: true + /glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + dev: true + /globals@13.20.0: resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==} engines: {node: '>=8'} @@ -1375,6 +1496,13 @@ packages: binary-extensions: 2.2.0 dev: true + /is-builtin-module@3.2.1: + resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} + engines: {node: '>=6'} + dependencies: + builtin-modules: 3.3.0 + dev: true + /is-core-module@2.11.0: resolution: {integrity: sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==} dependencies: @@ -1398,6 +1526,10 @@ packages: is-extglob: 2.1.1 dev: true + /is-module@1.0.0: + resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} + dev: true + /is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} @@ -1408,6 +1540,12 @@ packages: engines: {node: '>=8'} dev: true + /is-reference@1.2.1: + resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} + dependencies: + '@types/estree': 1.0.5 + dev: true + /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true @@ -1503,6 +1641,13 @@ packages: '@jridgewell/sourcemap-codec': 1.4.14 dev: true + /magic-string@0.30.5: + resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} @@ -1533,6 +1678,13 @@ packages: brace-expansion: 1.1.11 dev: true + /minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} dev: true diff --git a/svelte.config.js b/svelte.config.js index ed49b60..f513fa1 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,27 +1,29 @@ import adapterAuto from '@sveltejs/adapter-auto' +import adapterNode from '@sveltejs/adapter-node' import adapterStatic from '@sveltejs/adapter-static' import { vitePreprocess } from '@sveltejs/kit/vite' import { loadEnv } from 'vite' -/** @type {{BUILD_BASE?: '' | `/${string}`}} */ +/** @type {{ BUILD_ADAPTER: 'auto' | 'node' | 'static', BUILD_BASE: '' | `/${string}` | undefined, BUILD_IPFS: 'false' | 'true' }} */ const env = loadEnv(process.env.NODE_ENV ?? 'development', process.cwd(), 'BUILD') /** @returns {import('@sveltejs/kit').Adapter} */ function adapter() { - if (process.env.GITHUB_ACTIONS) return adapterStatic({ fallback: '404.html' }) + if (env.BUILD_IPFS === 'true') return adapterStatic({ fallback: 'ipfs-404.html' }) + else if (env.BUILD_ADAPTER === 'node') return adapterNode() + else if (env.BUILD_ADAPTER === 'static' || process.env.GITHUB_ACTIONS === 'true') + return adapterStatic({ fallback: '404.html' }) + return adapterAuto() } /** @type {import('@sveltejs/kit').Config} */ const config = { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - preprocess: vitePreprocess(), + preprocess: [vitePreprocess()], kit: { adapter: adapter(), - paths: { - base: env.BUILD_BASE, - }, + paths: { base: env.BUILD_BASE }, }, } diff --git a/tsconfig.json b/tsconfig.json index 4c8b35a..0474c17 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,40 +1,57 @@ { "extends": "./.svelte-kit/tsconfig.json", "compilerOptions": { - "allowJs": true, - "checkJs": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, + // Projects + "incremental": true, + "composite": true, + + // Language and Environment + "useDefineForClassFields": true, + "moduleDetection": "force", + + // Modules + "module": "NodeNext", + "moduleResolution": "NodeNext", + "resolvePackageJsonExports": true, + "resolvePackageJsonImports": true, "resolveJsonModule": true, - "skipLibCheck": true, + + // JavaScript Support + + // Emit + "declaration": true, + "declarationMap": true, "sourceMap": true, - "strict": true, + + // Interop Constraints + "forceConsistentCasingInFileNames": true, + "verbatimModuleSyntax": true, // Type Checking - "allowUnreachableCode": false, - "allowUnusedLabels": false, + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictBindCallApply": true, + "strictPropertyInitialization": true, + "noImplicitThis": true, + "useUnknownInCatchVariables": true, "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, "exactOptionalPropertyTypes": true, + "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, + "noUncheckedIndexedAccess": true, "noImplicitOverride": true, - "noImplicitReturns": true, - "noImplicitThis": true, "noPropertyAccessFromIndexSignature": true, - "noUncheckedIndexedAccess": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "useUnknownInCatchVariables": true, + "allowUnusedLabels": false, + "allowUnreachableCode": false - // SvelteKit - "moduleResolution": "nodenext" + // Completeness } // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias // - // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes - // from the referenced tsconfig.json - TypeScript does not merge them in + // If you want to overwrite includes/excludes, make sure to copy over the relevant + // includes/excludes from the referenced tsconfig.json - TypeScript does not merge them in. }