Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
Merge branch 'manipulation' of https://github.com/google/WebFundamentals
Browse files Browse the repository at this point in the history
 into manipulation
  • Loading branch information
jpmedley committed Jun 22, 2017
2 parents dafa15a + 539a55d commit 1a1caa3
Show file tree
Hide file tree
Showing 154 changed files with 3,290 additions and 1,597 deletions.
1,415 changes: 715 additions & 700 deletions gae/scripts/footer-closure.js

Large diffs are not rendered by default.

540 changes: 277 additions & 263 deletions gae/scripts/framebox.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gae/styles/devsite-google-blue.css

Large diffs are not rendered by default.

52 changes: 43 additions & 9 deletions gulp-tasks/test.js
Expand Up @@ -27,12 +27,14 @@ const runSequence = require('run-sequence');
*****************************************************************************/

const MAX_DESCRIPTION_LENGTH = 485;
const MAX_FILE_SIZE_WARN = 500; // Max file size (in kB) before warning
const MAX_FILE_SIZE_ERROR = 2500; // Max file size (in kB) before error
const MD_FILES = ['.md', '.mdown', '.markdown'];
const EXTENSIONS_TO_SKIP = [
'.css',
const EXTENSIONS_TO_SKIP = ['.css', '.vtt', '.xml'];
const MEDIA_FILES = [
'.gif', '.ico', '.jpg', '.png', '.psd', '.svg',
'.mov', '.mp3', '.mp4', '.webm', '.vtt',
'.pdf', '.xml'
'.mov', '.mp3', '.mp4', '.webm',
'.pdf',
];
const VALID_DATE_FORMATS = [
'YYYY-MM-DD',
Expand All @@ -55,6 +57,11 @@ const VALID_VERTICALS = [
'education', 'entertainment', 'media', 'real-estate', 'retail',
'transportation', 'travel'
];
const IS_TRAVIS = process.env.TRAVIS === 'true';
const IS_TRAVIS_PUSH = process.env.TRAVIS_EVENT_TYPE === 'push';
const IS_TRAVIS_ON_MASTER = process.env.TRAVIS_BRANCH === 'master';
const TRAVIS_BRANCH = process.env.TRAVIS_BRANCH;
const TRAVIS_EVENT_TYPE = process.env.TRAVIS_EVENT_TYPE;

let remarkLintOptions = {
external: [
Expand Down Expand Up @@ -186,7 +193,7 @@ function printSummary() {
gutil.log(' - with issues:', chalk.yellow(cFilesWithIssues));
gutil.log('Errors : ', chalk.red(allErrors.length));
gutil.log('Warnings: ', chalk.yellow(allWarnings.length));
if (process.env.TRAVIS === 'true') {
if (IS_TRAVIS) {
let result = {
summary: {
filesTested: filesTested,
Expand Down Expand Up @@ -315,7 +322,7 @@ function getFiles() {
} else {
gutil.log(' ', 'Searching for changed files');
let cmd = 'git --no-pager diff --name-only ';
if (process.env.TRAVIS === 'true') {
if (IS_TRAVIS) {
cmd += 'FETCH_HEAD $(git merge-base FETCH_HEAD master)';
} else {
cmd += '$(git merge-base master HEAD)';
Expand Down Expand Up @@ -884,6 +891,35 @@ function testFile(filename, opts) {
return;
}

// Check media files & verify they're not too big
if (MEDIA_FILES.indexOf(filenameObj.ext) >= 0) {
let fsOK = true;
try {
// Read the file size and check if it exceeds the known limits
const stats = fs.statSync(filename);
const fileSize = Math.round(parseInt(stats.size, 10) / 1024);
if (fileSize > MAX_FILE_SIZE_ERROR) {
fsOK = false;
msg = `Exceeds maximum files size (${MAX_FILE_SIZE_ERROR}K)`;
// For builds of master on Travis, warn only, do not error.
if (IS_TRAVIS && IS_TRAVIS_PUSH && IS_TRAVIS_ON_MASTER) {
logWarning(filename, null, `${msg} - was ${fileSize}K`);
} else {
logError(filename, null, `${msg} - was ${fileSize}K`);
}
} else if (fileSize > MAX_FILE_SIZE_WARN) {
fsOK = false;
msg = `Try to keep files below (${MAX_FILE_SIZE_WARN}K)`;
logWarning(filename, null, `${msg} - was ${fileSize}K`);
}
} catch (ex) {
fsOK = false;
logWarning(filename, null, `Unable to read file stats: ${ex.message}`);
}
resolve(fsOK);
return;
}

// Attempt to read the file contents
let contents = readFile(filename);
if (!contents) {
Expand Down Expand Up @@ -955,9 +991,7 @@ function testFile(filename, opts) {
*****************************************************************************/

gulp.task('test', function() {
const travisEventType = process.env.TRAVIS_EVENT_TYPE;
const travisBranch = process.env.TRAVIS_BRANCH;
if (travisEventType === 'push' && travisBranch === 'master') {
if (IS_TRAVIS && IS_TRAVIS_PUSH && IS_TRAVIS_ON_MASTER) {
GLOBAL.WF.options.testAll = true;
}
let opts = {
Expand Down
11 changes: 6 additions & 5 deletions gulp-tasks/wfTemplateHelper.js
Expand Up @@ -66,15 +66,15 @@ function getFullFeedEntries(articles) {
article.feedAuthor = authorName.trim();
}
}
var rssPubDate = moment(article.datePublished);
var rssPubDate = moment.utc(article.datePublished);
article.rssPubDate = rssPubDate.format('DD MMM YYYY HH:mm:ss [GMT]');
});
return articles;
}

function generateFeeds(files, options) {
gutil.log(' ', 'Generating RSS and ATOM feeds...');
var lastUpdated = files[0].datePublished;
var lastUpdated = files[0].dateUpdated;
var context = {
title: options.title,
description: options.description,
Expand All @@ -90,8 +90,9 @@ function generateFeeds(files, options) {
context.baseUrl += options.section + '/';
context.analyticsQS = context.analyticsQS.replace('root_feed', options.section + '_feed');
}
context.rssPubDate = moment(lastUpdated).format('DD MMM YYYY HH:mm:ss [GMT]');
context.atomPubDate = moment(lastUpdated).format('YYYY-MM-DDTHH:mm:ss[Z]');
const now = moment.utc(lastUpdated);
context.rssPubDate = now.format('DD MMM YYYY HH:mm:ss [GMT]');
context.atomPubDate = now.format('YYYY-MM-DDTHH:mm:ss[Z]');

var template = path.join(GLOBAL.WF.src.templates, 'atom.xml');
var outputFile = path.join(options.outputPath, 'atom.xml');
Expand All @@ -118,7 +119,7 @@ function generatePodcastFeed(files, options) {
if (options.baseUrl) {
context.baseUrl = options.baseUrl;
}
context.rssPubDate = moment(lastUpdated).format('DD MMM YYYY HH:mm:ss [GMT]');
context.rssPubDate = moment.utc(lastUpdated).format('DD MMM YYYY HH:mm:ss [GMT]');
var template = path.join(GLOBAL.WF.src.templates, 'shows', 'podcast.xml');
var outputFile = path.join(options.outputPath, 'feed.xml');
renderTemplate(template, context, outputFile);
Expand Down
Expand Up @@ -134,7 +134,7 @@ screen reader on OS X, called VoiceOver. See [this
video](https://www.youtube.com/watch?v=QW_dUs9D1oQ) of Victor using VoiceOver.

Now, it's your turn to try using a screen reader. Here is a page with *ChromeVox
Lite*, a minimal but functioning screen reader written in Javascript. The screen
Lite*, a minimal but functioning screen reader written in JavaScript. The screen
is purposefully blurred to simulate a low-vision experience and force the user
to complete the task with a screen reader. Of course, you'll need to use the
Chrome browser for this exercise.
Expand Down
Expand Up @@ -2,7 +2,7 @@ project_path: /web/_project.yaml
book_path: /web/fundamentals/_book.yaml
description: "HowTo: Components"

{# wf_updated_on: 2017-06-01 #}
{# wf_updated_on: 2017-06-12 #}
{# wf_published_on: 2017-04-06 #}
# Glossary {: .page-title }
{% include "web/_shared/contributors/robdodson.html" %}
Expand Down
@@ -1,7 +1,7 @@
project_path: /web/_project.yaml
book_path: /web/fundamentals/_book.yaml

{# wf_updated_on: 2017-06-01#}
{# wf_updated_on: 2017-06-12#}
{# wf_published_on: 2017-04-06 #}

# HowTo: Components – howto-checkbox {: .page-title }
Expand Down Expand Up @@ -189,10 +189,6 @@ attributeChangedCallback(name, oldValue, newValue) {
## Demo {: #demo }
{% framebox height="auto" width="100%" class="demo" suppress_site_styles="true" %}
<!doctype html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=false,minimum-scale=1.0">
<meta encoding="utf8">
<!--
Copyright 2017 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -205,7 +201,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!doctype html>
<style>
howto-checkbox {
display: inline-block;
Expand All @@ -215,22 +210,18 @@ limitations under the License.
height: 24px;
vertical-align: middle;
}
howto-checkbox[aria-checked="true"] {
background: url('/web/fundamentals/architecture/howto-components/./images/checked-checkbox.svg') no-repeat;
background-size: contain;
}
howto-checkbox[aria-disabled="true"] {
background: url('/web/fundamentals/architecture/howto-components/./images/unchecked-checkbox-disabled.svg') no-repeat;
background-size: contain;
}
howto-checkbox[aria-checked="true"][aria-disabled="true"] {
background: url('/web/fundamentals/architecture/howto-components/./images/checked-checkbox-disabled.svg') no-repeat;
background-size: contain;
}
#join-label {
vertical-align: middle;
display: inline-block;
Expand Down Expand Up @@ -436,8 +427,7 @@ limitations under the License.

<li class="linecomment ">
<div class="literate-text empty"></div>
<pre><code class="literate-code ">&lt;!doctype html&gt;
&lt;style&gt;
<pre><code class="literate-code ">&lt;style&gt;
<sPan class="indent">&nbsp;&nbsp;</span>howto-checkbox {
<sPan class="indent">&nbsp;&nbsp;</span><sPan class="indent">&nbsp;&nbsp;</span>display: inline-block;
<sPan class="indent">&nbsp;&nbsp;</span><sPan class="indent">&nbsp;&nbsp;</span>background: url('./images/unchecked-checkbox.svg') no-repeat;
Expand Down
@@ -1,7 +1,7 @@
project_path: /web/_project.yaml
book_path: /web/fundamentals/_book.yaml

{# wf_updated_on: 2017-06-01#}
{# wf_updated_on: 2017-06-12#}
{# wf_published_on: 2017-04-06 #}

# HowTo: Components – howto-tooltip {: .page-title }
Expand Down Expand Up @@ -50,10 +50,6 @@ connectedCallback() {
## Demo {: #demo }
{% framebox height="auto" width="100%" class="demo" suppress_site_styles="true" %}
<!doctype html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=false,minimum-scale=1.0">
<meta encoding="utf8">
<!--
Copyright 2017 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -66,8 +62,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!doctype html>
<style>
/* The tooltip is by default unstyled. */
howto-tooltip {
Expand All @@ -77,7 +71,6 @@ limitations under the License.
color: #fff;
border-radius: 3px;
}
</style>
<div class="text">
Expand Down Expand Up @@ -192,9 +185,7 @@ window.customElements.define('howto-tooltip', HowtoTooltip);
<li class="linecomment ">
<div class="literate-text empty"></div>
<pre><code class="literate-code ">&lt;!doctype html&gt;
&lt;style&gt;</code></pre>
<pre><code class="literate-code ">&lt;style&gt;</code></pre>
</li>
<li class="blockcomment ">
Expand Down
Expand Up @@ -2,7 +2,7 @@ project_path: /web/_project.yaml
book_path: /web/fundamentals/_book.yaml
description: "HowTo: Components"

{# wf_updated_on: 2017-06-01 #}
{# wf_updated_on: 2017-06-12 #}
{# wf_published_on: 2017-04-06 #}
# HowTo: Components – Overview {: .page-title }
{% include "web/_shared/contributors/ewagasperowicz.html" %}
Expand Down
Binary file not shown.
Expand Up @@ -150,7 +150,7 @@ your behalf and returns a chargeable gateway token.

var supportedInstruments = [
{
supportedMethods: ['basic-card']
supportedMethods: ['basic-card'],
data: {
supportedNetworks: ['amex', 'discover', 'mastercard', 'visa']
}
Expand Down Expand Up @@ -233,7 +233,7 @@ refer to the specific gateway's documentation for more details.

var supportedInstruments = [
{
supportedMethods: ['basic-card']
supportedMethods: ['basic-card'],
data: {
supportedNetworks: ['amex', 'discover','mastercard','visa'],
supportedTypes: ['credit']
Expand Down Expand Up @@ -380,7 +380,7 @@ in the PaymentRequest.

var supportedInstruments = [
{
supportedMethods: ['basic-card']
supportedMethods: ['basic-card'],
data: {
supportedNetworks: ['amex', 'discover','mastercard','visa'],
supportedTypes: ['credit']
Expand All @@ -396,7 +396,7 @@ in the PaymentRequest.
tokenizationType: 'NETWORK_TOKEN',
parameters: {
//public key to encrypt response from Android Pay
'publicKey': 'BC9u7amr4kFD8qsdxnEfWV7RPDR9v4gLLkx3jfyaGOvxBoEuLZKE0Tt5O/2jMMxJ9axHpAZD2Jhi4E74nqxr944='
publicKey: 'BC9u7amr4kFD8qsdxnEfWV7RPDR9v4gLLkx3jfyaGOvxBoEuLZKE0Tt5O/2jMMxJ9axHpAZD2Jhi4E74nqxr944='
}
}
}
Expand Down

1 comment on commit 1a1caa3

@WebFundBot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops!

There were 1 critical errors that broke the build and prevented it from being automatically deployed.

ERRORS
src/content/en/fundamentals/media/videos/glocken.mov - Exceeds maximum files size (2500K) - was 11797K

Please sign in to comment.