Skip to content

Commit 10d1ec2

Browse files
committed
update build script
1 parent ef3cc9f commit 10d1ec2

4 files changed

Lines changed: 54 additions & 14 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@
66
[![GitHub Repo stars](https://img.shields.io/github/stars/Zehir/godot-hexagon-tile-map-layer?style=for-the-badge&color=16A085)](https://github.com/Zehir/godot-hexagon-tile-map-layer/stargazers)
77
[![GitHub Sponsors](https://img.shields.io/github/sponsors/Zehir?style=for-the-badge&color=16A085)](https://github.com/sponsors/Zehir)
88

9+
<!-- description_start -->
10+
911
Set of tools to use hexagon based tilemap in Godot with A\* pathfinding and cube coordinates system.
1012

1113
Require [Godot 4.4](https://godotengine.org/releases/4.4/)+, for [4.3](https://godotengine.org/releases/4.3/)+ use version [1.0.1](https://github.com/Zehir/godot-hexagon-tile-map-layer/releases/tag/v1.0.1) or earlier
1214

15+
<!-- description_end -->
16+
1317
<p align="center">
1418
<img src="https://raw.githubusercontent.com/Zehir/godot-hexagon-tile-map-layer/main/images/cube_linedraw.png" />
1519
</p>
1620

1721
## Features
1822

23+
<!-- description_start -->
24+
1925
- A\* pathfinding support
2026
- Cube coordinates system
2127
- Conversion between different coordinate systems
@@ -25,6 +31,8 @@ Require [Godot 4.4](https://godotengine.org/releases/4.4/)+, for [4.3](https://g
2531
- Debug visualization
2632
- Embeded documentation
2733

34+
<!-- description_end -->
35+
2836
## Quick Start
2937

3038
1. Setup your tileset with hexagon shaped tiles (TileSet.TileShape.TILE_SHAPE_HEXAGON)

addons/hexagon_tilemaplayer/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@
66
[![GitHub Repo stars](https://img.shields.io/github/stars/Zehir/godot-hexagon-tile-map-layer?style=for-the-badge&color=16A085)](https://github.com/Zehir/godot-hexagon-tile-map-layer/stargazers)
77
[![GitHub Sponsors](https://img.shields.io/github/sponsors/Zehir?style=for-the-badge&color=16A085)](https://github.com/sponsors/Zehir)
88

9+
<!-- description_start -->
10+
911
Set of tools to use hexagon based tilemap in Godot with A\* pathfinding and cube coordinates system.
1012

1113
Require [Godot 4.4](https://godotengine.org/releases/4.4/)+, for [4.3](https://godotengine.org/releases/4.3/)+ use version [1.0.1](https://github.com/Zehir/godot-hexagon-tile-map-layer/releases/tag/v1.0.1) or earlier
1214

15+
<!-- description_end -->
16+
1317
<p align="center">
1418
<img src="https://raw.githubusercontent.com/Zehir/godot-hexagon-tile-map-layer/main/images/cube_linedraw.png" />
1519
</p>
1620

1721
## Features
1822

23+
<!-- description_start -->
24+
1925
- A\* pathfinding support
2026
- Cube coordinates system
2127
- Conversion between different coordinate systems
@@ -25,6 +31,8 @@ Require [Godot 4.4](https://godotengine.org/releases/4.4/)+, for [4.3](https://g
2531
- Debug visualization
2632
- Embeded documentation
2733

34+
<!-- description_end -->
35+
2836
## Quick Start
2937

3038
1. Setup your tileset with hexagon shaped tiles (TileSet.TileShape.TILE_SHAPE_HEXAGON)

build.js

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,45 @@ const download_url = `${REPO_URL}/releases/download/v${packageJson.version}/${ad
7979
// Function to parse README and extract description
8080
function getDescriptionFromReadme() {
8181
const readmeContent = fs.readFileSync('README.md', 'utf8');
82-
const lines = readmeContent.split('\n');
82+
let description = '';
83+
let searchStart = 0;
8384

84-
// Get first paragraph (excluding lines starting with #)
85-
const firstParagraph = lines.find(line => line.trim() && !line.startsWith('#'));
85+
// Find all text blocks between description markers
86+
while (true) {
87+
const descriptionStart = readmeContent.indexOf('<!-- description_start -->', searchStart);
88+
if (descriptionStart === -1) break;
8689

87-
// Get features list (excluding the "Features" header)
88-
const featureStart = lines.findIndex(line => line.includes('## Features'));
89-
const featureEnd = lines.findIndex((line, idx) => idx > featureStart && line.startsWith('##'));
90-
const features = lines
91-
.slice(featureStart + 1, featureEnd)
92-
.filter(line => line.trim() && line.startsWith('-'))
93-
.map(line => line.trim())
94-
.join('\n');
90+
const contentStart = descriptionStart + '<!-- description_start -->'.length;
91+
const descriptionEnd = readmeContent.indexOf('<!-- description_end -->', contentStart);
92+
93+
if (descriptionEnd === -1) break;
94+
95+
// Extract the text between the markers
96+
let blockText = readmeContent.substring(contentStart, descriptionEnd).trim();
97+
98+
blockText = blockText.replaceAll("A\\*", 'A*');
99+
100+
// Remove Markdown links - format [text](url) - keep only the text part
101+
blockText = blockText.replaceAll(/\[([^\]]+)\]\([^)]+\)/g, '$1');
102+
103+
// Remove HTML links - format <url>
104+
blockText = blockText.replaceAll(/<https?:\/\/[^>]+>/g, '');
105+
106+
// Add this block to the combined description
107+
if (description && blockText) {
108+
description += '\n\n';
109+
}
110+
description += blockText;
111+
112+
// Move search position to continue looking for more blocks
113+
searchStart = descriptionEnd + '<!-- description_end -->'.length;
114+
}
115+
116+
// If we found description blocks, return them
117+
if (description) {
118+
return description;
119+
}
95120

96-
return `${firstParagraph}\n\nFeatures:\n${features}`;
97121
}
98122

99123
const image_url = (name) => `${REPO_URL.replace('github.com', 'raw.githubusercontent.com')}/main/images/${name}.png`;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"tilemap"
1919
],
2020
"private": true,
21-
"packageManager": "pnpm@10.6.1",
21+
"packageManager": "pnpm@10.7.0",
2222
"devDependencies": {
2323
"@changesets/cli": "^2.28.1",
2424
"adm-zip": "^0.5.16"
2525
}
26-
}
26+
}

0 commit comments

Comments
 (0)