fix(backend): fixes for branding (#8449)

* copy from branding folder to backend public folder

provide default branding/public folder

* copy public folder correctly

* copy files again for providers.json

* copy more public folders

* more copy

* revert change

* fix naming of called script when using db:data:branding

* prod command for branding data

* close database connection

* lint fixes

* increase test timeout again
This commit is contained in:
Ulf Gebhardt 2025-04-28 18:17:18 +02:00 committed by GitHub
parent fffaebcbca
commit d7d8a242cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 7 deletions

View File

@ -24,11 +24,12 @@ ONBUILD COPY ./branding/constants/ src/config/tmp
ONBUILD RUN tools/replace-constants.sh ONBUILD RUN tools/replace-constants.sh
ONBUILD COPY ./branding/email/ src/middleware/helpers/email/ ONBUILD COPY ./branding/email/ src/middleware/helpers/email/
ONBUILD COPY ./branding/data/ src/db/data ONBUILD COPY ./branding/data/ src/db/data
ONBUILD COPY ./branding/public/ public/
ONBUILD RUN yarn install --production=false --frozen-lockfile --non-interactive ONBUILD RUN yarn install --production=false --frozen-lockfile --non-interactive
ONBUILD RUN yarn run build ONBUILD RUN yarn run build
ONBUILD RUN mkdir /build ONBUILD RUN mkdir /build
ONBUILD RUN cp -r ./build /build ONBUILD RUN cp -r ./build /build
ONBUILD RUN cp -r ./public /build/build ONBUILD RUN cp -r ./public /build
ONBUILD RUN cp -r ./package.json yarn.lock /build ONBUILD RUN cp -r ./package.json yarn.lock /build
ONBUILD RUN cd /build && yarn install --production=true --frozen-lockfile --non-interactive ONBUILD RUN cd /build && yarn install --production=true --frozen-lockfile --non-interactive

View File

View File

@ -19,11 +19,12 @@
"db:seed": "ts-node --require tsconfig-paths/register src/db/seed.ts", "db:seed": "ts-node --require tsconfig-paths/register src/db/seed.ts",
"db:data:admin": "ts-node --require tsconfig-paths/register src/db/admin.ts", "db:data:admin": "ts-node --require tsconfig-paths/register src/db/admin.ts",
"db:data:badges": "ts-node --require tsconfig-paths/register src/db/badges.ts", "db:data:badges": "ts-node --require tsconfig-paths/register src/db/badges.ts",
"db:data:branding": "ts-node --require tsconfig-paths/register src/db/data-production.ts", "db:data:branding": "ts-node --require tsconfig-paths/register src/db/data-branding.ts",
"db:data:categories": "ts-node --require tsconfig-paths/register src/db/categories.ts", "db:data:categories": "ts-node --require tsconfig-paths/register src/db/categories.ts",
"db:migrate": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --store ./src/db/migrate/store.ts", "db:migrate": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --store ./src/db/migrate/store.ts",
"db:migrate:create": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --template-file ./src/db/migrate/template.ts --date-format 'yyyymmddHHmmss' create", "db:migrate:create": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --template-file ./src/db/migrate/template.ts --date-format 'yyyymmddHHmmss' create",
"prod:migrate": "migrate --migrations-dir ./build/src/db/migrations --store ./build/src/db/migrate/store.js" "prod:migrate": "migrate --migrations-dir ./build/src/db/migrations --store ./build/src/db/migrate/store.js",
"prod:db:data:branding": "node build/src/db/data-branding.js"
}, },
"dependencies": { "dependencies": {
"@babel/cli": "~7.27.0", "@babel/cli": "~7.27.0",

View File

@ -1,16 +1,18 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-misused-promises */
/* eslint-disable @typescript-eslint/no-floating-promises */ /* eslint-disable @typescript-eslint/no-floating-promises */
import { readdir } from 'node:fs/promises' import { readdir } from 'node:fs/promises'
import path from 'node:path' import path from 'node:path'
import { getNeode } from './neo4j'
const dataFolder = path.join(__dirname, 'data/') const dataFolder = path.join(__dirname, 'data/')
const neode = getNeode()
;(async function () { ;(async function () {
const files = await readdir(dataFolder) const files = await readdir(dataFolder)
files.forEach(async (file) => { for await (const file of files) {
if (file.slice(0, -3).endsWith('-branding')) { if (file.slice(0, -3).endsWith('-branding')) {
const importedModule = await import(path.join(dataFolder, file)) const importedModule = await import(path.join(dataFolder, file))
if (!importedModule.default) { if (!importedModule.default) {
@ -18,5 +20,8 @@ const dataFolder = path.join(__dirname, 'data/')
} }
await importedModule.default() await importedModule.default()
} }
}) }
// close database connection
neode.close()
})() })()

View File

@ -1,2 +1,2 @@
// Metascraper takes longer nowadays, double time // Metascraper takes longer nowadays, double time
// jest.setTimeout(10000) jest.setTimeout(10000)