mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-04 17:41:23 +01:00
Update copilot guidelines to reflect NPM/Vite/TypeScript migration
Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>
This commit is contained in:
parent
b940f71257
commit
b3dd065c0e
2 changed files with 62 additions and 32 deletions
83
.github/copilot-instructions.md
vendored
83
.github/copilot-instructions.md
vendored
|
|
@ -1,58 +1,76 @@
|
||||||
# Fantasy Map Generator
|
# Fantasy Map Generator
|
||||||
|
|
||||||
Azgaar's Fantasy Map Generator is a client-side JavaScript web application for creating fantasy maps. It generates detailed fantasy worlds with countries, cities, rivers, biomes, and cultural elements.
|
Azgaar's Fantasy Map Generator is a web application for creating fantasy maps. It generates detailed fantasy worlds with countries, cities, rivers, biomes, and cultural elements.
|
||||||
|
|
||||||
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
|
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
|
||||||
|
|
||||||
## Working Effectively
|
## Working Effectively
|
||||||
|
|
||||||
- **CRITICAL**: This is a static web application - NO build process needed. No npm install, no compilation, no bundling.
|
- The project uses NPM, Vite, and TypeScript for development and building.
|
||||||
- Run the application using HTTP server (required - cannot run with file:// protocol):
|
- **Setup**: Run `npm install` to install dependencies (requires Node.js >= 24.0.0)
|
||||||
- `python3 -m http.server 8000` - takes 2-3 seconds to start
|
- **Development**: Run `npm run dev` to start the Vite development server
|
||||||
- Access at: `http://localhost:8000`
|
- Access at: `http://localhost:5173` (Vite's default port)
|
||||||
|
- Hot module replacement (HMR) enabled - changes are reflected immediately
|
||||||
|
- **Building**: Run `npm run build` to compile TypeScript and build for production
|
||||||
|
- TypeScript compilation runs first (`tsc`)
|
||||||
|
- Vite builds the application to `dist/` directory
|
||||||
|
- **Preview**: Run `npm run preview` to preview the production build locally
|
||||||
|
|
||||||
## Validation
|
## Validation
|
||||||
|
|
||||||
- Always manually validate any changes by:
|
- Always manually validate any changes by:
|
||||||
1. Starting the HTTP server (NEVER CANCEL - wait for full startup)
|
1. Run `npm run dev` to start the development server (wait for "ready" message)
|
||||||
2. Navigate to the application in browser
|
2. Navigate to the application in browser (typically `http://localhost:5173`)
|
||||||
3. Click the "►" button to open the menu and generate a new map
|
3. Click the "►" button to open the menu and generate a new map
|
||||||
4. **CRITICAL VALIDATION**: Verify the map generates with countries, cities, roads, and geographic features
|
4. **CRITICAL VALIDATION**: Verify the map generates with countries, cities, roads, and geographic features
|
||||||
5. Test UI interaction: click "Layers" button, verify layer controls work
|
5. Test UI interaction: click "Layers" button, verify layer controls work
|
||||||
6. Test regeneration: click "New Map!" button, verify new map generates correctly
|
6. Test regeneration: click "New Map!" button, verify new map generates correctly
|
||||||
- **Known Issues**: Google Analytics and font loading errors are normal (blocked external resources)
|
- **Known Issues**: Google Analytics and font loading errors are normal (blocked external resources)
|
||||||
|
- For production build validation: run `npm run build` followed by `npm run preview`
|
||||||
|
|
||||||
## Repository Structure
|
## Repository Structure
|
||||||
|
|
||||||
### Core Files
|
### Core Files
|
||||||
|
|
||||||
- `index.html` - Main application entry point
|
- `package.json` - NPM package configuration with scripts and dependencies
|
||||||
- `main.js` - Core application logic
|
- `vite.config.ts` - Vite build configuration
|
||||||
- `versioning.js` - Version management and update handling
|
- `tsconfig.json` - TypeScript compiler configuration
|
||||||
|
|
||||||
### Key Directories
|
### Source Directories
|
||||||
|
|
||||||
- `modules/` - core functionality modules:
|
- `src/` - Source code directory (build input)
|
||||||
|
- `src/index.html` - Main application entry point
|
||||||
|
- `src/utils/` - TypeScript utility modules (migrated from JS)
|
||||||
|
- `public/` - Static assets (copied to build output)
|
||||||
|
- `public/main.js` - Core application logic
|
||||||
|
- `public/versioning.js` - Version management and update handling
|
||||||
|
- `public/modules/` - Core functionality modules:
|
||||||
- `modules/ui/` - UI components (editors, tools, style management)
|
- `modules/ui/` - UI components (editors, tools, style management)
|
||||||
- `modules/dynamic/` - runtime modules (export, installation)
|
- `modules/dynamic/` - runtime modules (export, installation)
|
||||||
- `modules/renderers/` - drawing and rendering logic
|
- `modules/renderers/` - drawing and rendering logic
|
||||||
- `utils/` - utility libraries (math, arrays, strings, etc.)
|
- `public/styles/` - Visual style presets (JSON files)
|
||||||
- `styles/` - visual style presets (JSON files)
|
- `public/libs/` - Third-party libraries (D3.js, TinyMCE, etc.)
|
||||||
- `libs/` - Third-party libraries (D3.js, TinyMCE, etc.)
|
- `public/images/` - Backgrounds, UI elements
|
||||||
- `images/` - backgrounds, UI elements
|
- `public/charges/` - Heraldic symbols and coat of arms elements
|
||||||
- `charges/` - heraldic symbols and coat of arms elements
|
- `public/config/` - Heightmap templates and configurations
|
||||||
- `config/` - Heightmap templates and configurations
|
- `public/heightmaps/` - Terrain generation data
|
||||||
- `heightmaps/` - Terrain generation data
|
- `dist/` - Production build output (generated by `npm run build`)
|
||||||
|
|
||||||
## Common Tasks
|
## Common Tasks
|
||||||
|
|
||||||
### Making Code Changes
|
### Making Code Changes
|
||||||
|
|
||||||
1. Edit JavaScript files directly (no compilation needed)
|
1. **TypeScript files** (`src/utils/*.ts`):
|
||||||
2. Refresh browser to see changes immediately
|
- Edit TypeScript files in the `src/utils/` directory
|
||||||
3. **ALWAYS test map generation** after making changes
|
- Changes are automatically recompiled and hot-reloaded in dev mode
|
||||||
4. Update version in `versioning.js` for all changes
|
- Run `npm run build` to verify TypeScript compilation succeeds
|
||||||
5. Update file hashes in `index.html` for changed files (format: `file.js?v=1.108.1`)
|
2. **JavaScript files** (`public/*.js`, `public/modules/*.js`):
|
||||||
|
- Edit JavaScript files directly in the `public/` directory
|
||||||
|
- Changes are automatically reflected in dev mode via HMR
|
||||||
|
- **Note**: Core application logic is still in JavaScript and gradually being migrated
|
||||||
|
3. **Always test map generation** after making changes
|
||||||
|
4. Update version in `public/versioning.js` for all changes
|
||||||
|
5. For production builds, update file hashes in `src/index.html` if needed (format: `file.js?v=1.108.1`)
|
||||||
|
|
||||||
### Debugging Map Generation
|
### Debugging Map Generation
|
||||||
|
|
||||||
|
|
@ -71,19 +89,30 @@ Always reference these instructions first and fallback to search or bash command
|
||||||
|
|
||||||
### Application Won't Load
|
### Application Won't Load
|
||||||
|
|
||||||
- Ensure using HTTP server (not file://)
|
- Run `npm install` to ensure dependencies are installed
|
||||||
- Check console for JavaScript errors
|
- Run `npm run dev` to start the development server
|
||||||
|
- Check console for JavaScript/TypeScript errors
|
||||||
- Verify all files are present in repository
|
- Verify all files are present in repository
|
||||||
|
- Ensure Node.js version >= 24.0.0 (`node --version`)
|
||||||
|
|
||||||
|
### Build Failures
|
||||||
|
|
||||||
|
- Check TypeScript compilation errors (`tsc` output)
|
||||||
|
- Verify all dependencies are installed (`npm install`)
|
||||||
|
- Check `tsconfig.json` for configuration issues
|
||||||
|
- Look for import/module resolution errors
|
||||||
|
|
||||||
### Map Generation Fails
|
### Map Generation Fails
|
||||||
|
|
||||||
- Check browser console for error messages
|
- Check browser console for error messages
|
||||||
- Look for specific module failures in generation logs
|
- Look for specific module failures in generation logs
|
||||||
- Try refreshing page and generating new map
|
- Try refreshing page and generating new map
|
||||||
|
- Verify build completed successfully if using production build
|
||||||
|
|
||||||
### Performance Issues
|
### Performance Issues
|
||||||
|
|
||||||
- Map generation should complete in ~1 second for standard configurations
|
- Map generation should complete in ~1 second for standard configurations
|
||||||
- If slower, check browser console for errors
|
- If slower, check browser console for errors
|
||||||
|
- Development mode may be slower due to HMR overhead
|
||||||
|
|
||||||
Remember: This is a sophisticated client-side application that generates complete fantasy worlds with political systems, geography, cultures, and detailed cartographic elements. Always validate that your changes preserve the core map generation functionality.
|
Remember: This is a sophisticated application that generates complete fantasy worlds with political systems, geography, cultures, and detailed cartographic elements. The project is gradually migrating from vanilla JavaScript to TypeScript. Always validate that your changes preserve the core map generation functionality.
|
||||||
|
|
|
||||||
5
package-lock.json
generated
5
package-lock.json
generated
|
|
@ -20,6 +20,9 @@
|
||||||
"@types/polylabel": "^1.1.3",
|
"@types/polylabel": "^1.1.3",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"vite": "^7.3.1"
|
"vite": "^7.3.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=24.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/aix-ppc64": {
|
"node_modules/@esbuild/aix-ppc64": {
|
||||||
|
|
@ -1458,7 +1461,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz",
|
||||||
"integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==",
|
"integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
|
|
@ -1680,7 +1682,6 @@
|
||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue