Skip to content

Commit

Permalink
Merge branch 'develop' into core-themes
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCramer committed May 31, 2018
2 parents a36a281 + 64de118 commit f5ca657
Show file tree
Hide file tree
Showing 47 changed files with 6,317 additions and 3,308 deletions.
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
{
"pragma": "wp.element.createElement"
}
],
[
"@wordpress/babel-plugin-makepot",
{
"output": "languages/amp-js.pot"
}
]
],
"env": {
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ node_modules
wiki
amp.zip
**/*-compiled.js
languages/*.pot
languages/*.php
32 changes: 24 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ module.exports = function( grunt ) {
verify_matching_versions: {
command: 'php bin/verify-version-consistency.php'
},
create_release_zip: {
webpack_production: {
command: 'cross-env BABEL_ENV=production webpack'
},
pot_to_php: {
command: 'npm run pot-to-php'
},
makepot: {
command: 'wp i18n make-pot .'
},
create_build_zip: {
command: 'if [ ! -e build ]; then echo "Run grunt build first."; exit 1; fi; if [ -e amp.zip ]; then rm amp.zip; fi; cd build; zip -r ../amp.zip .; cd ..; echo; echo "ZIP of build: $(pwd)/amp.zip"'
}
},
Expand Down Expand Up @@ -82,6 +91,8 @@ module.exports = function( grunt ) {
spawnQueue = [];
stdout = [];

grunt.task.run( 'shell:webpack_production' );

spawnQueue.push(
{
cmd: 'git',
Expand All @@ -100,12 +111,14 @@ module.exports = function( grunt ) {
versionAppend = commitHash + '-' + new Date().toISOString().replace( /\.\d+/, '' ).replace( /-|:/g, '' );

paths = lsOutput.trim().split( /\n/ ).filter( function( file ) {
return ! /^(blocks|\.|bin|([^/]+)+\.(md|json|xml)|Gruntfile\.js|tests|wp-assets|dev-lib|readme\.md|composer\..*)/.test( file );
return ! /^(blocks|\.|bin|([^/]+)+\.(md|json|xml)|Gruntfile\.js|tests|wp-assets|dev-lib|readme\.md|composer\..*|webpack.*|languages\/README.*)/.test( file );
} );
paths.push( 'vendor/autoload.php' );
paths.push( 'assets/js/*-compiled.js' );
paths.push( 'vendor/composer/**' );
paths.push( 'vendor/sabberworm/php-css-parser/lib/**' );
paths.push( 'languages/amp-translations.php' );
paths.push( 'languages/amp.pot' );

grunt.task.run( 'clean' );
grunt.config.set( 'copy', {
Expand Down Expand Up @@ -137,8 +150,6 @@ module.exports = function( grunt ) {
grunt.task.run( 'readme' );
grunt.task.run( 'copy' );

grunt.task.run( 'shell:create_release_zip' );

done();
}

Expand All @@ -163,16 +174,21 @@ module.exports = function( grunt ) {
doNext();
} );

grunt.registerTask( 'create-release-zip', [
'build',
'shell:create_release_zip'
grunt.registerTask( 'create-build-zip', [
'shell:create_build_zip'
] );

grunt.registerTask( 'build-release', [
'shell:makepot',
'shell:pot_to_php',
'build'
] );

grunt.registerTask( 'deploy', [
'build',
'jshint',
'shell:phpunit',
'shell:verify_matching_versions',
'build-release',
'wp_deploy'
] );
};
5 changes: 3 additions & 2 deletions assets/css/amp-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
object-fit: contain;
}

.entry__content amp-fit-text blockquote,
amp-fit-text blockquote,
amp-fit-text h1,
amp-fit-text h2,
amp-fit-text h3,
amp-fit-text h4,
amp-fit-text h5,
amp-fit-text h6 {
font-size: inherit;
}
}

26 changes: 20 additions & 6 deletions assets/js/amp-block-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ var ampBlockValidation = ( function() { // eslint-disable-line no-unused-vars

currentPost = wp.data.select( 'core/editor' ).getCurrentPost();
ampValidity = currentPost[ module.data.ampValidityRestField ] || {};
validationErrors = ampValidity.errors;
validationErrors = _.map(
_.filter( ampValidity.results, function( result ) {
return ! result.sanitized;
} ),
function( result ) {
return result.error;
}
);

// Short-circuit if there was no change to the validation errors.
if ( ! validationErrors || _.isEqual( module.lastValidationErrors, validationErrors ) ) {
Expand Down Expand Up @@ -172,13 +179,13 @@ var ampBlockValidation = ( function() { // eslint-disable-line no-unused-vars
);
}

noticeMessage += ' ' + wp.i18n.__( 'Invalid code is stripped when displaying AMP.', 'amp' );
noticeMessage += ' ' + wp.i18n.__( 'Non-accepted validation errors prevent AMP from being served.', 'amp' );
noticeElement = wp.element.createElement( 'p', {}, [
noticeMessage + ' ',
ampValidity.link && wp.element.createElement(
ampValidity.review_link && wp.element.createElement(
'a',
{ key: 'details', href: ampValidity.link, target: '_blank' },
wp.i18n.__( 'Details', 'amp' )
{ key: 'review_link', href: ampValidity.review_link, target: '_blank' },
wp.i18n.__( 'Review issues', 'amp' )
)
] );

Expand Down Expand Up @@ -211,7 +218,14 @@ var ampBlockValidation = ( function() { // eslint-disable-line no-unused-vars
var blockValidationErrorsByUid, editorSelect, currentPost, blockOrder, validationErrors, otherValidationErrors;
editorSelect = wp.data.select( 'core/editor' );
currentPost = editorSelect.getCurrentPost();
validationErrors = currentPost[ module.data.ampValidityRestField ].errors;
validationErrors = _.map(
_.filter( currentPost[ module.data.ampValidityRestField ].results, function( result ) {
return ! result.sanitized;
} ),
function( result ) {
return result.error;
}
);
blockOrder = module.getFlattenedBlockOrder( editorSelect.getBlocks() );

otherValidationErrors = [];
Expand Down
Loading

0 comments on commit f5ca657

Please sign in to comment.