Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/deploy-wordpress-org.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Deploy to WordPress.org
on:
push:
tags:
- "*"
- "*.*.*"
- "!*-*"

permissions:
contents: write

jobs:
tag:
name: New tag
name: Stable tag deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -34,6 +34,17 @@ jobs:
npm run test:unit
npm run build:release
npm run build:report
- name: Prepare Plugin Check build
run: |
rm -rf "${RUNNER_TEMP}/plugin-check-build"
mkdir -p "${RUNNER_TEMP}/plugin-check-build/jeo"
rsync -a --delete src/ "${RUNNER_TEMP}/plugin-check-build/jeo/"
- name: Run WordPress Plugin Check
uses: wordpress/plugin-check-action@v1
with:
build-dir: ${{ runner.temp }}/plugin-check-build/jeo
slug: jeo
include-experimental: false
- name: WordPress Plugin Deploy
id: wordpress_org_deploy
uses: 10up/action-wordpress-plugin-deploy@stable
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ The deploy workflow now validates that:
- `package.json` and the root package entry in `package-lock.json` match the plugin version
- the `Stable tag` in `src/readme.txt` matches the plugin version for the tagged stable release
- the release tag is a stable `x.y.z` version
- the built release tree from `src/` passes WordPress Plugin Check when staged as `jeo/`

Pre-release tags such as `-rc` are intentionally blocked from the WordPress.org deploy pipeline.
Stable tag releases only proceed to WordPress.org deployment after Plugin Check passes; a failing check blocks the release before any publish step runs.

Release validation and packaging should use:

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
"check:env": "node scripts/check-node-version.mjs",
"preinstall": "node scripts/check-node-version.mjs",
"sync:version": "node scripts/sync-plugin-version.mjs",
"check:wporg-compliance": "node scripts/check-wporg-compliance.mjs",
"start": "wp-scripts start",
"build:assets": "wp-scripts build",
"build:assets": "wp-scripts build && node scripts/patch-build-compliance.mjs",
"i18n:json": "node scripts/make-i18n-json.mjs",
"build": "npm run build:assets && npm run i18n:json",
"build:release": "npm run build",
Expand Down
73 changes: 73 additions & 0 deletions scripts/check-wporg-compliance.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const ROOT = path.resolve( path.dirname( fileURLToPath( import.meta.url ) ), '..' );
const SRC_DIR = path.join( ROOT, 'src' );
const README_FILE = path.join( SRC_DIR, 'readme.txt' );
const TEXT_EXTENSIONS = new Set( [
'.css',
'.ejs',
'.js',
'.json',
'.map',
'.md',
'.php',
'.po',
'.scss',
'.svg',
'.txt',
'.xml',
] );
const FORBIDDEN_PATTERNS = [
{
label: 'curl usage',
pattern: /\bcurl_(?:init|exec|setopt|close|multi_exec|copy)\b/i,
},
{
label: 'raw.githubusercontent.com',
pattern: /raw\.githubusercontent\.com/i,
},
{
label: 'fonts.openmaptiles.org',
pattern: /fonts\.openmaptiles\.org/i,
},
];

function listFiles( dir ) {
return fs.readdirSync( dir, { withFileTypes: true } ).flatMap( ( entry ) => {
const fullPath = path.join( dir, entry.name );

if ( entry.isDirectory() ) {
return listFiles( fullPath );
}

return [ fullPath ];
} );
}

function fail( message ) {
console.error( `WordPress.org compliance check failed: ${ message }` );
process.exit( 1 );
}

const readme = fs.readFileSync( README_FILE, 'utf8' );
if ( ! /^== Third Party Services ==$/m.test( readme ) ) {
fail( 'src/readme.txt is missing the "Third Party Services" section.' );
}

for ( const file of listFiles( SRC_DIR ) ) {
if ( ! TEXT_EXTENSIONS.has( path.extname( file ) ) ) {
continue;
}

const contents = fs.readFileSync( file, 'utf8' );

for ( const forbidden of FORBIDDEN_PATTERNS ) {
if ( forbidden.pattern.test( contents ) ) {
fail( `${ forbidden.label } found in ${ path.relative( ROOT, file ) }.` );
}
}
}

