Skip to content

Commit

Permalink
Release 13.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfagun74 committed Oct 25, 2024
1 parent f0c0f91 commit 83ca2e4
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 32 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# GameVault Backend Server Changelog

## 13.0.3

### Changes

- Implemented Auto Plugin injection short circuit for developers.

## 13.0.2

### Changes
Expand All @@ -24,6 +30,7 @@
- @sebastrion on Discord
- @yann577 on Discord
- @johanstrese on Discord
- @MisterVertigo on Discord

## 13.0.0

Expand Down
63 changes: 63 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# How to Set Up GameVault Backend for Local Development

## What You Need

- [Git](https://git-scm.com/)
- [Node.js LTS](https://nodejs.org/)
- [pnpm](https://pnpm.io)
- [Visual Studio Code (\*)](https://code.visualstudio.com/)
- [Docker (\*)](https://www.docker.com/)

`Items with an asterisk (*) are optional, but recommended.`

## Steps to Get Started

1. **Clone the Repository**

Open your terminal and run:

```bash
git clone https://github.com/Phalcode/gamevault-backend
```

2. **Go to the Project Folder**

Navigate to the directory you just downloaded:

```bash
cd gamevault-backend
```

3. **Install the Required Dependencies**

Install all necessary packages:

```bash
pnpm install
```

4. **Set Up Your Environment**

Copy the sample environment file:

```bash
cp .dev.env .env
```

5. **Start the App or Run Tests**

To start the app:

```bash
pnpm start
```

To run tests:

```bash
pnpm test
```

## Contributing

Before contributing, please review and agree to the [Contributors License Agreement](CONTRIBUTING.md) and the [License](LICENSE.md).
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gamevault-backend",
"version": "13.0.2",
"version": "13.0.3",
"description": "the self-hosted gaming platform for drm-free games",
"author": "Alkan Alper, Schäfer Philip GbR / Phalcode",
"private": true,
Expand Down Expand Up @@ -120,9 +120,9 @@
"json",
"ts"
],
"rootDir": "src",
"roots": ["src", ".local/plugins"],
"setupFiles": [
"./testing/setup-jest.ts"
"./src/testing/setup-jest.ts"
],
"testRegex": ".*\\.spec\\.ts$",
"transform": {
Expand All @@ -131,7 +131,7 @@
"collectCoverageFrom": [
"**/*.ts"
],
"coverageDirectory": "../coverage",
"coverageDirectory": "./coverage",
"testEnvironment": "node"
},
"simple-git-hooks": {
Expand Down
74 changes: 46 additions & 28 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,25 @@ import { GameVaultPluginModule } from "./globals";
import { default as logger } from "./logging";

export default async function loadPlugins() {
const injectDir = `${__dirname}/../plugins/injected`;
let injectDir = `${__dirname}/../plugins/injected`;
const pluginDir = configuration.VOLUMES.PLUGINS;

// Step 1: Remove /app/dist/plugins/injected folder if it exists
try {
await rm(injectDir, { recursive: true, force: true });
logger.debug({
context: "PluginLoader",
message: "Ejecting plugins.",
});
} catch (error) {
logger.error({
context: "PluginLoader",
message: "Failed to eject plugins folder.",
error,
});
}

// Step 2: Copy configuration.VOLUMES.PLUGINS folder to /app/dist/plugins/injected
try {
await cp(configuration.VOLUMES.PLUGINS, injectDir, { recursive: true });
if (
configuration.VOLUMES.PLUGINS == "./.local/plugins" ||
configuration.TESTING.MOCK_FILES
) {
logger.log({
context: "PluginLoader",
message: "Injecting plugins.",
});
} catch (error) {
logger.error({
context: "PluginLoader",
message: "Failed to inject plugins folder.",
error,
message:
"Applying injection short circuit, because either VOLUMES_PLUGINS is set to ./.local/plugins or TESTING_MOCK_FILES is set to true.",
injectDir,
pluginDir,
});
throw error;
injectDir = `${__dirname}/../${pluginDir}`;
} else {
injectPluginFolder(injectDir);
}

// Step 3: Load the plugin files from the new /app/dist/plugins/injected folder
const pluginModuleFiles = (
await readdir(injectDir, {
encoding: "utf8",
Expand Down Expand Up @@ -73,3 +58,36 @@ export default async function loadPlugins() {

return pluginModules;
}

async function injectPluginFolder(injectDir) {
// Step 1: Remove /app/dist/plugins/injected folder if it exists
try {
await rm(injectDir, { recursive: true, force: true });
logger.debug({
context: "PluginLoader",
message: "Ejecting plugins.",
});
} catch (error) {
logger.error({
context: "PluginLoader",
message: "Failed to eject plugins folder.",
error,
});
}

// Step 2: Copy configuration.VOLUMES.PLUGINS folder to /app/dist/plugins/injected
try {
await cp(configuration.VOLUMES.PLUGINS, injectDir, { recursive: true });
logger.log({
context: "PluginLoader",
message: "Injecting plugins.",
});
} catch (error) {
logger.error({
context: "PluginLoader",
message: "Failed to inject plugins folder.",
error,
});
throw error;
}
}

0 comments on commit 83ca2e4

Please sign in to comment.