Skip to content

Commit

Permalink
Merge pull request #378 from studiopress/develop
Browse files Browse the repository at this point in the history
Merge 3.4.1 to Master branch
  • Loading branch information
dreamwhisper authored Mar 25, 2021
2 parents f45eb5c + d6456f1 commit d1352e1
Show file tree
Hide file tree
Showing 12 changed files with 1,849 additions and 2,885 deletions.
150 changes: 85 additions & 65 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
version: 2.1

commands:
install_dependencies:
description: "Install development dependencies."
steps:
- run: composer install
- run: npm ci
mkdir_artifacts:
description: "Make Artifacts directory"
steps:
- run:
command: |
[ ! -d "/tmp/artifacts" ] && mkdir /tmp/artifacts &>/dev/null
set_env_vars:
description: "Set commonly used environment variables"
steps:
- run:
name: "Set Theme Variables"
command: |
echo "export THEME_SLUG=genesis-sample" >> ${BASH_ENV}
echo "export THEME_VERSION=$(grep 'version":' /tmp/theme/package.json | awk -F: '{print $2}' | sed -e 's/\s//g' -e 's/[\"\,]//g')" >> ${BASH_ENV}
echo "export THEME_TEXT_DOMAIN=genesis-sample" >> ${BASH_ENV}
- run:
name: "Set Artifact Name"
command: |
echo "export VERSION_ARTIFACT_FILE=${THEME_TEXT_DOMAIN}.${THEME_VERSION}.zip" >> ${BASH_ENV}
echo "export VERSION_DATA_FILE=${THEME_TEXT_DOMAIN}.${THEME_VERSION}.json" >> ${BASH_ENV}
- run:
name: "Set Latest Artifact Name"
command: |
echo "export LATEST_ARTIFACT_FILE=${THEME_TEXT_DOMAIN}.latest.zip" >> ${BASH_ENV}
echo "export LATEST_DATA_FILE=${THEME_TEXT_DOMAIN}.latest.json" >> ${BASH_ENV}
orbs:
wp-product-orb: wpengine/wp-product-orb@1.3.0

executors:
base:
Expand All @@ -41,43 +12,68 @@ executors:
docker:
- image: circleci/php:7.3.3-stretch-node-browsers
working_directory: /tmp/theme
python:
docker:
- image: circleci/python:3.7-stretch
working_directory: /tmp

jobs:
checkout:
executor: base
executor: wp-product-orb/python
environment:
WPE_SESSION_DIR: /tmp/.wpe
working_directory: /tmp
steps:
- checkout:
path: theme
- set_env_vars
- wp-product-orb/get-version-from-theme-json:
filename: theme/package.json
return_var: THEME_VERSION
- wp-product-orb/variable:
value: $THEME_VERSION
var: THEME_VERSION
- wp-product-orb/get-slug-from-theme-json:
filename: theme/package.json
return_var: THEME_SLUG
- wp-product-orb/variable:
value: $THEME_SLUG
var: THEME_SLUG
- wp-product-orb/variable:
value: $THEME_SLUG
var: THEME_TEXT_DOMAIN
- wp-product-orb/variable:
value: ${THEME_SLUG}.${THEME_VERSION}.zip
var: VERSION_ARTIFACT_FILE
- wp-product-orb/variable:
value: ${THEME_SLUG}.${THEME_VERSION}.json
var: VERSION_DATA_FILE
- persist_to_workspace:
root: /tmp
paths:
- theme
- .wpe

standards:
executor: php_node
steps:
- attach_workspace:
at: /tmp
- install_dependencies
- run: composer install
- run: npm ci
- run: composer phpcs
- run: npm run lint:css
- run: npm run lint:js

bundle:
executor: php_node
environment:
WPE_SESSION_DIR: /tmp/.wpe
steps:
- attach_workspace:
at: /tmp
- set_env_vars
- wp-product-orb/variable-load
- run: npm ci
- run: npm run zip
- mkdir_artifacts
- run: mv ./${VERSION_ARTIFACT_FILE} /tmp/artifacts/.
- run:
command: |
[ ! -d "/tmp/artifacts" ] && mkdir /tmp/artifacts &>/dev/null
- run: mv ${VERSION_ARTIFACT_FILE} /tmp/artifacts/
- persist_to_workspace:
root: /tmp
paths:
Expand All @@ -88,26 +84,32 @@ jobs:

