Skip to content

Commit

Permalink
Remove deprecated 2020 Learn child theme and parent (#2835)
Browse files Browse the repository at this point in the history
* Delete 2020 child theme and parent

* Remove old block styles from plugin

* Update build script

* Update lint script

* Remove references to old theme

* Push to build-test

* Remove wordpress-meta/wporg from composer.lock

* Build checkout PR branch

* Run build on push to PR branch

* Update readme

* Revert build.yml branch changes
  • Loading branch information
adamwoodnz authored Aug 12, 2024
1 parent 1bc7869 commit c7f3917
Show file tree
Hide file tree
Showing 119 changed files with 22 additions and 13,833 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,12 @@ jobs:
run: |
rm -rf wp-content/mu-plugins/pub/locale-switcher/node_modules
rm -rf wp-content/plugins/wporg-learn/node_modules
rm -rf wp-content/themes/pub/wporg-learn-2020/node_modules
rm -rf wp-content/themes/pub/wporg-learn-2024/node_modules
mv wp-content/mu-plugins/pub/locale-switcher $RUNNER_TEMP
mv wp-content/mu-plugins/pub/class-validator.php $RUNNER_TEMP
mv wp-content/mu-plugins/pub/locales.php $RUNNER_TEMP
mv wp-content/plugins/sensei-pro $RUNNER_TEMP
mv wp-content/plugins/wporg-learn $RUNNER_TEMP
mv wp-content/themes/pub/wporg-learn-2020 $RUNNER_TEMP
mv wp-content/themes/pub/wporg-learn-2024 $RUNNER_TEMP
git rm -rfq .
rm -rf *
Expand All @@ -71,7 +69,6 @@ jobs:
mv $RUNNER_TEMP/locales.php wp-content/mu-plugins/pub
mv $RUNNER_TEMP/sensei-pro wp-content/plugins
mv $RUNNER_TEMP/wporg-learn wp-content/plugins
mv $RUNNER_TEMP/wporg-learn-2020 wp-content/themes/pub
mv $RUNNER_TEMP/wporg-learn-2024 wp-content/themes/pub
- name: Add all the files
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Fetch wporg parent theme css
run: |
mkdir wp-content/themes/pub/wporg
svn export https://meta.svn.wordpress.org/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/css wp-content/themes/pub/wporg/css
- name: composer install
run: |
composer install
Expand Down
33 changes: 0 additions & 33 deletions bin/index.old.sh

This file was deleted.

11 changes: 0 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@
"url": "https://meta.svn.wordpress.org/sites/",
"reference": "trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/"
}
},
{
"name": "wordpress-meta/wporg",
"type": "wordpress-theme",
"version": "1",
"source": {
"type": "svn",
"url": "https://meta.svn.wordpress.org/sites/",
"reference": "trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/"
}
}
]
},
Expand All @@ -85,7 +75,6 @@
"wpackagist-plugin/wordpress-importer": "*",
"wordpress-meta/locale-detection": "1",
"wordpress-meta/pub": "1",
"wordpress-meta/wporg": "1",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"wp-coding-standards/wpcs": "2.*",
"phpcompatibility/phpcompatibility-wp": "*",
Expand Down
12 changes: 1 addition & 11 deletions composer.lock

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

