Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move PL plugin under plugins/performance-lab #1182

Merged
merged 39 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
92e2ce2
Move PL plugin files to plugins/performance-lab
thelovekesh Apr 21, 2024
9e06ddd
Add performance-lab to plugins.json
thelovekesh Apr 21, 2024
38f2e9d
Move dotorg assets to PL plugin in plugins directory
thelovekesh Apr 21, 2024
cd0f1be
Update build command for PL plugin
thelovekesh Apr 21, 2024
a0336b0
Move PHPCS config for PL plugins/performance-lab
thelovekesh Apr 21, 2024
797f2ff
Update wp-env config to include PL plugin from plugins directory
thelovekesh Apr 21, 2024
a421c68
Update PHPCS config
thelovekesh Apr 21, 2024
c719034
Add placeholder plugin file for performance monorepo
thelovekesh Apr 21, 2024
2533f82
Mount root in wp-env
thelovekesh Apr 21, 2024
09569fc
Update test scritps
thelovekesh Apr 21, 2024
7feeecd
Update tests bootstrap file
thelovekesh Apr 21, 2024
ef9f70a
Add PHPCS config for root
thelovekesh Apr 21, 2024
c4e4de9
Add lint:all script
thelovekesh Apr 21, 2024
5d7ec03
Update deploy plugin workflow name
thelovekesh Apr 21, 2024
750efa1
Remove redundant workflows
thelovekesh Apr 21, 2024
c4ac624
Update build-plugins command
thelovekesh Apr 21, 2024
9125db7
Move avif site health checks to plugins/performance-lab
thelovekesh Apr 25, 2024
fd67b38
Update PHPStan config
thelovekesh Apr 25, 2024
bfb1b4b
Update text domain for plugin root files
thelovekesh Apr 25, 2024
ec6fa46
Update plugin description
thelovekesh May 16, 2024
feab2ab
Move perflab tests to tests/plugins/performance-lab
thelovekesh May 16, 2024
d323090
Update testsuite config for performance-lab plugin
thelovekesh May 16, 2024
c8e476e
Fix type hints
thelovekesh May 16, 2024
affed22
Move perflab tests to includes dir; Move all site health tests under …
thelovekesh May 16, 2024
fff04de
Move test data images from modules to test/data
thelovekesh May 16, 2024
f946536
Move perflab main plugin file tests to its tests dir
thelovekesh May 16, 2024
618446f
Add perflab load.php in paths to get loaded early
thelovekesh May 16, 2024
af1b602
Set default testsuite
thelovekesh May 16, 2024
2937407
Remove edge case of PL plugin to be refered as the root plugin
thelovekesh May 22, 2024
db957d4
Mount plugin root files in tests
thelovekesh May 22, 2024
23de67a
Fix cwd in wp-env tests
thelovekesh May 22, 2024
a0f00cc
Update ruleset name
thelovekesh May 22, 2024
0596b06
Update lint:all script
thelovekesh May 22, 2024
8cbac0c
Update monorepo notices
westonruter May 22, 2024
f5f5fbb
Remove redundant export-ignores
thelovekesh May 22, 2024
e3dc1a6
Remove obsolete condition in since command
westonruter May 22, 2024
d9cd4d4
Add github-linguist docs for reference
thelovekesh May 22, 2024
f0d034d
Update PHP tests commands
thelovekesh May 22, 2024
8bc9e7d
Update test command in php-test-plugins workflow
westonruter May 22, 2024
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
45 changes: 3 additions & 42 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,43 +1,4 @@
*.stub linguist-language=PHP

/.git export-ignore
/.github export-ignore
/.wordpress-org export-ignore
/.husky export-ignore
/node_modules export-ignore
/vendor export-ignore

/bin export-ignore
/docs export-ignore
/tests export-ignore
/plugin-tests export-ignore
/plugins export-ignore
/plugins.json export-ignore

