Skip to content

Commit

Permalink
Lint .extra.dependencies.test-only setting (#37967)
Browse files Browse the repository at this point in the history
The setting should refer to dev dependencies of the package. Verify that
this is indeed the case.

Then clean up the two references to the removed idc package that were
left behind when the dependencies on it were removed.
  • Loading branch information
anomiex committed Jun 21, 2024
1 parent 1baef3f commit 6d88abb
Show file tree
Hide file tree
Showing 40 changed files with 147 additions and 66 deletions.
25 changes: 25 additions & 0 deletions .github/files/lint-project-structure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,31 @@ for PROJECT in projects/*/*; do
fi
fi

# - `.extra.dependencies.test-only` must refer to dev dependencies.
if jq -e '.extra.dependencies["test-only"] // empty' "$PROJECT/composer.json" >/dev/null; then
while IFS=$'\t' read -r LINE DEP; do
if [[ ! -e "projects/$DEP/composer.json" ]]; then
EXIT=1
echo "::error file=$PROJECT/composer.json,line=${LINE}::Dependency \"$DEP\" does not exist in the monorepo."
elif [[ "$DEP" == packages/* ]]; then
N=$( jq -r .name "projects/$DEP/composer.json" )
if ! jq -e --arg N "$N" '.["require-dev"][$N]' "$PROJECT/composer.json" &>/dev/null; then
EXIT=1
echo "::error file=$PROJECT/composer.json,line=${LINE}::Project \"$DEP\" ($N) is not a dev dependency of $SLUG."
fi
elif [[ "$DEP" == js-packages/* ]]; then
N=$( jq -r .name "projects/$DEP/package.json" 2>/dev/null || true )
if ! jq -e --arg N "$N" '.devDependencies[$N]' "$PROJECT/package.json" &>/dev/null; then
EXIT=1
echo "::error file=$PROJECT/composer.json,line=${LINE}::Project \"$DEP\" ($N) is not a dev dependency of $SLUG."
fi
else
EXIT=1
echo "::error file=$PROJECT/composer.json,line=${LINE}::Dependency \"$DEP\" is neither a package nor a js-package."
fi
done < <( jq --stream -r 'if length == 2 and .[0][:-1] == ["extra","dependencies","test-only"] then [input_line_number,.[1]] | @tsv else empty end' "$PROJECT/composer.json" )
fi

done

# - Monorepo root composer.json must also use dev deps appropriately.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove reference to removed identity-crisis package from composer.json `.extra.dependencies.test-only`. No change to functionality.


1 change: 0 additions & 1 deletion projects/packages/config/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"dependencies": {
"test-only": [
"packages/connection",
"packages/identity-crisis",
"packages/import",
"packages/jitm",
"packages/post-list",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove reference to removed identity-crisis package from composer.json `.extra.dependencies.test-only`. No change to functionality.


1 change: 0 additions & 1 deletion projects/packages/status/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"dependencies": {
"test-only": [
"packages/connection",
"packages/identity-crisis",
"packages/plans"
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


6 changes: 2 additions & 4 deletions projects/plugins/automattic-for-agencies-client/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


6 changes: 2 additions & 4 deletions projects/plugins/backup/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/boost/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Boost your WordPress site's performance, from the creators of Jetpack",
"type": "library",
"license": "GPL-2.0-or-later",
"version": "3.4.5-beta",
"version": "3.4.6-alpha",
"authors": [
{
"name": "Automattic, Inc.",
Expand Down Expand Up @@ -73,7 +73,7 @@
"platform": {
"ext-intl": "0.0.0"
},
"autoloader-suffix": "b1e77e6231d50e7663f84529b6a3dfda_jetpack_boostⓥ3_4_5_beta",
"autoloader-suffix": "b1e77e6231d50e7663f84529b6a3dfda_jetpack_boostⓥ3_4_6_alpha",
"allow-plugins": {
"roots/wordpress-core-installer": true,
"automattic/jetpack-autoloader": true,
Expand Down
8 changes: 3 additions & 5 deletions projects/plugins/boost/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions projects/plugins/boost/jetpack-boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Plugin Name: Jetpack Boost
* Plugin URI: https://jetpack.com/boost
* Description: Boost your WordPress site's performance, from the creators of Jetpack
* Version: 3.4.5-beta
* Version: 3.4.6-alpha
* Author: Automattic - Jetpack Site Speed team
* Author URI: https://jetpack.com/boost/
* License: GPL-2.0+
Expand All @@ -29,7 +29,7 @@
die;
}

define( 'JETPACK_BOOST_VERSION', '3.4.5-beta' );
define( 'JETPACK_BOOST_VERSION', '3.4.6-alpha' );
define( 'JETPACK_BOOST_SLUG', 'jetpack-boost' );

if ( ! defined( 'JETPACK_BOOST_CLIENT_NAME' ) ) {
Expand Down
2 changes: 1 addition & 1 deletion projects/plugins/boost/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jetpack-boost",
"version": "3.4.5-beta",
"version": "3.4.6-alpha",
"description": "Boost your WordPress site's performance, from the creators of Jetpack",
"directories": {
"test": "tests"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


6 changes: 2 additions & 4 deletions projects/plugins/classic-theme-helper-plugin/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


6 changes: 2 additions & 4 deletions projects/plugins/inspect/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


6 changes: 2 additions & 4 deletions projects/plugins/jetpack/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


6 changes: 2 additions & 4 deletions projects/plugins/migration/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6d88abb

Please sign in to comment.