From 630c02a132536afd364bee1cf1c0a95feeac25ce Mon Sep 17 00:00:00 2001 From: Nikos Roussos Date: Fri, 31 Jan 2025 13:10:57 +0200 Subject: [PATCH] Retire blocks plugin --- .circleci/config.yml | 7 ++--- .p4-env.json | 3 +-- scripts/clean-repos.js | 4 --- scripts/e2e.js | 6 ----- scripts/fix-permissions.js | 3 --- scripts/lib/composer-requirements.js | 9 ------- scripts/lib/gpi-frontend.code-workspace | 26 ------------------ scripts/lib/main-repos.js | 35 +------------------------ scripts/nro-install.js | 1 - scripts/php-tests.js | 4 --- scripts/update.js | 9 ++----- 11 files changed, 6 insertions(+), 101 deletions(-) delete mode 100644 scripts/lib/gpi-frontend.code-workspace diff --git a/.circleci/config.yml b/.circleci/config.yml index 67326873..9ef92308 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,11 +103,8 @@ jobs: name: Extract tests artifacts when: always command: | - mkdir -p /home/circleci/artifacts/playwright/themes /home/circleci/artifacts/playwright/plugins - cp -r planet4/themes/planet4-master-theme/e2e-* /home/circleci/artifacts/playwright/themes || true - cp planet4/themes/planet4-master-theme/results.xml /home/circleci/artifacts/playwright/themes || true - cp -r planet4/plugins/planet4-plugin-gutenberg-blocks/e2e-* /home/circleci/artifacts/playwright/plugins || true - cp planet4/plugins/planet4-plugin-gutenberg-blocks/results.xml /home/circleci/artifacts/playwright/plugins || true + cp -r planet4/themes/planet4-master-theme/e2e-* /home/circleci/artifacts/playwright || true + cp planet4/themes/planet4-master-theme/results.xml /home/circleci/artifacts/playwright || true - store_test_results: path: /home/circleci/artifacts - store_artifacts: diff --git a/.p4-env.json b/.p4-env.json index 5b0f97d6..276b1f0f 100644 --- a/.p4-env.json +++ b/.p4-env.json @@ -6,8 +6,7 @@ }, "repos": { "planet4-base": "main", - "planet4-master-theme": "main", - "planet4-plugin-gutenberg-blocks": "main" + "planet4-master-theme": "main" }, "composer": { "processTimeout": "600" diff --git a/scripts/clean-repos.js b/scripts/clean-repos.js index 5d902465..dd5a9a34 100644 --- a/scripts/clean-repos.js +++ b/scripts/clean-repos.js @@ -4,11 +4,7 @@ const {isDir, isRepo} = require('./lib/utils'); const config = getConfig(); const themeDir = `${config.themesDir}/planet4-master-theme`; -const pluginDir = `${config.pluginsDir}/planet4-plugin-gutenberg-blocks`; if (isDir(themeDir) && !isRepo(themeDir)) { run(`sudo rm -rf ${themeDir}`); } -if (isDir(pluginDir) && !isRepo(pluginDir)) { - run(`sudo rm -rf ${pluginDir}`); -} diff --git a/scripts/e2e.js b/scripts/e2e.js index 2412b6b5..f47f3c03 100644 --- a/scripts/e2e.js +++ b/scripts/e2e.js @@ -24,16 +24,10 @@ if (args.command === 'install') { run(`npx playwright install ${args.options.join(' ')}`, { cwd: `${config.paths.local.themes}/planet4-master-theme`, }); - run(`npx playwright install ${args.options.join(' ')}`, { - cwd: `${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`, - }); } if (args.command === 'run') { run(`npx playwright test ${args.options.join(' ')} --pass-with-no-tests`, { cwd: `${config.paths.local.themes}/planet4-master-theme`, }); - run(`npx playwright test ${args.options.join(' ')} --pass-with-no-tests`, { - cwd: `${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`, - }); } diff --git a/scripts/fix-permissions.js b/scripts/fix-permissions.js index 45452fb5..7830e529 100644 --- a/scripts/fix-permissions.js +++ b/scripts/fix-permissions.js @@ -13,7 +13,4 @@ if (all) { run( `sudo find ${config.paths.local.themes}/planet4-master-theme -not -user $(whoami) -exec chown -f $(whoami) {} \\+` ); - run( - `sudo find ${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks -not -user $(whoami) -exec chown -f $(whoami) {} \\+` - ); } diff --git a/scripts/lib/composer-requirements.js b/scripts/lib/composer-requirements.js index 70583f12..87277c9c 100644 --- a/scripts/lib/composer-requirements.js +++ b/scripts/lib/composer-requirements.js @@ -21,15 +21,6 @@ function generateBaseComposerRequirements(config) { ); } - if ( - isDir(`${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`) - ) { - composer( - 'remove --no-update greenpeace/planet4-plugin-gutenberg-blocks', - config.paths.container.app - ); - } - composer( 'remove --no-update greenpeace/planet4-nginx-helper', config.paths.container.app diff --git a/scripts/lib/gpi-frontend.code-workspace b/scripts/lib/gpi-frontend.code-workspace deleted file mode 100644 index 6db0e36b..00000000 --- a/scripts/lib/gpi-frontend.code-workspace +++ /dev/null @@ -1,26 +0,0 @@ -{ - "folders": [ - { - "path": "../.." - }, - { - "path": "../../planet4/themes/planet4-master-theme" - }, - { - "path": "../../planet4/plugins/planet4-plugin-gutenberg-blocks" - }, - { - "path": "../../../planet4-dashdash" - }, - { - "path": "../../../planet4-design-tokens" - }, - { - "path": "../../planet4/plugins/planet4-plugin-medialibrary" - }, - { - "path": "../../planet4/themes/planet4-child-theme-argentina" - } - ], - "settings": {} -} diff --git a/scripts/lib/main-repos.js b/scripts/lib/main-repos.js index d287c4e1..f4afac5f 100644 --- a/scripts/lib/main-repos.js +++ b/scripts/lib/main-repos.js @@ -29,40 +29,20 @@ function getMainReposFromGit(config) { } || true`, {cwd: themePath} ); - - const pluginPath = `${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`; - if(isRepo(pluginPath)) { - run('git status', {cwd: pluginPath}); - } else { - run(`rm -rf ${pluginPath} && git clone --recurse-submodules --shallow-submodule https://github.com/greenpeace/planet4-plugin-gutenberg-blocks.git ${pluginPath}`); - } - - run( - `git checkout ${ - config.planet4.repos['planet4-plugin-gutenberg-blocks'] || 'main' - } || true`, - {cwd: pluginPath} - ); } function getMainReposFromRelease(config, force = false) { if ( !force && - isDir(`${config.paths.local.themes}/planet4-master-theme`) && - isDir(`${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`) + isDir(`${config.paths.local.themes}/planet4-master-theme`) ) { return; } const themeRelease = 'https://github.com/greenpeace/planet4-master-theme/releases/latest/download/planet4-master-theme.zip'; - const pluginRelease = - 'https://github.com/greenpeace/planet4-plugin-gutenberg-blocks/releases/latest/download/planet4-plugin-gutenberg-blocks.zip'; run(`curl -L ${themeRelease} > content/planet4-master-theme.zip`); - run( - `curl -L ${pluginRelease} > content/planet4-plugin-gutenberg-blocks.zip` - ); run( `mkdir -p ${config.paths.local.themes} && mkdir -p ${config.paths.local.plugins}` @@ -70,26 +50,19 @@ function getMainReposFromRelease(config, force = false) { run( `unzip -o content/planet4-master-theme.zip -d ${config.paths.local.themes}/planet4-master-theme` ); - run( - `unzip -o content/planet4-plugin-gutenberg-blocks.zip -d ${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks` - ); } function installRepos(config) { - // composer(`config platform.php "${config.phpVersion}"`, `/app/${config.themesDir}/planet4-master-theme `) composer( 'install', `${config.paths.container.themes}/planet4-master-theme ` ); - // composer(`config platform.php "${config.phpVersion}"`, `/app/${config.pluginsDir}/planet4-plugin-gutenberg-blocks`) - composer('install', `${config.paths.container.plugins}/planet4-plugin-gutenberg-blocks`); } function installNpmDependencies (config) { process.env.PUPPETEER_SKIP_DOWNLOAD = true; process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = true; run('npm install --legacy-peer-deps', {cwd: `${config.paths.local.themes}/planet4-master-theme`}); - run('npm install', {cwd: `${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`}); } function buildAssets(config, force = false) { @@ -97,9 +70,6 @@ function buildAssets(config, force = false) { !force && isDir( `${config.paths.local.themes}/planet4-master-theme/assets/build` - ) && - isDir( - `${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks/assets/build` ) ) { return; @@ -109,9 +79,6 @@ function buildAssets(config, force = false) { run('npm run build', { cwd: `${config.paths.local.themes}/planet4-master-theme`, }); - run('npm run build', { - cwd: `${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`, - }); } function setComposerConfig (config) { diff --git a/scripts/nro-install.js b/scripts/nro-install.js index 6ecefaa8..444e8844 100644 --- a/scripts/nro-install.js +++ b/scripts/nro-install.js @@ -93,7 +93,6 @@ if (theme) { } composer('update', config.paths.container.app); -// installPluginsDependencies(config) if (themeName) { wp(`theme activate ${themeName}`); } diff --git a/scripts/php-tests.js b/scripts/php-tests.js index 3e395829..c8d4cf90 100644 --- a/scripts/php-tests.js +++ b/scripts/php-tests.js @@ -5,21 +5,17 @@ const {parseArgs} = require('./lib/utils'); const config = getConfig(); const rootPath = config.paths.container.app.replace('/wp-content', ''); const themePath = `${rootPath}/${config.paths.container.themes}/planet4-master-theme`; -const pluginPath = `${rootPath}/${config.paths.container.plugins}/planet4-plugin-gutenberg-blocks`; const args = parseArgs(process.argv, {command: 'lint'}); // lint, fix, test if (args.command === 'lint') { runInWpContainer('./vendor/bin/phpcs src/ page-templates/ tests/', {working_dir: themePath}); - runInWpContainer('./vendor/bin/phpcs classes/', {working_dir: pluginPath}); } if (args.command === 'fix') { runInWpContainer('./vendor/bin/phpcbf src/ page-templates/ tests/', {working_dir: themePath}); - runInWpContainer('./vendor/bin/phpcbf classes/', {working_dir: pluginPath}); } if (args.command === 'test') { runInWpContainer('./vendor/bin/phpunit', {working_dir: themePath}); - runInWpContainer('./vendor/bin/phpunit', {working_dir: pluginPath}); } diff --git a/scripts/update.js b/scripts/update.js index 1c28f538..75b38706 100644 --- a/scripts/update.js +++ b/scripts/update.js @@ -29,19 +29,14 @@ if (isRepo(`${config.paths.local.app}/planet4-base`)) { // main repos if ( - isRepo(`${config.paths.local.themes}/planet4-master-theme`) && - isRepo(`${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`) + isRepo(`${config.paths.local.themes}/planet4-master-theme`) ) { run('git pull || true', { cwd: `${config.paths.local.themes}/planet4-master-theme`, }); - run('git pull || true', { - cwd: `${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`, - }); installRepos(config); } else if ( - isDir(`${config.paths.local.themes}/planet4-master-theme`) && - isDir(`${config.paths.local.plugins}/planet4-plugin-gutenberg-blocks`) + isDir(`${config.paths.local.themes}/planet4-master-theme`) ) { getMainReposFromRelease(config, true); installRepos(config);