From dc9dc98c7190c67470990419bb5fa2c0828ccd32 Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 4 Apr 2024 12:34:23 -0400 Subject: [PATCH] Adding Env files for Local Development Ease --- .env | 2 ++ .env.development | 2 ++ README.md | 9 +++------ package.json | 1 + src/battle-scene.ts | 4 ++-- vite.env.d.ts | 11 +++++++++++ 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 .env create mode 100644 .env.development create mode 100644 vite.env.d.ts diff --git a/.env b/.env new file mode 100644 index 00000000000..86feafaa143 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +VITE_BYPASS_LOGIN=0 +VITE_BYPASS_TUTORIAL=0 \ No newline at end of file diff --git a/.env.development b/.env.development new file mode 100644 index 00000000000..88dcdce619c --- /dev/null +++ b/.env.development @@ -0,0 +1,2 @@ +VITE_BYPASS_LOGIN=1 +VITE_BYPASS_TUTORIAL=0 \ No newline at end of file diff --git a/README.md b/README.md index ce917491fa5..299cd9b84cf 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,12 @@ node: 18.3.0 1. Clone the repo and in the root directory run `npm install` - *if you run into any errors, reach out in the **#dev-corner** channel in discord* -2. Run `npm run start` to locally run the project in `localhost:8000` +2. Run `npm run start:dev` to locally run the project in `localhost:8000` ### ❔ FAQ -**How do I test a new ability/move?** -- In the `pokemon.ts` file there are overrides you can set to apply the new move/ability to your active pokemon - -**How do I test a specific seed/wave?** -- In the `battle-scene.ts` file there are overrides for seed, starting level, starting wave, starting biome, and starting money +**How do I test a new _______?** +- In the `battle-scene.ts` file there are overrides for most values you'll need to change for testing ## 🪧 To Do diff --git a/package.json b/package.json index 035b770696e..9065bc17a55 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "type": "module", "scripts": { "start": "vite", + "start:dev": "vite --mode development", "build": "vite build", "preview": "vite preview", "test": "vitest run", diff --git a/src/battle-scene.ts b/src/battle-scene.ts index d386aff415f..abf347b1873 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -59,7 +59,7 @@ import { UiTheme } from './enums/ui-theme'; import CacheBustedLoaderPlugin from './plugins/cache-busted-loader-plugin'; import { SceneBase } from './scene-base'; -export const bypassLogin = false; +export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; export const SEED_OVERRIDE = ''; export const STARTER_SPECIES_OVERRIDE = 0; @@ -115,7 +115,7 @@ export default class BattleScene extends SceneBase { public gameSpeed: integer = 1; public damageNumbersMode: integer = 0; public showLevelUpStats: boolean = true; - public enableTutorials: boolean = true; + public enableTutorials: boolean = import.meta.env.VITE_BYPASS_TUTORIAL === "1"; public uiTheme: UiTheme = UiTheme.DEFAULT; public windowType: integer = 0; public experimentalSprites: boolean = false; diff --git a/vite.env.d.ts b/vite.env.d.ts new file mode 100644 index 00000000000..1bb3a15b588 --- /dev/null +++ b/vite.env.d.ts @@ -0,0 +1,11 @@ +/// + +interface ImportMetaEnv { + readonly VITE_BYPASS_LOGIN: string; + readonly VITE_BYPASS_TUTORIAL: string; + readonly VITE_API_BASE_URL: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} \ No newline at end of file