Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bperel/DucksManager
Browse files Browse the repository at this point in the history
  • Loading branch information
bperel committed Feb 2, 2024
2 parents 3a785f7 + 483a47f commit 6f3b56c
Show file tree
Hide file tree
Showing 33 changed files with 387 additions and 126 deletions.
30 changes: 30 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 4 additions & 2 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/deploy-duck-estimator.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
1 change: 1 addition & 0 deletions .github/workflows/deploy-ducksmanager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- ".github/workflows/deploy-ducksmanager.yml"
- "apps/web/**"
- "packages/api/**"
- "pnpm-lock.yaml"
branches:
- "master"
Expand Down
11 changes: 10 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
path = apps/duck-estimator
url = [email protected]:bperel/duck-estimator.git
branch=master
[submodule "apps/duckguessr"]
[submodule "duckguessr-old"]
path = apps/duckguessr-old
url = [email protected]:bperel/duckguessr.git
branch=master
[submodule "duckguessr"]
path = apps/duckguessr
url = [email protected]:bperel/duckguessr.git
branch=nuxt3-to-vite-vue3
[submodule "duckguessr-ml"]
branch=ts
path = packages/duckguessr-ml
url = [email protected]:bperel/duckguessr-ml.git
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"sqltools.connections": [
{
Expand All @@ -17,5 +17,5 @@
"password": "changeme"
}
],
"i18n-ally.localesPaths": ["translations"],
"i18n-ally.localesPaths": ["translations"]
}
2 changes: 1 addition & 1 deletion apps/duck-estimator
2 changes: 1 addition & 1 deletion apps/duckguessr
1 change: 1 addition & 0 deletions apps/duckguessr-old
Submodule duckguessr-old added at dbd39e
3 changes: 2 additions & 1 deletion apps/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18 as pnpm
FROM node:18.18 as pnpm

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
Expand Down Expand Up @@ -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
Expand Down
37 changes: 27 additions & 10 deletions apps/web/src/components/Bookcase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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])
"
/>
</template>
</div>
Expand Down Expand Up @@ -76,6 +89,10 @@ const {
)
>();
const sortedBookcaseWithPopularity = $computed(() =>
embedded ? undefined : (sortedBookcase as BookcaseEdgeWithPopularity[]),
);
const MAX_BATCH_SIZE = 50;
let loadedImages = $ref(new Set<number>() as Set<number>);
Expand Down
20 changes: 9 additions & 11 deletions apps/web/src/components/LastPurchases.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
:visible="false"
>
<template #header>
<b>{{ purchase.date }}</b
<b>{{ purchase.date.toLocaleDateString(locale) }}</b
>&nbsp;<i v-if="purchase.description"
>{{ purchase.description }}&nbsp;</i
>{{ issues.length }}
Expand All @@ -44,14 +44,14 @@
import { IssueWithPublicationcode } from "~dm-types/IssueWithPublicationcode";
const { publicationNames } = storeToRefs(coa());
const { purchasesById, issues } = storeToRefs(collection());
const { purchasesById, issues: allIssues } = storeToRefs(collection());
const { t } = useI18n();
const { t, locale } = useI18n();
const hasPublicationNames = $computed(() => Object.keys(publicationNames)),
collectionPerPurchaseDate = $computed(
() =>
purchasesById.value &&
issues.value
allIssues.value
?.reduce(
(acc, issue) => {
const existingPurchase =
Expand All @@ -62,19 +62,17 @@ const hasPublicationNames = $computed(() => Object.keys(publicationNames)),
description: existingPurchase.description,
}
: {
date: (
(issue.creationDate || "0001-01-01T00:00:00") as string
).split("T")[0],
date: issue.creationDate,
description: "",
};
let purchaseIndex = acc.findIndex(
({ purchase: currentPurchase }) =>
(currentPurchase.date as string) === (purchase.date as string),
currentPurchase.date === purchase.date,
);
if (purchaseIndex === -1) {
if (purchaseIndex === -1 && purchase.date) {
acc.push({
purchase: {
date: purchase.date as string,
date: purchase.date,
description: purchase.description,
},
issues: [],
Expand All @@ -85,7 +83,7 @@ const hasPublicationNames = $computed(() => Object.keys(publicationNames)),
return acc;
},
[] as {
purchase: { date: string; description: string };
purchase: { date: Date; description: string };
issues: IssueWithPublicationcode[];
}[],
)
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/PublicationSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const { countryNames, publicationNames, publicationNamesFullCountries } =
storeToRefs(coa());
const countryNamesForPublication = $computed(
() =>
(countryNames &&
Object.entries(countryNames)
(countryNames.value &&
Object.entries(countryNames.value)
.map(([countrycode, countryName]) => ({
text: countryName,
value: countrycode,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/stats/ConditionsComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Pie } from "vue-chartjs";
const props = defineProps<{
conditions: { dbValue: string; color: string; text: string }[];
numberPerCondition: Record<string, number>;
style: Record<string, string>;
style?: Record<string, string>;
}>();
Chart.register(Legend, PieController, Tooltip, Title, ArcElement);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/admin/presentation-text/[decision].vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let router = useRouter();
params: { decision: currentRoute.params.decision as string },
reqBody: currentRoute.query as unknown as {
sentence: string;
userId: number;
userId: string;
},
}),
);
Expand Down
Loading

0 comments on commit 6f3b56c

Please sign in to comment.