/*.DS_store export-ignore
/.DS_store? export-ignore

/.editorconfig export-ignore
/.eslintrc.js export-ignore
/.nvmrc export-ignore
/.wp-env.json export-ignore
/composer.json export-ignore
/composer.lock export-ignore
/package.json export-ignore
/package-lock.json export-ignore
phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/webpack.config.js export-ignore
# See <https://github.com/github-linguist/linguist/blob/master/docs/overrides.md>.

/CONTRIBUTING.md export-ignore
/SECURITY.md export-ignore
/README.md export-ignore

/.gitattributes export-ignore
/.gitignore export-ignore

/modules/**/readme.txt export-ignore
/modules/**/.wordpress-org export-ignore

/plugins/**/.wordpress-org export-ignore
# Improve highlighting for PHPStan stub files.
*.stub linguist-language=PHP
28 changes: 0 additions & 28 deletions .github/workflows/deploy-dotorg.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/php-test-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
run: npm run wp-env start
- name: Composer Install
run: npm run wp-env run tests-cli -- --env-cwd="wp-content/plugins/$(basename $(pwd))" composer install --no-interaction --no-progress
- name: Running single site unit tests for plugins
run: npm run test-php-plugins
- name: Running multisite unit tests for plugins
run: npm run test-php-multisite-plugins
- name: Running single site unit tests
run: npm run test-php
- name: Running multisite unit tests
run: npm run test-php-multisite
74 changes: 0 additions & 74 deletions .github/workflows/php-test.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{
"core": null,
"plugins": [
".",
"./plugins/auto-sizes",
"./plugins/dominant-color-images",
"./plugins/embed-optimizer",
"./plugins/optimization-detective",
"./plugins/performance-lab",
"./plugins/speculation-rules",
"./plugins/webp-uploads"
],
"env": {
"tests": {
"config": {
"FS_METHOD": "direct"
},
"mappings": {
"/wp-content/plugins/performance": "."
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions bin/phpcs/phpcs.ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,8 @@

<!-- Exclude built plugins and built assets in plugins. -->
<exclude-pattern>./build/*</exclude-pattern>

<!-- Exclude node_modules and vendor directories. -->
<exclude-pattern>./node_modules/*</exclude-pattern>
<exclude-pattern>./vendor/*</exclude-pattern>
</ruleset>
20 changes: 9 additions & 11 deletions bin/plugin/commands/readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,28 +123,25 @@ function getStableTag( readmeFilePath ) {
async function updateReadme( settings ) {
const pluginRoot = path.resolve( __dirname, '../../../' );

const allPluginSlugs = [
'performance-lab', // TODO: Remove as of <https://github.com/WordPress/performance/pull/1182>.
...plugins,
];
if ( settings.plugin && ! allPluginSlugs.includes( settings.plugin ) ) {
if ( settings.plugin && ! plugins.includes( settings.plugin ) ) {
throw new Error( `Unrecognized plugin: ${ settings.plugin }` );
}

const pluginSlugs = [];

if ( settings.plugin ) {
pluginSlugs.push( settings.plugin );
} else {
pluginSlugs.push( ...allPluginSlugs );
pluginSlugs.push( ...plugins );
}

for ( const pluginSlug of pluginSlugs ) {
try {
const pluginDirectory =
'performance-lab' === pluginSlug // TODO: Remove this condition as of <https://github.com/WordPress/performance/pull/1182>.
? pluginRoot
: path.resolve( pluginRoot, 'plugins', pluginSlug );

const pluginDirectory = path.resolve(
pluginRoot,
'plugins',
pluginSlug
);
const readmeFilePath = path.resolve(
pluginDirectory,
'readme.txt'
Expand All @@ -157,6 +154,7 @@ async function updateReadme( settings ) {
token: settings.token,
} );
const status = updateReadmeChangelog( readmeFilePath, changelog );

log(
formats.success(
`💃 ${ pluginSlug } successfully updated for version ${ stableTag }: ${ status }`
Expand Down
15 changes: 2 additions & 13 deletions bin/plugin/commands/since.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,15 @@ exports.options = [
exports.handler = async ( opt ) => {
const isAllPlugins = ! opt.plugin;

if (
! isAllPlugins &&
opt.plugin !== 'performance-lab' && // TODO: Remove this as of <https://github.com/WordPress/performance/pull/1182>.
! plugins.includes( opt.plugin )
) {
if ( ! isAllPlugins && ! plugins.includes( opt.plugin ) ) {
throw new Error(
`The plugin "${ opt.plugin }" is not a valid plugin managed as part of this project.`
);
}

const pluginDirectories = [];
const pluginRoot = path.resolve( __dirname, '../../../' );

const pluginDirectories = [];
if ( isAllPlugins || opt.plugin === 'performance-lab' ) {
pluginDirectories.push( pluginRoot ); // TODO: Remove this as of <https://github.com/WordPress/performance/pull/1182>.
}
if ( isAllPlugins ) {
for ( const pluginSlug of plugins ) {
pluginDirectories.push(
Expand Down Expand Up @@ -77,10 +70,6 @@ exports.handler = async ( opt ) => {
}
const version = readmeContentMatches[ 1 ];

if ( pluginDirectory === pluginRoot ) {
ignore.push( '**/plugins' ); // TODO: Remove this as of <https://github.com/WordPress/performance/pull/1182>.
}

patterns.push( `${ pluginDirectory }/**/*.php` );
patterns.push( `${ pluginDirectory }/**/*.js` );

Expand Down
7 changes: 1 addition & 6 deletions bin/plugin/commands/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,8 @@ async function checkPluginDirectory( pluginDirectory ) {
* @param {WPVersionsCommandOptions} opt Command options.
*/
exports.handler = async ( opt ) => {
const pluginRoot = path.resolve( __dirname, '../../../' );

const pluginDirectories = [];

if ( ! opt.plugin || 'performance-lab' === opt.plugin ) {
pluginDirectories.push( pluginRoot ); // TODO: Remove this after <https://github.com/WordPress/performance/pull/1182>.
}
const pluginRoot = path.resolve( __dirname, '../../../' );

for ( const pluginSlug of plugins ) {
if ( ! opt.plugin || pluginSlug === opt.plugin ) {
Expand Down
42 changes: 20 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,53 +71,51 @@
"@lint:dominant-color-images",
"@lint:embed-optimizer",
"@lint:optimization-detective",
"@lint:performance-lab",
"@lint:speculation-rules",
"@lint:webp-uploads"
],
"lint:auto-sizes": "@lint -- ./plugins/auto-sizes --standard=./plugins/auto-sizes/phpcs.xml.dist",
"lint:dominant-color-images": "@lint -- ./plugins/dominant-color-images --standard=./plugins/dominant-color-images/phpcs.xml.dist",
"lint:embed-optimizer": "@lint -- ./plugins/embed-optimizer --standard=./plugins/embed-optimizer/phpcs.xml.dist",
"lint:optimization-detective": "@lint -- ./plugins/optimization-detective --standard=./plugins/optimization-detective/phpcs.xml.dist",
"lint:performance-lab": "@lint -- ./plugins/performance-lab --standard=./plugins/performance-lab/phpcs.xml.dist",
"lint:speculation-rules": "@lint -- ./plugins/speculation-rules --standard=./plugins/speculation-rules/phpcs.xml.dist",
"lint:webp-uploads": "@lint -- ./plugins/webp-uploads --standard=./plugins/webp-uploads/phpcs.xml.dist",
"phpstan": "phpstan analyse --memory-limit=2048M",
"test": "phpunit --verbose --testsuite performance-lab",
"test-multisite": "phpunit -c tests/multisite.xml --verbose --testsuite performance-lab",
"test-multisite:all": [
"@test-multisite",
"@test-multisite:plugins"
],
"test-multisite:auto-sizes": "phpunit -c tests/multisite.xml --verbose --testsuite auto-sizes",
"test-multisite:dominant-color-images": "phpunit -c tests/multisite.xml --verbose --testsuite dominant-color-images",
"test-multisite:embed-optimizer": "phpunit -c tests/multisite.xml --verbose --testsuite embed-optimizer",
"test-multisite:optimization-detective": "phpunit -c tests/multisite.xml --verbose --testsuite optimization-detective",
"test": "phpunit",
"test-multisite": "@test -c tests/multisite.xml",
"test-multisite:plugins": [
"@test-multisite:auto-sizes",
"@test-multisite:dominant-color-images",
"@test-multisite:embed-optimizer",
"@test-multisite:optimization-detective",
"@test-multisite:performance-lab",
"@test-multisite:speculation-rules",
"@test-multisite:webp-uploads"
],
"test-multisite:speculation-rules": "phpunit -c tests/multisite.xml --verbose --testsuite speculation-rules",
"test-multisite:webp-uploads": "phpunit -c tests/multisite.xml --verbose --testsuite webp-uploads",
"test:all": [
"@test",
"@test:plugins"
],
"test:auto-sizes": "phpunit --verbose --testsuite auto-sizes",
"test:dominant-color-images": "phpunit --verbose --testsuite dominant-color-images",
"test:embed-optimizer": "phpunit --verbose --testsuite embed-optimizer",
"test:optimization-detective": "phpunit --verbose --testsuite optimization-detective",
"test-multisite:auto-sizes": "@test-multisite --verbose --testsuite auto-sizes",
"test-multisite:dominant-color-images": "@test-multisite --verbose --testsuite dominant-color-images",
"test-multisite:embed-optimizer": "@test-multisite --verbose --testsuite embed-optimizer",
"test-multisite:optimization-detective": "@test-multisite --verbose --testsuite optimization-detective",
"test-multisite:performance-lab": "@test-multisite --verbose --testsuite performance-lab",
"test-multisite:speculation-rules": "@test-multisite --verbose --testsuite speculation-rules",
"test-multisite:webp-uploads": "@test-multisite --verbose --testsuite webp-uploads",
"test:plugins": [
"@test:auto-sizes",
"@test:dominant-color-images",
"@test:embed-optimizer",
"@test:optimization-detective",
"@test:performance-lab",
"@test:speculation-rules",
"@test:webp-uploads"
],
"test:speculation-rules": "phpunit --verbose --testsuite speculation-rules",
"test:webp-uploads": "phpunit --verbose --testsuite webp-uploads"
"test:auto-sizes": "@test --verbose --testsuite auto-sizes",
"test:dominant-color-images": "@test --verbose --testsuite dominant-color-images",
"test:embed-optimizer": "@test --verbose --testsuite embed-optimizer",
"test:optimization-detective": "@test --verbose --testsuite optimization-detective",
"test:performance-lab": "@test --verbose --testsuite performance-lab",
"test:speculation-rules": "@test --verbose --testsuite speculation-rules",
"test:webp-uploads": "@test --verbose --testsuite webp-uploads"
}
}
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"readme": "./bin/plugin/cli.js readme",
"versions": "./bin/plugin/cli.js versions",
"build": "wp-scripts build",
"build-plugins": "npm-run-all 'build:plugin:!(performance-lab)'",
"build:plugin:performance-lab": "rm -rf build/performance-lab && mkdir -p build/performance-lab && git archive HEAD | tar -x -C build/performance-lab",
"build-plugins": "npm-run-all 'build:plugin:*'",
"build:plugin:performance-lab": "webpack --mode production --env plugin=performance-lab",
"build:plugin:auto-sizes": "webpack --mode production --env plugin=auto-sizes",
"build:plugin:dominant-color-images": "webpack --mode production --env plugin=dominant-color-images",
"build:plugin:embed-optimizer": "webpack --mode production --env plugin=embed-optimizer",
Expand All @@ -43,10 +43,8 @@
"format-php": "composer format",
"phpstan": "composer phpstan",
"lint-php": "composer lint:all",
"test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename $(pwd)) composer test",
"test-php-multisite": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename $(pwd)) composer test-multisite",
"test-php-plugins": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename $(pwd)) composer test:plugins",
"test-php-multisite-plugins": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/$(basename $(pwd)) composer test-multisite:plugins",
"test-php": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/performance composer test:plugins",
"test-php-multisite": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/performance composer test-multisite:plugins",
"wp-env": "wp-env",
"prepare": "husky install"
},
Expand Down
Loading
Loading