Modernize deps. Gulp4
This commit is contained in:
Родитель
6b58910889
Коммит
23e78af1ca
10
.eslintrc
10
.eslintrc
|
@ -14,7 +14,15 @@
|
|||
"args": "after-used",
|
||||
"argsIgnorePattern": "^var_args$"
|
||||
}],
|
||||
"indent": ["error", 2, { "outerIIFEBody": 0, "SwitchCase": 1 }]
|
||||
"indent": ["error", 2, { "outerIIFEBody": 0, "SwitchCase": 1 }],
|
||||
"require-jsdoc": 0,
|
||||
"no-var": 1,
|
||||
"arrow-parens": 0,
|
||||
"max-len": [2, 100, {
|
||||
"ignoreComments": true,
|
||||
"ignoreUrls": true,
|
||||
"tabWidth": 2
|
||||
}],
|
||||
},
|
||||
"globals": {
|
||||
"Polymer": true,
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
import path from 'path';
|
||||
import gulp from 'gulp';
|
||||
import del from 'del';
|
||||
import runSequence from 'run-sequence';
|
||||
import swPrecache from 'sw-precache';
|
||||
import * as uglifyEs from 'gulp-uglify-es';
|
||||
const uglify = uglifyEs.default;
|
||||
import gulpLoadPlugins from 'gulp-load-plugins';
|
||||
import merge from 'merge-stream';
|
||||
import cssslam from 'css-slam';
|
||||
import * as cssslam from 'css-slam';
|
||||
|
||||
const $ = gulpLoadPlugins();
|
||||
|
||||
|
@ -25,7 +26,9 @@ function minifyHtml() {
|
|||
}
|
||||
|
||||
function uglifyJS() {
|
||||
return $.uglify({preserveComments: 'some'});
|
||||
return uglify({
|
||||
output: {comments: 'some'},
|
||||
});
|
||||
}
|
||||
|
||||
function license() {
|
||||
|
@ -105,7 +108,7 @@ gulp.task('vulcanize-lazy-elements', () => {
|
|||
.pipe(gulp.dest('static/elements'));
|
||||
});
|
||||
|
||||
gulp.task('vulcanize', ['styles', 'vulcanize-lazy-elements'], () => {
|
||||
gulp.task('vulcanize', gulp.series('styles', 'vulcanize-lazy-elements', function vulcanizeStuff() {
|
||||
return gulp.src([
|
||||
'static/elements/metrics-imports.html',
|
||||
'static/elements/features-imports.html',
|
||||
|
@ -124,11 +127,11 @@ gulp.task('vulcanize', ['styles', 'vulcanize-lazy-elements'], () => {
|
|||
.pipe($.if('*.js', uglifyJS())) // Minify JS in HTML output.
|
||||
.pipe($.if('*.js', license())) // Add license to top.
|
||||
.pipe(gulp.dest('static/elements'));
|
||||
});
|
||||
}));
|
||||
|
||||
// Clean generated files
|
||||
gulp.task('clean', () => {
|
||||
del([
|
||||
return del([
|
||||
'static/css/',
|
||||
'static/dist',
|
||||
'static/elements/*.vulcanize.{html,js}',
|
||||
|
@ -138,18 +141,6 @@ gulp.task('clean', () => {
|
|||
|
||||
});
|
||||
|
||||
// Build production files, the default task
|
||||
gulp.task('default', ['clean'], cb =>
|
||||
runSequence(
|
||||
'styles',
|
||||
'lint',
|
||||
'vulcanize',
|
||||
'js',
|
||||
'generate-service-worker',
|
||||
cb
|
||||
)
|
||||
);
|
||||
|
||||
// Generate a service worker file that will provide offline functionality for
|
||||
// local resources.
|
||||
gulp.task('generate-service-worker', () => {
|
||||
|
@ -242,6 +233,15 @@ gulp.task('generate-service-worker', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// Build production files, the default task
|
||||
gulp.task('default', gulp.series(
|
||||
'styles',
|
||||
'lint',
|
||||
'vulcanize',
|
||||
'js',
|
||||
'generate-service-worker'
|
||||
));
|
||||
|
||||
// Load custom tasks from the `tasks` directory
|
||||
// Run: `npm install --save-dev require-dir` from the command-line
|
||||
// try { require('require-dir')('tasks'); } catch (err) { console.error(err); }
|
||||
|
|
29
package.json
29
package.json
|
@ -22,32 +22,33 @@
|
|||
"url": "https://github.com/GoogleChrome/chromium-dashboard/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.10.4",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-preset-es2015": "^6.9.0",
|
||||
"css-slam": "^1.1.0",
|
||||
"del": "^2.2.1",
|
||||
"eslint-config-google": "^0.6.0",
|
||||
"css-slam": "^2.1.2",
|
||||
"del": "^3.0.0",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-google": "^0.9.1",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-appengine": "^0.1.5",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-autoprefixer": "^3.1.0",
|
||||
"gulp-babel": "^6.1.2",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-autoprefixer": "^5.0.0",
|
||||
"gulp-babel": "^7.0.1",
|
||||
"gulp-crisper": "^1.1.0",
|
||||
"gulp-eslint": "^3.0.1",
|
||||
"gulp-eslint": "^4.0.2",
|
||||
"gulp-if": "^2.0.1",
|
||||
"gulp-license": "^1.1.0",
|
||||
"gulp-load-plugins": "^1.2.4",
|
||||
"gulp-minify-html": "^1.0.6",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-sass": "^3.1.0",
|
||||
"gulp-uglify": "^1.5.4",
|
||||
"gulp-rename": "^1.2.3",
|
||||
"gulp-sass": "^4.0.1",
|
||||
"gulp-uglify-es": "^1.0.4",
|
||||
"gulp-util": "^3.0.7",
|
||||
"gulp-vulcanize": "^6.1.0",
|
||||
"gulp-vulcanize": "^7.0.0",
|
||||
"http2-push-manifest": "^1.0.0",
|
||||
"lighthouse-ci": "https://github.com/ebidel/lighthouse-ci",
|
||||
"load-grunt-tasks": "^3.4.1",
|
||||
"run-sequence": "^1.2.2",
|
||||
"sw-precache": "^5.2.1",
|
||||
"sw-toolbox": "^3.6.0"
|
||||
}
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
var fields = document.querySelectorAll('input, textarea');
|
||||
for (var i = 0; i < fields.length; ++i) {
|
||||
const fields = document.querySelectorAll('input, textarea');
|
||||
for (let i = 0; i < fields.length; ++i) {
|
||||
fields[i].addEventListener('blur', function(e) {
|
||||
e.target.classList.add('interacted');
|
||||
});
|
||||
}
|
||||
|
||||
// TODO(ericbidelman): These values are brittle if changed in the db later on.
|
||||
var MIN_MILESTONE_TO_BE_ACTIVE = 3;
|
||||
var MIN_STD_TO_BE_ACTIVE = 5;
|
||||
var NO_LONGER_PURSUING = 1000;
|
||||
const MIN_MILESTONE_TO_BE_ACTIVE = 3;
|
||||
const MIN_STD_TO_BE_ACTIVE = 5;
|
||||
const NO_LONGER_PURSUING = 1000;
|
||||
|
||||
var form = document.querySelector('[name="feature_form"]');
|
||||
const form = document.querySelector('[name="feature_form"]');
|
||||
form.addEventListener('change', function(e) {
|
||||
switch (e.target.tagName.toLowerCase()) {
|
||||
case 'select':
|
||||
|
@ -33,20 +33,20 @@ form.addEventListener('change', function(e) {
|
|||
}
|
||||
});
|
||||
|
||||
var operaDesktop = document.querySelector('#id_shipped_opera_milestone');
|
||||
var operaAndroid = document.querySelector(
|
||||
'#id_shipped_opera_android_milestone');
|
||||
const operaDesktop = document.querySelector('#id_shipped_opera_milestone');
|
||||
const operaAndroid = document.querySelector(
|
||||
'#id_shipped_opera_android_milestone');
|
||||
|
||||
/**
|
||||
* Populates Opera version inputs with Chrome 32 -> Opera 19 version mapping.
|
||||
* @param {HTMLInputElement} chromeField Chrome version input.
|
||||
*/
|
||||
function fillOperaFields(chromeField) {
|
||||
var chromeVersion = chromeField.valueAsNumber;
|
||||
const chromeVersion = chromeField.valueAsNumber;
|
||||
if (chromeVersion < 28) {
|
||||
return;
|
||||
}
|
||||
var operaVersion = chromeVersion - 13; // e.g. Chrome 32 ~ Opera 19
|
||||
const operaVersion = chromeVersion - 13; // e.g. Chrome 32 ~ Opera 19
|
||||
if (!operaDesktop.classList.contains('interacted')) {
|
||||
operaDesktop.value = operaVersion;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ function fillOperaFields(chromeField) {
|
|||
}
|
||||
}
|
||||
|
||||
var specLink = document.querySelector('#id_spec_link');
|
||||
const specLink = document.querySelector('#id_spec_link');
|
||||
|
||||
/**
|
||||
* Toggles the spec link input.
|
||||
|
@ -71,11 +71,11 @@ function toggleSpecLink(stdStage) {
|
|||
* @param {HTMLInputElement} status Input element.
|
||||
*/
|
||||
function toggleMilestones(status) {
|
||||
var val = parseInt(status.value, 10);
|
||||
var disabled = (val <= MIN_MILESTONE_TO_BE_ACTIVE ||
|
||||
val === NO_LONGER_PURSUING);
|
||||
const val = parseInt(status.value, 10);
|
||||
const disabled = (val <= MIN_MILESTONE_TO_BE_ACTIVE ||
|
||||
val === NO_LONGER_PURSUING);
|
||||
|
||||
var shippedInputs = document.querySelectorAll('[name^="shipped_"]');
|
||||
const shippedInputs = document.querySelectorAll('[name^="shipped_"]');
|
||||
[].forEach.call(shippedInputs, function(input) {
|
||||
input.disabled = disabled;
|
||||
input.parentElement.parentElement.hidden = input.disabled;
|
||||
|
@ -90,19 +90,19 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
document.body.classList.remove('loading');
|
||||
|
||||
// Get around Django rendering input type="text" fields for URLs.
|
||||
var inputs = document.querySelectorAll('[name$="_url"], [name$="_link"]');
|
||||
const inputs = document.querySelectorAll('[name$="_url"], [name$="_link"]');
|
||||
[].forEach.call(inputs, function(input) {
|
||||
input.type = 'url';
|
||||
input.placeholder = 'http://';
|
||||
});
|
||||
|
||||
var shippedInputs = document.querySelectorAll('[name^="shipped_"]');
|
||||
const shippedInputs = document.querySelectorAll('[name^="shipped_"]');
|
||||
[].forEach.call(shippedInputs, function(input) {
|
||||
input.type = 'number';
|
||||
input.placeholder = 'Milestone #';
|
||||
});
|
||||
|
||||
var owner = document.querySelector('[name="owner"]');
|
||||
const owner = document.querySelector('[name="owner"]');
|
||||
owner.type = 'email';
|
||||
owner.multiple = true;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
'use strict';
|
||||
|
||||
class Metric {
|
||||
|
||||
static get supportsPerfNow() {
|
||||
return performance && performance.now;
|
||||
}
|
||||
|
|
|
@ -36,12 +36,12 @@ class PushNotifier {
|
|||
}
|
||||
|
||||
firebase.initializeApp({
|
||||
apiKey: "AIzaSyDMfRkOLG6OUTeEL_Z2ixEMDceyklm10UM",
|
||||
authDomain: "cr-status.firebaseapp.com",
|
||||
databaseURL: "https://cr-status.firebaseio.com",
|
||||
projectId: "cr-status",
|
||||
storageBucket: "cr-status.appspot.com",
|
||||
messagingSenderId: "999517574127"
|
||||
apiKey: 'AIzaSyDMfRkOLG6OUTeEL_Z2ixEMDceyklm10UM',
|
||||
authDomain: 'cr-status.firebaseapp.com',
|
||||
databaseURL: 'https://cr-status.firebaseio.com',
|
||||
projectId: 'cr-status',
|
||||
storageBucket: 'cr-status.appspot.com',
|
||||
messagingSenderId: '999517574127',
|
||||
});
|
||||
|
||||
this.messaging = firebase.messaging();
|
||||
|
@ -63,7 +63,7 @@ class PushNotifier {
|
|||
|
||||
this.messaging.onMessage(payload => {
|
||||
const notification = new Notification(
|
||||
payload.notification.title, payload.notification);
|
||||
payload.notification.title, payload.notification);
|
||||
|
||||
notification.onerror = function(e) {
|
||||
console.log(e);
|
||||
|
@ -108,7 +108,7 @@ class PushNotifier {
|
|||
const resp = await fetch('/features/push/info', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({subscriptionId: token})
|
||||
body: JSON.stringify({subscriptionId: token}),
|
||||
});
|
||||
// if (resp.status !== 200) {
|
||||
// const text = await resp.text();
|
||||
|
@ -161,7 +161,7 @@ class PushNotifier {
|
|||
await fetch('/features/push/new', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({subscriptionId: token})
|
||||
body: JSON.stringify({subscriptionId: token}),
|
||||
});
|
||||
|
||||
this._setTokenSentToServer(true);
|
||||
|
@ -190,7 +190,7 @@ class PushNotifier {
|
|||
await fetch(`/features/push/subscribe/${featureId}`, {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify(body)
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error [un]subscribing to topic.', err);
|
||||
|
|
|
@ -75,10 +75,10 @@ function registerServiceWorker() {
|
|||
// Send precached bytes to GA.
|
||||
let metric = new Metric('sw_precache');
|
||||
metric.sendToAnalytics(
|
||||
'service worker', 'precache size', bytes);
|
||||
'service worker', 'precache size', bytes);
|
||||
|
||||
Toast.showMessage(
|
||||
`This site is cached (${kb}KB). Ready to use offline!`);
|
||||
`This site is cached (${kb}KB). Ready to use offline!`);
|
||||
}));
|
||||
}
|
||||
break;
|
||||
|
@ -112,7 +112,7 @@ if (navigator.serviceWorker && navigator.serviceWorker.controller) {
|
|||
if (Toast) {
|
||||
toastReady.then(function() {
|
||||
Toast.showMessage('A new version of this app is available.',
|
||||
'Refresh', tapHandler, -1);
|
||||
'Refresh', tapHandler, -1);
|
||||
});
|
||||
} else {
|
||||
tapHandler(); // Force reload if toast never loads.
|
||||
|
|
|
@ -42,7 +42,7 @@ if (a2hsButton) {
|
|||
addToHomescreenEvent = null;
|
||||
} else {
|
||||
a2hsButton.setAttribute(
|
||||
'title', 'Refresh the page and click again to install app.');
|
||||
'title', 'Refresh the page and click again to install app.');
|
||||
}
|
||||
a2hsButton.classList.add('disabled'); // Can't re-prompt, so disable button
|
||||
});
|
||||
|
@ -53,12 +53,12 @@ if (a2hsButton) {
|
|||
})(window);
|
||||
|
||||
// Google Analytics
|
||||
/*eslint-disable */
|
||||
/* eslint-disable */
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
/*eslint-enable */
|
||||
/* eslint-enable */
|
||||
|
||||
ga('create', 'UA-39048143-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
/*! (c) 2018 Copyright (c) 2016 The Google Inc. All rights reserved. (Apache2) */
|
||||
"use strict";!function(e){var t=void 0,a=document.querySelector("#a2hs-button");e.addEventListener("beforeinstallprompt",function(e){e.preventDefault(),t=e,a.classList.add("available")}),a&&a.addEventListener("click",function(e){e.preventDefault(),t&&!a.classList.contains("disabled")&&t.prompt().then(function(){t.userChoice.then(function(e){console.log(e),"accepted"===e.outcome?(a.classList.add("disabled"),a.setAttribute("title","App already installed."),t=null):a.setAttribute("title","Refresh the page and click again to install app."),a.classList.add("disabled")})})})}(window),function(e,t,a,n,s,i,c){e.GoogleAnalyticsObject=s,e[s]=e[s]||function(){(e[s].q=e[s].q||[]).push(arguments)},e[s].l=1*new Date,i=t.createElement(a),c=t.getElementsByTagName(a)[0],i.async=1,i.src=n,c.parentNode.insertBefore(i,c)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-39048143-1","auto"),ga("send","pageview");
|
||||
"use strict";!function(e){var t=void 0,a=document.querySelector("#a2hs-button");e.addEventListener("beforeinstallprompt",function(e){e.preventDefault(),t=e,a.classList.add("available")}),a&&a.addEventListener("click",function(e){e.preventDefault(),t&&!a.classList.contains("disabled")&&t.prompt().then(function(){t.userChoice.then(function(e){console.log(e),"accepted"===e.outcome?(a.classList.add("disabled"),a.setAttribute("title","App already installed."),t=null):a.setAttribute("title","Refresh the page and click again to install app."),a.classList.add("disabled")})})})}(window),function(e,t,a,n,s,i,c){e.GoogleAnalyticsObject=s,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,i=t.createElement(a),c=t.getElementsByTagName(a)[0],i.async=1,i.src="//www.google-analytics.com/analytics.js",c.parentNode.insertBefore(i,c)}(window,document,"script",0,"ga"),ga("create","UA-39048143-1","auto"),ga("send","pageview");
|
2749
yarn.lock
2749
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче