-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to Node 20 & add Docker support (#3)
Deps updated, Node updated, Added Docker support, Removed some no longer needed packages.
- Loading branch information
Showing
28 changed files
with
629 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Obvious... | ||
node_modules | ||
|
||
# Already built files | ||
dist | ||
|
||
# Cache | ||
.cache | ||
|
||
# IDE | ||
.vs | ||
.idea | ||
.editorconfig | ||
|
||
# Environment | ||
.env | ||
.env.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Copy this to .env.local and fill in the values | ||
API_KEY= | ||
SECRET_KEY= | ||
STORMFORGE_API_KEY= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build and Publish Docker Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- docker | ||
paths-ignore: | ||
- ".editorconfig" | ||
- "tsm.service" | ||
- "README.md" | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- dockerfile: Dockerfile | ||
image: ghcr.io/tauri-wow-community-devs/tsm-app-data-generator:latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./${{ matrix.dockerfile }} | ||
push: true | ||
tags: ${{ matrix.image }} | ||
cache-from: type=gha, key=docker-${{ matrix.dockerfile }}-${{ matrix.image }} | ||
cache-to: type=gha, key=docker-${{ matrix.dockerfile }}-${{ matrix.image }}, mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM node:20-alpine AS builder | ||
|
||
WORKDIR /app | ||
|
||
# Copy package.json and yarn.lock | ||
COPY package.json yarn.lock ./ | ||
|
||
# Install dependencies | ||
RUN yarn install --frozen-lockfile | ||
|
||
# Copy source files and tsconfig | ||
COPY src ./src | ||
COPY tsconfig.json ./ | ||
|
||
# Build the project | ||
RUN yarn build | ||
|
||
# Remove dev dependencies | ||
RUN yarn install --production --ignore-scripts --prefer-offline | ||
|
||
# Start the application | ||
CMD ["node", "dist/index.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
services: | ||
app: | ||
image: ghcr.io/tauri-wow-community-devs/tsm-app-data-generator:latest | ||
pull_policy: always | ||
restart: always | ||
ports: | ||
- "${SERVER_PORT:-9876}:${SERVER_PORT:-9876}" | ||
env_file: | ||
- .env.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
import {config} from "dotenv"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import {config} from "dotenv"; | ||
|
||
export const initDotEnv = () => { | ||
let envFile = ""; | ||
try { | ||
envFile = ".env.local"; | ||
if (!fs.existsSync(path.resolve(envFile))) | ||
envFile = ".env"; | ||
if (!fs.existsSync(path.resolve(envFile))) envFile = ".env"; | ||
} catch (err) { | ||
envFile = ".env"; | ||
} | ||
|
||
config({ | ||
path: envFile | ||
path: envFile, | ||
}); | ||
|
||
const envVariables = ["API_KEY", "SECRET_KEY"]; | ||
envVariables.forEach(env => { | ||
if (!process.env[env]) | ||
throw new Error(`Missing .env variable: ${env}`); | ||
const envVariables = [ | ||
"API_KEY", | ||
"SECRET_KEY", | ||
"STORMFORGE_API_KEY", | ||
"STORMFORGE_SECRET_KEY", | ||
]; | ||
envVariables.forEach((env) => { | ||
if (!process.env[env]) throw new Error(`Missing .env variable: ${env}`); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "src/lib/tsm/tsm"; | ||
export * from "src/lib/tsm/math"; | ||
export * from "src/lib/tsm/types"; | ||
export * from "./math"; | ||
export * from "./tsm"; | ||
export * from "./types"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {apiCall} from "src/lib/api"; | ||
import {Realm} from "src/constants/realms"; | ||
import {Realm} from "../../constants/realms"; | ||
import {apiCall} from "../../lib/api"; | ||
import {AuctionsDataResult} from "./auctions-data"; | ||
|
||
export const fetchAuctionsItemPrices = (item: number, realm: Realm = Realm.TAURI) => apiCall<AuctionsDataResult>("auctions-item-prices", realm, {item}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.