From e30f32452440803fefd7b08433cbb106b9936a15 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 13 Jun 2024 14:45:15 -0400 Subject: [PATCH 1/2] renovate: Fix warnings from weird wpcomsh deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the five `type: vcs` deps, Renovate needs a `name` key in each one so it knows the package name (versus Composer itself that fetches the composer.json). The "wordpress/classic-editor-plugin" fake package is a bit more difficult. We have to disable the 'packagist' entry entirely. But then we can make a customManager and customDatasource for it. 😀 --- .github/renovate.json5 | 35 +++++++++++++++++++ .../fix-renovate-and-wpcomsh-weird-deps | 5 +++ projects/plugins/wpcomsh/composer.json | 7 +++- projects/plugins/wpcomsh/composer.lock | 2 +- projects/plugins/wpcomsh/package.json | 2 +- projects/plugins/wpcomsh/wpcomsh.php | 4 +-- 6 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 projects/plugins/wpcomsh/changelog/fix-renovate-and-wpcomsh-weird-deps diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 5c5bcf32a8ed9..26499461dc971 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -26,6 +26,13 @@ // Monorepo packages are excluded in renovate-config.js, where we can read // the list of them in code. + // Disable the packagist 'wordpress/classic-editor-plugin'. It's not in packagist, and we have a customManager for it below. + { + matchDatasources: [ 'packagist' ], + matchDepNames: [ 'wordpress/classic-editor-plugin' ], + enabled: false, + }, + // Widen PHP dev deps to maintain support for old PHP versions we still support. // When we drop an old PHP version we'll manually go through and narrow any ranges. // (non-dev deps are handled in renovate-config.js where we can read the correct value for `constraints.php`) @@ -106,7 +113,35 @@ depNameTemplate: 'renovate', packageNameTemplate: 'ghcr.io/renovatebot/renovate', }, + + // wpcomsh's wordpress/classic-editor-plugin fake-package. + { + customType: 'regex', + fileMatch: [ '^projects/plugins/wpcomsh/composer\\.json$' ], + matchStrings: [ + // Alas the only option is regexing to match against the JSON. Four patterns for the four different places the version number appears. + // .require: + '"wordpress/classic-editor-plugin": "(?[0-9.]+)",', + // .repositories[].package.version + '"name": "wordpress/classic-editor-plugin",\\s+"version": "(?[0-9.]+)",', + // .repositories[].package.dist.url + '"url": "https://downloads\\.wordpress\\.org/plugin/classic-editor\\.(?[0-9.]+)\\.zip",', + // .repositories[].package.source.reference + '"url": "https://plugins\\.svn\\.wordpress\\.org/classic-editor/",\\s+"type": "svn",\\s+"reference": "tags/(?[0-9.]+)/"', + ], + depNameTemplate: 'wordpress/classic-editor-plugin', + packageNameTemplate: 'classic-editor', + datasourceTemplate: 'custom.wordpress-plugin', + }, ], + customDatasources: { + 'wordpress-plugin': { + defaultRegistryUrlTemplate: 'https://api.wordpress.org/plugins/info/1.0/{{packageName}}.json', + transformTemplates: [ + '{ "releases": $each( versions, function($v, $k) { $match( $k, /^[0-9.]+$/ ) ? { "version": $k } } ) }', + ], + }, + }, lockFileMaintenance: { enabled: true, diff --git a/projects/plugins/wpcomsh/changelog/fix-renovate-and-wpcomsh-weird-deps b/projects/plugins/wpcomsh/changelog/fix-renovate-and-wpcomsh-weird-deps new file mode 100644 index 0000000000000..3a53fc09c7c1d --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/fix-renovate-and-wpcomsh-weird-deps @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Add names in composer.json `repositories` to make Renovate happy. No change to functionality. + + diff --git a/projects/plugins/wpcomsh/composer.json b/projects/plugins/wpcomsh/composer.json index ce867dc5dfdfc..001b5675c209d 100644 --- a/projects/plugins/wpcomsh/composer.json +++ b/projects/plugins/wpcomsh/composer.json @@ -73,26 +73,31 @@ } }, { + "name": "automattic/custom-fonts", "type": "vcs", "no-api": true, "url": "https://github.com/Automattic/custom-fonts.git" }, { + "name": "automattic/custom-fonts-typekit", "type": "vcs", "no-api": true, "url": "https://github.com/Automattic/custom-fonts-typekit.git" }, { + "name": "automattic/at-pressable-podcasting", "type": "vcs", "no-api": true, "url": "https://github.com/automattic/at-pressable-podcasting.git" }, { + "name": "automattic/text-media-widget-styles", "type": "vcs", "no-api": true, "url": "https://github.com/Automattic/text-media-widget-styles.git" }, { + "name": "automattic/wc-calypso-bridge", "type": "vcs", "no-api": true, "url": "https://github.com/Automattic/wc-calypso-bridge.git" @@ -125,7 +130,7 @@ "composer/installers": true, "roots/wordpress-core-installer": true }, - "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ3_22_14" + "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ3_22_15_alpha" }, "extra": { "mirror-repo": "Automattic/wpcom-site-helper", diff --git a/projects/plugins/wpcomsh/composer.lock b/projects/plugins/wpcomsh/composer.lock index 28eacab904bba..f6308212a7c21 100644 --- a/projects/plugins/wpcomsh/composer.lock +++ b/projects/plugins/wpcomsh/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4437b03befd1d10fbfd87f388d358501", + "content-hash": "60e9652f729fce540bc1812d6d173006", "packages": [ { "name": "automattic/at-pressable-podcasting", diff --git a/projects/plugins/wpcomsh/package.json b/projects/plugins/wpcomsh/package.json index 80ae9d8a03def..2b3655e9c1df4 100644 --- a/projects/plugins/wpcomsh/package.json +++ b/projects/plugins/wpcomsh/package.json @@ -3,7 +3,7 @@ "name": "@automattic/jetpack-wpcomsh", "description": "A helper for connecting WordPress.com sites to external host infrastructure.", "homepage": "https://jetpack.com", - "version": "3.22.14", + "version": "3.22.15-alpha", "bugs": { "url": "https://github.com/Automattic/jetpack/labels/[Plugin] Wpcomsh" }, diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index ef5ac49f63375..e02db6e8081ce 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -2,7 +2,7 @@ /** * Plugin Name: WordPress.com Site Helper * Description: A helper for connecting WordPress.com sites to external host infrastructure. - * Version: 3.22.14 + * Version: 3.22.15-alpha * Author: Automattic * Author URI: http://automattic.com/ * @@ -10,7 +10,7 @@ */ // Increase version number if you change something in wpcomsh. -define( 'WPCOMSH_VERSION', '3.22.14' ); +define( 'WPCOMSH_VERSION', '3.22.15-alpha' ); // If true, Typekit fonts will be available in addition to Google fonts add_filter( 'jetpack_fonts_enable_typekit', '__return_true' ); From 6f10592a907d2b0d259fcf468f7c1719c3cde2e8 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Mon, 17 Jun 2024 08:54:42 -0400 Subject: [PATCH 2/2] Update lock file hash --- projects/plugins/wpcomsh/composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/plugins/wpcomsh/composer.lock b/projects/plugins/wpcomsh/composer.lock index 1e14edb4453dc..d7d7162f66b85 100644 --- a/projects/plugins/wpcomsh/composer.lock +++ b/projects/plugins/wpcomsh/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "60e9652f729fce540bc1812d6d173006", + "content-hash": "2fbe57d46fc37e2ff4d82f863058a224", "packages": [ { "name": "automattic/at-pressable-podcasting",