chore: add biome for linting/formatting + CI action for linting in SRC folder (#1284)
Some checks are pending
Deploy static content to Pages / deploy (push) Waiting to run
Code quality / quality (push) Waiting to run

* chore: add npm + vite for progressive enhancement

* fix: update Dockerfile to copy only the dist folder contents

* fix: update Dockerfile to use multi-stage build for optimized production image

* fix: correct nginx config file copy command in Dockerfile

* chore: add netlify configuration for build and redirects

* fix: add NODE_VERSION to environment in Netlify configuration

* remove wrong dist folder

* Update package.json

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: split public and src

* migrating all util files from js to ts

* feat: Implement HeightmapGenerator and Voronoi module

- Added HeightmapGenerator class for generating heightmaps with various tools (Hill, Pit, Range, Trough, Strait, etc.).
- Introduced Voronoi class for creating Voronoi diagrams using Delaunator.
- Updated index.html to include new modules.
- Created index.ts to manage module imports.
- Enhanced arrayUtils and graphUtils with type definitions and improved functionality.
- Added utility functions for generating grids and calculating Voronoi cells.

* chore: add GitHub Actions workflow for deploying to GitHub Pages

* fix: update branch name in GitHub Actions workflow from 'main' to 'master'

* chore: update package.json to specify Node.js engine version and remove unused launch.json

* Initial plan

* Update copilot guidelines to reflect NPM/Vite/TypeScript migration

Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>

* Update src/modules/heightmap-generator.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/utils/graphUtils.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/heightmap-generator.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: Add TIME and ERROR variables to global scope in HeightmapGenerator

* fix: Update base path in vite.config.ts for Netlify deployment

* refactor: Migrate features to a new module and remove legacy script reference

* refactor: Update feature interfaces and improve type safety in FeatureModule

* refactor: Add documentation for markupPack and defineGroups methods in FeatureModule

* refactor: Remove legacy ocean-layers.js and migrate functionality to ocean-layers.ts

* refactor: Remove river-generator.js script reference and migrate river generation logic to river-generator.ts

* refactor: Remove river-generator.js reference and add biomes module

* refactor: Migrate lakes functionality to lakes.ts and update related interfaces

* refactor: clean up global variable declarations and improve type definitions

* refactor: update shoreline calculation and improve type imports in PackedGraph

* fix: e2e tests

* chore: add biome for linting/formatting

* chore: add linting workflow using Biome

* refactor: improve code readability by standardizing string quotes and simplifying function calls

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Azgaar <maxganiev@yandex.com>
Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>
This commit is contained in:
Marc Emmanuel 2026-01-26 22:30:28 +01:00 committed by GitHub
parent e37fce1eed
commit 9db40a5230
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 2001 additions and 782 deletions

View file

@ -1,13 +1,22 @@
import "./polyfills";
import { rn, lim, minmax, normalize, lerp } from "./numberUtils";
import { lerp, lim, minmax, normalize, rn } from "./numberUtils";
window.rn = rn;
window.lim = lim;
window.minmax = minmax;
window.normalize = normalize;
window.lerp = lerp as typeof window.lerp;
import { isVowel, trimVowels, getAdjective, nth, abbreviate, list } from "./languageUtils";
import {
abbreviate,
getAdjective,
isVowel,
list,
nth,
trimVowels,
} from "./languageUtils";
window.vowel = isVowel;
window.trimVowels = trimVowels;
window.getAdjective = getAdjective;
@ -15,7 +24,15 @@ window.nth = nth;
window.abbreviate = abbreviate;
window.list = list;
import { last, unique, deepCopy, getTypedArray, createTypedArray, TYPED_ARRAY_MAX_VALUES } from "./arrayUtils";
import {
createTypedArray,
deepCopy,
getTypedArray,
last,
TYPED_ARRAY_MAX_VALUES,
unique,
} from "./arrayUtils";
window.last = last;
window.unique = unique;
window.deepCopy = deepCopy;
@ -26,7 +43,19 @@ window.UINT8_MAX = TYPED_ARRAY_MAX_VALUES.UINT8_MAX;
window.UINT16_MAX = TYPED_ARRAY_MAX_VALUES.UINT16_MAX;
window.UINT32_MAX = TYPED_ARRAY_MAX_VALUES.UINT32_MAX;
import { rand, P, each, gauss, Pint, biased, generateSeed, getNumberInRange, ra, rw } from "./probabilityUtils";
import {
biased,
each,
gauss,
generateSeed,
getNumberInRange,
P,
Pint,
ra,
rand,
rw,
} from "./probabilityUtils";
window.rand = rand;
window.P = P;
window.each = each;
@ -38,12 +67,23 @@ window.biased = biased;
window.getNumberInRange = getNumberInRange;
window.generateSeed = generateSeed;
import { convertTemperature, si, getIntegerFromSI } from "./unitUtils";
window.convertTemperature = (temp:number, scale: any = (window as any).temperatureScale.value || "°C") => convertTemperature(temp, scale);
import { convertTemperature, getIntegerFromSI, si } from "./unitUtils";
window.convertTemperature = (
temp: number,
scale: any = (window as any).temperatureScale.value || "°C",
) => convertTemperature(temp, scale);
window.si = si;
window.getInteger = getIntegerFromSI;
import { toHEX, getColors, getRandomColor, getMixedColor, C_12 } from "./colorUtils";
import {
C_12,
getColors,
getMixedColor,
getRandomColor,
toHEX,
} from "./colorUtils";
window.toHEX = toHEX;
window.getColors = getColors;
window.getRandomColor = getRandomColor;
@ -51,21 +91,41 @@ window.getMixedColor = getMixedColor;
window.C_12 = C_12;
import { getComposedPath, getNextId } from "./nodeUtils";
window.getComposedPath = getComposedPath;
window.getNextId = getNextId;
import { rollups, distanceSquared } from "./functionUtils";
import { distanceSquared, rollups } from "./functionUtils";
window.rollups = rollups;
window.dist2 = distanceSquared;
import { getIsolines, getPolesOfInaccessibility, connectVertices, findPath, getVertexPath } from "./pathUtils";
import {
connectVertices,
findPath,
getIsolines,
getPolesOfInaccessibility,
getVertexPath,
} from "./pathUtils";
window.getIsolines = getIsolines;
window.getPolesOfInaccessibility = getPolesOfInaccessibility;
window.connectVertices = connectVertices;
window.findPath = (start, end, getCost) => findPath(start, end, getCost, (window as any).pack);
window.getVertexPath = (cellsArray) => getVertexPath(cellsArray, (window as any).pack);
window.findPath = (start, end, getCost) =>
findPath(start, end, getCost, (window as any).pack);
window.getVertexPath = (cellsArray) =>
getVertexPath(cellsArray, (window as any).pack);
import {
capitalize,
isValidJSON,
parseTransform,
round,
safeParseJSON,
sanitizeId,
splitInTwo,
} from "./stringUtils";
import { round, capitalize, splitInTwo, parseTransform, isValidJSON, safeParseJSON, sanitizeId } from "./stringUtils";
window.round = round;
window.capitalize = capitalize;
window.splitInTwo = splitInTwo;
@ -76,6 +136,7 @@ JSON.isValid = isValidJSON;
JSON.safeParse = safeParseJSON;
import { byId } from "./shorthands";
window.byId = byId;
Node.prototype.on = function (name, fn, options) {
this.addEventListener(name, fn, options);
@ -87,27 +148,63 @@ Node.prototype.off = function (name, fn) {
};
declare global {
interface JSON {
isValid: (str: string) => boolean;
safeParse: (str: string) => any;
}
interface Node {
on: (name: string, fn: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => Node;
on: (
name: string,
fn: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
) => Node;
off: (name: string, fn: EventListenerOrEventListenerObject) => Node;
}
}
import { shouldRegenerateGrid, generateGrid, findGridAll, findGridCell, findClosestCell, calculateVoronoi, findAllCellsInRadius, getPackPolygon, getGridPolygon, poissonDiscSampler, isLand, isWater, findAllInQuadtree, drawHeights } from "./graphUtils";
window.shouldRegenerateGrid = (grid: any, expectedSeed: number) => shouldRegenerateGrid(grid, expectedSeed, (window as any).graphWidth, (window as any).graphHeight);
window.generateGrid = () => generateGrid((window as any).seed, (window as any).graphWidth, (window as any).graphHeight);
window.findGridAll = (x: number, y: number, radius: number) => findGridAll(x, y, radius, (window as any).grid);
window.findGridCell = (x: number, y: number) => findGridCell(x, y, (window as any).grid);
window.findCell = (x: number, y: number, radius?: number) => findClosestCell(x, y, radius, (window as any).pack);
window.findAll = (x: number, y: number, radius: number) => findAllCellsInRadius(x, y, radius, (window as any).pack);
window.getPackPolygon = (cellIndex: number) => getPackPolygon(cellIndex, (window as any).pack);
window.getGridPolygon = (cellIndex: number) => getGridPolygon(cellIndex, (window as any).grid);
import {
calculateVoronoi,
drawHeights,
findAllCellsInRadius,
findAllInQuadtree,
findClosestCell,
findGridAll,
findGridCell,
generateGrid,
getGridPolygon,
getPackPolygon,
isLand,
isWater,
poissonDiscSampler,
shouldRegenerateGrid,
} from "./graphUtils";
window.shouldRegenerateGrid = (grid: any, expectedSeed: number) =>
shouldRegenerateGrid(
grid,
expectedSeed,
(window as any).graphWidth,
(window as any).graphHeight,
);
window.generateGrid = () =>
generateGrid(
(window as any).seed,
(window as any).graphWidth,
(window as any).graphHeight,
);
window.findGridAll = (x: number, y: number, radius: number) =>
findGridAll(x, y, radius, (window as any).grid);
window.findGridCell = (x: number, y: number) =>
findGridCell(x, y, (window as any).grid);
window.findCell = (x: number, y: number, radius?: number) =>
findClosestCell(x, y, radius, (window as any).pack);
window.findAll = (x: number, y: number, radius: number) =>
findAllCellsInRadius(x, y, radius, (window as any).pack);
window.getPackPolygon = (cellIndex: number) =>
getPackPolygon(cellIndex, (window as any).pack);
window.getGridPolygon = (cellIndex: number) =>
getGridPolygon(cellIndex, (window as any).grid);
window.calculateVoronoi = calculateVoronoi;
window.poissonDiscSampler = poissonDiscSampler;
window.findAllInQuadtree = findAllInQuadtree;
@ -115,8 +212,26 @@ window.drawHeights = drawHeights;
window.isLand = (i: number) => isLand(i, (window as any).pack);
window.isWater = (i: number) => isWater(i, (window as any).pack);
import { clipPoly, getSegmentId, debounce, throttle, parseError, getBase64, openURL, wiki, link, isCtrlClick, generateDate, getLongitude, getLatitude, getCoordinates, initializePrompt } from "./commonUtils";
window.clipPoly = (points: [number, number][], secure?: number) => clipPoly(points, graphWidth, graphHeight, secure);
import {
clipPoly,
debounce,
generateDate,
getBase64,
getCoordinates,
getLatitude,
getLongitude,
getSegmentId,
initializePrompt,
isCtrlClick,
link,
openURL,
parseError,
throttle,
wiki,
} from "./commonUtils";
window.clipPoly = (points: [number, number][], secure?: number) =>
clipPoly(points, graphWidth, graphHeight, secure);
window.getSegmentId = getSegmentId;
window.debounce = debounce;
window.throttle = throttle;
@ -127,25 +242,37 @@ window.wiki = wiki;
window.link = link;
window.isCtrlClick = isCtrlClick;
window.generateDate = generateDate;
window.getLongitude = (x: number, decimals?: number) => getLongitude(x, mapCoordinates, graphWidth, decimals);
window.getLatitude = (y: number, decimals?: number) => getLatitude(y, mapCoordinates, graphHeight, decimals);
window.getCoordinates = (x: number, y: number, decimals?: number) => getCoordinates(x, y, mapCoordinates, graphWidth, graphHeight, decimals);
window.getLongitude = (x: number, decimals?: number) =>
getLongitude(x, mapCoordinates, graphWidth, decimals);
window.getLatitude = (y: number, decimals?: number) =>
getLatitude(y, mapCoordinates, graphHeight, decimals);
window.getCoordinates = (x: number, y: number, decimals?: number) =>
getCoordinates(x, y, mapCoordinates, graphWidth, graphHeight, decimals);
// Initialize prompt when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initializePrompt);
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", initializePrompt);
} else {
initializePrompt();
}
import { drawCellsValue, drawPolygons, drawRouteConnections, drawPoint, drawPath } from "./debugUtils";
window.drawCellsValue = (data:any[]) => drawCellsValue(data, (window as any).pack);
window.drawPolygons = (data: any[]) => drawPolygons(data, (window as any).terrs, (window as any).grid);
window.drawRouteConnections = () => drawRouteConnections((window as any).packedGraph);
import {
drawCellsValue,
drawPath,
drawPoint,
drawPolygons,
drawRouteConnections,
} from "./debugUtils";
window.drawCellsValue = (data: any[]) =>
drawCellsValue(data, (window as any).pack);
window.drawPolygons = (data: any[]) =>
drawPolygons(data, (window as any).terrs, (window as any).grid);
window.drawRouteConnections = () =>
drawRouteConnections((window as any).packedGraph);
window.drawPoint = drawPoint;
window.drawPath = drawPath;
export {
rn,
lim,
@ -232,5 +359,5 @@ export {
drawPolygons,
drawRouteConnections,
drawPoint,
drawPath
}
drawPath,
};