console.log( 'WordPress.org compliance checks passed.' );
59 changes: 59 additions & 0 deletions scripts/patch-build-compliance.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const ROOT = path.resolve( path.dirname( fileURLToPath( import.meta.url ) ), '..' );
const BUILD_DIR = path.join( ROOT, 'src', 'js', 'build' );
const TEXT_EXTENSIONS = new Set( [ '.css', '.js', '.json', '.map', '.php', '.svg', '.txt' ] );
const REPLACEMENTS = [
{
search: /https:\/\/raw\.githubusercontent\.com\/ajv-validator\/ajv\/master\/lib\/refs\/([^"'`]+?)(?=[#"'`])/g,
replace: 'urn:jeo:ajv:$1',
},
{
search: /https:\/\/raw\.githubusercontent\.com\/ajv-validator\/ajv\/master\/lib\/refs\/([^"'`]+)/g,
replace: 'urn:jeo:ajv:$1',
},
];

function listFiles( dir ) {
if ( ! fs.existsSync( dir ) ) {
return [];
}

return fs.readdirSync( dir, { withFileTypes: true } ).flatMap( ( entry ) => {
const fullPath = path.join( dir, entry.name );

if ( entry.isDirectory() ) {
return listFiles( fullPath );
}

return [ fullPath ];
} );
}

let filesPatched = 0;

for ( const file of listFiles( BUILD_DIR ) ) {
if ( ! TEXT_EXTENSIONS.has( path.extname( file ) ) ) {
continue;
}

const original = fs.readFileSync( file, 'utf8' );
let updated = original;

for ( const replacement of REPLACEMENTS ) {
updated = updated.replace( replacement.search, replacement.replace );
}

if ( updated === original ) {
continue;
}

fs.writeFileSync( file, updated );
filesPatched += 1;
}

if ( filesPatched > 0 ) {
console.log( `Patched WordPress.org compliance references in ${ filesPatched } build file(s).` );
}
2 changes: 1 addition & 1 deletion scripts/report-bundle-sizes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const buildDir = path.resolve( 'src/js/build' );
const budgetByEntry = {
mapglLoader: 1100,
mapglReact: 120,
mapBlocks: 1150,
mapBlocks: 1260,
layersSidebar: 360,
discovery: 280,
mapsSidebar: 240,
Expand Down
59 changes: 57 additions & 2 deletions src/css/jeo-map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,13 @@
}

div.more-info-overlayer {
box-sizing: border-box;
margin-top: 50px;
position: absolute;
width: calc(100% - 250px);
height: calc(100% - 70px);
max-width: calc(100% - 20px);
max-height: calc(100% - 70px);
background-color: white;
z-index: 10;
top: 10px;
Expand Down Expand Up @@ -1125,6 +1128,50 @@
width: auto;
}

.jeomap:is(.wp-block-jeo-map, .wp-block-jeo-onetime-map).alignfull {
margin-inline: calc(50% - 50vw);
max-width: 100vw;
width: 100vw;
}

.jeomap:is(.wp-block-jeo-map, .wp-block-jeo-onetime-map).alignleft,
.jeomap:is(.wp-block-jeo-map, .wp-block-jeo-onetime-map).alignright {
--jeo-aligned-map-base-width: var( --wp--style--global--content-size, 645px );
--jeo-aligned-map-expanded-width: calc( var( --jeo-aligned-map-base-width ) * 1.6 );
display: table;
max-width: none;
min-width: min( var( --jeo-aligned-map-base-width ), calc( 100vw - 2rem ) );
width: min( var( --jeo-aligned-map-expanded-width ), calc( 100vw - 2rem ) );
}

.jeomap:is(.wp-block-jeo-map, .wp-block-jeo-onetime-map).alignleft {
float: left;
margin-left: 0;
margin-right: 1em;
margin-top: 0.5em;
margin-bottom: 0.5em;
}

.jeomap:is(.wp-block-jeo-map, .wp-block-jeo-onetime-map).alignright {
float: right;
margin-right: 0;
margin-left: 1em;
margin-top: 0.5em;
margin-bottom: 0.5em;
}

@media (max-width: 782px) {
.jeomap:is(.wp-block-jeo-map, .wp-block-jeo-onetime-map).alignleft,
.jeomap:is(.wp-block-jeo-map, .wp-block-jeo-onetime-map).alignright {
display: block;
float: none;
margin-left: 0;
margin-right: 0;
min-width: 0;
width: 100%;
}
}

p.jeomap-no-layers__text {
font-size: 16px;
border: 1px solid #e3dfdf;
Expand Down Expand Up @@ -1204,8 +1251,16 @@ div.jeomap.alignwide {
}

div.more-info-overlayer {
width: calc(100% - 20px);
height: calc(100% - 150px);
inset-inline-start: 10px;
inset-inline-end: 10px;
top: 60px;
bottom: 10px;
margin-top: 0;
width: auto;
height: auto;
max-width: none;
max-height: none;
padding: 0 14px 14px;
}
}
}
Loading
Loading