create_data_file:
executor: php_node
environment:
WPE_SESSION_DIR: /tmp/.wpe
steps:
- attach_workspace:
at: /tmp
- set_env_vars
- run: npm run prep:piservice /tmp/artifacts
- wp-product-orb/variable-load
- run: npm run prep:piservice /tmp/artifacts --verbose
- persist_to_workspace:
root: /tmp
paths:
- artifacts
- store_artifacts:
path: /tmp/artifacts/

deploy_studiopress:
executor: base
environment:
WPE_SESSION_DIR: /tmp/.wpe
parameters:
sp_install:
type: string
default: myspressstg
steps:
- attach_workspace:
at: /tmp
- set_env_vars
- wp-product-orb/variable-load
- run:
name: Deploy To StudioPress
command: |
Expand All @@ -117,24 +119,28 @@ jobs:
chmod 600 ./sp_deploy_key
scp -i ./sp_deploy_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null /tmp/artifacts/${VERSION_ARTIFACT_FILE} ${DEST_HOST}:/${DEST_PATH}
deploy_s3:
executor: python
deploy_api:
executor: wp-product-orb/authenticate
environment:
WPE_SESSION_DIR: /tmp/.wpe
parameters:
environment:
auth_url:
type: string
upload_url:
type: string
default: themes
steps:
- attach_workspace:
at: /tmp
- set_env_vars
- run:
name: "Copy Version to Latest"
command: |
cp /tmp/artifacts/${VERSION_ARTIFACT_FILE} /tmp/artifacts/${LATEST_ARTIFACT_FILE}
cp /tmp/artifacts/${VERSION_DATA_FILE} /tmp/artifacts/${LATEST_DATA_FILE}
- aws-s3/sync:
from: "/tmp/artifacts/"
to: "s3://update.atomicblocks.com/<< parameters.environment >>/${THEME_TEXT_DOMAIN}/"
- wp-product-orb/variable-load
- wp-product-orb/authenticate:
user: WPE_LDAP_USER
pass: WPE_LDAP_PASS
url: << parameters.auth_url >>
- wp-product-orb/post-zip:
url: << parameters.upload_url >>/${THEME_SLUG}
zip: /tmp/artifacts/${VERSION_ARTIFACT_FILE}
json: /tmp/artifacts/${VERSION_DATA_FILE}
version: $THEME_VERSION

workflows:
version: 2
Expand All @@ -152,6 +158,20 @@ workflows:
branches:
ignore:
- master
- bundle:
requires:
- standards
filters:
branches:
ignore:
- master
- create_data_file:
requires:
- bundle
filters:
branches:
ignore:
- master

branch_deploy:
jobs:
Expand Down Expand Up @@ -190,9 +210,10 @@ workflows:
branches:
only:
- master
- deploy_s3:
context: wpe-product-info-aws
environment: staging/themes
- deploy_api:
context: wpe-ldap-creds
auth_url: https://auth-staging.wpengine.io/v1/tokens
upload_url: https://wp-product-info-staging.wpesvc.net/v1/themes
requires:
- create_data_file
- deploy_studiopress
Expand Down Expand Up @@ -243,8 +264,10 @@ workflows:
only: /^\d+\.\d+\.\d+$/
branches:
ignore: /.*/
- deploy_s3:
context: wpe-product-info-aws
- deploy_api:
context: wpe-ldap-creds
auth_url: https://auth.wpengine.io/v1/tokens
upload_url: https://wp-product-info.wpesvc.net/v1/themes
requires:
- create_data_file
- deploy_studiopress
Expand All @@ -253,6 +276,3 @@ workflows:
only: /^\d+\.\d+\.\d+$/
branches:
ignore: /.*/

