From 8de21b815e5636dd876c45ea76d6bf24221a4a19 Mon Sep 17 00:00:00 2001 From: Hein van Vlastuin Date: Fri, 8 May 2026 11:21:11 +0200 Subject: [PATCH 1/5] Update Elementor install --- .github/scripts/build-wp-env.js | 114 +++----------------------------- 1 file changed, 11 insertions(+), 103 deletions(-) diff --git a/.github/scripts/build-wp-env.js b/.github/scripts/build-wp-env.js index 9037a539..4c0586b6 100644 --- a/.github/scripts/build-wp-env.js +++ b/.github/scripts/build-wp-env.js @@ -66,122 +66,30 @@ wpEnv.plugins = []; // Add Elementor plugin if ( ELEMENTOR_VERSION ) { - // eslint-disable-next-line no-console - console.log( '🔍 =============================================' ); - // eslint-disable-next-line no-console - console.log( '🔍 BUILD-WP-ENV.JS ELEMENTOR DEBUG' ); - // eslint-disable-next-line no-console - console.log( '🔍 =============================================' ); // eslint-disable-next-line no-console console.log( `🎯 ELEMENTOR_VERSION: "${ ELEMENTOR_VERSION }"` ); - if ( 'latest-stable' === ELEMENTOR_VERSION ) { - // Use WordPress.org directly for latest-stable (most reliable) - wpEnv.plugins.push( 'https://downloads.wordpress.org/plugin/elementor.latest-stable.zip' ); + const isValidLocalElementor = fs.existsSync( './tmp/elementor/elementor.php' ) && + fs.existsSync( './tmp/elementor/includes' ) && + fs.existsSync( './tmp/elementor/assets' ); + + if ( isValidLocalElementor ) { + // Prefer the artifact downloaded during the build job. This pins the exact + // Elementor binary across both jobs and prevents version drift when + // 'latest-stable' is updated between the build and test steps. + wpEnv.plugins.push( './tmp/elementor' ); // eslint-disable-next-line no-console - console.log( '✅ Using WordPress.org Elementor latest-stable (direct)' ); + console.log( '✅ Using local Elementor artifact from ./tmp/elementor (pinned from build job)' ); } else if ( ELEMENTOR_VERSION.match( /^v?[0-9]+\.[0-9]+\.[0-9]+$/ ) ) { - // Use WordPress.org directly for semantic versions (e.g., 3.30.4, v3.30.4) const cleanVersion = ELEMENTOR_VERSION.replace( /^v/, '' ); wpEnv.plugins.push( `https://downloads.wordpress.org/plugin/elementor.${ cleanVersion }.zip` ); // eslint-disable-next-line no-console console.log( `✅ Using WordPress.org Elementor ${ cleanVersion } (direct)` ); - } else if ( fs.existsSync( './tmp/elementor' ) ) { - // GitHub branches (main, feature-branch) - expect built artifacts from workflow - // eslint-disable-next-line no-console - console.log( `🔍 Using GitHub built artifacts for Elementor ${ ELEMENTOR_VERSION }` ); - // Debug: Verify Elementor directory structure - // eslint-disable-next-line no-console - console.log( '🔍 DEBUG: Elementor directory found, verifying structure...' ); - try { - const elementorContents = fs.readdirSync( './tmp/elementor' ); - // eslint-disable-next-line no-console - console.log( `📁 Elementor directory contents (${ elementorContents.length } items):`, elementorContents.slice( 0, 10 ) ); - - // Check for main plugin file - if ( fs.existsSync( './tmp/elementor/elementor.php' ) ) { - // eslint-disable-next-line no-console - console.log( '✅ Main plugin file found: elementor.php' ); - - // Read plugin header for verification - try { - const pluginContent = fs.readFileSync( './tmp/elementor/elementor.php', 'utf8' ); - const headerMatch = pluginContent.match( /Plugin Name:\s*(.+)/i ); - const versionMatch = pluginContent.match( /Version:\s*(.+)/i ); - if ( headerMatch ) { - // eslint-disable-next-line no-console - console.log( `📄 Plugin Name: ${ headerMatch[ 1 ].trim() }` ); - } - if ( versionMatch ) { - // eslint-disable-next-line no-console - console.log( `🏷️ Plugin Version: ${ versionMatch[ 1 ].trim() }` ); - } - } catch ( error ) { - // eslint-disable-next-line no-console - console.log( '⚠️ Could not read plugin header:', error.message ); - } - } else { - // eslint-disable-next-line no-console - console.log( '❌ Main plugin file missing: elementor.php' ); - const phpFiles = elementorContents.filter( ( file ) => file.endsWith( '.php' ) ); - // eslint-disable-next-line no-console - console.log( `🔍 Available PHP files (${ phpFiles.length }):`, phpFiles.slice( 0, 5 ) ); - } - - // Check for essential directories - const essentialDirs = [ 'includes', 'assets' ]; - essentialDirs.forEach( ( dir ) => { - if ( fs.existsSync( `./tmp/elementor/${ dir }` ) ) { - // eslint-disable-next-line no-console - console.log( `✅ Essential directory found: ${ dir }` ); - } else { - // eslint-disable-next-line no-console - console.log( `⚠️ Essential directory missing: ${ dir }` ); - } - } ); - } catch ( error ) { - // eslint-disable-next-line no-console - console.error( '❌ Error reading Elementor directory:', error.message ); - } - - // Check if local Elementor installation is valid - const isValidElementor = fs.existsSync( './tmp/elementor/elementor.php' ) && - fs.existsSync( './tmp/elementor/includes' ) && - fs.existsSync( './tmp/elementor/assets' ); - - if ( isValidElementor ) { - // Use the GitHub built artifacts for branches - wpEnv.plugins.push( './tmp/elementor' ); - // eslint-disable-next-line no-console - console.log( `✅ Using GitHub built artifacts for Elementor ${ ELEMENTOR_VERSION }` ); - } else { - // GitHub artifacts should be valid - if not, something went wrong in workflow - // eslint-disable-next-line no-console - console.error( `❌ Invalid GitHub artifacts for Elementor ${ ELEMENTOR_VERSION }` ); - // eslint-disable-next-line no-console - console.error( 'Expected workflow to provide valid built artifacts in ./tmp/elementor' ); - process.exit( 1 ); - } } else { - // eslint-disable-next-line no-console - console.error( `❌ Elementor directory not found at ./tmp/elementor for branch/commit: ${ ELEMENTOR_VERSION }` ); - // eslint-disable-next-line no-console - console.error( 'Note: Semantic versions (e.g., 3.30.4) and latest-stable are downloaded directly from WordPress.org' ); - // eslint-disable-next-line no-console - console.error( '🔄 Using WordPress.org latest-stable as fallback for CI stability' ); - - // Add fallback to WordPress.org for branches to prevent CI failures wpEnv.plugins.push( 'https://downloads.wordpress.org/plugin/elementor.latest-stable.zip' ); // eslint-disable-next-line no-console - console.log( `⚠️ Fallback: Using WordPress.org Elementor latest-stable for ${ ELEMENTOR_VERSION }` ); + console.log( `⚠️ No local artifact found, using Elementor latest-stable from WordPress.org` ); } - - // eslint-disable-next-line no-console - console.log( '🔍 =============================================' ); - // eslint-disable-next-line no-console - console.log( '🔍 END BUILD-WP-ENV.JS ELEMENTOR DEBUG' ); - // eslint-disable-next-line no-console - console.log( '🔍 =============================================' ); } // Test configuration From 6f7a38b11d7aa896213ee0156bb3f97118e4196c Mon Sep 17 00:00:00 2001 From: Hein van Vlastuin Date: Fri, 8 May 2026 13:40:10 +0200 Subject: [PATCH 2/5] Error logs --- .github/scripts/build-wp-env.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/scripts/build-wp-env.js b/.github/scripts/build-wp-env.js index 4c0586b6..d00bb2f3 100644 --- a/.github/scripts/build-wp-env.js +++ b/.github/scripts/build-wp-env.js @@ -37,7 +37,7 @@ wpEnv.core = wpCore; if ( fs.existsSync( './tmp/hello-elementor' ) ) { wpEnv.themes = [ './tmp/hello-elementor' ]; // eslint-disable-next-line no-console - console.log( '✅ Using built Hello Theme from ./tmp/hello-elementor' ); + console.log( 'Using built Hello Theme from ./tmp/hello-elementor' ); } else { // eslint-disable-next-line no-console console.error( 'Built Hello Theme not found at ./tmp/hello-elementor' ); @@ -67,7 +67,7 @@ wpEnv.plugins = []; // Add Elementor plugin if ( ELEMENTOR_VERSION ) { // eslint-disable-next-line no-console - console.log( `🎯 ELEMENTOR_VERSION: "${ ELEMENTOR_VERSION }"` ); + console.log( `ELEMENTOR_VERSION: "${ ELEMENTOR_VERSION }"` ); const isValidLocalElementor = fs.existsSync( './tmp/elementor/elementor.php' ) && fs.existsSync( './tmp/elementor/includes' ) && @@ -79,16 +79,23 @@ if ( ELEMENTOR_VERSION ) { // 'latest-stable' is updated between the build and test steps. wpEnv.plugins.push( './tmp/elementor' ); // eslint-disable-next-line no-console - console.log( '✅ Using local Elementor artifact from ./tmp/elementor (pinned from build job)' ); + console.log( 'Using local Elementor artifact from ./tmp/elementor (pinned from build job)' ); } else if ( ELEMENTOR_VERSION.match( /^v?[0-9]+\.[0-9]+\.[0-9]+$/ ) ) { const cleanVersion = ELEMENTOR_VERSION.replace( /^v/, '' ); wpEnv.plugins.push( `https://downloads.wordpress.org/plugin/elementor.${ cleanVersion }.zip` ); // eslint-disable-next-line no-console - console.log( `✅ Using WordPress.org Elementor ${ cleanVersion } (direct)` ); + console.log( `Using WordPress.org Elementor ${ cleanVersion } (direct)` ); } else { + if ( fs.existsSync( './tmp/elementor' ) ) { + // eslint-disable-next-line no-console + console.error( `Elementor artifact at ./tmp/elementor is incomplete for ${ ELEMENTOR_VERSION } (missing elementor.php, includes, or assets)` ); + } else { + // eslint-disable-next-line no-console + console.error( `Elementor directory not found at ./tmp/elementor for ${ ELEMENTOR_VERSION }` ); + } wpEnv.plugins.push( 'https://downloads.wordpress.org/plugin/elementor.latest-stable.zip' ); // eslint-disable-next-line no-console - console.log( `⚠️ No local artifact found, using Elementor latest-stable from WordPress.org` ); + console.log( `Falling back to Elementor latest-stable from WordPress.org for ${ ELEMENTOR_VERSION }` ); } } @@ -129,4 +136,4 @@ console.log( `- Plugins: ${ wpEnv.plugins.join( ', ' ) }` ); fs.writeFileSync( '.wp-env.json', JSON.stringify( wpEnv, null, 4 ) ); // eslint-disable-next-line no-console -console.log( '✅ wp-env.json updated successfully' ); +console.log( 'wp-env.json updated successfully' ); From 612758cf5f844318e8482c4f8b2ef9b04677a59c Mon Sep 17 00:00:00 2001 From: Hein van Vlastuin Date: Fri, 8 May 2026 14:07:31 +0200 Subject: [PATCH 3/5] Update reporting --- .github/scripts/build-wp-env.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/scripts/build-wp-env.js b/.github/scripts/build-wp-env.js index d00bb2f3..bb88c185 100644 --- a/.github/scripts/build-wp-env.js +++ b/.github/scripts/build-wp-env.js @@ -80,6 +80,10 @@ if ( ELEMENTOR_VERSION ) { wpEnv.plugins.push( './tmp/elementor' ); // eslint-disable-next-line no-console console.log( 'Using local Elementor artifact from ./tmp/elementor (pinned from build job)' ); + } else if ( ELEMENTOR_VERSION === 'latest-stable' ) { + wpEnv.plugins.push( 'https://downloads.wordpress.org/plugin/elementor.latest-stable.zip' ); + // eslint-disable-next-line no-console + console.log( 'Using Elementor latest-stable from WordPress.org' ); } else if ( ELEMENTOR_VERSION.match( /^v?[0-9]+\.[0-9]+\.[0-9]+$/ ) ) { const cleanVersion = ELEMENTOR_VERSION.replace( /^v/, '' ); wpEnv.plugins.push( `https://downloads.wordpress.org/plugin/elementor.${ cleanVersion }.zip` ); From f6104c1f385e15f4a6b38f10e39b593d5f5d0c80 Mon Sep 17 00:00:00 2001 From: Hein van Vlastuin Date: Fri, 8 May 2026 14:17:40 +0200 Subject: [PATCH 4/5] Simplify error logs --- .github/scripts/build-wp-env.js | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/.github/scripts/build-wp-env.js b/.github/scripts/build-wp-env.js index bb88c185..4da77ec2 100644 --- a/.github/scripts/build-wp-env.js +++ b/.github/scripts/build-wp-env.js @@ -66,40 +66,16 @@ wpEnv.plugins = []; // Add Elementor plugin if ( ELEMENTOR_VERSION ) { - // eslint-disable-next-line no-console - console.log( `ELEMENTOR_VERSION: "${ ELEMENTOR_VERSION }"` ); - const isValidLocalElementor = fs.existsSync( './tmp/elementor/elementor.php' ) && fs.existsSync( './tmp/elementor/includes' ) && fs.existsSync( './tmp/elementor/assets' ); if ( isValidLocalElementor ) { - // Prefer the artifact downloaded during the build job. This pins the exact - // Elementor binary across both jobs and prevents version drift when - // 'latest-stable' is updated between the build and test steps. wpEnv.plugins.push( './tmp/elementor' ); - // eslint-disable-next-line no-console - console.log( 'Using local Elementor artifact from ./tmp/elementor (pinned from build job)' ); - } else if ( ELEMENTOR_VERSION === 'latest-stable' ) { - wpEnv.plugins.push( 'https://downloads.wordpress.org/plugin/elementor.latest-stable.zip' ); - // eslint-disable-next-line no-console - console.log( 'Using Elementor latest-stable from WordPress.org' ); - } else if ( ELEMENTOR_VERSION.match( /^v?[0-9]+\.[0-9]+\.[0-9]+$/ ) ) { - const cleanVersion = ELEMENTOR_VERSION.replace( /^v/, '' ); - wpEnv.plugins.push( `https://downloads.wordpress.org/plugin/elementor.${ cleanVersion }.zip` ); - // eslint-disable-next-line no-console - console.log( `Using WordPress.org Elementor ${ cleanVersion } (direct)` ); } else { - if ( fs.existsSync( './tmp/elementor' ) ) { - // eslint-disable-next-line no-console - console.error( `Elementor artifact at ./tmp/elementor is incomplete for ${ ELEMENTOR_VERSION } (missing elementor.php, includes, or assets)` ); - } else { - // eslint-disable-next-line no-console - console.error( `Elementor directory not found at ./tmp/elementor for ${ ELEMENTOR_VERSION }` ); - } - wpEnv.plugins.push( 'https://downloads.wordpress.org/plugin/elementor.latest-stable.zip' ); - // eslint-disable-next-line no-console - console.log( `Falling back to Elementor latest-stable from WordPress.org for ${ ELEMENTOR_VERSION }` ); + const versionMatch = ELEMENTOR_VERSION.match( /^v?([0-9]+\.[0-9]+\.[0-9]+)$/ ); + const wpOrgVersion = versionMatch ? versionMatch[ 1 ] : 'latest-stable'; + wpEnv.plugins.push( `https://downloads.wordpress.org/plugin/elementor.${ wpOrgVersion }.zip` ); } } From 75e14be2582f7df705bb563efbad56fac66f69c3 Mon Sep 17 00:00:00 2001 From: Hein van Vlastuin Date: Fri, 8 May 2026 17:44:31 +0200 Subject: [PATCH 5/5] Bot feedback --- .github/scripts/build-wp-env.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/scripts/build-wp-env.js b/.github/scripts/build-wp-env.js index 4da77ec2..fc20901c 100644 --- a/.github/scripts/build-wp-env.js +++ b/.github/scripts/build-wp-env.js @@ -64,19 +64,19 @@ if ( HELLO_PLUS_VERSION && fs.existsSync( './tmp/hello-plus' ) ) { // Configure plugins wpEnv.plugins = []; -// Add Elementor plugin -if ( ELEMENTOR_VERSION ) { - const isValidLocalElementor = fs.existsSync( './tmp/elementor/elementor.php' ) && - fs.existsSync( './tmp/elementor/includes' ) && - fs.existsSync( './tmp/elementor/assets' ); +const isValidLocalElementor = fs.existsSync( './tmp/elementor/elementor.php' ) && + fs.existsSync( './tmp/elementor/includes' ) && + fs.existsSync( './tmp/elementor/assets' ); - if ( isValidLocalElementor ) { - wpEnv.plugins.push( './tmp/elementor' ); - } else { - const versionMatch = ELEMENTOR_VERSION.match( /^v?([0-9]+\.[0-9]+\.[0-9]+)$/ ); - const wpOrgVersion = versionMatch ? versionMatch[ 1 ] : 'latest-stable'; - wpEnv.plugins.push( `https://downloads.wordpress.org/plugin/elementor.${ wpOrgVersion }.zip` ); - } +let elementorSource; +if ( isValidLocalElementor ) { + wpEnv.plugins.push( './tmp/elementor' ); + elementorSource = './tmp/elementor'; +} else { + const versionMatch = ( ELEMENTOR_VERSION || '' ).match( /^v?([0-9]+\.[0-9]+\.[0-9]+)$/ ); + const wpOrgVersion = versionMatch ? versionMatch[ 1 ] : 'latest-stable'; + wpEnv.plugins.push( `https://downloads.wordpress.org/plugin/elementor.${ wpOrgVersion }.zip` ); + elementorSource = `WordPress.org ${ wpOrgVersion }`; } // Test configuration @@ -108,7 +108,7 @@ console.log( `- Hello Theme: ${ HELLO_THEME_VERSION || 'current' }` ); // eslint-disable-next-line no-console console.log( `- Hello Plus: ${ HELLO_PLUS_VERSION || 'not included' }` ); // eslint-disable-next-line no-console -console.log( `- Elementor: ${ ELEMENTOR_VERSION || 'latest-stable' }` ); +console.log( `- Elementor: ${ elementorSource }` ); // eslint-disable-next-line no-console console.log( `- Themes: ${ wpEnv.themes.join( ', ' ) }` ); // eslint-disable-next-line no-console