8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,26 @@
"packages": [
"wp-content/mu-plugins/pub/locale-switcher",
"wp-content/plugins/wporg-learn",
"wp-content/themes/pub/wporg-learn-2020",
"wp-content/themes/pub/wporg-learn-2024"
],
"nohoist": [
"**/grunt-*"
]
},
"scripts": {
"build": "yarn workspace wporg-learn-2024 run build && yarn workspace wporg-learn-plugin run build",
"build:old": "yarn workspace wporg-learn-theme run build && yarn workspace wporg-learn-plugin run build",
"build": "yarn workspace wporg-locale-switcher build && yarn workspace wporg-learn-2024 build && yarn workspace wporg-learn-plugin build",
"create": "composer install && yarn setup:tools && yarn build && yarn run install:env",
"create:old": "composer install && yarn setup:tools && yarn build:old && yarn run install:env:old",
"format:php": "composer run format",
"install:env": "./bin/index.sh",
"install:env:old": "./bin/index.old.sh",
"install:githooks": "mv .git/hooks .git/hooks_orig && ln -s ../.githooks .git/hooks",
"lint": "yarn lint:css && yarn lint:js && yarn lint:php",
"lint:css": "yarn workspaces run lint:css",
"lint:js": "yarn workspaces run lint:js",
"lint:php": "composer run lint",
"setup:tools": "TEXTDOMAIN=wporg-learn composer exec update-configs",
"start:locale-switcher": "yarn workspace wporg-locale-switcher start",
"start:plugin": "yarn workspace wporg-learn-plugin start",
"start:theme": "yarn workspace wporg-learn-2024 start",
"start:theme:old": "yarn workspace wporg-learn-theme start",
"wp-env": "wp-env"
},
"main": "index.js"
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<exclude-pattern>*/build/*</exclude-pattern>

<!-- Exclude all themes except the learn theme -->
<exclude-pattern>/wp-content/themes/pub/(?!wporg-learn-2020|wporg-learn-2024)</exclude-pattern>
<exclude-pattern>/wp-content/themes/pub/(?!wporg-learn-2024)</exclude-pattern>

<!-- Exclude all plugins except the learn plugin -->
<exclude-pattern>/wp-content/plugins/(?!wporg-learn)</exclude-pattern>
Expand Down
35 changes: 17 additions & 18 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@ If you're interested in contributing to the site, but aren't sure where to start
- [SVN](https://subversion.apache.org/packages.html)
- [NVM](https://github.com/nvm-sh/nvm) or [N](https://github.com/tj/n) (optional)

## Setup 2020 version
1. `yarn`
2. `yarn run create:old`
3. Visit site at `localhost:8888`

## Setup 2024 version
1. `yarn`
2. `yarn run create`
3. Visit site at `localhost:8888`
4. To watch for changes `yarn start:theme`
## Setup
1. `nvm use` or ensure you are running the Node version specified in the `.nvmrc` file
2. `yarn`
3. `yarn run create`
4. Visit site at `localhost:8888`
5. To watch for changes `yarn start:theme`

## Stopping Environment
run `yarn run wp-env stop`

yarn run wp-env stop`

## Removing Environment
run `yarn run wp-env destroy`

yarn run wp-env destroy`

## Admin

Expand All @@ -46,15 +44,15 @@ To build all projects, you can run:

To build one project at a time, run:

yarn workspace wporg-locale-switcher build
yarn workspace wporg-learn-2024 build
yarn workspace wporg-learn-theme build
yarn workspace wporg-learn-plugin build

If you want to watch for changes, run `start`. This can only be run in one project at a time:
If you want to watch for changes, run:

yarn workspace wporg-learn-2024 start
yarn workspace wporg-learn-theme start
yarn workspace wporg-learn-plugin start
yarn start:locale-switcher
yarn start:theme
yarn start:plugin

### Linting

Expand All @@ -72,9 +70,10 @@ To lint one language run one of:

To check an individual project before pushing to the repo, run one of:

yarn workspace wporg-locale-switcher lint:css
yarn workspace wporg-locale-switcher lint:js
yarn workspace wporg-learn-2024 lint:css
yarn workspace wporg-learn-2024 lint:js
yarn workspace wporg-learn-theme lint:css
yarn workspace wporg-learn-plugin lint:css
yarn workspace wporg-learn-plugin lint:js
composer run lint
Expand Down
33 changes: 0 additions & 33 deletions wp-content/plugins/wporg-learn/inc/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
* Actions and filters.
*/
add_action( 'init', __NAMESPACE__ . '\register_types' );
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_style_assets' );
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_block_style_assets' );

/**
* Register block types.
Expand Down Expand Up @@ -417,37 +415,6 @@ function workshop_application_form_render_callback() {
return render_workshop_application_form();
}

/**
* Enqueue scripts and stylesheets for custom block styles.
*
* @throws Error If the build files are not found.
*/
function enqueue_block_style_assets() {
if ( is_admin() ) {
$script_asset_path = get_build_path() . 'block-styles.asset.php';
if ( ! file_exists( $script_asset_path ) ) {
throw new Error(
'You need to run `npm start` or `npm run build` for block styles first.'
);
}

$script_asset = require $script_asset_path;
wp_enqueue_script(
'wporg-learn-block-styles',
get_build_url() . 'block-styles.js',
$script_asset['dependencies'],
$script_asset['version']
);
}

wp_enqueue_style(
'wporg-learn-block-styles',
get_build_url() . 'style-block-styles.css',
array(),
filemtime( get_build_path() . 'style-block-styles.css' )
);
}

/**
* Register the learning duration block.
*/
Expand Down
4 changes: 0 additions & 4 deletions wp-content/plugins/wporg-learn/inc/locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ function wporg_archive_query_prioritize_locale( $clauses, $query ) {
$current_theme = wp_get_theme();
$theme_slug = $current_theme->get_stylesheet();

if ( 'pub/wporg-learn-2020' === $theme_slug ) {
return $clauses;
}

if ( $query->is_post_type_archive( 'course' ) || $query->is_post_type_archive( 'lesson' ) || $query->is_post_type_archive( 'lesson-plan' ) ) {
return wporg_query_prioritize_locale( $clauses, $locale );
}
Expand Down
29 changes: 0 additions & 29 deletions wp-content/plugins/wporg-learn/js/block-styles/index.js

This file was deleted.

49 changes: 0 additions & 49 deletions wp-content/plugins/wporg-learn/js/block-styles/style.scss

This file was deleted.

1 change: 0 additions & 1 deletion wp-content/plugins/wporg-learn/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const config = require( '@wordpress/scripts/config/webpack.config' );
* Set up the custom entry points.
*/
config.entry = {
'block-styles': './js/block-styles/index.js',
'course-status': './js/course-status/src/index.js',
'duration-meta': './js/duration-meta/index.js',
'expiration-date': './js/expiration-date/index.js',
Expand Down
2 changes: 1 addition & 1 deletion wp-content/plugins/wporg-learn/wporg-learn.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Plugin name: WordPress.org Learn
* Description: Functionality for learn.wordpress.org. See also the wporg-learn-2020 theme.
* Description: Functionality for learn.wordpress.org. See also the wporg-learn-2024 theme.
* Version: 1.0.0
* Author: WordPress.org
* Author URI: http://wordpress.org/
Expand Down
Loading

0 comments on commit c7f3917

Please sign in to comment.