orbs:
aws-s3: circleci/aws-s3@1.0.0
6 changes: 4 additions & 2 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "stylelint-config-wordpress",
"extends": "@wordpress/stylelint-config",
"rules": {
"no-descending-specificity": null,
"no-duplicate-selectors": null
"no-duplicate-selectors": null,
"selector-id-pattern": null,
"selector-class-pattern": null
}
}
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Genesis Sample Theme Changelog

## [3.4.1] - 2021-03-25

### Added
* Implement preconnect for Google Fonts.

### Changed
* Use null in place of theme version for Google Fonts URL.
* Optimize images included with the Black & White one-click theme setup option.
* Update developer dependencies. ([GitHub version](https://github.com/studiopress/genesis-sample/) only.)

### Fixed
* Improve Content Layout Shift (CLS) occurring when using a custom logo.
* Improve Content Layout Shift (CLS) caused by the mobile menu.

## [3.4.0] - 2020-10-20
Genesis Sample 3.4.0 requires the Genesis Blocks plugin.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"require-dev": {
"php": "^5.6 || ^7",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"phpcompatibility/phpcompatibility-wp": "^2",
"squizlabs/php_codesniffer": "^3.3.2",
"wp-coding-standards/wpcs": "^1.1"
Expand Down
Binary file modified config/import/images/home-about.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified config/import/images/mountain-bw.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 67 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ function genesis_sample_enqueue_scripts_styles() {

$appearance = genesis_get_config( 'appearance' );

wp_enqueue_style(
wp_enqueue_style( // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- see https://core.trac.wordpress.org/ticket/49742
genesis_get_theme_handle() . '-fonts',
$appearance['fonts-url'],
[],
genesis_get_theme_version()
null
);

wp_enqueue_style( 'dashicons' );
Expand All @@ -91,6 +91,71 @@ function genesis_sample_enqueue_scripts_styles() {

}

add_filter( 'body_class', 'genesis_sample_body_classes' );
/**
* Add additional classes to the body element.
*
* @since 3.4.1
*
* @param array $classes Classes array.
* @return array $classes Updated class array.
*/
function genesis_sample_body_classes( $classes ) {

if ( ! genesis_is_amp() ) {
// Add 'no-js' class to the body class values.
$classes[] = 'no-js';
}
return $classes;
}

add_action( 'genesis_before', 'genesis_sample_js_nojs_script', 1 );
/**
* Echo the script that changes 'no-js' class to 'js'.
*
* @since 3.4.1
*/
function genesis_sample_js_nojs_script() {

if ( genesis_is_amp() ) {
return;
}

?>
<script>
//<![CDATA[
(function(){
var c = document.body.classList;
c.remove( 'no-js' );
c.add( 'js' );
})();
//]]>
</script>
<?php
}

add_filter( 'wp_resource_hints', 'genesis_sample_resource_hints', 10, 2 );
/**
* Add preconnect for Google Fonts.
*
* @since 3.4.1
*
* @param array $urls URLs to print for resource hints.
* @param string $relation_type The relation type the URLs are printed.
* @return array URLs to print for resource hints.
*/
function genesis_sample_resource_hints( $urls, $relation_type ) {

if ( wp_style_is( genesis_get_theme_handle() . '-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
$urls[] = [
'href' => 'https://fonts.gstatic.com',
'crossorigin',
];
}

return $urls;
}

add_action( 'after_setup_theme', 'genesis_sample_theme_support', 9 );
/**
* Add desired theme supports.
Expand Down
8 changes: 4 additions & 4 deletions languages/genesis-sample.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# <!=Copyright (C) 2020 StudioPress
# <!=Copyright (C) 2021 StudioPress
# This file is distributed under the GPL-2.0-or-later.=!>
msgid ""
msgstr ""
"Project-Id-Version: Genesis Sample 3.3.1\n"
"Project-Id-Version: Genesis Sample 3.4.1\n"
"Report-Msgid-Bugs-To: StudioPress <translations@studiopress.com>\n"
"POT-Creation-Date: 2020-08-14 15:48:27+00:00\n"
"POT-Creation-Date: 2021-03-23 15:47:25+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: en\n"
Expand Down
Loading

0 comments on commit d1352e1

Please sign in to comment.