From 01f6dbc59e01af25fac5564a4c48545d26678bdb Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 19:35:52 -0500 Subject: [PATCH 01/15] Side-by-side map preview --- .github/workflows/build-preview.yml | 89 +++++++++++++++++++++-------- .github/workflows/s3-cleanup.yml | 5 +- CONTRIBUTING.md | 4 ++ scripts/folder_diff.sh | 60 +++++++++++++++++++ src/js/shield_defs.js | 2 +- test/sample_locations.json | 16 ++++-- 6 files changed, 144 insertions(+), 32 deletions(-) create mode 100755 scripts/folder_diff.sh diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml index 54bf2ecf3..f0646165d 100644 --- a/.github/workflows/build-preview.yml +++ b/.github/workflows/build-preview.yml @@ -15,13 +15,22 @@ permissions: checks: write concurrency: preview-${{ github.ref }} jobs: - deploy-preview: + build-preview: runs-on: ubuntu-latest steps: + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x - name: Checkout Main Branch 🛎️ uses: actions/checkout@v3 with: ref: main + path: main + - name: Checkout PR Branch 🛎️ + uses: actions/checkout@v3 + with: + path: pr-branch - name: Install and Build Main Branch 🔧 run: | npm ci --include=dev @@ -29,20 +38,8 @@ jobs: npm run style npm run shields cp src/configs/config.aws.js src/config.js - - name: Capture main branch usage statistics - id: main-stats - run: | - MAIN_STATS=$(node scripts/stats.js -j) - echo "MAIN_STATS<> $GITHUB_ENV - echo -e "$MAIN_STATS" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - name: Checkout PR Branch 🛎️ - uses: actions/checkout@v3 - - name: Use Node.js 18.x - uses: actions/setup-node@v3 - with: - node-version: 18.x - - name: Install and Build 🔧 + working-directory: main + - name: Install and Build PR Branch 🔧 # TODO: when we move shieldlib to its own repo, move shieldlib docs CI also run: | npm ci --include=dev @@ -52,11 +49,42 @@ jobs: cp src/configs/config.aws.js src/config.js mkdir -p dist/shield-docs cp -r shieldlib/docs/* dist/shield-docs - - name: Upload Build artifact - uses: actions/upload-artifact@v3 - with: - name: americana - path: dist/ + mv dist .. + working-directory: pr-branch + - name: Capture main branch usage statistics + id: main-stats + run: | + MAIN_STATS=$(node scripts/stats.js -j) + echo "MAIN_STATS<> $GITHUB_ENV + echo -e "$MAIN_STATS" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + working-directory: main + - name: Start main branch map server + id: main-start-server + run: | + npm start & + until nc -z localhost 1776; do sleep 1; done + working-directory: main + - name: Capture main branch sample clips + # Run PR branch scripts against server running from main branch + id: main-samples + run: | + npm run generate_samples + mv samples ../samples-main + working-directory: pr-branch + - name: Stop main branch map server + id: main-stop-server + run: kill $(lsof -t -i:1776) 2>/dev/null || echo "No process found listening on port 1776." + working-directory: main + - name: Capture PR branch sample clips + id: pr-samples + run: | + npm start & + until nc -z localhost 1776; do sleep 1; done + npm run generate_samples + kill $(lsof -t -i:1776) 2>/dev/null || echo "No process found listening on port 1776." + mv samples ../samples-pr + working-directory: pr-branch - name: Capture PR branch usage statistics id: pr-stats run: | @@ -64,14 +92,29 @@ jobs: echo "PR_STATS<> $GITHUB_ENV echo -e "$PR_STATS" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV + working-directory: pr-branch - name: Compare Stats id: compare-stats run: | - mkdir -p pr + mkdir -p ../pr echo '${{ env.MAIN_STATS }}' echo '${{ env.PR_STATS }}' - npm exec tsx scripts/stats_compare '${{ env.MAIN_STATS }}' '${{ env.PR_STATS }}' > pr/stats-difference.md - - name: Save PR artifacts + npm exec tsx scripts/stats_compare '${{ env.MAIN_STATS }}' '${{ env.PR_STATS }}' > ../pr/stats-difference.md + working-directory: pr-branch + - name: Generate map diff sample clips + id: map-diff-samples + run: | + ./scripts/folder_diff.sh ../samples-main ../samples-pr https://preview.ourmap.us/pr/${{ github.event.pull_request.number }}/ ${{ github.event.pull_request.head.sha }} + mv pr_preview-extra.md ../pr/ + cat ../pr/pr_preview-extra.md + mv samples-diff ../dist/ + working-directory: pr-branch + - name: Upload Build artifacts + uses: actions/upload-artifact@v3 + with: + name: americana + path: dist/ + - name: Save PR attributes env: PR_NUMBER: ${{ github.event.pull_request.number }} PR_SHA: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/s3-cleanup.yml b/.github/workflows/s3-cleanup.yml index 2e2f0b3ab..5d5b45acc 100644 --- a/.github/workflows/s3-cleanup.yml +++ b/.github/workflows/s3-cleanup.yml @@ -11,11 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Set up AWS CLI - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5415fba27..216ac2039 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -405,3 +405,7 @@ For consistency, POI icons use the following color palette: ## Fonts Fonts for style labels are packaged and defined in [fontstack66](https://github.com/osm-americana/fontstack66), Americana's font package. + +## Render Samples + +A GitHub action will check a list of regression test locations to see if the map has changed. If any of those locations have changed visually, the "Map Preview" check will generate before and after images. If your PR changes the visual appearance of the map, add an entry to `test/sample_locations.json` with a location that best illustrates the change. This will help show your change to PR reviewers as well as act as a regression test for future PRs. diff --git a/scripts/folder_diff.sh b/scripts/folder_diff.sh new file mode 100755 index 000000000..0c306c61a --- /dev/null +++ b/scripts/folder_diff.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# Compare two folders of images and produce an .md file of differences + +# Check if the right number of arguments are passed +if [ "$#" -ne 4 ]; then + echo "Usage: $0 " + exit 1 +fi + +FOLDER1="$1" +FOLDER2="$2" +OUTPUT_FOLDER="samples-diff" +URL_BASE="$3" + +# Ensure that image URLs are unique to this commit because GitHub caches identical URLs +SHA="$4" + +# Create the output folder if it doesn't exist +mkdir -p "$OUTPUT_FOLDER" + +# Loop through files in FOLDER1 +for file in "$FOLDER1"/*.png; do + # Extract just the base filename without the path + basefile=$(basename "$file") + + # Check if file exists in FOLDER2 + if [ -e "$FOLDER2/$basefile" ]; then + # Compare the files + cmp -s "$FOLDER1/$basefile" "$FOLDER2/$basefile" + + # If files are different ($? is the exit status of last command, 1 means different for cmp) + if [ $? -eq 1 ]; then + # Copy the files to the output folder with the appropriate naming scheme + cp "$FOLDER1/$basefile" "$OUTPUT_FOLDER/${basefile%.*}_${SHA}_before.png" + cp "$FOLDER2/$basefile" "$OUTPUT_FOLDER/${basefile%.*}_${SHA}_after.png" + fi + fi +done + +OUTPUT_MD="pr_preview-extra.md" + +# Start the table with headers +echo "## Map Changes" > $OUTPUT_MD +echo "| Sample Name | Before | After |" >> $OUTPUT_MD +echo "|-------------|--------|-------|" >> $OUTPUT_MD + +# Loop through *_before.png files in the output folder +for before_file in "$OUTPUT_FOLDER"/*_before.png; do + # Extract just the base filename without the path and the '_before' suffix + basefile=$(basename "$before_file" _${SHA}_before.png) + + # Construct the path to the corresponding after file + after_file="$OUTPUT_FOLDER/${basefile}_${SHA}_after.png" + + # Check if the after file exists + if [ -e "$after_file" ]; then + # Add an entry to the markdown table + echo "| $basefile | ![before]($URL_BASE$before_file) | ![after]($URL_BASE$after_file) |" >> $OUTPUT_MD + fi +done diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index 5f60877a8..fa4fd7f13 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -500,7 +500,7 @@ export function loadShields() { textColor: Color.shields.brown, colorLighten: Color.shields.brown, }, - ["HIST"], + ["XYZA"], Color.shields.brown ); diff --git a/test/sample_locations.json b/test/sample_locations.json index 689a07e94..8b4efff47 100644 --- a/test/sample_locations.json +++ b/test/sample_locations.json @@ -12,16 +12,24 @@ "location": "13/40.01264/-75.70446", "name": "downingtown_alt_trk_bus", "viewport": { - "width": 600, - "height": 600 + "width": 400, + "height": 400 } }, { "location": "13/35.22439/-99.99495", "name": "historic_us66_oklahoma", "viewport": { - "width": 600, - "height": 600 + "width": 400, + "height": 400 + } + }, + { + "location": "15/33.92208/-83.37654", + "name": "athens_ga_7_way_concurrency", + "viewport": { + "width": 400, + "height": 400 } } ] From 6fa7f89c613937df8c1d11aa091fa93fa72019bc Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 21:03:16 -0500 Subject: [PATCH 02/15] Convert folder_diff to typescript --- .github/workflows/build-preview.yml | 2 +- scripts/folder_diff.sh | 60 ---------------------------- scripts/folder_diff.ts | 61 +++++++++++++++++++++++++++++ shieldlib/src/shield.js | 6 +-- 4 files changed, 63 insertions(+), 66 deletions(-) delete mode 100755 scripts/folder_diff.sh create mode 100644 scripts/folder_diff.ts diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml index f0646165d..6f3608e6f 100644 --- a/.github/workflows/build-preview.yml +++ b/.github/workflows/build-preview.yml @@ -104,7 +104,7 @@ jobs: - name: Generate map diff sample clips id: map-diff-samples run: | - ./scripts/folder_diff.sh ../samples-main ../samples-pr https://preview.ourmap.us/pr/${{ github.event.pull_request.number }}/ ${{ github.event.pull_request.head.sha }} + npm exec tsx scripts/folder_diff ../samples-main ../samples-pr https://preview.ourmap.us/pr/${{ github.event.pull_request.number }}/ ${{ github.event.pull_request.head.sha }} mv pr_preview-extra.md ../pr/ cat ../pr/pr_preview-extra.md mv samples-diff ../dist/ diff --git a/scripts/folder_diff.sh b/scripts/folder_diff.sh deleted file mode 100755 index 0c306c61a..000000000 --- a/scripts/folder_diff.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Compare two folders of images and produce an .md file of differences - -# Check if the right number of arguments are passed -if [ "$#" -ne 4 ]; then - echo "Usage: $0 " - exit 1 -fi - -FOLDER1="$1" -FOLDER2="$2" -OUTPUT_FOLDER="samples-diff" -URL_BASE="$3" - -# Ensure that image URLs are unique to this commit because GitHub caches identical URLs -SHA="$4" - -# Create the output folder if it doesn't exist -mkdir -p "$OUTPUT_FOLDER" - -# Loop through files in FOLDER1 -for file in "$FOLDER1"/*.png; do - # Extract just the base filename without the path - basefile=$(basename "$file") - - # Check if file exists in FOLDER2 - if [ -e "$FOLDER2/$basefile" ]; then - # Compare the files - cmp -s "$FOLDER1/$basefile" "$FOLDER2/$basefile" - - # If files are different ($? is the exit status of last command, 1 means different for cmp) - if [ $? -eq 1 ]; then - # Copy the files to the output folder with the appropriate naming scheme - cp "$FOLDER1/$basefile" "$OUTPUT_FOLDER/${basefile%.*}_${SHA}_before.png" - cp "$FOLDER2/$basefile" "$OUTPUT_FOLDER/${basefile%.*}_${SHA}_after.png" - fi - fi -done - -OUTPUT_MD="pr_preview-extra.md" - -# Start the table with headers -echo "## Map Changes" > $OUTPUT_MD -echo "| Sample Name | Before | After |" >> $OUTPUT_MD -echo "|-------------|--------|-------|" >> $OUTPUT_MD - -# Loop through *_before.png files in the output folder -for before_file in "$OUTPUT_FOLDER"/*_before.png; do - # Extract just the base filename without the path and the '_before' suffix - basefile=$(basename "$before_file" _${SHA}_before.png) - - # Construct the path to the corresponding after file - after_file="$OUTPUT_FOLDER/${basefile}_${SHA}_after.png" - - # Check if the after file exists - if [ -e "$after_file" ]; then - # Add an entry to the markdown table - echo "| $basefile | ![before]($URL_BASE$before_file) | ![after]($URL_BASE$after_file) |" >> $OUTPUT_MD - fi -done diff --git a/scripts/folder_diff.ts b/scripts/folder_diff.ts new file mode 100644 index 000000000..5f27b2d99 --- /dev/null +++ b/scripts/folder_diff.ts @@ -0,0 +1,61 @@ +import fs from "fs"; +import { basename } from "path"; +import { execSync } from "child_process"; + +// Check if the right number of arguments are passed +if (process.argv.length !== 6) { + console.log("Usage: "); + process.exit(1); +} + +const [folder1, folder2, urlBase, sha] = process.argv.slice(2); +const outputFolder = "samples-diff"; + +// Create the output folder if it doesn't exist +if (!fs.existsSync(outputFolder)) { + fs.mkdirSync(outputFolder); +} + +// Loop through files in folder1 +fs.readdirSync(folder1) + .filter((file) => file.endsWith(".png")) + .forEach((file) => { + const basefile = basename(file); + + // Check if file exists in folder2 + if (fs.existsSync(`${folder2}/${basefile}`)) { + // Compare the files + try { + execSync(`cmp -s "${folder1}/${basefile}" "${folder2}/${basefile}"`); + } catch (e) { + // If files are different + fs.copyFileSync( + `${folder1}/${basefile}`, + `${outputFolder}/${basefile.split(".")[0]}_${sha}_before.png` + ); + fs.copyFileSync( + `${folder2}/${basefile}`, + `${outputFolder}/${basefile.split(".")[0]}_${sha}_after.png` + ); + } + } + }); + +const outputMD = "pr_preview-extra.md"; +let mdContent = + "## Map Changes\n| Sample Name | Before | After |\n|-------------|--------|-------|\n"; + +// Loop through *_before.png files in the output folder +fs.readdirSync(outputFolder) + .filter((file) => file.endsWith("_before.png")) + .forEach((before_file) => { + const basefile = basename(before_file, `_${sha}_before.png`); + + // Check if the after file exists + if (fs.existsSync(`${outputFolder}/${basefile}_${sha}_after.png`)) { + // Add an entry to the markdown table + mdContent += `| ${basefile} | ![before](${urlBase}${before_file}) | ![after](${urlBase}${outputFolder}/${basefile}_${sha}_after.png) |\n`; + } + }); + +fs.writeFileSync(outputMD, mdContent); diff --git a/shieldlib/src/shield.js b/shieldlib/src/shield.js index 698cc254b..ba31ed75c 100644 --- a/shieldlib/src/shield.js +++ b/shieldlib/src/shield.js @@ -3,11 +3,7 @@ import * as ShieldText from "./shield_text"; import * as ShieldDraw from "./shield_canvas_draw"; import * as Gfx from "./screen_gfx"; -import { - drawBanners, - drawBannerHalos, - getBannerCount, -} from "./shield_banner"; +import { drawBanners, drawBannerHalos, getBannerCount } from "./shield_banner"; function compoundShieldSize(r, dimension, bannerCount) { return { From 2e47007d0e379679348ead6ef5307eb97c8d114c Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 21:15:08 -0500 Subject: [PATCH 03/15] debugging --- .github/workflows/build-preview.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml index 6f3608e6f..f3eac8fae 100644 --- a/.github/workflows/build-preview.yml +++ b/.github/workflows/build-preview.yml @@ -105,6 +105,7 @@ jobs: id: map-diff-samples run: | npm exec tsx scripts/folder_diff ../samples-main ../samples-pr https://preview.ourmap.us/pr/${{ github.event.pull_request.number }}/ ${{ github.event.pull_request.head.sha }} + cat pr_preview-extra.md mv pr_preview-extra.md ../pr/ cat ../pr/pr_preview-extra.md mv samples-diff ../dist/ From c7c16cd1c592a822691cdbf6bb695ed3d45f6a55 Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 21:27:14 -0500 Subject: [PATCH 04/15] Fix bug in before image url --- .github/workflows/build-preview.yml | 1 - scripts/folder_diff.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml index f3eac8fae..6f3608e6f 100644 --- a/.github/workflows/build-preview.yml +++ b/.github/workflows/build-preview.yml @@ -105,7 +105,6 @@ jobs: id: map-diff-samples run: | npm exec tsx scripts/folder_diff ../samples-main ../samples-pr https://preview.ourmap.us/pr/${{ github.event.pull_request.number }}/ ${{ github.event.pull_request.head.sha }} - cat pr_preview-extra.md mv pr_preview-extra.md ../pr/ cat ../pr/pr_preview-extra.md mv samples-diff ../dist/ diff --git a/scripts/folder_diff.ts b/scripts/folder_diff.ts index 5f27b2d99..a77ddf718 100644 --- a/scripts/folder_diff.ts +++ b/scripts/folder_diff.ts @@ -54,7 +54,7 @@ fs.readdirSync(outputFolder) // Check if the after file exists if (fs.existsSync(`${outputFolder}/${basefile}_${sha}_after.png`)) { // Add an entry to the markdown table - mdContent += `| ${basefile} | ![before](${urlBase}${before_file}) | ![after](${urlBase}${outputFolder}/${basefile}_${sha}_after.png) |\n`; + mdContent += `| ${basefile} | ![before](${urlBase}${outputFolder}/${basefile}_${sha}_before.png) | ![after](${urlBase}${outputFolder}/${basefile}_${sha}_after.png) |\n`; } }); From 923073c4d7f0d4cdbf92966d71296a448a9ce87f Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 22:51:40 -0500 Subject: [PATCH 05/15] Add links to before/after --- scripts/folder_diff.ts | 34 ++++++++++++++++++++++++++++++++-- tsconfig.json | 1 + 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/scripts/folder_diff.ts b/scripts/folder_diff.ts index a77ddf718..00967bf57 100644 --- a/scripts/folder_diff.ts +++ b/scripts/folder_diff.ts @@ -2,6 +2,31 @@ import fs from "fs"; import { basename } from "path"; import { execSync } from "child_process"; +interface Viewport { + width: number; + height: number; +} + +interface LocationData { + location: string; + name: string; + viewport: Viewport; + controls?: boolean; +} + +type Locations = LocationData[]; + +import sampleLocationJSON from "../test/sample_locations.json"; + +const sampleLocations: Locations = sampleLocationJSON as Locations; + +function getLocationByName(name: string): string | undefined { + const locationData = sampleLocations.find( + (location) => location.name === name + ); + return locationData?.location; +} + // Check if the right number of arguments are passed if (process.argv.length !== 6) { console.log("Usage: "); @@ -43,7 +68,7 @@ fs.readdirSync(folder1) const outputMD = "pr_preview-extra.md"; let mdContent = - "## Map Changes\n| Sample Name | Before | After |\n|-------------|--------|-------|\n"; + "## Map Changes\n| Sample Name | Current Render | This PR |\n|-------------|--------|-------|\n"; // Loop through *_before.png files in the output folder fs.readdirSync(outputFolder) @@ -54,7 +79,12 @@ fs.readdirSync(outputFolder) // Check if the after file exists if (fs.existsSync(`${outputFolder}/${basefile}_${sha}_after.png`)) { // Add an entry to the markdown table - mdContent += `| ${basefile} | ![before](${urlBase}${outputFolder}/${basefile}_${sha}_before.png) | ![after](${urlBase}${outputFolder}/${basefile}_${sha}_after.png) |\n`; + const loc = getLocationByName("basefile"); + mdContent += + `| ${basefile}
${loc}
[Current Render](https://zelonewolf.github.io/openstreetmap-americana/#map=${loc})` + + `
[This PR](${urlBase}#map=${loc}) ` + + `| ![Current Render](${urlBase}${outputFolder}/${basefile}_${sha}_before.png) |` + + ` ![This PR](${urlBase}${outputFolder}/${basefile}_${sha}_after.png) |\n`; } }); diff --git a/tsconfig.json b/tsconfig.json index c4d433a91..d457a561d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "target": "ESNext", "module": "ESNext", "moduleResolution": "node", + "resolveJsonModule": true, "allowSyntheticDefaultImports": true }, "include": ["src/**/*.ts", "shieldlib/src/headless_graphics.ts"] From 40dbf15f7063de38612d5053416a642065ab2391 Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 22:59:27 -0500 Subject: [PATCH 06/15] Debugging --- scripts/folder_diff.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/folder_diff.ts b/scripts/folder_diff.ts index 00967bf57..7401a9900 100644 --- a/scripts/folder_diff.ts +++ b/scripts/folder_diff.ts @@ -20,6 +20,9 @@ import sampleLocationJSON from "../test/sample_locations.json"; const sampleLocations: Locations = sampleLocationJSON as Locations; +//debugging +console.log(sampleLocations); + function getLocationByName(name: string): string | undefined { const locationData = sampleLocations.find( (location) => location.name === name From fa6c17057d4030fb9d166abd245948938311a4fe Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 23:10:58 -0500 Subject: [PATCH 07/15] bugfix --- scripts/folder_diff.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/folder_diff.ts b/scripts/folder_diff.ts index 7401a9900..0f49fe9c9 100644 --- a/scripts/folder_diff.ts +++ b/scripts/folder_diff.ts @@ -20,9 +20,6 @@ import sampleLocationJSON from "../test/sample_locations.json"; const sampleLocations: Locations = sampleLocationJSON as Locations; -//debugging -console.log(sampleLocations); - function getLocationByName(name: string): string | undefined { const locationData = sampleLocations.find( (location) => location.name === name @@ -82,7 +79,7 @@ fs.readdirSync(outputFolder) // Check if the after file exists if (fs.existsSync(`${outputFolder}/${basefile}_${sha}_after.png`)) { // Add an entry to the markdown table - const loc = getLocationByName("basefile"); + const loc = getLocationByName(basefile); mdContent += `| ${basefile}
${loc}
[Current Render](https://zelonewolf.github.io/openstreetmap-americana/#map=${loc})` + `
[This PR](${urlBase}#map=${loc}) ` + From 8bb8317fe6aabee2d1ee2867c3f23732dd7ee654 Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 23:15:30 -0500 Subject: [PATCH 08/15] Text tweak --- scripts/folder_diff.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/folder_diff.ts b/scripts/folder_diff.ts index 0f49fe9c9..93263faf8 100644 --- a/scripts/folder_diff.ts +++ b/scripts/folder_diff.ts @@ -68,7 +68,7 @@ fs.readdirSync(folder1) const outputMD = "pr_preview-extra.md"; let mdContent = - "## Map Changes\n| Sample Name | Current Render | This PR |\n|-------------|--------|-------|\n"; + "## Map Changes\n| Sample | Current Render | This PR |\n|-------------|--------|-------|\n"; // Loop through *_before.png files in the output folder fs.readdirSync(outputFolder) From 803ffeedfa31400347f638fbeaf833fa01c103d0 Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Wed, 13 Dec 2023 23:19:33 -0500 Subject: [PATCH 09/15] Add Manhattan location for POIs --- test/sample_locations.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/sample_locations.json b/test/sample_locations.json index 8b4efff47..7c4f4a291 100644 --- a/test/sample_locations.json +++ b/test/sample_locations.json @@ -31,5 +31,13 @@ "width": 400, "height": 400 } + }, + { + "location": "16/40.765073/-73.965035", + "name": "manhattan_poi", + "viewport": { + "width": 400, + "height": 400 + } } ] From f04f4e72a0e9ab9d0f8b75c4af60991415737c9d Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Fri, 15 Dec 2023 00:51:39 -0500 Subject: [PATCH 10/15] Update build-preview.yml Ensure that we capture stats from the PR branch --- .github/workflows/build-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml index 6f3608e6f..5a1fe803a 100644 --- a/.github/workflows/build-preview.yml +++ b/.github/workflows/build-preview.yml @@ -54,7 +54,7 @@ jobs: - name: Capture main branch usage statistics id: main-stats run: | - MAIN_STATS=$(node scripts/stats.js -j) + MAIN_STATS=$(node ../pr-branch/scripts/stats.js -j) echo "MAIN_STATS<> $GITHUB_ENV echo -e "$MAIN_STATS" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV From 8a2de3968dcb8e57955e172de964a3ec124870d6 Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Sat, 23 Dec 2023 09:33:27 -0500 Subject: [PATCH 11/15] Add interesting UK test location --- test/sample_locations.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/sample_locations.json b/test/sample_locations.json index 7c4f4a291..9fc9c110a 100644 --- a/test/sample_locations.json +++ b/test/sample_locations.json @@ -39,5 +39,13 @@ "width": 400, "height": 400 } + }, + { + "location": "12/52.43818/-1.70563", + "name": "uk_all_roads_routes_z12", + "viewport": { + "width": 400, + "height": 400 + } } ] From 16f3c5d3c135af775e7af7b6da8daaf8c70bfbf4 Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Sat, 23 Dec 2023 19:38:40 -0500 Subject: [PATCH 12/15] Remove z4 park layer --- src/layer/park.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/layer/park.js b/src/layer/park.js index bcf2cebd3..662f3af01 100644 --- a/src/layer/park.js +++ b/src/layer/park.js @@ -13,6 +13,7 @@ export const fill = { "fill-color": Color.parkFill, }, source: "openmaptiles", + minzoom: 5, "source-layer": "park", }; @@ -24,6 +25,7 @@ export const outline = { "line-color": Color.parkOutline, }, source: "openmaptiles", + minzoom: 5, metadata: {}, "source-layer": "park", }; From 788bdae5db73f683304c58e78d556bfcea7b344b Mon Sep 17 00:00:00 2001 From: Jeroen van der Gun Date: Wed, 27 Dec 2023 23:21:07 +0100 Subject: [PATCH 13/15] Change E-road shields to variable-width --- src/js/shield_defs.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index d49525eda..a906aeb39 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -3146,9 +3146,7 @@ export function loadShields() { // EUROPE shields["e-road"] = roundedRectShield( Color.shields.green, - Color.shields.white, - Color.shields.white, - 34 + Color.shields.white ); // Austria From a2accbbc8ac462a15e5bb08ec44ebe00e62e96b5 Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Sun, 31 Dec 2023 20:20:58 -0500 Subject: [PATCH 14/15] Restore test data --- src/js/shield_defs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index af6069288..d49525eda 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -500,7 +500,7 @@ export function loadShields() { textColor: Color.shields.brown, colorLighten: Color.shields.brown, }, - ["XYZA"], + ["HIST"], Color.shields.brown ); From 413299780a7adb48ae23f294890950b1c2bdc6e5 Mon Sep 17 00:00:00 2001 From: Jeroen van der Gun Date: Mon, 1 Jan 2024 22:04:26 +0100 Subject: [PATCH 15/15] Add e-road route sample loction --- test/sample_locations.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/sample_locations.json b/test/sample_locations.json index 9fc9c110a..2ff11454f 100644 --- a/test/sample_locations.json +++ b/test/sample_locations.json @@ -47,5 +47,13 @@ "width": 400, "height": 400 } + }, + { + "location": "13.25/49.552/5.8107", + "name": "europe_e-road_routes", + "viewport": { + "width": 400, + "height": 400 + } } ]