Skip to content

Commit

Permalink
Tools: Update packages and site setup script (#622)
Browse files Browse the repository at this point in the history
* Update packages, node, composer deps

* Update script commands

* Update the site setup, add more demo data

* Add missing eslint-plugin

* Add back path to PHP unit test config

* Add missing jest-preset-default package

* Fix up the phpunit config
  • Loading branch information
ryelle authored Feb 20, 2024
1 parent 541d753 commit 5e95506
Show file tree
Hide file tree
Showing 15 changed files with 256,267 additions and 2,718 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ module.exports = {
* connection, and will default back to vanilla prettier configuration.
*/
'prettier/prettier': [ 'error', prettierConfig ],

// Remove deprecated rule.
'jsdoc/newline-after-description': 'off',
},
overrides: [
{
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
# Ignore built files inside our plugins & themes.
/public_html/wp-content/themes/pattern-directory/css/*.css
/public_html/wp-content/themes/pattern-directory/css/*.map
public_html/wp-content/tests/phpunit/.phpunit.result.cache
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
20
4 changes: 4 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"WP_ENVIRONMENT_TYPE": "local"
},
"core": "WordPress/WordPress#master",
"phpVersion": "7.4",
"plugins": [],
"mappings": {
".htaccess": "./.wp-env/.htaccess",
Expand All @@ -16,6 +17,9 @@
},
"env": {
"tests": {
"config": {
"WP_ENVIRONMENT_TYPE": false
},
"mappings": {
".htaccess": "./.wp-env/.htaccess",
"wp-content": "./public_html/wp-content",
Expand Down
222,516 changes: 222,516 additions & 0 deletions .wp-env/data/exports/pattern-dir.000.xml

Large diffs are not rendered by default.

28,615 changes: 28,615 additions & 0 deletions .wp-env/data/exports/pattern-dir.001.xml

Large diffs are not rendered by default.

55 changes: 23 additions & 32 deletions bin/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,37 @@ yarn workspaces run build
yarn wp-env start --update

# Update wp configs
yarn wp-env run cli "wp config set JETPACK_DEV_DEBUG true"
yarn wp-env run cli "wp config set WPORG_SANDBOXED true"
yarn wp-env run cli wp config set JETPACK_DEV_DEBUG true
yarn wp-env run cli wp config set WPORG_SANDBOXED true

# Create the table for locales
yarn wp-env run cli "wp db import wp-content/uploads/data/wporg_locales.sql"
yarn wp-env run cli wp db import wp-content/uploads/data/wporg_locales.sql

# Activate plugins
yarn wp-env run cli "wp plugin activate wordpress-importer"
yarn wp-env run cli "wp plugin activate gutenberg"
yarn wp-env run cli "wp plugin activate pattern-directory/bootstrap.php"
yarn wp-env run cli "wp plugin activate pattern-creator"
yarn wp-env run cli wp plugin activate wordpress-importer
yarn wp-env run cli wp plugin activate gutenberg
yarn wp-env run cli wp plugin activate pattern-directory/bootstrap.php
yarn wp-env run cli wp plugin activate pattern-creator

# Activate theme
yarn wp-env run cli "wp theme activate pattern-directory"
yarn wp-env run cli wp theme activate wporg-pattern-directory-2022

# Change permalinks
yarn wp-env run cli "wp rewrite structure '/%postname%/'"
yarn wp-env run cli wp rewrite structure '/%postname%/'

# Create editor user
yarn wp-env run cli "wp user create editor editor@wp.local --role=editor --user_pass=password"
# Set up site title
yarn wp-env run cli wp option update blogname "Pattern Directory"
yarn wp-env run cli wp option update blogdescription "Add a beautifully designed, ready to go layout to any WordPress site with a simple copy/paste."

# Create the default pages
yarn wp-env run cli "wp post create --post_type=page --post_status='publish' --post_name='new-pattern' --post_title='New Pattern'"
yarn wp-env run cli "wp post create --post_type=page --post_status='publish' --post_name='favorites' --post_title='My Favorites'"
yarn wp-env run cli "wp post create --post_type=page --post_status='publish' --post_name='my-patterns' --post_title='My Patterns'"

# Create some block categories for the submission window
yarn wp-env run cli "wp term create wporg-pattern-category Header --description='A header pattern'"
yarn wp-env run cli "wp term create wporg-pattern-category Footer --description='A footer pattern'"
yarn wp-env run cli "wp term create wporg-pattern-category Button --description='A button pattern'"
yarn wp-env run cli "wp term create wporg-pattern-category Columns --description='A column pattern'"
yarn wp-env run cli "wp term create wporg-pattern-category Gallery --description='A gallery pattern'"
yarn wp-env run cli "wp term create wporg-pattern-category Image --description='An image pattern'"

# Create flag reasons for block pattern moderation
yarn wp-env run cli "wp term create wporg-pattern-flag-reason 'Rude, Crude, or Inappropriate' --slug=1-inappropriate --description='This pattern contains content deemed inappropriate for a general audience.'"
yarn wp-env run cli "wp term create wporg-pattern-flag-reason 'Copyrighted or Trademark Issue' --slug=2-copyright --description='This pattern contains copyrighted material or uses a trademark without permission.'"
yarn wp-env run cli "wp term create wporg-pattern-flag-reason 'Broken or Unusable' --slug=3-broken --description='This pattern is broken or does not display correctly.'"
yarn wp-env run cli "wp term create wporg-pattern-flag-reason 'Spam' --slug=4-spam --description='This pattern was determined to be spam.'"
yarn wp-env run cli "wp term create wporg-pattern-flag-reason 'Not English' --slug=5-not-english --description='This pattern is not in English. Patterns should be submitted in English, and will be translated through translate.wordpress.org.'"
yarn wp-env run cli "wp term create wporg-pattern-flag-reason 'Not a Pattern' --slug=6-not-a-pattern --description='This content is not a valid pattern. It may have too much or too little content. Patterns should keep placeholder text to a minimum, while still showcasing what each block can do.'"
yarn wp-env run cli "wp term create wporg-pattern-flag-reason 'Invalid Name' --slug=7-invalid-name --description='The title for this pattern should be changed to something more descriptive.'"
yarn wp-env run cli "wp term create wporg-pattern-flag-reason 'Other' --slug=9-other --description='Additional review has been requested for this pattern.'"
yarn wp-env run cli wp post create --post_type=page --post_status='publish' --post_name='front-page' --post_title='Pattern Directory'
yarn wp-env run cli wp post create --post_type=page --post_status='publish' --post_name='archives' --post_title='Archives'

yarn wp-env run cli wp option update show_on_front 'page'
yarn wp-env run cli wp option update page_on_front 4
yarn wp-env run cli wp option update page_for_posts 5
yarn wp-env run cli wp option update posts_per_page 18

# Import content
yarn wp-env run cli wp import --authors=create --skip=image_resize wp-content/uploads/data/exports/pattern-dir.000.xml
yarn wp-env run cli wp import --authors=create --skip=image_resize wp-content/uploads/data/exports/pattern-dir.001.xml
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"config": {
"platform": {
"php": "7.2"
"php": "7.4"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
Expand Down Expand Up @@ -73,11 +73,11 @@
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"wp-coding-standards/wpcs": "2.*",
"phpcompatibility/phpcompatibility-wp": "*",
"wp-phpunit/wp-phpunit": "^5.4",
"phpunit/phpunit": "^7.5.20",
"phpunit/phpunit": "^9.5",
"rmccue/requests": "^1.8.1",
"wp-coding-standards/wpcs": "2.*",
"wp-phpunit/wp-phpunit": "~6.0",
"yoast/phpunit-polyfills": "^1.1"
},
"scripts": {
Expand Down
Loading

0 comments on commit 5e95506

Please sign in to comment.