Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark mode, i18n, Dockerfile, resource bar #80

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.github/
.next/
.vscode/
db/
node_modules/

docker-compose.yml
.prettier*
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch via NPM",
"request": "launch",
"runtimeArgs": [
"run-script",
"dev"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
},
]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"spellright.language": [
"en_US",
"ru_RU"
],
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext",
"json"
]
}
25 changes: 25 additions & 0 deletions .vscode/spellright.dict
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Бонусные
Pearlbrook
АМБАССАДОРЫ
реактивировать
Monastary
Ветко
ВП
Амбассадора
Санблейз
Sunblaze
токена
Everdell
Hopewatch
Mistrise
Омикрон
Снаут
Iluminor
Иллюминор
Crustina
Крустина
Босли
Bosley
Seaglass
realtime
Амбассадоров
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Build stage
FROM node:16-alpine AS builder

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build:ci

# Production stage
FROM node:16-alpine AS production

WORKDIR /app

COPY --from=builder /app/.next /app/.next
COPY --from=builder /app/public /app/public
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/next.config.js ./next.config.js
COPY --from=builder /app/next-i18next.config.js ./next-i18next.config.js

# Install only production dependencies
RUN npm install --production

EXPOSE 3000

CMD ["npm", "run", "start"]
1 change: 1 addition & 0 deletions db/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.sqlite
*.db
*.csv
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3.8"

services:
everdell:
build:
context: .
target: production
ports:
- "3010:3000"
volumes:
- everdell-db:/app/db # Mount the volume at /app/db inside the container
environment:
- DB_PATH=/app/db/game.sqlite # Update DB_PATH to use the mounted volume
- PORT=3000
# entrypoint: ["/bin/sleep", "infinty"]

volumes:
everdell-db: # Named volume for the database
62 changes: 62 additions & 0 deletions locale_helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Made by ChatGPT. To copy missing keys from ru-RU to pt-BR run it like this:
//
// node locale_helper.js public/locales/{ru-RU,pt-BR}/common.json

const fs = require('fs');
const path = require('path');

// Get arguments from the command line
const args = process.argv.slice(2);

if (args.length < 2) {
console.error('Usage: node script.js <path_to_file1.json> <path_to_file2.json>');
process.exit(1);
}

const [filePath1, filePath2] = args.map(arg => path.resolve(arg));

// Helper function to load a JSON file
function loadJSON(filePath) {
try {
const data = fs.readFileSync(filePath, 'utf-8');
return JSON.parse(data);
} catch (error) {
console.error(`Error loading JSON file at ${filePath}:`, error);
process.exit(1);
}
}

// Helper function to save a JSON file
function saveJSON(filePath, data) {
try {
fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
console.log(`File saved successfully at ${filePath}`);
} catch (error) {
console.error(`Error saving JSON file at ${filePath}:`, error);
}
}

// Main function to add missing keys
function addMissingKeys() {
const json1 = loadJSON(filePath1);
const json2 = loadJSON(filePath2);

const keys1 = Object.keys(json1);
let modified = false;

keys1.forEach((key) => {
if (!(key in json2)) {
json2[key] = key; // Set the key's name as its own value
modified = true;
console.log(`Added missing key: ${key}`);
}
});

if (modified) {
saveJSON(filePath2, json2);
} else {
console.log('No missing keys were found.');
}
}

addMissingKeys();
8 changes: 8 additions & 0 deletions next-i18next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('next-i18next').UserConfig} */
module.exports = {
i18n: {
defaultLocale: "en-US",
locales: ["en-US", "ru-RU", "pt-BR"],
localeDetection: false,
},
};
5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { i18n } = require("./next-i18next.config");

module.exports = {
i18n,
};
Loading