diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..0b9c6d9f5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,30 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "npm" + directory: "/packages/api" + schedule: + interval: "daily" + - package-ecosystem: "npm" + directory: "/packages/api-routes" + schedule: + interval: "daily" + - package-ecosystem: "npm" + directory: "/packages/axios-helper" + schedule: + interval: "daily" + - package-ecosystem: "npm" + directory: "/packages/prisma-clients" + schedule: + interval: "daily" + - package-ecosystem: "npm" + directory: "/packages/types" + schedule: + interval: "daily" + - package-ecosystem: "npm" + directory: "/apps/web" + schedule: + interval: "daily" diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 8bcbf9f17..879bcaad0 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -54,8 +54,10 @@ jobs: key: ${{ secrets.PRODUCTION_SSH_KEY }} command_timeout: 60m script: | - cd workspace/DucksManager2 - docker compose run --rm --no-deps duck-estimator + cd workspace/DucksManager2/apps/duck-estimator + echo ${{ secrets.DOCKER_REGISTRY_TOKEN_DM }} | docker login ghcr.io -u bperel --password-stdin + docker compose pull + docker compose run --rm duck-estimator - name: Run sprite-names-updater uses: appleboy/ssh-action@v0.1.4 diff --git a/.github/workflows/deploy-duck-estimator.yml b/.github/workflows/deploy-duck-estimator.yml new file mode 100644 index 000000000..725f3efec --- /dev/null +++ b/.github/workflows/deploy-duck-estimator.yml @@ -0,0 +1,66 @@ +name: deploy-duck-estimator + +on: + workflow_dispatch: + push: + paths: + - ".github/workflows/deploy-duck-estimator.yml" + - "apps/duck-estimator" + - "pnpm-lock.yaml" + branches: + - "master" +jobs: + deploy-duck-estimator: + runs-on: ubuntu-latest + environment: production + steps: + - name: Check out repository + uses: actions/checkout@master + with: + submodules: recursive + + - name: Download web .env file + uses: nicklasfrahm/scp-action@main + with: + direction: download + host: ${{ secrets.PRODUCTION_SSH_HOST }} + fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }} + username: ${{ secrets.PRODUCTION_SSH_USER }} + key: ${{ secrets.PRODUCTION_SSH_KEY }} + source: /home/bperel/workspace/DucksManager2/apps/duck-estimator/.env.local + target: apps/duck-estimator/.env.local + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + image=moby/buildkit:v0.12.3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: bperel + password: ${{ secrets.DOCKER_REGISTRY_TOKEN_DM }} + + - name: Build and push app + uses: docker/build-push-action@v5 + with: + context: . + file: apps/duck-estimator/Dockerfile + platforms: linux/x86_64 + push: true + cache-from: type=registry,ref=ghcr.io/bperel/duck-estimator:buildcache + cache-to: type=registry,ref=ghcr.io/bperel/duck-estimator:buildcache,mode=max + tags: ghcr.io/bperel/duck-estimator:latest + + - name: Upload docker-compose.yml file + uses: nicklasfrahm/scp-action@v1.0.1 + with: + direction: upload + host: ${{ secrets.PRODUCTION_SSH_HOST }} + fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }} + username: ${{ secrets.PRODUCTION_SSH_USER }} + key: ${{ secrets.PRODUCTION_SSH_KEY }} + source: apps/duck-estimator/docker-compose.yml + target: /home/bperel/workspace/DucksManager2/apps/duck-estimator/docker-compose.yml diff --git a/.github/workflows/deploy-ducksmanager.yml b/.github/workflows/deploy-ducksmanager.yml index 3aa73ca84..ce34a9a96 100644 --- a/.github/workflows/deploy-ducksmanager.yml +++ b/.github/workflows/deploy-ducksmanager.yml @@ -6,6 +6,7 @@ on: paths: - ".github/workflows/deploy-ducksmanager.yml" - "apps/web/**" + - "packages/api/**" - "pnpm-lock.yaml" branches: - "master" diff --git a/.gitmodules b/.gitmodules index e22710e8d..955b383c2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,6 +10,15 @@ path = apps/duck-estimator url = git@github.com:bperel/duck-estimator.git branch=master -[submodule "apps/duckguessr"] +[submodule "duckguessr-old"] + path = apps/duckguessr-old + url = git@github.com:bperel/duckguessr.git + branch=master +[submodule "duckguessr"] path = apps/duckguessr url = git@github.com:bperel/duckguessr.git + branch=nuxt3-to-vite-vue3 +[submodule "duckguessr-ml"] + branch=ts + path = packages/duckguessr-ml + url = git@github.com:bperel/duckguessr-ml.git diff --git a/.vscode/settings.json b/.vscode/settings.json index ae0ee58d6..82c61a488 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "editor.codeActionsOnSave": { - "source.fixAll": true + "source.fixAll": "explicit" }, "sqltools.connections": [ { @@ -17,5 +17,5 @@ "password": "changeme" } ], - "i18n-ally.localesPaths": ["translations"], + "i18n-ally.localesPaths": ["translations"] } diff --git a/apps/duck-estimator b/apps/duck-estimator index 46ca02b77..612e1cf79 160000 --- a/apps/duck-estimator +++ b/apps/duck-estimator @@ -1 +1 @@ -Subproject commit 46ca02b7760391de17fad9ec9b863357311491d0 +Subproject commit 612e1cf79d5761bc515221b0c892e0b42fd4d131 diff --git a/apps/duckguessr b/apps/duckguessr index fc58de7b7..323e72c8f 160000 --- a/apps/duckguessr +++ b/apps/duckguessr @@ -1 +1 @@ -Subproject commit fc58de7b7495adb8fcd77f74d5491ab47b2b5e22 +Subproject commit 323e72c8f1ec3c6cb951e0cd0c4e8631d9e3a602 diff --git a/apps/duckguessr-old b/apps/duckguessr-old new file mode 160000 index 000000000..dbd39e3a6 --- /dev/null +++ b/apps/duckguessr-old @@ -0,0 +1 @@ +Subproject commit dbd39e3a6e72da60bc0855a999b5887653b95d27 diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index c8d073166..fa7df5712 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18 as pnpm +FROM node:18.18 as pnpm ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" @@ -36,6 +36,7 @@ COPY --from=build /app/packages/api/dist/api ./packages/api COPY packages/api/package.json ./packages/api COPY packages/api/translations ./packages/api/translations +COPY packages/api/emails ./packages/api/emails RUN --mount=type=cache,id=pnpm-store,target=/app/.pnpm-store \ pnpm i --production diff --git a/apps/web/src/components/Bookcase.vue b/apps/web/src/components/Bookcase.vue index fb3eca1a4..02e876be6 100644 --- a/apps/web/src/components/Bookcase.vue +++ b/apps/web/src/components/Bookcase.vue @@ -24,21 +24,34 @@ :id="`edge-${edgeIndex}`" :key="`edge-${edgeIndex}`" :invisible=" - currentEdgeOpened === sortedBookcase[edgeIndex] || + currentEdgeOpened === sortedBookcaseWithPopularity![edgeIndex] || edgeIndex > lastEdgeIndexContinuouslyLoaded " - :highlighted="currentEdgeHighlighted === sortedBookcase[edgeIndex].id" - :publicationcode="sortedBookcase[edgeIndex].publicationcode" - :issuenumber="sortedBookcase[edgeIndex].issuenumber" - :issuenumber-reference="sortedBookcase[edgeIndex].issuenumberReference" - :creation-date="sortedBookcase[edgeIndex].creationDate?.toString()" - :popularity="sortedBookcase[edgeIndex].popularity || null" - :existing="!!sortedBookcase[edgeIndex].edgeId" + :highlighted=" + currentEdgeHighlighted === sortedBookcaseWithPopularity![edgeIndex].id + " + :publicationcode=" + sortedBookcaseWithPopularity![edgeIndex].publicationcode + " + :issuenumber="sortedBookcaseWithPopularity![edgeIndex].issuenumber" + :issuenumber-reference=" + sortedBookcaseWithPopularity![edgeIndex].issuenumberReference + " + :creation-date=" + sortedBookcaseWithPopularity![edgeIndex].creationDate?.toString() + " + :popularity=" + sortedBookcaseWithPopularity![edgeIndex].popularity || null + " + :existing="!!sortedBookcaseWithPopularity![edgeIndex].edgeId" :sprite-path=" - edgesUsingSprites[sortedBookcase[edgeIndex].edgeId] || null + edgesUsingSprites[sortedBookcaseWithPopularity![edgeIndex].edgeId] || + null " @loaded="onEdgeLoaded(edgeIndex)" - @open-book="$emit('open-book', sortedBookcase[edgeIndex])" + @open-book=" + $emit('open-book', sortedBookcaseWithPopularity![edgeIndex]) + " /> @@ -76,6 +89,10 @@ const { ) >(); +const sortedBookcaseWithPopularity = $computed(() => + embedded ? undefined : (sortedBookcase as BookcaseEdgeWithPopularity[]), +); + const MAX_BATCH_SIZE = 50; let loadedImages = $ref(new Set() as Set); diff --git a/apps/web/src/components/LastPurchases.vue b/apps/web/src/components/LastPurchases.vue index 7f4b9c10c..9c40bf9e9 100644 --- a/apps/web/src/components/LastPurchases.vue +++ b/apps/web/src/components/LastPurchases.vue @@ -19,7 +19,7 @@ :visible="false" >