Skip to content

Commit a4fa384

Browse files
committed
merge: upstream/master (v1.114.2) into barrulus customizations
Conflict resolutions: - public/modules/resample.js: accept upstream deletion (migrated to src/modules/resample.ts); re-apply Uint32Array fix for pack.cells.burg. - public/modules/submap.js: accept upstream deletion (generator fully removed; only submap-tool.js remains and does not allocate cells). - src/modules/ice.ts: port perf tweaks from the old ice.js - Set-based getNextId() and sequential nextId++ in generate() - onto the new TS class form.
2 parents b0520c3 + bb5039d commit a4fa384

92 files changed

Lines changed: 10431 additions & 7524 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
---
22
name: Bug report
33
about: Report a problem
4-
title: ''
4+
title: ""
55
labels: pending review
66
assignees: Azgaar
7-
87
---
98

10-
<!-- PLEASE FILL OUT THE FOLLOWING INFORMATION -->
119
**Describe the bug**
10+
1211
<!-- A clear and concise description of what the bug is -->
1312

1413
**Steps to reproduce**
14+
1515
<!-- Steps to reproduce the behavior. Please try to explain like to a 5-year-old person who had never used the tool before -->
16+
1617
1. Click on ...
1718
2. Type ...
1819
3. See the ...
1920

2021
**Expected behavior**
22+
2123
<!-- A clear and concise description of what you expected to happen -->
2224

2325
**.map file**
26+
2427
<!-- Attach archived .map file (zip archive) so we can fix the issue faster -->
2528

2629
**Screenshots**
30+
2731
<!-- Add screenshots to help explain your problem -->
2832

2933
**System**
34+
3035
<!-- Please add all the details. Verison is displayed as a part of the page title and also at loading screen. If the issue is for desktop version, please specify it as well -->
31-
- Version: ...
32-
- Browser: ...
33-
- OS: ...
36+
37+
- Version: ...
38+
- Browser: ...
39+
- OS: ...

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
name: Feature request
33
about: Suggest an idea
4-
title: ''
4+
title: ""
55
labels: pending review
66
assignees: Azgaar
7-
87
---
98

109
<-- BEFORE CREATING PLEASE CHECK THE TO-DO LIST-->
1110
<-- https://trello.com/b/7x832DG4/fantasy-map-generator ->>
11+
1212
**Problem**
1313
<-- Is your feature request related to a problem? Please describe. Ex.: I'm always frustrated when ... -->
1414

.github/copilot-instructions.md

Lines changed: 63 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,65 @@
11
# Fantasy Map Generator
22

