diff --git a/README.md b/README.md index 5c9e90f..84ab623 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ Available options/variables and their default values: | GOG_PASSWORD | | GOG password for login. Overrides PASSWORD. | | GOG_NEWSLETTER | 0 | Do not unsubscribe from newsletter after claiming a game if 1. | -See `config.js` for all options. +See `src/config.js` for all options. #### How to set options You can add options directly in the command or put them in a file to load. diff --git a/epic-games.js b/epic-games.js index f91d7e5..ae1505d 100644 --- a/epic-games.js +++ b/epic-games.js @@ -2,8 +2,8 @@ import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdate import { authenticator } from 'otplib'; import path from 'path'; import { existsSync, writeFileSync } from 'fs'; -import { resolve, jsonDb, datetime, stealth, filenamify, prompt, notify, html_game_list, handleSIGINT } from './util.js'; -import { cfg } from './config.js'; +import { resolve, jsonDb, datetime, stealth, filenamify, prompt, notify, html_game_list, handleSIGINT } from './src/util.js'; +import { cfg } from './src/config.js'; const screenshot = (...a) => resolve(cfg.dir.screenshots, 'epic-games', ...a); diff --git a/gog.js b/gog.js index 74623e6..048e04a 100644 --- a/gog.js +++ b/gog.js @@ -1,6 +1,6 @@ import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdated playwright-extra -import { resolve, jsonDb, datetime, filenamify, prompt, notify, html_game_list, handleSIGINT } from './util.js'; -import { cfg } from './config.js'; +import { resolve, jsonDb, datetime, filenamify, prompt, notify, html_game_list, handleSIGINT } from './src/util.js'; +import { cfg } from './src/config.js'; const screenshot = (...a) => resolve(cfg.dir.screenshots, 'gog', ...a); diff --git a/prime-gaming.js b/prime-gaming.js index 067ef37..f437d91 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -2,7 +2,7 @@ import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdate import { authenticator } from 'otplib'; import chalk from 'chalk'; import { resolve, jsonDb, datetime, stealth, filenamify, prompt, confirm, notify, html_game_list, handleSIGINT } from './util.js'; -import { cfg } from './config.js'; +import { cfg } from './src/config.js'; const screenshot = (...a) => resolve(cfg.dir.screenshots, 'prime-gaming', ...a); diff --git a/config.js b/src/config.js similarity index 100% rename from config.js rename to src/config.js diff --git a/migrate.js b/src/migrate.js similarity index 100% rename from migrate.js rename to src/migrate.js diff --git a/util.js b/src/util.js similarity index 99% rename from util.js rename to src/util.js index 6ed1d10..f82102b 100644 --- a/util.js +++ b/src/util.js @@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); // explicit object instead of Object.fromEntries since the built-in type would loose the keys, better type: https://dev.to/svehla/typescript-object-fromentries-389c -export const dataDir = s => path.resolve(__dirname, 'data', s); +export const dataDir = s => path.resolve(__dirname, '..', 'data', s); // modified path.resolve to return null if first argument is '0', used to disable screenshots export const resolve = (...a) => a.length && a[0] == '0' ? null : path.resolve(...a); diff --git a/version.js b/src/version.js similarity index 100% rename from version.js rename to src/version.js diff --git a/unrealengine.js b/unrealengine.js index cd2eb33..bfd3417 100644 --- a/unrealengine.js +++ b/unrealengine.js @@ -5,8 +5,8 @@ import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdate import { authenticator } from 'otplib'; import path from 'path'; import { writeFileSync } from 'fs'; -import { resolve, jsonDb, datetime, stealth, filenamify, prompt, notify, html_game_list, handleSIGINT } from './util.js'; -import { cfg } from './config.js'; +import { resolve, jsonDb, datetime, stealth, filenamify, prompt, notify, html_game_list, handleSIGINT } from './src/util.js'; +import { cfg } from './src/config.js'; const screenshot = (...a) => resolve(cfg.dir.screenshots, 'unrealengine', ...a); diff --git a/xbox.js b/xbox.js index 54cccf2..008388c 100644 --- a/xbox.js +++ b/xbox.js @@ -7,8 +7,8 @@ import { jsonDb, notify, prompt, -} from './util.js'; -import { cfg } from './config.js'; +} from './src/util.js'; +import { cfg } from './src/config.js'; // ### SETUP const URL_CLAIM = 'https://www.xbox.com/en-US/live/gold'; // #gameswithgold";