3-
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.
4-
5-
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.
6-
7-
## Working Effectively
8-
9-
- The project uses NPM, Vite, and TypeScript for development and building.
10-
- **Setup**: Run `npm install` to install dependencies (requires Node.js >= 24.0.0)
11-
- **Development**: Run `npm run dev` to start the Vite development server
12-
- Access at: `http://localhost:5173` (Vite's default port)
13-
- Hot module replacement (HMR) enabled - changes are reflected immediately
14-
- **Building**: Run `npm run build` to compile TypeScript and build for production
15-
- TypeScript compilation runs first (`tsc`)
16-
- Vite builds the application to `dist/` directory
17-
- **Preview**: Run `npm run preview` to preview the production build locally
18-
19-
## Validation
20-
21-
- Always manually validate any changes by:
22-
1. Run `npm run dev` to start the development server (wait for "ready" message)
23-
2. Navigate to the application in browser (typically `http://localhost:5173`)
24-
3. Click the "►" button to open the menu and generate a new map
25-
4. **CRITICAL VALIDATION**: Verify the map generates with countries, cities, roads, and geographic features
26-
5. Test UI interaction: click "Layers" button, verify layer controls work
27-
6. Test regeneration: click "New Map!" button, verify new map generates correctly
28-
- **Known Issues**: Google Analytics and font loading errors are normal (blocked external resources)
29-
- For production build validation: run `npm run build` followed by `npm run preview`
30-
31-
## Repository Structure
32-
33-
### Core Files
34-
35-
- `package.json` - NPM package configuration with scripts and dependencies
36-
- `vite.config.ts` - Vite build configuration
37-
- `tsconfig.json` - TypeScript compiler configuration
38-
39-
### Source Directories
40-
41-
- `src/` - Source code directory (build input)
42-
- `src/index.html` - Main application entry point
43-
- `src/utils/` - TypeScript utility modules (migrated from JS)
44-
- `public/` - Static assets (copied to build output)
45-
- `public/main.js` - Core application logic
46-
- `public/versioning.js` - Version management and update handling
47-
- `public/modules/` - Core functionality modules:
48-
- `modules/ui/` - UI components (editors, tools, style management)
49-
- `modules/dynamic/` - runtime modules (export, installation)
50-
- `modules/renderers/` - drawing and rendering logic
51-
- `public/styles/` - Visual style presets (JSON files)
52-
- `public/libs/` - Third-party libraries (D3.js, TinyMCE, etc.)
53-
- `public/images/` - Backgrounds, UI elements
54-
- `public/charges/` - Heraldic symbols and coat of arms elements
55-
- `public/config/` - Heightmap templates and configurations
56-
- `public/heightmaps/` - Terrain generation data
57-
- `dist/` - Production build output (generated by `npm run build`)
58-
59-
## Common Tasks
60-
61-
### Making Code Changes
62-
63-
1. **TypeScript files** (`src/utils/*.ts`):
64-
- Edit TypeScript files in the `src/utils/` directory
65-
- Changes are automatically recompiled and hot-reloaded in dev mode
66-
- Run `npm run build` to verify TypeScript compilation succeeds
67-
2. **JavaScript files** (`public/*.js`, `public/modules/*.js`):
68-
- Edit JavaScript files directly in the `public/` directory
69-
- Changes are automatically reflected in dev mode via HMR
70-
- **Note**: Core application logic is still in JavaScript and gradually being migrated
71-
3. **Always test map generation** after making changes
72-
4. Update version in `public/versioning.js` for all changes
73-
5. For production builds, update file hashes in `src/index.html` if needed (format: `file.js?v=1.108.1`)
74-
75-
### Debugging Map Generation
76-
77-
- Open browser developer tools console
78-
- Look for timing logs, e.g. "TOTAL: ~0.76s"
79-
- Map generation logs show each step (heightmap, rivers, states, etc.)
80-
- Error messages will indicate specific generation failures
81-
82-
### Testing Different Map Types
83-
84-
- Use "New Map!" button for quick regeneration
85-
- Access "Layers" menu to change map visualization
86-
- Available presets: Political, Cultural, Religions, Biomes, Heightmap, Physical, Military
87-
88-
## Troubleshooting
89-
90-
### Application Won't Load
91-
92-
- Run `npm install` to ensure dependencies are installed
93-
- Run `npm run dev` to start the development server
94-
- Check console for JavaScript/TypeScript errors
95-
- Verify all files are present in repository
96-
- Ensure Node.js version >= 24.0.0 (`node --version`)
97-
98-
### Build Failures
99-
100-
- Check TypeScript compilation errors (`tsc` output)
101-
- Verify all dependencies are installed (`npm install`)
102-
- Check `tsconfig.json` for configuration issues
103-
- Look for import/module resolution errors
104-
105-
### Map Generation Fails
106-
107-
- Check browser console for error messages
108-
- Look for specific module failures in generation logs
109-
- Try refreshing page and generating new map
110-
- Verify build completed successfully if using production build
111-
112-
### Performance Issues
113-
114-
- Map generation should complete in ~1 second for standard configurations
115-
- If slower, check browser console for errors
116-
- Development mode may be slower due to HMR overhead
117-
118-
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.
3+
Azgaar's Fantasy Map Generator is a client-only web application for creating fantasy maps. It generates detailed fantasy worlds with countries, cities, rivers, biomes, and cultural elements.
4+
5+
Always reference these instructions first.
6+
7+
# Architecture
8+
9+
The codebase is gradually transitioning from **vanilla JavaScript to TypeScript** while maintaining compatibility with the existing generation pipeline and legacy `.map` user files.
10+
11+
The expected **future architecture** is based on a separation between **world data**, **procedural generation**, **interactive editing**, and **rendering**.
12+
13+
The application is conceptually divided into four main layers:
14+
15+
- **State** — world data and style configuration, the single source of truth
16+
- **Generators** — procedural world simulation (model)
17+
- **Editors** — user-driven mutations of the world state (controllers)
18+
- **Renderer** — map visualization (view)
19+
20+
Flow:
21+
settings → generators → world data → renderer
22+
UI → editors → world data → renderer
23+
24+
### Layer responsibilities
25+
26+
**State (world data)**
27+
Stores all map data and style configuration.
28+
The data layer must contain **no logic and no rendering code**.
29+
30+
**Generators**
31+
Implement the procedural world simulation and populate or update world data based on generation settings.
32+
33+
**Editors**
34+
Implement interactive editing tools used by the user.
35+
Editors perform controlled mutations of the world state and can be viewed as **interactive generators**.
36+
37+
**Renderer**
38+
Converts the world state into **SVG or WebGL graphics**.
39+
Rendering must be a **pure visualization step** and must **not modify world data**.
40+
41+
# Working Effectively
42+
43+
The project uses **NPM**, **Vite**, and **TypeScript** for development and building.
44+
45+
## Setup
46+
47+
Install dependencies: `npm install`
48+
49+
Requirements: Node.js **>= 24.0.0**
50+
51+
## Development
52+
53+
Start the development server: `npm run dev`
54+
55+
Access the application at: http://localhost:5173
56+
57+
## Build
58+
59+
Create a production build: `npm run build`
60+
61+
Build steps:
62+
63+
1. TypeScript compilation (`tsc`)
64+
2. Vite build
65+
3. Output written to `dist/`

.github/pull_request_template.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
11
# Description
22

33
<!-- Please include a summary of the change, motivation and context. It it's a but fix, add a reference in format #issue_number -->
4-
5-
# Type of change
6-
7-
<!-- Please put X into brackets of required option OR delete options that are not relevant -->
8-
9-
- [ ] Bug fix
10-
- [ ] New feature
11-
- [ ] Refactoring / style
12-
- [ ] Documentation update / chore
13-
- [ ] Other (please describe)
14-
15-
# Versioning
16-
17-
<!-- Update the VERSION if you want the PR to be merged. Currently it's a manual 3-steps process:
18-
* update VERSION in `versioning.js` using semver principle
19-
* for all changed files update hash (the part after `?`) in place where file is requested (usually it's `index.html`)
20-
* if the change can be really interesting for end-users, describe it inside the `showUpdateWindow()` function in `versioning.js` -->
21-
22-
- [ ] Version is updated
23-
- [ ] Changed files hash is updated

.github/workflows/bump-version.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Bump version on PR merge
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
types: [closed]
7+
8+
permissions:
9+
contents: write
10+
models: read
11+
12+
jobs:
13+
bump:
14+
# Only run when the PR was actually merged (not just closed)
15+
if: github.event.pull_request.merged == true
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v5
22+
with:
23+
# Check out the base branch (master) so we are on a real branch, not
24+
# a detached PR merge ref, which makes git push work without arguments.
25+
ref: ${{ github.event.pull_request.base.ref }}
26+
# fetch-depth 2 so HEAD~1 resolves to the pre-merge master commit
27+
fetch-depth: 2
28+
# Use a PAT so the pushed bump commit can trigger deploy.yml.
29+
# Falls back to github.token if RELEASE_BOT_TOKEN is not configured
30+
# (note: pushes with github.token won't re-trigger deploy.yml).
31+
token: ${{ secrets.RELEASE_BOT_TOKEN || github.token }}
32+
33+
- name: Set up Node
34+
uses: actions/setup-node@v6
35+
with:
36+
node-version: "24.x"
37+
cache: npm
38+
39+
- name: Get PR diff
40+
run: git diff HEAD~1 HEAD > /tmp/pr.diff
41+
42+
- name: AI-detect bump type from diff
43+
id: bump
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: |
47+
TYPE=$(node scripts/detect-bump-type.js --diff-file /tmp/pr.diff)
48+
echo "type=$TYPE" >> "$GITHUB_OUTPUT"
49+
echo "AI-determined bump type: $TYPE"
50+
51+
- name: Extract base version (master before this PR merged)
52+
id: base
53+
run: |
54+
BASE=$(git show HEAD~1:public/versioning.js \
55+
| grep -oP 'const VERSION = "\K[\d.]+')
56+
echo "version=$BASE" >> "$GITHUB_OUTPUT"
57+
echo "Base version: $BASE"
58+
59+
- name: Run version bump script
60+
run: |
61+
node scripts/bump-version.js ${{ steps.bump.outputs.type }} \
62+
--base-version ${{ steps.base.outputs.version }}
63+
64+
- name: Commit and push bump
65+
run: |
66+
NEW_VERSION=$(node -e "
67+
const m = require('fs')
68+
.readFileSync('public/versioning.js', 'utf8')
69+
.match(/const VERSION = \"([\d.]+)\"/);
70+
console.log(m[1]);
71+
")
72+
73+
git config user.name "github-actions[bot]"
74+
git config user.email "github-actions[bot]@users.noreply.github.com"
75+
# Stage versioning files + any public/**/*.js whose dynamic import
76+
# hashes may have been refreshed by updatePublicJsDynamicImportHashes
77+
git add public/versioning.js package.json package-lock.json src/index.html
78+
git add public/ 2>/dev/null || true
79+
80+
if ! git diff --cached --quiet; then
81+
git commit -m "chore: bump version to $NEW_VERSION"
82+
git push
83+
echo "Pushed version bump → $NEW_VERSION"
84+
else
85+
echo "Nothing changed, skipping commit."
86+
fi

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
/dist
66
/coverage
77
/playwright-report
8-
/test-results
8+
/test-results
9+
/_bmad
10+
/_bmad-output
11+
.github/agents/bmad-*
12+
.github/prompts/bmad-*

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ RUN npm ci
1212
# Copy source code
1313
COPY ./src ./src
1414
COPY ./public ./public
15-
COPY vite.config.js .
15+
COPY tsconfig.json .
16+
COPY vite.config.ts .
1617

1718
# Build the application
19+
ENV NETLIFY=true
1820
RUN npm run build
1921

2022
# Production stage

0 commit comments

Comments
 (0)