commit
stringlengths
40
40
subject
stringlengths
1
3.25k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
old_contents
stringlengths
0
26.3k
lang
stringclasses
3 values
proba
float64
0
1
diff
stringlengths
0
7.82k
0e2aa4c584e76ba4b1393e103c0e67d964ec9091
Create element with jQuery.
src/sensei-row-actions.js
src/sensei-row-actions.js
(function ($) { var root = this; var RowAction = function (grid) { this.grid = grid; }; RowAction.extend = function (props) { var parent = this; var child; child = function () { return parent.apply(this, arguments); }; var Surrogate = function () { this.constructor = child; }; Surrogate.prototype = parent.prototype; child.prototype = new Surrogate(); if (props) { _.extend(child.prototype, props); } child.__super__ = parent.prototype; return child; }; root.BasicRowActions = RowAction.extend({ name: "BasicRowActions", render: function () { if (!this.el) { this.el = document.createElement("div"); this.el.className = "sensei-grid-row-action sensei-grid-basic-row-actions"; this.grid.$el.append(this.el); } } }); // export root.RowAction = RowAction; })(jQuery);
JavaScript
0
@@ -753,77 +753,13 @@ - this.el = document.createElement(%22div%22);%0A this.el. +%09var clas @@ -822,16 +822,74 @@ tions%22;%0A + this.el = $(%22%3Cdiv%3E%22).addClass(className);%0A
96cc0c1037bb1c85834cb2228f040651c35db6a1
change alias target to be unique
server/models/urlAlias.js
server/models/urlAlias.js
/** * Url alias Model * * @module :: Model */ module.exports = function UrlSlugModel(we) { return { definition: { alias: { type: we.db.Sequelize.STRING(760), allowNull: false, formFieldType: 'text', unique: true }, target: { type: we.db.Sequelize.STRING(760), allowNull: false, formFieldType: 'text' }, locale: { type: we.db.Sequelize.STRING, formFieldType: null } }, options: { // Model tableName will be the same as the model name freezeTableName: true, hooks: { afterCreate: function(record, opts, done) { // cache after create a record we.router.alias.cache[record.target] = record; done(); }, afterUpdate: function(record, opts, done) { // cache after udate the record we.router.alias.cache[record.target] = record; done(); }, afterDestroy: function(record, opts, done) { delete we.router.alias.cache[record.target]; done(); } } } } }
JavaScript
0.000001
@@ -382,16 +382,38 @@ : 'text' +,%0A unique: true %0A %7D
b4efa8b919f4c02c7ee46a573c4db17be682d1b9
Fix rounding errors in avg values.
feedback.js
feedback.js
var rest = require('restler'); function dining_stats(chatId, bot, when, where) { var statsURL = 'https://script.google.com/macros/s/AKfycbw22JUY0XVktavbywTQ7z--mTe7CFbL8X-Bgb6fX-JVNcjGBbeA/exec?'; statsURL += 'when=' + when; statsURL += '&where=' + where; function callback(data) { var msg = "Avg rating for " + where + " stall at " + when + " is: " + data; bot.sendMessage(chatId, msg); } rest.get(statsURL).on('complete', callback); } function dining_feedback(eatingPeriod, stall, rating) { var feedbackURL = "https://docs.google.com/forms/d/17IQ-KQCiDWPlJ992yIQIFxocPbBvvqKJTXmzoxOUPJQ/formResponse?entry.1834728229=" + eatingPeriod + "&entry.385772714=" + rating; if (eatingPeriod === "Dinner") { feedbackURL += "&entry.1055773284=" + stall; } else if (eatingPeriod === "Breakfast") { feedbackURL += "&entry.1929069273=" + stall; } rest.get(feedbackURL).on('complete', function(data) {}); } function ask_when_dining_feedback(chatId, bot) { var opts = { reply_markup: JSON.stringify({ keyboard: [ ['Breakfast', 'Dinner'], ], one_time_keyboard: true }) }; bot.sendMessage(chatId, "When did you eat?", opts); } function ask_where_dining_feedback(chatId, bot, when) { var keyboard = []; if (when === "Breakfast") { keyboard = [ ['Asian', 'Western'], ['Muslim', 'Toast'], ['Other'] ]; } else if (when === "Dinner") { keyboard = [ ['Noodle', 'Asian'], ['Western - Main Course'], ['Western - Panini'], ['Indian', 'Malay', 'Late Plate'] ]; } var opts = { reply_markup: JSON.stringify({ keyboard: keyboard, one_time_keyboard: true }) }; bot.sendMessage(chatId, "Where did you eat?", opts); } function ask_how_dining_feedback(chatId, bot) { var opts = { reply_markup: JSON.stringify({ keyboard: [ ['👍', '👍👍', '👍👍👍'], ['👍👍👍👍', '👍👍👍👍👍'] ], one_time_keyboard: true }) }; bot.sendMessage(chatId, "How was it?", opts); } module.exports = { "dining_feedback": dining_feedback, "dining_stats": dining_stats, "ask_where_dining_feedback": ask_where_dining_feedback, "ask_when_dining_feedback": ask_when_dining_feedback, "ask_how_dining_feedback": ask_how_dining_feedback };
JavaScript
0.000002
@@ -289,24 +289,132 @@ ack(data) %7B%0A + var avgRating = parseFloat(data);%0A var roundedAvgRating = Math.round(avgRating * 100) / 100;%0A var @@ -479,20 +479,32 @@ is: %22 + -data +roundedAvgRating ;%0A
cdf0679890dae18bb5cf8a89430092564dbe243a
revert da-feng checkin in account.js
dionysus-client/yo/app/scripts/modules/account.js
dionysus-client/yo/app/scripts/modules/account.js
Dionysus.module('Account', function(Account, Dionysus, Backbone, Marionette) { 'use strict'; var LoginView = Marionette.ItemView.extend({ template: '#account-login-tpl', tagName: 'form', className: 'ui form compact segment', onRender: function() { this.$el.form({ username: { identifier: 'username', rules: [{ type: 'empty', prompt: 'Please enter a username' }] }, password: { identifier: 'password', rules: [{ type: 'empty', prompt: 'Please enter a password' }] } }); }, ui: { submit: '.submit' }, events: { 'click @ui.submit': 'login' }, login: function() { var user = this.$el.form('get values', ['username', 'password']); $.ajax({ url: '/api/v1/login', method: 'POST', contentType: 'application/json; charset=utf-8', data: JSON.stringify(user) }).done(function(response) { var data = response.id; window.location.href = "/app/profile/" + data; }).fail(function() { window.alert('login failure'); }); } }); var RegisterView = Marionette.ItemView.extend({ template: '#account-register-tpl', tagName: 'form', className: 'ui form compact segment', onRender: function() { this.$('.ui.checkbox').checkbox(); this.$el.form({ username: { identifier: 'username', rules: [{ type: 'empty', prompt: 'Please enter a username' }] }, password: { identifier: 'password', rules: [{ type: 'empty', prompt: 'Please enter a password' }] }, password1: { identifier: 'password1', rules: [{ type: 'empty', prompt: 'Please retype your password' }, { type: 'match[password]', prompt: 'Password should match' }] }, email: { identifier: 'email', rules: [{ type: 'email', prompt: 'Please enter an valid email' }] }, terms: { identifier : 'terms', rules: [{ type : 'checked', prompt : 'You must agree to the terms and conditions' }] }, consultant: { identifier : 'consultant', rules: [{ //type : 'checked', //prompt : 'Select if you are a consultant' }] } }); }, ui: { submit: '.submit', consultant: '.consultant' }, events: { 'click @ui.submit': 'register', 'click @ui.consultant': 'consultant' }, register: function() { var user = this.$el.form('get values', ['username', 'password', 'email']); $.ajax({ url: '/api/v1/register', method: 'POST', contentType: 'application/json; charset=utf-8', data: JSON.stringify(user) }).done(function() { window.alert('register success'); window.location.href = "/app/login"; }).fail(function() { window.alert('register failure'); }); }, consultant: function() { var user = this.$el.form('get values', ['username', 'password', 'email']); $.ajax({ url: '/api/v1/consultant', method: 'POST', contentType: 'application/json; charset=utf-8', data: JSON.stringify(user) }).done(function() { window.alert('send the validation to admin'); window.location.href = "/app/site"; }).fail(function() { window.alert('fail to send the validation to admin'); }); } }); var AccountController = Marionette.Controller.extend({ login: function() { Dionysus.mainRegion.show(new LoginView()); }, register: function() { Dionysus.mainRegion.show(new RegisterView()); }, logout: function() { } }); Dionysus.addInitializer(function() { new Marionette.AppRouter({ appRoutes: { 'app/login(/)': 'login', 'app/logout(/)': 'logout', 'app/register(/)': 'register' }, controller: new AccountController() }); }); });
JavaScript
0
@@ -127,34 +127,33 @@ temView.extend(%7B - %0A + template: '# @@ -1021,48 +1021,11 @@ ion( -response) %7B%0A%09 var data = response.id; +) %7B %0A @@ -1062,24 +1062,13 @@ app/ -profile/%22 + data +site%22 ;%0A @@ -1203,17 +1203,16 @@ extend(%7B - %0A tem @@ -1737,17 +1737,16 @@ %7D, - %0A @@ -2736,21 +2736,17 @@ %0A %7D,%0A - %0A + regi @@ -3190,26 +3190,24 @@ );%0A %7D); - %0A %7D,%0A @@ -3694,18 +3694,16 @@ %7D); - %0A %7D%0A @@ -3960,15 +3960,9 @@ ) %7B%0A - %0A + @@ -4230,11 +4230,12 @@ ;%0A %7D);%0A - %7D); +%0A
cc10f3361470136788ff5e4220b576c7f3f28b5c
Fix jshint issue in servicemgmt controllers
src/app/service_mgmt/controllers/categories.js
src/app/service_mgmt/controllers/categories.js
(function (angular, _) { angular.module("mfl.service_mgmt.controllers.categories", [ "mfl.service_mgmt.services" ]) .controller("mfl.service_mgmt.controllers.category_list", [angular.noop]) .controller("mfl.service_mgmt.controllers.category_view", [angular.noop]) .controller("mfl.service_mgmt.controllers.category_edit", [angular.noop]) .controller("mfl.service_mgmt.controllers.category_create", [angular.noop]) .controller("mfl.service_mgmt.controllers.category_delete", [angular.noop]); })(angular, _);
JavaScript
0
@@ -11,19 +11,16 @@ (angular -, _ ) %7B%0A%0A @@ -538,10 +538,7 @@ ular -, _ );%0A
d9f4608697302e27a5c6448548adcc31307c99ee
Add the even to a DL analytics event (#15002)
src/applications/debt-letters/actions/index.js
src/applications/debt-letters/actions/index.js
import recordEvent from '~/platform/monitoring/record-event'; import { apiRequest } from '~/platform/utilities/api'; import environment from '~/platform/utilities/environment'; import { isVAProfileServiceConfigured } from '@@vap-svc/util/local-vapsvc'; import { debtLettersSuccess, debtLettersSuccessVBMS, } from '../utils/mockResponses'; import { deductionCodes } from '../const/deduction-codes'; export const DEBTS_FETCH_INITIATED = 'DEBTS_FETCH_INITIATED'; export const DEBTS_FETCH_SUCCESS = 'DEBTS_FETCH_SUCCESS'; export const DEBTS_FETCH_FAILURE = 'DEBTS_FETCH_FAILURE'; export const DEBTS_SET_ACTIVE_DEBT = 'DEBTS_SET_ACTIVE_DEBT'; export const DEBT_LETTERS_FETCH_INITIATED = 'DEBT_LETTERS_FETCH_INITIATED'; export const DEBT_LETTERS_FETCH_SUCCESS = 'DEBT_LETTERS_FETCH_SUCCESS'; export const DEBT_LETTERS_FETCH_FAILURE = 'DEBT_LETTERS_FETCH_FAILURE'; const fetchDebtLettersSuccess = debts => ({ type: DEBTS_FETCH_SUCCESS, debts, }); const fetchDebtLettersVBMSSuccess = debtLinks => ({ type: DEBT_LETTERS_FETCH_SUCCESS, debtLinks, }); const fetchDebtLettersFailure = () => ({ type: DEBTS_FETCH_FAILURE }); const fetchDebtLettersVBMSFailure = () => ({ type: DEBT_LETTERS_FETCH_FAILURE, }); const fetchDebtsInitiated = () => ({ type: DEBTS_FETCH_INITIATED }); const fetchDebtLettersInitiated = () => ({ type: DEBT_LETTERS_FETCH_INITIATED, }); export const setActiveDebt = debt => ({ type: DEBTS_SET_ACTIVE_DEBT, debt, }); export const fetchDebtLettersVBMS = () => async dispatch => { dispatch(fetchDebtLettersInitiated()); try { const options = { method: 'GET', credentials: 'include', headers: { 'Content-Type': 'application/json', 'X-Key-Inflection': 'camel', 'Source-App-Name': window.appName, }, }; const response = isVAProfileServiceConfigured() ? await apiRequest(`${environment.API_URL}/v0/debt_letters`, options) : await debtLettersSuccessVBMS(); // Remove DMC - prefixing added by VBMS const filteredResponse = response.map(debtLetter => { if (debtLetter.typeDescription.includes('DMC - ')) { return { ...debtLetter, typeDescription: debtLetter.typeDescription.slice(6), date: new Date(debtLetter.receivedAt), }; } return debtLetter; }); return dispatch(fetchDebtLettersVBMSSuccess(filteredResponse)); } catch (error) { recordEvent({ event: 'bam-get-veteran-vbms-info-failed' }); return dispatch(fetchDebtLettersVBMSFailure()); } }; export const fetchDebtLetters = () => async dispatch => { dispatch(fetchDebtsInitiated()); try { const options = { method: 'GET', credentials: 'include', headers: { 'Content-Type': 'application/json', 'X-Key-Inflection': 'camel', 'Source-App-Name': window.appName, }, }; const response = isVAProfileServiceConfigured() ? await apiRequest(`${environment.API_URL}/v0/debts`, options) : await debtLettersSuccess(); if (Object.keys(response).includes('error')) { recordEvent({ event: 'bam-get-veteran-dmc-info-failed' }); return dispatch(fetchDebtLettersFailure()); } const approvedDeductionCodes = Object.keys(deductionCodes); // remove any debts that do not have approved deductionCodes or // that have a current amount owed of 0 const filteredResponse = response.debts .filter(res => approvedDeductionCodes.includes(res.deductionCode)) .filter(debt => debt.currentAr > 0); recordEvent({ event: 'bam-get-veteran-dmc-info-successful', 'veteran-has-dependent-debt': response.hasDependentDebts, }); if (filteredResponse.length > 0) { recordEvent({ 'number-of-current-debt-cards': filteredResponse.length }); } // suppress VBMS call if they have dependent debt if (!response.hasDependentDebts) { dispatch(fetchDebtLettersVBMS()); } return dispatch(fetchDebtLettersSuccess(filteredResponse)); } catch (error) { recordEvent({ event: 'bam-get-veteran-dmc-info-failed' }); return dispatch(fetchDebtLettersFailure()); } };
JavaScript
0.000001
@@ -3740,16 +3740,62 @@ dEvent(%7B +%0A event: 'bam-cards-retrieved',%0A 'number @@ -3842,16 +3842,23 @@ e.length +,%0A %7D);%0A
6ffc8e3d1c247b2df22c31c81234b881b4a5be53
add jsdoc to mock component
__tests__/test-utils/mocks/index.js
__tests__/test-utils/mocks/index.js
import {Component} from 'react' import uuid from 'uuid' import png from '../../../mastarm.png' export default class MockTestComponentUniqueName extends Component { static defaultProps = { test: 'hi' } /** * Render the component. */ render () { return <div /> } } console.log(uuid.v4()) console.log(png.length)
JavaScript
0.000002
@@ -90,16 +90,106 @@ m.png'%0A%0A +/**%0A * A Mock Component to test to ensure that building of React jsx components works%0A */%0A export d
157bf5a67a0fd668c90d7d36f3912abaf0628ec3
remove console log
server/response/result.js
server/response/result.js
var path = require('path'); var BPromise = require('bluebird'); var config = require('../config'); var logger = require('../logger'); var result = { cache: {}, file: function(res, response) { BPromise.delay(response.latency || 200).then(function() { var filePath = path.join(config.options.data, response.file); var status = response.status || 200; if(response.headers) { res.set(response.headers); } res.status(status).sendFile(filePath, function(err) { if(err) { logger.fileNotFound(filePath); res.sendStatus(404); } else { logger.fileFound(filePath, status); } }); }); }, url: function(res, response) { console.log('url'); console.log(response); res.redirect(response.url); }, send: function(req, res) { var route = res.locals.route; var request = res.locals.request; var routeId = route.id; var requestId = request.id; // cache: { // 'route1_request2': 0 // } var cacheKey = routeId + '_' + requestId; var index = result.cache[cacheKey]; var innerIndex = 0; if(index === undefined || index === null) { // nothing cached so set the index to 0 to return the first response configuration index = result.cache[cacheKey] = 0; }else { for(var i = 0; i < request.responses.length; i++) { if(request.responses[i].repeat && request.responses[i].repeat > 1) { innerIndex += request.responses[i].repeat; }else { innerIndex++; } } // increment the response index in a circular fashion index = (index + 1) % innerIndex; } // cache the latest index result.cache[cacheKey] = index; // return the appropriate response object var response; innerIndex = 0; for(var j = 0; j < request.responses.length; j++) { if(request.responses[j].repeat && request.responses[j].repeat > 1) { innerIndex += request.responses[j].repeat; }else { innerIndex++; } if(index < innerIndex) { response = request.responses[j]; break; } } if(response.file) { this.file(res, response); return; } this.url(res, response); } }; module.exports = result;
JavaScript
0.000003
@@ -726,60 +726,8 @@ ) %7B%0A - console.log('url');%0A console.log(response);%0A%0A @@ -1693,24 +1693,25 @@ y%5D = index;%0A +%0A // retur
bc10987c554fe91fb44fdb835323836a4be699c0
remove empty lien
app/pages/Logs.js
app/pages/Logs.js
import React from 'react'; import { Header, Feed, Divider, Label } from 'semantic-ui-react'; import { capitalize, toLower } from 'lodash/string'; const { ipcRenderer } = require('electron'); const remote = require('@electron/remote'); const config = remote.getGlobal('config'); const STATUS_COLOR_MAP = { success: 'green', info: 'blue', warning: 'yellow', error: 'red', debug: 'darkgrey', }; const STATUS_ICON_MAP = { success: 'check', info: 'info circle', warning: 'warning sign', error: 'x', debug: 'code', }; const determineLabelColor = (status) => STATUS_COLOR_MAP[status] || 'grey'; const determineLabelIcon = (status) => STATUS_ICON_MAP[status] || 'question'; class Logs extends React.Component { constructor() { super(); this.state = { entries: [] }; } componentDidMount() { ipcRenderer.on('logupdated', (event, message) => { this.update(message); }); this.setState({ entries: ipcRenderer.sendSync('logGetEntries') }); } componentWillUnmount() { ipcRenderer.removeAllListeners('logupdated'); } update(entries) { this.setState({ entries }); } render() { const LogEntries = this.state.entries.map((entry) => { if (entry.type !== 'debug' || config.Config.App.debug) { return ( <Feed key={entry.id} className="log" size="small"> <Feed.Event> <Feed.Content> <Feed.Summary> <Label color={determineLabelColor(entry.type)} image horizontal> <Icon name={determineLabelIcon(entry.type)} /> {capitalize(entry.source)} {entry.name && <Label.Detail>{entry.name}</Label.Detail>} </Label> <Feed.Date>{entry.date}</Feed.Date> </Feed.Summary> <Feed.Extra> <div dangerouslySetInnerHTML={{ __html: entry.message }} /> </Feed.Extra> </Feed.Content> </Feed.Event> </Feed> ); } }); return ( <div> <Header as="h1">Logs</Header> {LogEntries} </div> ); } } module.exports = Logs;
JavaScript
0.001491
@@ -1123,11 +1123,8 @@ %7D%0A - %0A re
c2be1145eab8ba18b2128832556c85b084ca53d1
add mapquest aerial
coinmap.js
coinmap.js
function coinmap() { var tileOSM = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: 'Map data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.', maxZoom: 18 }); var tileToner = L.tileLayer('http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png', { attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.', maxZoom: 18 }); var tileMapQuest = L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', { subdomains: ['otile1','otile2','otile3','otile4'], attribution: 'Map tiles by <a href="http://open.mapquestapi.com/">MapQuest</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.', maxZoom: 18 }); var map = L.map('map', { zoom: 3, layers: [tileOSM] }); L.control.layers({ "OpenStreetMap": tileOSM, "MapQuest Open": tileMapQuest, "Toner": tileToner, }).addTo(map); var markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 32}); coinmap_populate(markers); map.addLayer(markers); map.locate({setView: true, maxZoom: 6}); }
JavaScript
0
@@ -120,13 +120,9 @@ n: ' -Map d +D ata @@ -749,11 +749,11 @@ 0.0/ -osm +map /%7Bz%7D @@ -1067,24 +1067,447 @@ : 18%0A %7D);%0A%0A + var tileMapQuestAerial = L.tileLayer('http://%7Bs%7D.mqcdn.com/tiles/1.0.0/sat/%7Bz%7D/%7Bx%7D/%7By%7D.png', %7B%0A subdomains: %5B'otile1','otile2','otile3','otile4'%5D,%0A attribution: 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency. Data by %3Ca href=%22http://openstreetmap.org%22%3EOpenStreetMap%3C/a%3E, under %3Ca href=%22http://creativecommons.org/licenses/by-sa/3.0%22%3ECC BY SA%3C/a%3E.',%0A maxZoom: 18%0A %7D);%0A%0A%0A var map = @@ -1604,16 +1604,16 @@ ileOSM,%0A - %22Map @@ -1639,16 +1639,64 @@ pQuest,%0A + %22MapQuest Open Aerial%22: tileMapQuestAerial,%0A %22Ton
825a38b87d109fc4721c01229a8c96d1a5e0b932
update youtube source
server/sources/youtube.js
server/sources/youtube.js
'use strict'; var util = require('util'); var urlParser = require('url'); var Track = require('../track'); var Q = require('q'); var unirest = require('unirest'); var ytdl = require('ytdl-core'); var Transcoder = require('stream-transcoder'); var format = require('../config').format; var Throttle = require('throttle'); module.exports = { Track: YoutubeTrack, detectOnInput: detectOnInput, resolve: resolve }; /** * Youtube Track */ function YoutubeTrack(track) { if (track.platform) this._initFromInternal.apply(this, arguments); else this._initFromExternal.apply(this, arguments); } util.inherits(YoutubeTrack, Track); /** * Plays the sound of a Youtube video. * It streams the content, removes the video * and encode the sound into mp3. * Emits `progress` events. * * /!\ Resuming a video is (currently?) not possible. * When using the `range` option Youtube just returns a chunk a data * which is not recognized as a valid video. * cf. https://github.com/fent/node-ytdl/issues/32 */ YoutubeTrack.prototype.play = function play() { var totalLength; var currentLength = 0; var ytOpts = { quality: 'highest', // filter: function(format) { return format.container === 'mp4'; } }; if (this.position) ytOpts.range = this.position + '-'; var ytStream = ytdl(this.streamUrl, ytOpts); ytStream .on('info', function (_, format) { totalLength = parseInt(format.size, 10); }) .on('data', function (chunk) { currentLength += chunk.length; this.emit('progress', { current: currentLength, total: totalLength }); }.bind(this)) .on('error', function () { ytStream.push(null); }) .on('end', function () { this.end(); }); return new Transcoder(ytStream) .custom('vn') // no video .audioCodec('libmp3lame') .sampleRate(format.sampleRate) .channels(format.channels) .audioBitrate(format.bitRate) .format('mp3') .stream() .pipe(new Throttle(format.bitRate / 8)); // throttle at 128kbps }; /** * Detects if the input match this source. */ function detectOnInput(input) { var url = urlParser.parse(input, true, true); if (!url.hostname) return false; return (url.hostname.indexOf('youtube.com') > -1); } /** * Fetches the full track object from the Youtube API. * Returns a Promise resolving to a YoutubeTrack. */ function resolve(trackUrl) { var deferred = Q.defer(); var url = urlParser.parse(trackUrl, true, true); unirest.get('http://gdata.youtube.com/feeds/api/videos/' + url.query.v) .query({ v: 2, alt: 'json' }) .end(function (response) { if (response.error) return deferred.reject(response.error); var track = response.body.entry; track.bitrate = 128 * 1000; deferred.resolve(new YoutubeTrack(track)); }); return deferred.promise; } /** * Private helpers */ YoutubeTrack.prototype._initFromExternal = function (track) { this.title = track.title.$t; if (track.author && track.author[0]) { this.artist = track.author[0].name.$t; } this.duration = track.media$group.yt$duration.seconds * 1000; this.url = track.link[0].href; this.streamUrl = track.link[0].href; this.cover = track.media$group.media$thumbnail[1].url; this.createdAt = new Date(); this.platform = 'youtube'; }; YoutubeTrack.prototype._initFromInternal = function () { YoutubeTrack.super_.apply(this, arguments); };
JavaScript
0
@@ -1357,17 +1357,16 @@ function - (_, form @@ -1449,17 +1449,16 @@ function - (chunk) @@ -1525,16 +1525,24 @@ ress', %7B +%0A current @@ -1557,16 +1557,24 @@ tLength, +%0A total: @@ -1584,16 +1584,22 @@ alLength +%0A %7D);%0A @@ -1630,33 +1630,32 @@ error', function - () %7B%0A ytStr @@ -1696,25 +1696,24 @@ d', function - () %7B%0A t @@ -2549,16 +2549,18 @@ uery.v)%0A + .query @@ -2570,14 +2570,72 @@ + v: -2 +3 ,%0A + key: 'AIzaSyBb_ZqAqgZVlrF4yBQEv_3q-MI7AYBIttQ',%0A @@ -2646,21 +2646,25 @@ 'json'%0A + %7D)%0A + .end(f @@ -2670,17 +2670,16 @@ function - (respons @@ -2679,24 +2679,26 @@ response) %7B%0A + if (resp @@ -2753,16 +2753,18 @@ r);%0A + var trac @@ -2792,16 +2792,18 @@ ry;%0A + + track.bi @@ -2822,16 +2822,18 @@ * 1000;%0A + defe @@ -2871,16 +2871,18 @@ rack));%0A + %7D);%0A%0A @@ -2937,17 +2937,16 @@ ers%0A */%0A - YoutubeT @@ -2988,17 +2988,16 @@ function - (track) @@ -3011,20 +3011,16 @@ s.title - = track. @@ -3133,17 +3133,16 @@ uration - = track. @@ -3192,22 +3192,16 @@ his.url - = track. @@ -3266,20 +3266,16 @@ s.cover - = track. @@ -3357,17 +3357,16 @@ latform - = 'youtu @@ -3425,17 +3425,16 @@ function - () %7B%0A Y @@ -3474,13 +3474,12 @@ guments);%0A%7D; -%0A
22b843def642eb4ab674db33a2628c8e16ce9dcf
Remove validation check for reacts (#839)
src/setMessageReaction.js
src/setMessageReaction.js
"use strict"; var utils = require("../utils"); var log = require("npmlog"); module.exports = function(defaultFuncs, api, ctx) { return function setMessageReaction(reaction, messageID, callback) { if (!callback) { callback = function() {}; } switch (reaction) { case "\uD83D\uDE0D": //:heart_eyes: case "\uD83D\uDE06": //:laughing: case "\uD83D\uDE2E": //:open_mouth: case "\uD83D\uDE22": //:cry: case "\uD83D\uDE20": //:angry: case "\uD83D\uDC4D": //:thumbsup: case "\uD83D\uDC4E": //:thumbsdown: case "": //valid break; case ":heart_eyes:": case ":love:": reaction = "\uD83D\uDE0D"; break; case ":laughing:": case ":haha:": reaction = "\uD83D\uDE06"; break; case ":open_mouth:": case ":wow:": reaction = "\uD83D\uDE2E"; break; case ":cry:": case ":sad:": reaction = "\uD83D\uDE22"; break; case ":angry:": reaction = "\uD83D\uDE20"; break; case ":thumbsup:": case ":like:": reaction = "\uD83D\uDC4D"; break; case ":thumbsdown:": case ":dislike:": reaction = "\uD83D\uDC4E"; break; default: return callback({ error: "Reaction is not a valid emoji." }); break; } var variables = { data: { client_mutation_id: ctx.clientMutationId++, actor_id: ctx.userID, action: reaction == "" ? "REMOVE_REACTION" : "ADD_REACTION", message_id: messageID, reaction: reaction } }; var qs = { doc_id: "1491398900900362", variables: JSON.stringify(variables), dpr: 1 }; defaultFuncs .postFormData( "https://www.facebook.com/webgraphql/mutation/", ctx.jar, {}, qs ) .then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs)) .then(function(resData) { if (!resData) { throw { error: "setReaction returned empty object." }; } if (resData.error) { throw resData; } callback(null); }) .catch(function(err) { log.error("setReaction", err); return callback(err); }); }; };
JavaScript
0
@@ -281,332 +281,8 @@ ) %7B%0A - case %22%5CuD83D%5CuDE0D%22: //:heart_eyes:%0A case %22%5CuD83D%5CuDE06%22: //:laughing:%0A case %22%5CuD83D%5CuDE2E%22: //:open_mouth:%0A case %22%5CuD83D%5CuDE22%22: //:cry:%0A case %22%5CuD83D%5CuDE20%22: //:angry:%0A case %22%5CuD83D%5CuDC4D%22: //:thumbsup:%0A case %22%5CuD83D%5CuDC4E%22: //:thumbsdown:%0A case %22%22:%0A //valid%0A break;%0A @@ -946,78 +946,8 @@ lt:%0A - return callback(%7B error: %22Reaction is not a valid emoji.%22 %7D);%0A
0a867200e87ea80753ae6befbd028844ac6a180f
change datepicker props
src/collections/Form/inputs/DatePickerInput.js
src/collections/Form/inputs/DatePickerInput.js
import React, { PropTypes } from 'react' import InputWrapper from './InputWrapper' const DatePickerInput = ({ onChange, openModal, title, id, value}) => ( <div className="ui action input"> <input onChange={onChange} ref="value" type="text" placeholder={title} id={id} value={value} readOnly style={{ cursor: 'not-allowed' }} /> <button onClick={openModal} className="ui huge icon button"><i className="calendar icon"></i></button> </div> ) DatePickerInput.propTypes = { onChange: PropTypes.func, openModal: PropTypes.func, title: PropTypes.string, id: PropTypes.string, value: PropTypes.string } export default InputWrapper(DatePickerInput)
JavaScript
0.000001
@@ -109,38 +109,28 @@ (%7B o -nChange, openModal +penDatePicker , title -, id, val @@ -189,28 +189,8 @@ nput - onChange=%7BonChange%7D ref @@ -233,16 +233,8 @@ tle%7D - id=%7Bid%7D val @@ -315,21 +315,26 @@ ck=%7Bopen -Modal +DatePicker %7D classN @@ -451,44 +451,21 @@ %0A o -nChange: PropTypes.func,%0A openModal +penDatePicker : Pr @@ -509,32 +509,8 @@ ng,%0A - id: PropTypes.string,%0A va
dd0631c20eb7d11cb3c455b3a6f918af4cff8783
Move context to top - and give it a key name.
src/shared/ThisContext.js
src/shared/ThisContext.js
import R from 'ramda'; import api from './api-internal'; import * as util from 'js-util'; import schema, { PropTypes } from 'react-schema'; import AlignmentContainer from 'react-atoms/components/AlignmentContainer'; import log from '../shared/log'; const isBrowser = (typeof window !== 'undefined'); const PROP = Symbol('Prop'); const PROPS = { children: { key: 'componentChildren', // Stored on {current} as this. }, width: { default: 'auto', type: PropTypes.numberOrString, resetOn: null, }, height: { default: 'auto', type: PropTypes.numberOrString, resetOn: null, }, cropMarks: { default: true, type: PropTypes.bool, }, 'cropMarks.size': { default: 25, type: PropTypes.number, }, 'cropMarks.offset': { default: 5, type: PropTypes.number, }, margin: { default: 60, type: PropTypes.number, }, align: { default: 'center top', type: AlignmentContainer.propTypes.align, }, header: { type: PropTypes.string, }, footer: { type: PropTypes.string, }, hr: { default: true, type: PropTypes.bool, }, backdrop: { default: 0, type: PropTypes.numberOrString, }, scroll: { default: false, type: PropTypes.oneOf([true, false, 'x', 'y', 'x:y']), }, context: { type: PropTypes.object, }, }; const getPropParent = (ns, obj) => ( ns.length === 0 ? obj : getPropParent(R.takeLast(ns.length - 1, ns), obj[ns[0]]) ); /** * The [this] context that is passed into the [describe/it] * BDD methods. */ export default class UIHContext { constructor() { // Determine whether this is the currently loaded suite. const isCurrent = () => { const currentSuite = api.current.get('suite'); return (currentSuite && currentSuite.id === this.suite.id); }; // Read|Write helper for data-property methods. this[PROP] = (key, value, options) => { options = options || PROPS[key] || {}; key = options.key || key; // The property options may provide an alternative // key to store as on the {current} map. // WRITE. if (value !== undefined) { // Perform type validation. const type = options.type; if (type) { const validation = schema.validate(type, value); if (!validation.isValid) { const msg = `Invalid '${ key }' value (${ value }). Should be ${ type.toString() }.`; throw new Error(msg); } } // Reset the value if required. if (options.resetOn !== undefined && value === options.resetOn) { value = options.default; } // Store the value. this[PROP].state[key] = value; if (isCurrent()) { api.setCurrent({ [key]: value }); } return this; // When writing the [this] context is returned. // This allows for chaining of write operations. } // READ. let result = this[PROP].state[key]; if (result === undefined) { result = options.default; } return result; }; this[PROP].state = {}; // Create property functions. Object.keys(PROPS).forEach(key => { if (this[key]) { throw new Error(`Property named '${ key }' already exists.`); } // Ensure nested property extensions are added to the hierarchy. // ie. functions as properites of parent functions, for example: // - cropMarks // - cropMarks.size const parts = key.split('.'); const ns = R.take(parts.length - 1, parts); const propName = R.takeLast(1, parts).join('.'); const parent = getPropParent(ns, this); // Store the propery. parent[propName] = (value) => this[PROP](key, value); }); // Property extension methods. this.log.clear = () => api.clearLog(); } /** * Converts to an object of all current values. */ toValues() { const result = {}; Object.keys(PROPS).forEach(key => { const propFunc = util.ns(this, key); if (R.is(Function, propFunc)) { result[key] = propFunc.call(this); } else { result[key] = this[PROP].state[key]; } }); return result; } /** * Resets the UI Harness. */ reset(options) { api.reset(options); } /** * Cumulatively sets property values on the current component. * @param {object} value: An object containing {prop:value} to add */ props(value) { // WRITE. if (R.is(Object, value)) { // Cumulatively add given props to the existing // props on the component. const component = api.component(); let props = component && component.props; if (props) { props = R.clone(props); R.keys(value).forEach(key => props[key] = value[key]); value = props; } } // READ. return this[PROP]('componentProps', value); } /** * Loads the given component. * * @param component: The component Type * or created component element (eg: <MyComponent/>). * * @param props: Optional. The component props * (if not passed in with a component element). * * @param children: Optional. The component children * (if not passed in with a component element). * */ load(component, props, children) { if (!component) { if (isBrowser) { log.warn('Cannot load: a component was not specified (undefined/null)'); } } else { api.loadComponent(component, props, children); } return this; } /** * Unloads the currently loaded component. */ unload() { api.component(null); return this; } /** * Logs a value to the output. * @param {array} value: The value or values to append. */ log(...value) { api.log(value); return this; } }
JavaScript
0
@@ -421,16 +421,91 @@ s.%0A %7D,%0A + context: %7B%0A type: PropTypes.object,%0A key: 'componentContext',%0A %7D,%0A width: @@ -1361,54 +1361,8 @@ %7D,%0A - context: %7B%0A type: PropTypes.object,%0A %7D,%0A %7D;%0A%0A
d0c908f1862640fc77c09ebe5e177dbd136e15d5
stop playing soundcloud tracks on unmount, fixes #113
src/components/Video/SoundCloudPlayer/index.js
src/components/Video/SoundCloudPlayer/index.js
import cx from 'classnames'; import React from 'react'; import SoundCloudAudio from 'soundcloud-audio'; import VideoBackdrop from '../VideoBackdrop'; import SongInfo from './SongInfo'; const debug = require('debug')('uwave:component:video:soundcloud'); const CLIENT_ID = '9d883cdd4c3c54c6dddda2a5b3a11200'; let sc; function getTrack(media, cb) { sc._jsonp(`${sc._baseUrl}/tracks/${media.sourceID}.json?client_id=${CLIENT_ID}`, data => { sc._track = data; cb(data); }); } export default class SoundCloudPlayer extends React.Component { static propTypes = { className: React.PropTypes.string, enabled: React.PropTypes.bool, media: React.PropTypes.object, seek: React.PropTypes.number, volume: React.PropTypes.number }; state = { track: null }; componentWillMount() { if (!sc && typeof document !== 'undefined') { sc = new SoundCloudAudio(CLIENT_ID); sc.audio.autoplay = true; } } componentDidMount() { this.play(); } componentWillReceiveProps(nextProps) { if (nextProps.media.sourceID !== this.props.media.sourceID) { this.play(); } } componentDidUpdate(prevProps) { if (prevProps.volume !== this.props.volume) { sc.audio.volume = this.props.volume / 100; } if (prevProps.enabled !== this.props.enabled) { if (this.props.enabled) { this.play(); } else { this.stop(); } } } play() { this.setState({ track: null }); if (this.props.enabled) { getTrack(this.props.media, track => { this.setState({ track: track }); sc.play(); debug('currentTime', this.props.seek); sc.audio.currentTime = this.props.seek; sc.audio.volume = this.props.volume / 100; }); } else { this.stop(); } } stop() { sc.stop(); } render() { const { track } = this.state; if (!track) { return <div className={cx('SoundCloudPlayer', this.props.className)} />; } const user = track.user; return ( <div className={cx('SoundCloudPlayer', this.props.className)}> <VideoBackdrop url={track.artwork_url} /> <div className="SoundCloudPlayer-meta"> <div className="SoundCloudPlayer-info"> <img className="SoundCloudPlayer-art" src={track.artwork_url} alt="" /> <SongInfo artist={user.username} title={track.title} artistUrl={user.permalink_url} trackUrl={track.permalink_url} /> <div style={{ clear: 'both' }} /> </div> <a href={track.permalink_url} target="_blank" className="SoundCloudPlayer-permalink" > View on <img src="assets/img/soundcloud-inline.png" /> </a> </div> </div> ); } }
JavaScript
0
@@ -992,145 +992,8 @@ %7D%0A%0A - componentWillReceiveProps(nextProps) %7B%0A if (nextProps.media.sourceID !== this.props.media.sourceID) %7B%0A this.play();%0A %7D%0A %7D%0A%0A co @@ -1127,32 +1127,98 @@ ;%0A %7D%0A if ( +prevProps.media.sourceID !== this.props.media.sourceID %7C%7C%0A prevProps.enable @@ -1353,16 +1353,65 @@ %7D%0A %7D%0A%0A + componentWillUnmount() %7B%0A this.stop();%0A %7D%0A%0A play()
eedb9c438fb059fadf90e72bb53eae6bad92d300
write changelog in beforeRelease
ci/pnpm-git.js
ci/pnpm-git.js
/* eslint-disable @typescript-eslint/no-var-requires */ const Git = require('release-it/lib/plugin/git/Git') const { format } = require('release-it/lib/util') const { resolve, basename } = require('path') const yaml = require('js-yaml') const fs = require('fs/promises') const { promisify } = require('util') const glob = promisify(require('glob')) const { EOL } = require('os') const prependFile = require('prepend-file') const fixArgs = args => (args ? (typeof args === 'string' ? args.split(' ') : args) : []) const staged = resolve(__dirname, './staged') const root = resolve(__dirname, '../') const workspace = resolve(root, 'pnpm-workspace.yaml') class GitPNPMMonorepo extends Git { static disablePlugin() { return ['git'] } getInitialOptions(options, namespace) { options[namespace] = options.git return options[namespace] } async init() { await super.init() if (!await this.isPNPMAuthentication()) { throw new Error('Not authenticated with npm. Ensure NPM_TOKEN is set') } const packages = yaml.load(await fs.readFile(workspace, 'utf-8')).packages.map(x => basename(x)) const stagedJSONs = await glob(`${staged}/*.json`) .then(files => Promise.all(files.map(file => fs.readFile(file)))) .then(files => files.map((file) => JSON.parse(file))) const stagedChanges = stagedJSONs .filter(fileData => packages.find(x => fileData.name.includes(x))) this.config.setContext({ stagedChanges, affectedModules: stagedChanges.length, updateLog: stagedChanges.map(fileData => `${fileData.name}: ${fileData.latestVersion} -> ${fileData.version}`).join('\n'), aggregateChangelog: stagedChanges.flatMap(fileData => [ `# ${fileData.name} ${fileData.version}`, fileData.changelog ]).join('\n\n') }) } // overwrites changelog for release notes async beforeRelease() { this.config.setContext({ changelog: this.config.getContext('aggregateChangelog'), }) return super.beforeRelease() } async release() { const { commit, tag, push, pnpm, changelog } = this.options await this.step({ enabled: changelog, task: () => this.writeChangelog(), label: 'Aggregated Changelog' }) await this.step({ enabled: commit, task: () => this.commit(), label: 'Git commit' }) await this.step({ enabled: tag, task: () => this.tag(), label: 'Git tag' }) await this.step({ enabled: pnpm, task: () => this.pnpm(), label: 'Publish PNPM' }) return !!(await this.step({ enabled: push, task: () => this.push(), label: 'Git push' })) } async tag({ annotation = this.options.tagAnnotation, args = this.options.tagArgs } = {}) { const context = this.config.getContext() const { stagedChanges } = context for (const stagedModule of stagedChanges.values()) { const message = format(annotation, { ...context, stagedModule }) const tagName = format('${name}@${version}', stagedModule) try { await this.exec(['git', 'tag', '--annotate', '--message', message, ...fixArgs(args), tagName]) } catch (e) { if (/tag '.+' already exists/.test(e)) { this.log.warn(`Tag "${tagName}" already exists`) } else { throw e } } } const message = format('Release ${version}', context) await this.exec(['git', 'tag', '--annotate', '--message', message, ...fixArgs(args), context.tagName]) this.setContext({ isTagged: true }) } async isPNPMAuthentication() { try { const username = await this.exec('pnpm whoami', { options: { write: false } }) this.setContext({ username: username ? username.trim() : null }) } catch (err) { this.debug(err) if (/code E40[04]/.test(err)) { this.log.warn('Ignoring response from unsupported `pnpm whoami` command.') return true } return false } return !!this.getContext('username') } async pnpm() { await this.exec(['pnpm', '-r', 'publish']) } async writeChangelog() { const { infile } = this.options const { isDryRun } = this.config const { aggregateChangelog } = this.config.getContext() let hasInfile = false try { await fs.access(infile) hasInfile = true } catch (err) { this.debug(err) } if (!isDryRun) { await prependFile(infile, aggregateChangelog + EOL + EOL) } if (!hasInfile) { await this.exec(`git add ${infile}`) } } commit({ message = this.options.commitMessage, args = this.options.commitArgs } = {}) { const msg = format(message, this.config.getContext()) return this.exec(['git', 'commit', '--message', msg, ...fixArgs(args)]).then( () => this.setContext({ isCommitted: true }), err => { this.debug(err) if (/nothing (added )?to commit/.test(err) || /nichts zu committen/.test(err)) { this.log.warn('No changes to commit. The latest commit will be tagged.') } else { throw new Error(err) } } ) } step(options) { const context = Object.assign({}, this.config.getContext(), { [this.namespace]: this.getContext() }) const opts = Object.assign({}, options, { context }) return this.spinner.show(opts) } } module.exports = GitPNPMMonorepo
JavaScript
0
@@ -1884,24 +1884,64 @@ Release() %7B%0A + const %7B changelog %7D = this.options%0A%0A this.con @@ -2026,16 +2026,126 @@ ,%0A %7D) +%0A await this.step(%7B enabled: changelog, task: () =%3E this.writeChangelog(), label: 'Aggregated Changelog' %7D) %0A%0A re @@ -2235,19 +2235,8 @@ pnpm -, changelog %7D = @@ -2253,118 +2253,8 @@ ons%0A - await this.step(%7B enabled: changelog, task: () =%3E this.writeChangelog(), label: 'Aggregated Changelog' %7D)%0A
7022002b38a260032144eba03f25d230ddaebc94
Remove obsolete function call.
src/shrimppaste.jquery.js
src/shrimppaste.jquery.js
/** * Shrimp Paste * ------------ * This is the jQuery variant, supporting older broweser * don't need no jQuery? Try the plain version! */ function shrimppasteclass() { 'use strict'; var self = this; this.steps = {} this.createNav = function(type, parent) { var button = $('<a></a>'); button.attr('href', '#'); button.addClass('ShrimpPaste-button'); button.addClass('ShrimpPaste-button--'+type); button.addClass('js-'+type); button.text(type); return button; } this.setAllNavActive = function(sliderEl) { sliderEl.find('.js-next').removeClass('ShrimpPaste-button--inActive'); sliderEl.find('.js-prev').removeClass('ShrimpPaste-button--inActive'); } this.setNavInactive = function(event) { var button = $(event.target); button.addClass('ShrimpPaste-button--inActive'); } this.handleSlideClick = function(event, direction, parent) { event.preventDefault(); self.setAllNavActive(parent); if(direction === 'prev') { // Check if current step is possible if((self.steps.current + self.steps.width) <= 0){ self.steps.current = self.steps.current + self.steps.width; // Check if *next* step is even possible if((self.steps.current + self.steps.width) > 0){ self.setNavInactive(event); } } else { // Current step not possible, keep button inactive self.setNavInactive(event); } } else { // Check if current step is possible if(self.steps.current - self.steps.width >= -1 * self.steps.max){ self.steps.current = self.steps.current - self.steps.width; // Check if *next* step is even possible if(self.steps.current - self.steps.width <= -1 * self.steps.max){ self.setNavInactive(event); } } else { // Current step not possible, keep button inactive self.setNavInactive(event); } } var slidesWrap = parent.find('.js-shrimppaste-wrap'); slidesWrap.css('transform', 'translateX('+self.steps.current+'px)'); } this.build = function (sliderEl, opts) { var slidesViewport = sliderEl.find('.js-shrimppaste-viewport'); var maxWidth = Math.round(slidesViewport.width()); var slideWidth = Math.round(maxWidth / opts.slides); var slides = sliderEl.find('.js-shrimppaste-item'); var totWidth = Math.round(slideWidth * slides.length); var slidesWrap = sliderEl.find('.js-shrimppaste-wrap'); slidesWrap.css('width', totWidth.toString() + 'px'); sliderEl.addClass('is-active'); self.steps.width = slideWidth; self.steps.max = totWidth - maxWidth; self.steps.current = 0; if(self.steps.max > slideWidth) { var prevButton = self.createNav('prev',sliderEl); var nextButton = self.createNav('next',sliderEl); sliderEl.append(prevButton); sliderEl.append(nextButton); prevButton.addClass('ShrimpPaste-button--inActive'); nextButton.on('click', function(event){ self.handleSlideClick(event, 'next', sliderEl); }); prevButton.on('click', function(event){ self.handleSlideClick(event, 'prev', sliderEl); }); } slides.each(function() { $(this).css('width', slideWidth.toString() +'px'); }); } }; window.shrimppaste = (function (window, document, undefined) { 'use strict'; var shrimppaste = { steps : {} } shrimppaste.init = function (opts) { $('.js-shrimppaste').each(function(){ var shrimppasteinstance = new shrimppasteclass(); shrimppasteinstance.build($(this), opts); }); } return shrimppaste; })(window, document); shrimppaste.init({ 'slides' : 4 });
JavaScript
0.000004
@@ -3429,41 +3429,4 @@ t);%0A -%0Ashrimppaste.init(%7B 'slides' : 4 %7D);%0A
11828c40e546a5a1485857b37c1aab6d7731eba9
Add more weight of emoji font
src/utils/FontManager.js
src/utils/FontManager.js
/* Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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. */ /* * Based on... * ChromaCheck 1.16 * author Roel Nieskens, https://pixelambacht.nl * MIT license */ let colrFontSupported = undefined; async function isColrFontSupported() { if (colrFontSupported !== undefined) { return colrFontSupported; } // Firefox has supported COLR fonts since version 26 // but doesn't support the check below with content blocking enabled. if (navigator.userAgent.includes("Firefox")) { colrFontSupported = true; return colrFontSupported; } try { const canvas = document.createElement('canvas'); const context = canvas.getContext('2d'); const img = new Image(); // eslint-disable-next-line const fontCOLR = 'd09GRgABAAAAAAKAAAwAAAAAAowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABDT0xSAAACVAAAABYAAAAYAAIAJUNQQUwAAAJsAAAAEgAAABLJAAAQT1MvMgAAAYAAAAA6AAAAYBfxJ0pjbWFwAAABxAAAACcAAAAsAAzpM2dseWYAAAH0AAAAGgAAABoNIh0kaGVhZAAAARwAAAAvAAAANgxLumdoaGVhAAABTAAAABUAAAAkCAEEAmhtdHgAAAG8AAAABgAAAAYEAAAAbG9jYQAAAewAAAAGAAAABgANAABtYXhwAAABZAAAABsAAAAgAg4AHW5hbWUAAAIQAAAAOAAAAD4C5wsecG9zdAAAAkgAAAAMAAAAIAADAAB4AWNgZGAAYQ5+qdB4fpuvDNIsDCBwaQGTAIi+VlscBaJZGMDiHAxMIAoAtjIF/QB4AWNgZGBgYQACOAkUQQWMAAGRABAAAAB4AWNgZGBgYGJgAdMMUJILJMQgAWICAAH3AC4AeAFjYGFhYJzAwMrAwDST6QwDA0M/hGZ8zWDMyMmAChgFkDgKQMBw4CXDSwYWEBdIYgAFBgYA/8sIdAAABAAAAAAAAAB4AWNgYGBkYAZiBgYeBhYGBSDNAoRA/kuG//8hpDgjWJ4BAFVMBiYAAAAAAAANAAAAAQAAAAAEAAQAAAMAABEhESEEAPwABAD8AAAAeAEtxgUNgAAAAMHHIQTShTlOAty9/4bf7AARCwlBNhBw4L/43qXjYGUmf19TMuLcj/BJL3XfBg54AWNgZsALAAB9AAR4AWNgYGAEYj4gFgGygGwICQACOwAoAAAAAAABAAEAAQAAAA4AAAAAyP8AAA=='; const svg = ` <svg xmlns="http://www.w3.org/2000/svg" width="20" height="100" style="background:#fff;fill:#000;"> <style type="text/css"> @font-face { font-family: "chromacheck-colr"; src: url(data:application/x-font-woff;base64,${fontCOLR}) format("woff"); } </style> <text x="0" y="0" font-size="20"> <tspan font-family="chromacheck-colr" x="0" dy="20">&#xe900;</tspan> </text> </svg>`; canvas.width = 20; canvas.height = 100; img.src = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg); // FIXME wait for safari load our colr font const wait = ms => new Promise((r, j)=>setTimeout(r, ms)); await wait(500); context.drawImage(img, 0, 0); colrFontSupported = (context.getImageData(10, 10, 1, 1).data[0] === 200); } catch (e) { console.error("Couldn't load colr font", e); colrFontSupported = false; } return colrFontSupported; } export async function fixupColorFonts() { if (colrFontSupported !== undefined) { return; } if (await isColrFontSupported()) { const font = new FontFace("Twemoji", `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.woff2")}')`, {}); document.fonts.add(font); } // if not supported, the browser will fall back to one of the native fonts specified. }
JavaScript
0
@@ -3429,50 +3429,14 @@ nst -font = new FontFace(%22Twemoji%22,%0A +path = %60ur @@ -3516,13 +3516,71 @@ %7D')%60 +;%0A document.fonts.add(new FontFace(%22Twemoji%22, path , %7B%7D) +) ;%0A @@ -3604,20 +3604,138 @@ nts.add( -font +new FontFace(%22Twemoji%22, path, %7B weight: 600 %7D));%0A document.fonts.add(new FontFace(%22Twemoji%22, path, %7B weight: 700 %7D) );%0A %7D
f3fb5b3d39295deff8cb25b9d54d52c5f315d27f
fix learn translation
ui/learn/src/stage/capture.js
ui/learn/src/stage/capture.js
var util = require('../util'); var assert = require('../assert'); var arrow = util.arrow; var imgUrl = util.assetUrl + 'images/learn/bowman.svg'; module.exports = { key: 'capture', title: 'capture', subtitle: 'Take the enemy pieces', image: imgUrl, intro: 'captureIntro', illustration: util.roundSvg(imgUrl), levels: [{ // rook goal: 'takeTheBlackPieces', fen: '8/2p2p2/8/8/8/2R5/8/8 w - -', nbMoves: 2, captures: 2, shapes: [arrow('c3c7'), arrow('c7f7')], success: assert.extinct('black') }, { // queen goal: 'takeTheBlackPiecesAndDontLoseYours', fen: '8/2r2p2/8/8/5Q2/8/8/8 w - -', nbMoves: 2, captures: 2, shapes: [arrow('f4c7'), arrow('f4f7', 'red'), arrow('c7f7', 'yellow')], success: assert.extinct('black') }, { // bishop goal: 'takeTheBlackPiecesAndDontLoseYours', fen: '8/5r2/8/1r3p2/8/3B4/8/8 w - -', nbMoves: 5, captures: 3, success: assert.extinct('black') }, { // queen goal: 'takeTheBlackPiecesAndDontLoseYours', fen: '8/5b2/5p2/3n2p1/8/6Q1/8/8 w - -', nbMoves: 7, captures: 4, success: assert.extinct('black') }, { // knight goal: 'takeTheBlackPiecesAndDontLoseYours', fen: '8/3b4/2p2q2/8/3p1N2/8/8/8 w - -', nbMoves: 6, captures: 4, success: assert.extinct('black') }].map(function(l, i) { l.pointsForCapture = true; return util.toLevel(l, i); }), complete: 'captureComplete' };
JavaScript
0.000001
@@ -215,24 +215,21 @@ e: ' -Take the e +takeTheE nemy - p +P iece
a723b4b45fba3f7e995dfc61de646e0b0596e9de
Revert "corrected spelling"
test/angular-signalr_spec.js
test/angular-signalr_spec.js
describe('socketFactory', function() { 'use strict'; beforeEach(module('roy.signalr-hub')); var hub, mockedHub, /*server hub*/ spy, $timeout, $browser; beforeEach(inject(function(hubFactory, _$timeout_, $q, _$browser_) { mockedHub = window.jQuery.hubConnection(); spy = jasmine.createSpy('mockedFn'); $timeout = _$timeout_; $browser = _$browser_; //setup that #connect returns a promise. spyOn(mockedHub, 'start').and.callFake(function() { var deferred = $q.defer(); deferred.resolve('resolved # connect call'); return deferred.promise; }); hub = hubFactory('testHub', { hub: mockedHub }); mockedHub.proxy = hub.proxy; })); describe('# on', function() { it('should apply asynchronously', function () { hub.on('event', spy); mockedHub.proxy.invoke('event'); expect(spy).not.toHaveBeenCalled(); $timeout.flush(); expect(spy).toHaveBeenCalled(); }); }); describe('# off', function() { it('should not call after removing an event', function () { hub.on('event', spy); hub.off('event'); mockedHub.proxy.invoke('event'); expect($browser.deferredFns.length).toBe(0); }); }); describe('# invoke', function() { beforeEach(function() { spyOn(mockedHub.proxy, 'invoke'); }); it('should not call the delegate hub\'s invoke prior #connect', function() { hub.invoke('event', {foo: 'bar'}); expect(mockedHub.proxy.invoke).not.toHaveBeenCalled(); //assume connection has been established. $timeout.flush(); expect(mockedHub.proxy.invoke).toHaveBeenCalled(); }); it('should allow multiple data arguments', function() { hub.invoke('event', 'x', 'y'); $timeout.flush(); expect(mockedHub.proxy.invoke).toHaveBeenCalledWith('event', 'x', 'y'); }); }); describe('# connect', function() { it('should call the delegate hub\'s #start', function() { hub.connect(); expect(mockedHub.start).toHaveBeenCalled(); }); xit('should call the delegate hub\'s #start with transport option', function() { var transObj = { transport: 'longPolling' }; hub.connect(transObj); console.log(mockedHub.start.calls.first()); expect(mockedHub.start.calls.first().args[0]).toEqual(transObj); }); it('should return a promise', function() { hub.connect().then(function() { console.log('Success'); }); $timeout.flush(); }); }); describe('# disconnect', function () { it('should call the delegate hub\'s #stop', function() { spyOn(mockedHub, 'stop'); hub.disconnect(); expect(mockedHub.stop).toHaveBeenCalled(); }); }); describe('# error', function () { beforeEach(function() { spyOn(mockedHub, 'error'); hub.error(spy); }); it('should call the delegate hub\'s #error', function() { expect(mockedHub.error).toHaveBeenCalled(); }); it('should apply asynchronously', function() { expect(mockedHub.error.calls.first().args[0]).not.toBe(spy); var error = {error : 'test-error'}; mockedHub.error.calls.first().args[0](error); expect(spy).not.toHaveBeenCalled(); $timeout.flush(); expect(spy).toHaveBeenCalledWith(error); }); }); describe('# stateChanged', function() { beforeEach(function() { spyOn(mockedHub, 'stateChanged'); hub.stateChanged(spy); }); it('should not call the delegate hub\'s stateChanged prior #connect ', function() { expect(mockedHub.stateChanged).not.toHaveBeenCalled(); //assume connection has been established. $timeout.flush(); expect(mockedHub.stateChanged).toHaveBeenCalled(); }); it('should apply asynchronously', function() { //assume connection has been established. $timeout.flush(); expect(mockedHub.stateChanged.calls.first().args[0]).not.toBe(spy); var state = {state : 'test-state'}; mockedHub.stateChanged.calls.first().args[0](state); expect(spy).not.toHaveBeenCalled(); $timeout.flush(); expect(spy).toHaveBeenCalledWith(state); }); }); });
JavaScript
0
@@ -3607,17 +3607,16 @@ #connect - ', funct
4f4abdd3fa77166662ae6cad1367f6b5e7225a65
Add script files to the list of human readable files
ui/redux/selectors/content.js
ui/redux/selectors/content.js
// @flow import { createSelector } from 'reselect'; import { makeSelectClaimForUri, selectClaimsByUri, makeSelectClaimsInChannelForCurrentPageState, makeSelectClaimIsNsfw, makeSelectRecommendedContentForUri, makeSelectMediaTypeForUri, selectBlockedChannels, parseURI, } from 'lbry-redux'; import { selectAllCostInfoByUri } from 'lbryinc'; import { selectShowMatureContent } from 'redux/selectors/settings'; const RECENT_HISTORY_AMOUNT = 10; const HISTORY_ITEMS_PER_PAGE = 50; export const selectState = (state: any) => state.content || {}; export const selectPlayingUri = createSelector( selectState, state => state.playingUri ); export const makeSelectIsPlaying = (uri: string) => createSelector( selectPlayingUri, playingUri => playingUri === uri ); export const makeSelectContentPositionForUri = (uri: string) => createSelector( selectState, makeSelectClaimForUri(uri), (state, claim) => { if (!claim) { return null; } const outpoint = `${claim.txid}:${claim.nout}`; const id = claim.claim_id; return state.positions[id] ? state.positions[id][outpoint] : null; } ); export const selectHistory = createSelector( selectState, state => state.history || [] ); export const selectHistoryPageCount = createSelector( selectHistory, history => Math.ceil(history.length / HISTORY_ITEMS_PER_PAGE) ); export const makeSelectHistoryForPage = (page: number) => createSelector( selectHistory, selectClaimsByUri, (history, claimsByUri) => { const left = page * HISTORY_ITEMS_PER_PAGE; const historyItemsForPage = history.slice(left, left + HISTORY_ITEMS_PER_PAGE); return historyItemsForPage; } ); export const makeSelectHistoryForUri = (uri: string) => createSelector( selectHistory, history => history.find(i => i.uri === uri) ); export const makeSelectHasVisitedUri = (uri: string) => createSelector( makeSelectHistoryForUri(uri), history => Boolean(history) ); export const makeSelectNextUnplayedRecommended = (uri: string) => createSelector( makeSelectRecommendedContentForUri(uri), selectHistory, selectClaimsByUri, selectAllCostInfoByUri, selectBlockedChannels, ( recommendedForUri: Array<string>, history: Array<{ uri: string }>, claimsByUri: { [string]: ?Claim }, costInfoByUri: { [string]: { cost: 0 | string } }, blockedChannels: Array<string> ) => { if (recommendedForUri) { // Make sure we don't autoplay paid content, channels, or content from blocked channels for (let i = 0; i < recommendedForUri.length; i++) { const recommendedUri = recommendedForUri[i]; const claim = claimsByUri[recommendedUri]; if (!claim) { continue; } const { isChannel } = parseURI(recommendedUri); if (isChannel) { continue; } const costInfo = costInfoByUri[recommendedUri]; if (!costInfo || costInfo.cost !== 0) { continue; } // We already check if it's a channel above // $FlowFixMe const isVideo = claim.value && claim.value.stream_type === 'video'; // $FlowFixMe const isAudio = claim.value && claim.value.stream_type === 'audio'; if (!isVideo && !isAudio) { continue; } const channel = claim && claim.signing_channel; if (channel && blockedChannels.some(blockedUri => blockedUri === channel.permanent_url)) { continue; } if (!history.some(item => item.uri === recommendedForUri[i])) { return recommendedForUri[i]; } } } } ); export const selectRecentHistory = createSelector( selectHistory, history => { return history.slice(0, RECENT_HISTORY_AMOUNT); } ); export const makeSelectCategoryListUris = (uris: ?Array<string>, channel: string) => createSelector( makeSelectClaimsInChannelForCurrentPageState(channel), channelClaims => { if (uris) return uris; if (channelClaims) { const CATEGORY_LIST_SIZE = 10; return channelClaims.slice(0, CATEGORY_LIST_SIZE).map(({ name, claim_id: claimId }) => `${name}#${claimId}`); } return null; } ); export const makeSelectShouldObscurePreview = (uri: string) => createSelector( selectShowMatureContent, makeSelectClaimIsNsfw(uri), (showMatureContent, isClaimMature) => { return isClaimMature && !showMatureContent; } ); export const makeSelectCanAutoplay = (uri: string) => createSelector( makeSelectMediaTypeForUri(uri), mediaType => { const canAutoPlay = ['audio', 'video', 'image', 'text', 'document'].includes(mediaType); return canAutoPlay; } ); export const makeSelectIsText = (uri: string) => createSelector( makeSelectMediaTypeForUri(uri), mediaType => { const isText = ['text', 'document'].includes(mediaType); return isText; } );
JavaScript
0.000001
@@ -5010,31 +5010,33 @@ ext = %5B' -text', 'documen +document', 'scrip t'%5D.incl
5d29aaeab6eb9afdb869773d17643b10ed44bb11
update slider discrete demos
src/components/slider/demoBasicUsage/script.js
src/components/slider/demoBasicUsage/script.js
angular.module('sliderDemo1', ['ngMaterial']) .controller('AppCtrl', function($scope) { $scope.color = { red: Math.floor(Math.random() * 255), green: Math.floor(Math.random() * 255), blue: Math.floor(Math.random() * 255) }; $scope.rating1 = $scope.rating2 = $scope.rating3 = 3; $scope.disabled1 = 0; $scope.disabled2 = 70; });
JavaScript
0.000001
@@ -255,16 +255,21 @@ ating1 = + 3;%0A $scope. @@ -277,16 +277,21 @@ ating2 = + 2;%0A $scope. @@ -300,18 +300,19 @@ ting3 = -3; +4;%0A %0A $scop
07cc36ed9f906a91814efef4ff04b2e36cb11eaf
fix transformers
src/utils/transformer.js
src/utils/transformer.js
// eslint-disable import/no-mutable-exports import progress from 'nprogress' class Transformers { constructor() { this.map = {} } set(k, v) { this.map[k] = v } get(k) { return this.map[k] } } const transformers = new Transformers() async function loadBabel() { if (!transformers.get('babel')) { progress.start() const [babel, VuePreset] = await Promise.all([ import(/* webpackChunkName: "babel-stuffs" */ 'babel-standalone'), import(/* webpackChunkName: "babel-stuffs" */ 'babel-preset-vue') ]) transformers.set('babel', babel) transformers.set('VuePreset', VuePreset) progress.done() } } async function loadPug() { if (!transformers.get('pug')) { progress.start() const res = await Promise.all([ import('browserified-pug'), import(/* webpackChunkName: "codemirror-mode-pug" */ 'codemirror/mode/pug/pug') ]) transformers.set('pug', res[0]) progress.done() } } async function loadMarkdown() { if (!transformers.get('markdown')) { progress.start() const [marked] = await Promise.all([ import('marked3'), import('codemirror/mode/markdown/markdown') ]) transformers.set('markdown', marked) progress.done() } } export { loadBabel, loadPug, loadMarkdown, transformers }
JavaScript
0.000005
@@ -533,18 +533,97 @@ eset-vue -') +/dist/babel-preset-vue') // use umd bundle since we don't want to parse %60require%60 %0A %5D)%0A @@ -1195,16 +1195,37 @@ arked3') +.then(m =%3E m.default) ,%0A
6a8637307baf50594bf7d8ccd1e54095a353d412
Update touch.js
html5/touch.js
html5/touch.js
document.getElementById("id_bussiness_version").innerHTML = "Bussiness version: 2018.11.26.4"; var canvas = document.getElementById("id_canvas"); canvas.addEventListener("touchstart", on_touch_start); canvas.addEventListener("touchmove", on_touch_move); var canvas_bounding_rect = canvas.getBoundingClientRect(); var last_pos = {x: 0, y : 0}; //------------------------------------------- function on_touch_start(e) { e.preventDefault(); for (var i = 0; i < e.changedTouches.length; i++){ var context = canvas.getContext("2d"); context.beginPath(); context.arc(e.changedTouches[i].pageX - canvas_bounding_rect.left, e.changedTouches[i].pageY - canvas_bounding_rect.top, 10, 0, 2 * Math.PI); context.stroke(); last_pos.x = e.changedTouches[i].pageX; last_pos.y = e.changedTouches[i].pageY; } } //------------------------------------------- function on_touch_move(e) { e.preventDefault(); for (var i = 0; i < e.changedTouches.length; i++){ var context = canvas.getContext("2d"); context.beginPath(); context.moveTo(last_pos.x - canvas_bounding_rect.left, last_pos.y - canvas_bounding_rect.top); context.lineTo(e.changedTouches[i].pageX - canvas_bounding_rect.left, e.changedTouches[i].pageY - canvas_bounding_rect.top); context.arc(e.changedTouches[i].pageX - canvas_bounding_rect.left, e.changedTouches[i].pageY - canvas_bounding_rect.top, 10, 0, 2 * Math.PI); context.stroke(); } } //-------------------------------------------
JavaScript
0.000001
@@ -88,9 +88,9 @@ .26. -4 +5 %22;%0A%0A @@ -1463,16 +1463,100 @@ roke();%0A +%09%09last_pos.x = e.changedTouches%5Bi%5D.pageX;%0A%09%09last_pos.y = e.changedTouches%5Bi%5D.pageY;%0A %09%7D%0A%7D%0A//-
7f14264899d4e350d0335d101e3082195dd65616
Introduce remoteDir().trashed() and remoteFile().trashed()
test/builders/remote/base.js
test/builders/remote/base.js
/* @flow */ import { Cozy } from 'cozy-client-js' import uuid from 'node-uuid' import { FILES_DOCTYPE, ROOT_DIR_ID } from '../../../src/remote/constants' import timestamp from '../../../src/timestamp' import type { RemoteDoc } from '../../../src/remote/document' const ROOT_DIR_PROPERTIES = { _id: ROOT_DIR_ID, path: '/' } export default class RemoteBaseBuilder { cozy: Cozy options: { contentType?: string, dir: {_id: string, path: string}, name: string, lastModifiedDate: Date } constructor (cozy: Cozy) { this.cozy = cozy this.options = { dir: ROOT_DIR_PROPERTIES, name: '', lastModifiedDate: timestamp.current() } } inDir (dir: RemoteDoc): this { this.options.dir = dir return this } inRootDir (): this { this.options.dir = ROOT_DIR_PROPERTIES return this } timestamp (...args: number[]): this { this.options.lastModifiedDate = timestamp.build(...args) return this } named (name: string): this { this.options.name = name return this } build (): Object { return { _id: uuid.v4().replace(/-/g, ''), _rev: '1-' + uuid.v4().replace(/-/g, ''), _type: FILES_DOCTYPE, created_at: this.options.lastModifiedDate, dir_id: this.options.dir._id, name: this.options.name, path: `${this.options.dir.path}/${this.options.name}`, tags: [], updated_at: this.options.lastModifiedDate } } }
JavaScript
0.000006
@@ -109,16 +109,46 @@ T_DIR_ID +, TRASH_DIR_ID, TRASH_DIR_NAME %7D from @@ -355,16 +355,100 @@ '/'%0A%7D%0A%0A +const TRASH_DIR_PROPERTIES = %7B%0A _id: TRASH_DIR_ID,%0A path: %60/$%7BTRASH_DIR_NAME%7D%60%0A%7D%0A%0A export d @@ -962,16 +962,102 @@ is%0A %7D%0A%0A + trashed (): this %7B%0A this.options.dir = TRASH_DIR_PROPERTIES%0A return this%0A %7D%0A%0A timest
6439035b8f0ce9ed30450b42075bc2b3a65d055a
Fix a bug in event listening
src/parser/core/modules/EventEmitter.js
src/parser/core/modules/EventEmitter.js
import { captureException } from 'common/errorLogger'; import Module from '../Module'; import { SELECTED_PLAYER, SELECTED_PLAYER_PET } from '../Analyzer'; import EventFilter from '../EventFilter'; const CATCH_ALL_EVENT = 'event'; /** * This (core) module takes care of: * - tracking attached event listeners * - filtering event listeners (as configured in EventFilter) * - firing event listeners */ class EventEmitter extends Module { static __dangerousInvalidUsage = false; _eventListenersByEventType = {}; addEventListener(eventFilter, listener, module) { const eventType = eventFilter instanceof EventFilter ? eventFilter.eventType : eventFilter; const options = {}; if (eventFilter instanceof EventFilter) { const by = eventFilter.by(); if (by === SELECTED_PLAYER) { options.byPlayer = true; } if (by === SELECTED_PLAYER_PET) { options.byPlayerPet = true; } const to = eventFilter.to(); if (to === SELECTED_PLAYER) { options.toPlayer = true; } if (to === SELECTED_PLAYER_PET) { options.toPlayerPet = true; } } this._eventListenersByEventType[eventType] = this._eventListenersByEventType[eventType] || []; this._eventListenersByEventType[eventType].push({ ...options, eventFilter, listener: this._compileListener(eventFilter, listener, module), }); } _compileListener(eventFilter, listener, module) { if (eventFilter instanceof EventFilter) { listener = this._prependFilters(eventFilter, listener); } // We need to do this last so it's at the top level listener = this._prependActiveCheck(listener, module); return listener; } _prependActiveCheck(listener, module) { return function (event) { if (!module.active) return; listener(event); }; } _prependFilters(eventFilter, listener) { // const by = eventFilter.by(); // if (by) { // listener = this._prependByCheck(listener, by); // } return listener; } // _prependByCheck(listener, by) { // const requiresSelectedPlayer = by & SELECTED_PLAYER; // const requiresSelectedPlayerPet = by & SELECTED_PLAYER_PET; // // // } triggerEvent(event) { if (process.env.NODE_ENV === 'development') { if (!event.type) { console.log(event); throw new Error('Events should have a type. No type received. See the console for the event.'); } } // When benchmarking the event triggering make sure to disable the event batching and turn the listener into a dummy so you get the performance of just this piece of code. At the time of writing the event triggering code only has about 12ms overhead for a full log. if (event.timestamp) { this._timestamp = event.timestamp; } this._event = event; const isByPlayer = this.owner.byPlayer(event); const isToPlayer = this.owner.toPlayer(event); const isByPlayerPet = this.owner.byPlayerPet(event); const isToPlayerPet = this.owner.toPlayerPet(event); // TODO: Refactor this to compose a function with only the necessary if-statements in the addEventListener method so this doesn't become an endless list of if-statements const run = options => { if (!isByPlayer && options.byPlayer) { return; } if (!isByPlayerPet && options.byPlayerPet) { return; } if (!isToPlayer && options.toPlayer) { return; } if (!isToPlayerPet && options.toPlayerPet) { return; } try { options.listener(event); } catch (err) { if (process.env.NODE_ENV === 'development') { throw err; } console.error('Disabling', options.module.constructor.name, 'and child dependencies because an error occured', err); // Disable this module and all active modules that have this as a dependency this.owner.deepDisable(options.module); captureException(err); } }; { // Handle on_event (listeners of all events) const listeners = this._eventListenersByEventType[CATCH_ALL_EVENT]; if (listeners) { listeners.forEach(run); } } { const listeners = this._eventListenersByEventType[event.type]; if (listeners) { listeners.forEach(run); } } this.owner.eventHistory.push(event); // Some modules need to have a primitive value to cause re-renders // TODO: This can probably be removed since we only render upon completion now this.owner.eventCount += 1; } } export default EventEmitter;
JavaScript
0.000005
@@ -2771,16 +2771,22 @@ this. +owner. _timesta @@ -2818,24 +2818,30 @@ %7D%0A this. +owner. _event = eve
2682ad434bd93ac9a5489d713220faa742fae3a7
indent states
public/js/script.js
public/js/script.js
'use strict'; var test = false; angular.module('dft', ['ngSanitize', 'ui.router']) .config(['$stateProvider', '$urlRouterProvider', '$httpProvider' , function($stateProvider, $urlRouterProvider, $httpProvider) { $httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; $stateProvider.state('loggedIn', { url: '/' , controller: 'GlobalController' , controllerAs: 'global' }) .state('home', { templateUrl: '/views/partials/home.html' , url: 'home' }) .state('map', { template: '<roo-map></roo-map>' , url: '/map' }) .state('about', { templateUrl: '/views/layouts/about.html' , url: '/about' }) .state('data', { templateUrl: '/views/layouts/data.html' , url: '/data' }) .state('login', { templateUrl: '/views/partials/login.html' , url: '/login' }) .state('contact', { url: '/contact' , templateUrl: '/views/partials/contact.hml' }) .state('contribute', { templateUrl: '/views/partials/contribute.html' , url: '/contribute' }) .state('contribute.money', { url: '/money' }) .state('contribute.info', { url: '/info' }) .state('contribute.code', { url: '/code' }); $urlRouterProvider.otherwise('/'); }]);
JavaScript
0.000605
@@ -326,16 +326,18 @@ ith'%5D;%0A%0A + $state @@ -365,24 +365,26 @@ dIn', %7B%0A + url: '/'%0A , @@ -380,16 +380,18 @@ rl: '/'%0A + , cont @@ -413,24 +413,26 @@ Controller'%0A + , controll @@ -446,23 +446,27 @@ global'%0A + %7D)%0A + + .state(' @@ -470,24 +470,26 @@ e('home', %7B%0A + template @@ -513,32 +513,34 @@ ials/home.html'%0A + , url: 'home'%0A @@ -539,21 +539,25 @@ 'home'%0A + %7D)%0A + .state @@ -562,32 +562,34 @@ te('map', %7B%0A + + template: '%3Croo- @@ -604,16 +604,18 @@ o-map%3E'%0A + , url: @@ -622,23 +622,27 @@ '/map'%0A + %7D)%0A + + .state(' @@ -647,24 +647,26 @@ ('about', %7B%0A + template @@ -694,24 +694,26 @@ about.html'%0A + , url: '/a @@ -718,21 +718,25 @@ /about'%0A + %7D)%0A + .state @@ -742,32 +742,34 @@ e('data', %7B%0A + + templateUrl: '/v @@ -788,24 +788,26 @@ /data.html'%0A + , url: '/d @@ -811,21 +811,25 @@ '/data'%0A + %7D)%0A + .state @@ -836,24 +836,26 @@ ('login', %7B%0A + template @@ -884,24 +884,26 @@ login.html'%0A + , url: '/l @@ -908,21 +908,25 @@ /login'%0A + %7D)%0A + .state @@ -935,32 +935,34 @@ contact', %7B%0A + + url: '/contact'%0A @@ -961,16 +961,18 @@ ontact'%0A + , temp @@ -1010,21 +1010,25 @@ ct.hml'%0A + %7D)%0A + .state @@ -1040,24 +1040,26 @@ tribute', %7B%0A + template @@ -1099,16 +1099,18 @@ html'%0A + + , url: ' @@ -1122,21 +1122,25 @@ ribute'%0A + %7D)%0A + .state @@ -1162,24 +1162,26 @@ ney', %7B%0A + + url: '/money @@ -1182,21 +1182,25 @@ /money'%0A + %7D)%0A + .state @@ -1221,24 +1221,26 @@ nfo', %7B%0A + url: '/info' @@ -1240,23 +1240,27 @@ '/info'%0A + %7D)%0A + + .state(' @@ -1279,24 +1279,26 @@ ode', %7B%0A + url: '/code' @@ -1298,16 +1298,18 @@ '/code'%0A + %7D);%0A%0A
814b97596fd7f0e86ce7d22435720aa6500c6316
Update async.js
ES5/async.js
ES5/async.js
//aync problem var requests = ['1.json', '2.json', '3.json', '4.json', '5.json']; var results = []; for(var i = 0; i < requests.length; i++) { fetch(requests[i]).then(function(response){ //fetch creates an ajax call and returns a promise results.push(response.data); //collecting data }); } return results; //oops! results is still empty! //lets try again, we rewrite the fetch part... fetch(requests[i]).then(function(response){ results.push(response.data); //the addition if(results.length === requests.length) { return results; //oops!, we are returning the callback, it doesnt return a value anywhere! } }); //lets revise the whole thing var requests = ['1.json', '2.json', '3.json', '4.json', '5.json']; function getData(requests, callback) { //a wrapper function var results = []; for(var i = 0; i < requests.length; i++) { fetch(requests[i]).then(function(response){ //fetch creates an ajax call and returns a promise results.push(response.data); //collecting data if(results.length === requests.length) { //checking if its the last one callback(results); //now that should work } }); } } //how we use it? getData(requests, function(results) { console.log(results); //Array[5] });
JavaScript
0.000001
@@ -1276,12 +1276,92 @@ ray%5B5%5D%0A%7D);%0A%0A +// alternatively we can use promises - we will see that in the promises section%0A
8cded8160b19d3324d9e14be122c4038ed0b9403
Add id to ThumbnailGenerator
src/plugins/ThumbnailGenerator/index.js
src/plugins/ThumbnailGenerator/index.js
const Plugin = require('../../core/Plugin') const Utils = require('../../core/Utils') /** * The Thumbnail Generator plugin * */ module.exports = class ThumbnailGenerator extends Plugin { constructor (uppy, opts) { super(uppy, opts) this.type = 'thumbnail' this.id = 'ThumbnailGenerator' this.title = 'Thumbnail Generator' this.queue = [] this.queueProcessing = false const defaultOptions = { thumbnailWidth: 200 } this.opts = Object.assign({}, defaultOptions, opts) this.addToQueue = this.addToQueue.bind(this) this.onRestored = this.onRestored.bind(this) } /** * Create a thumbnail for the given Uppy file object. * * @param {{data: Blob}} file * @param {number} width * @return {Promise} */ createThumbnail (file, targetWidth) { const originalUrl = URL.createObjectURL(file.data) const onload = new Promise((resolve, reject) => { const image = new Image() image.src = originalUrl image.onload = () => { URL.revokeObjectURL(originalUrl) resolve(image) } image.onerror = () => { // The onerror event is totally useless unfortunately, as far as I know URL.revokeObjectURL(originalUrl) reject(new Error('Could not create thumbnail')) } }) return onload .then(image => { const targetHeight = this.getProportionalHeight(image, targetWidth) const canvas = this.resizeImage(image, targetWidth, targetHeight) return this.canvasToBlob(canvas, 'image/png') }) .then(blob => { return URL.createObjectURL(blob) }) } /** * Make sure the image doesn’t exceed browser/device canvas limits. * For ios with 256 RAM and ie */ protect (image) { // https://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element var ratio = image.width / image.height var maxSquare = 5000000 // ios max canvas square var maxSize = 4096 // ie max canvas dimensions var maxW = Math.floor(Math.sqrt(maxSquare * ratio)) var maxH = Math.floor(maxSquare / Math.sqrt(maxSquare * ratio)) if (maxW > maxSize) { maxW = maxSize maxH = Math.round(maxW / ratio) } if (maxH > maxSize) { maxH = maxSize maxW = Math.round(ratio * maxH) } if (image.width > maxW) { var canvas = document.createElement('canvas') canvas.width = maxW canvas.height = maxH canvas.getContext('2d').drawImage(image, 0, 0, maxW, maxH) image.src = 'about:blank' image.width = 1 image.height = 1 image = canvas } return image } /** * Resize an image to the target `width` and `height`. * * Returns a Canvas with the resized image on it. */ resizeImage (image, targetWidth, targetHeight) { // Resizing in steps refactored to use a solution from // https://blog.uploadcare.com/image-resize-in-browsers-is-broken-e38eed08df01 image = this.protect(image) // Use the Polyfill for Math.log2() since IE doesn't support log2 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2#Polyfill var steps = Math.ceil(Math.log(image.width / targetWidth) * Math.LOG2E) if (steps < 1) { steps = 1 } var sW = targetWidth * Math.pow(2, steps - 1) var sH = targetHeight * Math.pow(2, steps - 1) var x = 2 while (steps--) { var canvas = document.createElement('canvas') canvas.width = sW canvas.height = sH canvas.getContext('2d').drawImage(image, 0, 0, sW, sH) image = canvas sW = Math.round(sW / x) sH = Math.round(sH / x) } return image } /** * Save a <canvas> element's content to a Blob object. * * @param {HTMLCanvasElement} canvas * @return {Promise} */ canvasToBlob (canvas, type, quality) { if (canvas.toBlob) { return new Promise(resolve => { canvas.toBlob(resolve, type, quality) }) } return Promise.resolve().then(() => { return Utils.dataURItoBlob(canvas.toDataURL(type, quality), {}) }) } getProportionalHeight (img, width) { const aspect = img.width / img.height return Math.round(width / aspect) } /** * Set the preview URL for a file. */ setPreviewURL (fileID, preview) { this.uppy.setFileState(fileID, { preview: preview }) } addToQueue (item) { this.queue.push(item) if (this.queueProcessing === false) { this.processQueue() } } processQueue () { this.queueProcessing = true if (this.queue.length > 0) { const current = this.queue.shift() return this.requestThumbnail(current) .catch(err => {}) // eslint-disable-line handle-callback-err .then(() => this.processQueue()) } else { this.queueProcessing = false } } requestThumbnail (file) { if (Utils.isPreviewSupported(file.type) && !file.isRemote) { return this.createThumbnail(file, this.opts.thumbnailWidth) .then(preview => { this.setPreviewURL(file.id, preview) }) .catch(err => { console.warn(err.stack || err.message) }) } return Promise.resolve() } onRestored () { const fileIDs = Object.keys(this.uppy.getState().files) fileIDs.forEach((fileID) => { const file = this.uppy.getFile(fileID) if (!file.isRestored) return // Only add blob URLs; they are likely invalid after being restored. if (!file.preview || /^blob:/.test(file.preview)) { this.addToQueue(file) } }) } install () { this.uppy.on('file-added', this.addToQueue) this.uppy.on('restored', this.onRestored) } uninstall () { this.uppy.off('file-added', this.addToQueue) this.uppy.off('restored', this.onRestored) } }
JavaScript
0
@@ -276,16 +276,32 @@ his.id = + this.opts.id %7C%7C 'Thumbn
637d7cff664028415c3fc8351366ef51019376f3
Change url once new sketch is compiled.
public/js/sketch.js
public/js/sketch.js
var editor; function showErrorAlert(error) { var alert = $('<div></div>') .addClass('alert') .addClass('alert-danger') .attr('role', 'alert') .text(error.message) .insertBefore('#source'); } function setErrors(errors) { editor.getOption('lint').options.cljsErrors = errors; $('#source-content .alert-danger').remove(); errors.forEach(showErrorAlert); CodeMirror.signal(editor, 'change', editor); } function runSketch(id, size) { var src = '/sketches/html/' + id; var width = size ? size[0] : 500; var height = size ? size[1] : 500; $('#result').removeClass('hidden'); $('#result iframe') .attr('src', src) .css('width', width + 'px') .css('height', height + 'px'); $('#result a') .attr('href', src); $('#ajax-status').addClass('hidden'); setErrors([]); } function showError(response) { $('#ajax-status').addClass('hidden'); $('#source-tab').tab('show'); setErrors([response]); } function send() { editor.clearGutter('CodeMirror-lint-markers'); var data = {cljs: editor.getValue()}; $.ajax({ url: '/sketches/create', method: 'POST', data: JSON.stringify(data), contentType: 'application/json', success: function(resp) { if (resp.result === 'ok') { runSketch(resp.id, resp.size); } else if (resp.result === 'error') { showError(resp); } } }); $('#result').addClass('hidden'); $('#ajax-status').removeClass('hidden'); $('#result-tab').tab('show'); $('head').append( $('<link/>') .attr('rel', 'prefetch') .attr('href', '/js/preload.js')); } $(function() { CodeMirror.registerHelper('lint', 'clojure', function(text, options) { return options.cljsErrors.map(function(error) { return { from: CodeMirror.Pos(error.line - 1, error.column - 2), to: CodeMirror.Pos(error.line - 1, error.column - 1), message: error.message } }); }); editor = CodeMirror.fromTextArea($('#source')[0], { mode: 'clojure', lineNumbers: true, gutters: ["CodeMirror-lint-markers"], lint: { options: {cljsErrors: []}, }, viewportMargin: Infinity }); $.ajax({ url: '/sketches/info/' + $('#source').data('sketch-id'), method: 'GET', success: function(resp) { editor.setValue(resp.cljs); } }); $('#send').on('click', send); });
JavaScript
0
@@ -869,24 +869,157 @@ Errors(%5B%5D);%0A + if (window.history && window.history.replaceState) %7B%0A window.history.replaceState(%7B%7D, '', '/sketches/show/' + id);%0A %7D%0A %7D%0A%0Afunction
321962f08b9e8f9c1e02436394e36796785447f6
update history.js to be consistent with changes in DRE. This allows for deployment with remote mongodb, a requirement for a docker deployment.
lib/history.js
lib/history.js
"use strict"; var mongoose = require('mongoose'); var Schema = mongoose.Schema; mongoose.connect('mongodb://localhost:27017/dre'); exports.getFullEventName = function (typestring, callback) { var fullEventNames = { initAccount: 'Account created', loggedIn: 'Logged in', loggedOut: 'Logged out', fileUploaded: 'File uploaded', fileDownloaded: 'File downloaded', //could add filename or MHR labResults: 'Lab results received', //same as fileUploaded in API passwordChange: 'Password changed', //not in API yet infoUpdate: 'Personal Information updated', //not in API yet medUpdate: 'Patient-entered medications changed' }; callback(null, fullEventNames[typestring]); }; //Used in login, storage, record exports.saveEvent = function (dbinfo, eventType, ptKey, note, file, callback) { var newEvent = new dbinfo.accountHistoryModel({ username: ptKey, event_type: eventType, note: note, //file descriptor, IP address fileRef: file //MongoDB _id }); newEvent.save(function (err, result) { //removed ,num if (err) { console.log("error", err); callback(err); } else { callback(null, result); } }); }; exports.allEventsInOrder = function (dbinfo, ptKey, callback) { var model = dbinfo.accountHistoryModel; model.find({ "username": ptKey }).sort({ time: 1 }).exec(function (err, docs) { callback(err, docs); }); }; exports.lastLogin = function (dbinfo, ptKey, callback) { var model = dbinfo.accountHistoryModel; var loginQuery = model.find({ 'event_type': 'loggedIn', "username": ptKey }).sort({ time: -1 }); loginQuery.exec(function (err, logins) { if (err) { console.log(err); callback(err); } else { if (logins.length === 1) { //this is first login callback(null, logins[0]); } else if (logins.length === 0) { //no logins (e.g. in registered state) callback(null, null); } else { //multiple logins callback(null, logins[1]); } } }); }; exports.lastUpdate = function (dbinfo, ptKey, callback) { var model = dbinfo.accountHistoryModel; var updateQuery = model.find({ 'event_type': 'fileUploaded', "username": ptKey }).sort({ time: -1 }); updateQuery.exec(function (err, updates) { if (err) { console.log(err); callback(err); } else { if (updates) { callback(null, updates[0]); } else { //no files uploaded, so return account initialized var lastUpdate = model.findOne({ event_type: 'initAccount' }, function (err, update) { if (err) { console.log(err); callback(err); } else { callback(null, update); } }); } } }); };
JavaScript
0
@@ -78,56 +78,231 @@ ma;%0A -mongoose.connect('mongodb://localhost:27017/dre' +%0Avar mongo_url = process.env.MONGO_DB %7C%7C 'localhost';%0Avar mongo_port = process.env.MONGO_PORT %7C%7C 27017;%0Avar mongo_name = process.env.MONGO_NAME %7C%7C 'dre';%0Amongoose.connect('mongodb://'+mongo_url+':'+mongo_port+'/'+mongo_name );%0A%0A
60dff5ac69e1b5934e238e37b1997838a692c1ef
remove todo
gameData.js
gameData.js
console.log("Loading: game data"); var clientSetupPromise = $.Deferred(), serverSetupPromise = $.Deferred(); var gameSetupPromise = $.when(clientSetupPromise, serverSetupPromise); clientSetupPromise.then(function() { console.log('Setup by client done'); }); serverSetupPromise.then(function() { console.log('Setup by server done'); }); gameSetupPromise.then(function() { console.log('Game setup complete'); }); window.gameData = { PLAYER_CHILDREN_LABELS: {label: 'label', energy:'energy'}, localPlayerId: null, clientSetup: clientSetupPromise, serverSetup: serverSetupPromise, gameSetup: gameSetupPromise, assignedStartTiles: {}, game: null, localPlayer: null, roundReady: false, checkpointTiles: [], getPlayer: function getPlayers(id) { return _.find(gameData.getPlayers(), function(player) { return player.data.id === id; }); }, getPlayers: function getPlayers() { return _.values(_players); }, addPlayer: function(player) { _players[player.data.id] = player; }, removePlayer: function(player) { delete _players[player.data.id]; player.destroy(); }, updatePlayerLabel: function(player, text) { var newLabel = text || player.data.name || player.data.id; if(newLabel.length > 10) { newLabel = newLabel.substr(0, 4) + '...'; } label = player.children.length && _.find(player.children, function(child) { //the label child does not have a key! that sucks! return child.key === gameData.PLAYER_CHILDREN_LABELS.label }); if(label) { label.text = newLabel; } else if(!_.isUndefined(newLabel)) { var label = game.add.text(-21, 30, newLabel, { "font-size": '12px'}); label.key = gameData.PLAYER_CHILDREN_LABELS.label; player.addChild(label); } }, addInstruction: function (player, instruction) { var moveFunction = _.partial(moveAtAngle, player, directionToAngle(instruction)); moveFunction.instruction = instruction; player.data.movementQueue.push(moveFunction); }, restartGame: function(players){ _.each(players, function(player){ clearSpriteMovement(player); resetToStart(player); player.revive(5); player.data.movementQueue = []; }); _.each(gameData.checkpointTiles, function(tile) { tile.playersTouched = []; }); }, redrawPlayerInfo: function() { $('#player-info').empty(); _.each(gameData.getPlayers(), function(player) { var playerInfo = $('<li/>'); var checkpointsHit = gameData.getCheckpointsTouched(player); playerInfo.html((player.data.name || player.data.id) + ': ' + (((checkpointsHit && checkpointsHit.length) || '0') + '/' + gameData.checkpointTiles.length)); $('#player-info').append(playerInfo); }); }, getCheckpointsTouched: function(player) { return _.filter(gameData.checkpointTiles, function(tile) { return _.contains(tile.playersTouched, player.data.id) }); }, playerLostEnergy: function(player){ //find the last child that is an energy and remove it. var f = 0; while(player.getChildAt(f).key === gameData.PLAYER_CHILDREN_LABELS.energy){ f++; } var energy = player.getChildAt(f - 1) energy.destroy(); } };
JavaScript
0.000005
@@ -1493,71 +1493,8 @@ ) %7B%0A - //the label child does not have a key! that sucks!%0A
05228edc57e1178af8a98a924b9defa94b2bd3f2
Add reference, add gravity, change velo var names
public/src/mario.js
public/src/mario.js
'use strict'; /** * src/mario.js * * Creates the Mario object * */ //The frames in the sprite sheet is 16x16px //mario_wjlfy5.png window.onload = function() { var canvas = document.getElementById('game'); canvas.width = 640; canvas.height = 480; var marioImage = new Image(); marioImage.src = 'assets/mario_wjlfy5_large.png'; var rightPressed = false; var leftPressed = false; var upPressed = false; document.addEventListener('keydown', keyDownHandler, false); document.addEventListener('keyup', keyUpHandler, false); function keyDownHandler(e) { if (e.keyCode == 39) { rightPressed = true; } else if (e.keyCode == 37) { leftPressed = true; } else if (e.keyCode == 38) { upPressed = true; } } function keyUpHandler(e) { if (e.keyCode == 39) { rightPressed = false; } else if (e.keyCode == 37) { leftPressed = false; } else if (e.keyCode == 38) { upPressed = false; } } function sprite (options) { var that = {}, frameIndex = 0, tickCount = 0, ticksPerFrame = options.ticksPerFrame || 0, numberOfFrames = options.numberOfFrames || 1; that.context = options.context; that.width = options.width; that.height = options.height; that.image = options.image; that.x = options.x; that.y = options.y; that.xVelocity = options.xVelocity; that.yVelocity = options.yVelocity; // that.left = options.left; // that.right = options.right; that.topIndex = options.topIndex; that.render = function () { // Clear the canvas that.context.clearRect(0, 0, canvas.width, canvas.height); // Draw the animation that.context.drawImage ( that.image, frameIndex * that.width / numberOfFrames, that.topIndex, that.width / numberOfFrames, that.height, that.x, that.y, that.width / numberOfFrames, that.height); }; that.loop = options.loop; // that.update = function() { // tickCount += 1; // if (tickCount > ticksPerFrame) { // tickCount = 0; // if (frameIndex < numberOfFrames -1) { // frameIndex += 1; // } // else if (that.loop) { // frameIndex = 1; // } // else { // frameIndex = 1; // } // } // }; that.runRight = function() { tickCount += 1; that.topIndex = 0; if (tickCount > ticksPerFrame) { tickCount = 0; if (frameIndex < numberOfFrames -1) { frameIndex += 1; } else if (that.loop) { frameIndex = 1; } else { frameIndex = 1; } } }; that.runLeft = function() { tickCount += 1; that.topIndex = 128; if (tickCount > ticksPerFrame) { tickCount = 0; if (frameIndex < numberOfFrames -1) { frameIndex += 1; } else if (that.loop) { frameIndex = 1; } else { frameIndex = 1; } } }; that.jump = function() { frameIndex = 5; }; that.move = function() { if (rightPressed === true && that.x < canvas.width - that.width / numberOfFrames) { that.x += xVelocity; that.runRight(); // that.right = true; // that.left = false; } else if (leftPressed === true && that.x > 0) { that.x -= xVelocity; that.runLeft(); // that.right = false; // that.left = true; } else if (upPressed === true) { that.jump(); } else { frameIndex = 0; } }; return that; } var mario = sprite({ context: canvas.getContext('2d'), width: 512, height: 128, topIndex: 0, image: marioImage, numberOfFrames: 4, ticksPerFrame: 8, x: 20, y: canvas.height - 148, xVelocity: 3, yVelocity: 0, // right: true, // left: false, }); function gameLoop () { window.requestAnimationFrame(gameLoop); mario.render(); mario.move(); } // marioImage.addEventListener('load', gameLoop()); marioImage.addEventListener('load', gameLoop); };
JavaScript
0
@@ -126,16 +126,377 @@ lfy5.png +%0A // context.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh)%0A // img Source image object %0A // sx Source x %0A // sy Source y %0A // sw Source width %0A // sh Source height %0A // dx Destination x %0A // dy Destination y %0A // dw Destination width %0A // dh Destination height %0A%0Awindow @@ -1791,24 +1791,60 @@ .yVelocity;%0A + that.gravity = options.gravity;%0A // that. @@ -3908,16 +3908,21 @@ at.x += +that. xVelocit @@ -4108,16 +4108,21 @@ at.x -= +that. xVelocit
0716de6decca73306f44d2926d2161d3f25c2e78
Move going to particular page to the "before" section
test/spec/player/controllers/playerCtrlTest.js
test/spec/player/controllers/playerCtrlTest.js
'use strict' var testData = [ { id: "someId1", flashcard_list_id: "someNiceId1", front: "front 1", back: "back 1", create_date: 520603200000 }, { id: "someId3", flashcard_list_id: "someNiceId1", front: "front 3", back: "back 3", create_date: 520603200000 }]; describe('PlayerCtrl', function() { var $controller, $rootScope, $q, mockLocation, mockService, mockSanitize; beforeEach(function() { module('flashcardPlayerModule.controllers'); mockService = jasmine.createSpyObj('flashcardListDetailsService', [ 'getListDetails', 'getFlashcards', 'removeFlashcardFromList', 'updateFlashcard', 'createNewFlashcard' ]); mockLocation = jasmine.createSpyObj('$location', [ 'path' ]); mockSanitize = jasmine.createSpyObj('$sce', [ 'trustAsHtml' ]); mockSanitize.trustAsHtml.andCallFake(function(p) { return p; }); module(function ($provide) { $provide.value('flashcardListDetailsService', mockService); $provide.value('$location', mockLocation); $provide.value('$sce', mockSanitize); }); inject(function (_$controller_, _$rootScope_, _$q_) { $controller = _$controller_; $rootScope = _$rootScope_; $q = _$q_; }); }); describe('with no flashcard given', function() { var testObj, scope, deferred; beforeEach(function() { deferred = $q.defer(); mockService.getFlashcards.andReturn(deferred.promise); scope = $rootScope.$new(); testObj = $controller('PlayerCtrl', { $scope: scope, $routeParams: { 'flashcardListId': 'mockFlashcardList' }, }); }); it('should redirect to given flashcard', function() { // given deferred.resolve(testData); // when $rootScope.$digest(); // then expect(mockService.getFlashcards).toHaveBeenCalledWith('mockFlashcardList'); expect(mockLocation.path).toHaveBeenCalledWith('/Player/mockFlashcardList/someId1'); }); it('should show the rendered text', function() { // given deferred.resolve(testData); // when $rootScope.$digest(); // then expect(scope.renderedText).toBe('<p>front 1</p>'); }); }); describe('with flashcard given', function() { var testObj, deferred, scope; beforeEach(function() { deferred = $q.defer(); mockService.getFlashcards.andReturn(deferred.promise); scope = $rootScope.$new(); testObj = $controller('PlayerCtrl', { $scope: scope, $routeParams: { 'flashcardListId': 'mockFlashcardList', 'flashcardId': 'someId1' }, }); }); it('should remain at given flashcard', function() { // given deferred.resolve(testData); // when $rootScope.$digest(); // then expect(mockService.getFlashcards).toHaveBeenCalledWith('mockFlashcardList'); expect(mockLocation.path).not.toHaveBeenCalled(); }); it('should be front at the beginning', function() { expect(scope.isFront).toBe(true); }); it('should change the side upon clicking', function() { // given deferred.resolve(testData); $rootScope.$digest(); // when scope.toggleFrontBack(); // then expect(scope.isFront).toBe(false); }); it('should return side upon clicking twice', function() { // given deferred.resolve(testData); $rootScope.$digest(); // when scope.toggleFrontBack(); scope.toggleFrontBack(); // then expect(scope.isFront).toBe(true); }); it('should switch the rendered text upon toggling', function() { // given deferred.resolve(testData); $rootScope.$digest(); // when scope.toggleFrontBack(); // then expect(scope.renderedText).toMatch(testData[0].back); }); }); });
JavaScript
0.000001
@@ -1974,104 +1974,8 @@ );%0A%0A - %7D);%0A%0A it('should redirect to given flashcard', function() %7B%0A // given%0A @@ -2002,33 +2002,32 @@ olve(testData);%0A -%0A // w @@ -2022,36 +2022,16 @@ -// when%0A $rootSco @@ -2036,32 +2036,106 @@ cope.$digest();%0A + %7D);%0A%0A it('should redirect to given flashcard', function() %7B %0A // @@ -2399,125 +2399,8 @@ ) %7B%0A - // given%0A deferred.resolve(testData);%0A%0A // when%0A $rootScope.$digest();%0A%0A @@ -3044,102 +3044,8 @@ );%0A%0A - %7D);%0A%0A it('should remain at given flashcard', function() %7B%0A // given%0A @@ -3080,17 +3080,16 @@ tData);%0A -%0A @@ -3092,36 +3092,16 @@ -// when%0A $rootSco @@ -3106,32 +3106,104 @@ cope.$digest();%0A + %7D);%0A%0A it('should remain at given flashcard', function() %7B %0A // @@ -3423,32 +3423,52 @@ ', function() %7B%0A + // then%0A expe @@ -3578,112 +3578,8 @@ ) %7B%0A - // given%0A deferred.resolve(testData);%0A $rootScope.$digest();%0A %0A @@ -3782,104 +3782,8 @@ ) %7B%0A - // given%0A deferred.resolve(testData);%0A $rootScope.$digest();%0A%0A @@ -4029,104 +4029,8 @@ ) %7B%0A - // given%0A deferred.resolve(testData);%0A $rootScope.$digest();%0A%0A @@ -4173,27 +4173,28 @@ k);%0A %7D);%0A +%0A %7D);%0A%7D);
cbe8c84ec157088e1eb97a1e6b310b64da94f6c9
add messages to non regression test output
eslint/babel-eslint-parser/test/non-regression.js
eslint/babel-eslint-parser/test/non-regression.js
/*eslint-env mocha*/ "use strict"; var eslint = require("eslint"); function verifyAndAssertMessages(code, rules, expectedMessages) { var messages = eslint.linter.verify( code, { parser: require.resolve(".."), rules: rules, env: { node: true } } ); if (messages.length !== expectedMessages.length) { throw new Error("Expected " + expectedMessages.length + " message(s), got " + messages.length); } messages.forEach(function (message, i) { var formatedMessage = message.line + ":" + message.column + " " + message.message + (message.ruleId ? " " + message.ruleId : ""); if (formatedMessage !== expectedMessages[i]) { throw new Error("Message " + i + " does not match:\nExpected: " + expectedMessages[i] + "\nActual: " + formatedMessage); } }); } describe("verify", function () { it("arrow function support (issue #1)", function () { verifyAndAssertMessages( "describe('stuff', () => {});", {}, [] ); }); it("EOL validation (issue #2)", function () { verifyAndAssertMessages( "module.exports = \"something\";", { "eol-last": 1, "semi": 1 }, [ "1:1 Newline required at end of file but not found. eol-last" ] ); }); it("Readable error messages (issue #3)", function () { verifyAndAssertMessages( "{ , res }", {}, [ "1:2 Unexpected token" ] ); }); it("Unused vars in JSX (issue #5)", function () { verifyAndAssertMessages( "var App = require('./App');\n" + "module.exports = <App />;", { "no-unused-vars": 1 }, [] ); }); it("Modules support (issue #5)", function () { verifyAndAssertMessages( "import Foo from 'foo';\n" + "export default Foo;", { }, [] ); }); it("Rest parameters (issue #7)", function () { verifyAndAssertMessages( "function foo(...args) { return args; }", { "no-undef": 1 }, [] ); }); it("Exported classes should be used (issue #8)", function () { verifyAndAssertMessages( "class Foo {} module.exports = Foo;", { "no-unused-vars": 1 }, [] ); }); it("super keyword in class (issue #10)", function () { verifyAndAssertMessages( "class Foo { constructor() { super() } }", { "no-undef": 1 }, [] ); }); it("Rest parameter in destructuring assignment (issue #11)", function () { verifyAndAssertMessages( "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", { "no-undef": 1 }, [] ); }); it("JSX attribute names marked as variables (issue #12)", function () { verifyAndAssertMessages( "module.exports = <div className=\"foo\" />", { "no-undef": 1 }, [] ); }); it("Variables in JSX should be used (issues #15, #17, #21, #29)", function () { verifyAndAssertMessages( "import App from './App'; export default (<App />);", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("Multiple destructured assignment with compound properties (issue #16)", function () { verifyAndAssertMessages( "module.exports = { ...a.a, ...a.b };", { "no-dupe-keys": 1 }, [] ); }); it("Arrow function with non-block bodies (issue #20)", function () { verifyAndAssertMessages( "\"use strict\"; () => 1", { "strict": 1 }, [] ); }); it("await keyword (issue #22)", function () { verifyAndAssertMessages( "async function foo() { await bar(); }", { "no-unused-expressions": 1 }, [] ); }); });
JavaScript
0.000003
@@ -441,16 +441,49 @@ s.length + + %22 %22 + JSON.stringify(messages) );%0A %7D%0A%0A
96e769b6dd8817d25984ba500925b3dd42f665d5
Make instrumentation of templateRequest optional to gain Angular 1.2 support
src/instrumentation/angular/templateRequest.js
src/instrumentation/angular/templateRequest.js
var utils = require('../utils') module.exports = function ($provide, traceBuffer) { // Template Request Instrumentation $provide.decorator('$templateRequest', ['$delegate', '$injector', function ($delegate, $injector) { return utils.instrumentModule($delegate, $injector, { type: 'template.angular.request', prefix: '$templateRequest', signatureFormatter: function (key, args) { var text = ['$templateRequest', args[0]] return text.join(' ') } }) }]) }
JavaScript
0
@@ -78,16 +78,27 @@ ffer) %7B%0A + try %7B %0A // Tem @@ -127,16 +127,18 @@ ntation%0A + $provi @@ -231,24 +231,26 @@ ctor) %7B%0A + return utils @@ -291,16 +291,18 @@ ctor, %7B%0A + ty @@ -339,16 +339,18 @@ ,%0A + prefix: @@ -375,16 +375,18 @@ ,%0A + + signatur @@ -416,24 +416,26 @@ ey, args) %7B%0A + var @@ -475,24 +475,26 @@ 0%5D%5D%0A + return text. @@ -509,18 +509,22 @@ )%0A + + %7D%0A + %7D)%0A @@ -528,10 +528,32 @@ )%0A + + %7D%5D)%0A + %7D catch (e) %7B%0A %7D%0A %7D%0A
3a359b5abc5d266447836ce3aa3b8c3363d6a1cf
comment out unused code [will be used later]
src/service/processor/game_processor.js
src/service/processor/game_processor.js
export default class GameProcessor { constructor(size, opponents) { this.size = size; this.opponents = opponents; this.battlefields = []; } /** * @param {{id: {number}, coordinate: {string}}} criteria */ findCellByCriteria(criteria) { let cell = this.cells.find(cell => (undefined !== criteria.id && cell.id === criteria.id) || (undefined !== criteria.coordinate && cell.coordinate === criteria.coordinate) ); if (undefined !== cell) { return cell; } throw `cell by criteria ${JSON.stringify(criteria)} not found`; } }
JavaScript
0
@@ -247,16 +247,20 @@ */%0A + /** findCel @@ -649,6 +649,10 @@ %7D + */ %0A%7D +%0A
3cc939ba7fe3ab272928b46aeda7f30c4e354272
Teste inputselect no método selectedvalue.
src/js/components/input/select/input_select.js
src/js/components/input/select/input_select.js
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import PropTypes from '../../../prop_types'; import $ from 'jquery'; import i18n from '../../../i18n'; import { autobind, mixin } from '../../../utils/decorators'; import { InputSelectOption } from '../../../components'; import { CssClassMixin, InputComponentMixin, SelectComponentMixin, InputSelectActionsListenerMixin, MaterializeSelectMixin } from '../../../mixins'; @mixin( CssClassMixin, InputComponentMixin, SelectComponentMixin, InputSelectActionsListenerMixin, MaterializeSelectMixin ) export default class InputSelect extends Component { static propTypes = { includeBlank: PropTypes.bool, blankText: PropTypes.localizedString, }; static defaultProps = { includeBlank: true, themeClassKey: 'input.select', blankText: 'select', }; componentDidMount() { const valuesSelect = ReactDOM.findDOMNode(this.refs.select); const $form = $(valuesSelect.form); $form.on('reset', this.clearSelection); } componentWillUnmount() { const valuesSelect = ReactDOM.findDOMNode(this.refs.select); const $form = $(valuesSelect.form); $form.off('reset', this.clearSelection); } clearSelection() { this.setState({ value: [], }, this.triggerDependableChanged); } selectedValue() { let value = this.state.value; Console.log(value) if (!this.props.multiple) { value = value[0]; } return value; } @autobind handleChange(event) { const selectElement = ReactDOM.findDOMNode(this.refs.select); const newValue = this.ensureIsArray(selectElement.value); this.props.onChange(event, newValue, this); if(!event.isDefaultPrevented()) { this.setState({ value: newValue }, this.triggerDependableChanged); } } renderOptions() { const selectOptions = []; const options = this.state.options; if (this.props.includeBlank) { selectOptions.push( <InputSelectOption name={i18n.t(this.props.blankText)} value="" key="empty_option" /> ); } for (let i = 0; i < options.length; i++) { const optionProps = options[i]; selectOptions.push(<InputSelectOption {...optionProps} key={optionProps.name} />); } return selectOptions; } render() { return ( <select id={this.props.id} name={this.props.name} value={this.selectedValue()} onChange={this.handleChange} disabled={this.isDisabled() || this.props.readOnly} className={this.className()} ref="select" > {this.renderOptions()} </select> ); } }
JavaScript
0
@@ -1427,24 +1427,49 @@ multiple) %7B%0A + Console.log(value)%0A value
4c2fbeac410255eef4bc4a65cd03b262e720de2f
Fix big int parsing from string objects
src/som/primitives/IntegerPrimitives.js
src/som/primitives/IntegerPrimitives.js
/* * Copyright (c) 2014 Stefan Marr, [email protected] * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ // @ts-check import { isInIntRange } from '../../lib/platform.js'; import { SBigInteger } from '../vmobjects/numbers.js'; import { Primitives } from './Primitives.js'; import { universe } from '../vm/Universe.js'; import { SString } from '../vmobjects/SString.js'; function toNumber(val) { if (val instanceof SBigInteger) { return Number(val.getEmbeddedBigInteger()); } return val.getEmbeddedInteger(); } function _asString(_frame, args) { return args[0].primAsString(); } function _sqrt(_frame, args) { const res = Math.sqrt(args[0].getEmbeddedInteger()); if (res === Math.floor(res)) { return universe.newInteger(Math.floor(res)); } return universe.newDouble(res); } function _atRandom(_frame, args) { return universe.newInteger(Math.floor(args[0].getEmbeddedInteger() * Math.random())); } function _plus(_frame, args) { return args[0].primAdd(args[1]); } function _minus(_frame, args) { return args[0].primSubtract(args[1]); } function _mult(_frame, args) { return args[0].primMultiply(args[1]); } function _doubleDiv(_frame, args) { return args[0].primDoubleDiv(args[1]); } function _intDiv(_frame, args) { return args[0].primIntDiv(args[1]); } function _mod(_frame, args) { return args[0].primModulo(args[1]); } function _and(_frame, args) { return args[0].primAnd(args[1]); } function _equals(_frame, args) { return args[0].primEquals(args[1]); } function _equalsEquals(_frame, args) { return args[0].primEquals(args[1]); } function _lessThan(_frame, args) { return args[0].primLessThan(args[1]); } function _fromString(_frame, args) { const param = args[1]; if (!(param instanceof SString)) { return universe.nilObject; } const intVal = parseInt(param.getEmbeddedString(), 10); return universe.newInteger(intVal); } function _leftShift(_frame, args) { const r = toNumber(args[1]); const l = toNumber(args[0]); const result = l << r; if (Math.floor(l) !== l || !isInIntRange(result) || !isInIntRange(l * (2 ** r))) { let big = BigInt(l); big *= BigInt(2 ** r); return universe.newBigInteger(big); } return universe.newInteger(result); } function _bitXor(_frame, args) { const right = toNumber(args[1]); const left = toNumber(args[0]); return universe.newInteger(left ^ right); } function _rem(_frame, args) { const right = args[1]; const left = args[0]; return universe.newInteger(left.getEmbeddedInteger() % right.getEmbeddedInteger()); } function _as32BitUnsignedValue(_frame, args) { return args[0].prim32BitUnsignedValue(); } function _as32BitSignedValue(_frame, args) { return args[0].prim32BitSignedValue(); } function _unsignedRightShift(_frame, args) { const right = toNumber(args[1]); const left = toNumber(args[0]); return universe.newInteger(left >>> right); } class IntegerPrimitives extends Primitives { installPrimitives() { this.installInstancePrimitive('asString', _asString); this.installInstancePrimitive('sqrt', _sqrt); this.installInstancePrimitive('atRandom', _atRandom); this.installInstancePrimitive('+', _plus); this.installInstancePrimitive('-', _minus); this.installInstancePrimitive('*', _mult); this.installInstancePrimitive('//', _doubleDiv); this.installInstancePrimitive('/', _intDiv); this.installInstancePrimitive('%', _mod); this.installInstancePrimitive('&', _and); this.installInstancePrimitive('=', _equals); this.installInstancePrimitive('==', _equalsEquals, true); this.installInstancePrimitive('<', _lessThan); this.installInstancePrimitive('<<', _leftShift); this.installInstancePrimitive('bitXor:', _bitXor); this.installInstancePrimitive('rem:', _rem); this.installInstancePrimitive('>>>', _unsignedRightShift); this.installInstancePrimitive('as32BitUnsignedValue', _as32BitUnsignedValue); this.installInstancePrimitive('as32BitSignedValue', _as32BitSignedValue); this.installClassPrimitive('fromString:', _fromString); } } export const prims = IntegerPrimitives;
JavaScript
0.000117
@@ -1132,16 +1132,29 @@ import %7B + intOrBigInt, isInInt @@ -2834,16 +2834,17 @@ ct;%0A %7D%0A +%0A const @@ -2848,21 +2848,14 @@ st i -ntVal = parse + = Big Int( @@ -2883,12 +2883,8 @@ ng() -, 10 );%0A @@ -2895,34 +2895,31 @@ urn -universe.newInteger(intVal +intOrBigInt(i, universe );%0A%7D
f7d563192327976df505498ef79ba199bd470d3c
add config for new regions
tests/dummy/app/models/realtimeEnvironments.js
tests/dummy/app/models/realtimeEnvironments.js
const prodUS = { host: 'https://realtime.mypurecloud.com:443', thirdPartyOrgId: 397 }; const prodUSW2 = { host: 'https://realtime.usw2.pure.cloud:443', orgId: '8e743581-690c-4e8f-8f81-530cd37566e9', thirdPartyOrgId: 52, orgName: 'iris-testing-org-30' }; const prodAU = { host: 'https://realtime.mypurecloud.com.au:443', thirdPartyOrgId: 28, orgName: 'Admin_Prod_ANZ', orgId: '766eab18-6373-4026-8e70-07e3a07a51dd' }; const prodDE = { host: 'https://realtime.mypurecloud.de:443', thirdPartyOrgId: 176, orgName: 'test-devglobalalliances-tests', orgId: '6b2385a5-d57c-4838-89c3-8dda7b7f7bd7' }; const prodIE = { host: 'https://realtime.mypurecloud.ie:443', thirdPartyOrgId: 16, orgName: 'automationtestireland', orgId: '82e8346a-507e-4011-bcca-dc7ea8304133' }; const prodJP = { host: 'https://realtime.mypurecloud.jp:443', thirdPartyOrgId: 5, orgName: 'tokyoautomationorg', orgId: 'c32dd240-fd35-4d23-b06d-3694f7a8f18d' }; const tca = { host: 'https://realtime.inintca.com:443', thirdPartyOrgId: 1388, orgName: 'automationorganization', orgId: 'bb132ab6-1865-401e-9e1b-6ddd2cf8b771' }; const dca = { host: 'https://realtime.inindca.com:443', thirdPartyOrgId: 2217941, orgName: 'test-valve-1ym37mj1kao', orgId: '80883333-8617-472f-8274-58d5b9a10033', webchatDeploymentKey: '010bca46-de58-4df0-98ae-5c24a0f4003d' }; const localhost = { host: 'https://realtime.inindca.com:443', thirdPartyOrgId: 2217941, orgName: 'test-valve-1ym37mj1kao', orgId: '80883333-8617-472f-8274-58d5b9a10033', webchatDeploymentKey: '010bca46-de58-4df0-98ae-5c24a0f4003d' }; const realtimeEnvironments = { 'apps.mypurecloud.com': prodUS, 'apps.usw2.pure.cloud': prodUSW2, 'apps.mypurecloud.com.au': prodAU, 'apps.mypurecloud.de': prodDE, 'apps.mypurecloud.ie': prodIE, 'apps.mypurecloud.jp': prodJP, 'apps.inintca.com': tca, 'apps.inindca.com': dca, localhost: localhost }; export default realtimeEnvironments;
JavaScript
0
@@ -257,24 +257,523 @@ org-30'%0A%7D;%0A%0A +const prodAPNE2 = %7B%0A host: 'https://realtime.apne2.pure.cloud:443',%0A orgId: '3226a078-0840-4bd2-91da-0f36668f16ea',%0A thirdPartyOrgId: 72,%0A orgName: 'seoulbtc'%0A%7D;%0A%0Aconst prodCAC1 = %7B%0A host: 'https://realtime.cac1.pure.cloud:443',%0A orgId: '96f4c15e-c120-49d5-b4ad-268bad025f25',%0A thirdPartyOrgId: 85,%0A orgName: 'canadabtc'%0A%7D;%0A%0Aconst prodEUW2 = %7B%0A host: 'https://realtime.euw2.pure.cloud:443',%0A orgId: '774e625c-7626-41d3-93b8-5704cdfd57c3',%0A thirdPartyOrgId: 65,%0A orgName: 'londonbtc'%0A%7D;%0A%0A const prodAU @@ -2219,16 +2219,126 @@ odUSW2,%0A + 'apps.apne2.pure.cloud': prodAPNE2,%0A 'apps.cac1.pure.cloud': prodCAC1,%0A 'apps.euw2.pure.cloud': prodEUW2,%0A 'apps.
8421bec31bcddf77710763c619c34e69e88457d6
Resolve unrelated linting issue
tests/integration/components/sl-unable-test.js
tests/integration/components/sl-unable-test.js
import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; moduleForComponent( 'sl-unable', 'Integration | Component | sl unable', { beforeEach() { this.inject.service( 'sl-behavior' ); this.set( 'sl-behavior.behaviors', { event: { create: false, reschedule: true }, user: { edit: true } }); }, integration: true }); test( 'Yielded content passes through when "activity" is false', function( assert ) { this.render( hbs` {{#sl-unable activity="create" resource="event" }} <h3>You cannot create this event</h3> {{/sl-unable}} ` ); assert.strictEqual( this.$( '>:first-child' ).find( 'h3' ).text().trim(), 'You cannot create this event', 'Yielded content is passed through correctly' ); }); test( 'Yielded content passes through when "activity" is true', function( assert ) { this.render( hbs` {{#sl-unable activity="reschedule" resource="event" }} <h3>You cannot reschedule this event</h3> {{/sl-unable}} ` ); assert.strictEqual( this.$( '>:first-child' ).find( 'h3' ).length, 0, 'Yielded content is not passed through' ); }); test( 'Setting "possible" property affects yielded content when activity is true', function( assert ) { this.set( 'possible', false ); const template = hbs` {{#sl-unable activity="edit" resource="user" possible=possible }} <h3>You can edit this user</h3> {{/sl-unable}} `; this.render( template ); assert.strictEqual( this.$( '>:first-child' ).find( 'h3' ).text().trim(), 'You can edit this user', 'Yielded content is passed through correctly' ); this.set( 'possible', true ); this.render( template ); assert.strictEqual( this.$( '>:first-child' ).find( 'h3' ).length, 0, 'When "possible" is false, yielded content is not passed through' ); });
JavaScript
0.00006
@@ -2217,10 +2217,8 @@ );%0A%7D);%0A -%0A%0A
c38a7157113d51d373f1236de23eb77671bd4485
Use field token instead of string
src/lwc/geFormFieldLookup/geFormFieldLookup.js
src/lwc/geFormFieldLookup/geFormFieldLookup.js
import { LightningElement, api, wire, track } from 'lwc'; import { getObjectInfo } from 'lightning/uiObjectInfoApi'; import { getRecord } from 'lightning/uiRecordApi'; import doSearch from '@salesforce/apex/GE_LookupController.doSearch'; import doSearchRecordType from '@salesforce/apex/GE_LookupController.doSearchRecordType'; import { isNotEmpty } from 'c/utilCommon'; import { handleError } from 'c/utilTemplateBuilder'; const DELAY = 300; export default class GeFormFieldLookup extends LightningElement { @api fieldApiName; @api objectApiName; @api displayValue = ''; @api defaultValue = null; _defaultDisplayValue = ''; @api label; @api required; @api id; // unique identifier for this field, used mainly for accessibility @api variant; @api disabled; @api qaLocatorBase; @track options = []; @track value; @track targetObjectApiName; @track queryFields; @track valid = true; @track _getRecordId = null; connectedCallback() { if (this.defaultValue === undefined) { this.defaultValue = null; } this.value = this.defaultValue; if (this.value) { this._getRecordId = this.value; } this.dispatchChangeEvent({ value: this.value, displayValue: this.displayValue, fieldApiName: this.fieldApiName }); } /** * Retrieve information about the object the lookup points to. */ @wire(getObjectInfo, {objectApiName: '$targetObjectApiName'}) wiredTargetObjectInfo(response) { if (response.data) { this.targetObjectInfo = response; this.queryFields = this.getQueryFields(); } } @wire(getRecord, {recordId: '$_getRecordId', fields: '$queryFields'}) wiredGetRecord({error, data}) { if (data) { this.displayValue = data.fields.Name.value; if (data.fields.Id.value === this.defaultValue) { this._defaultDisplayValue = this.displayValue; } let autocomplete = this.template.querySelector('c-ge-autocomplete'); autocomplete.setValue({value: this.value, displayValue: this.displayValue}); } else if (error) { handleError(error); } } /** * Check validity, then update the field with a message if field is invalid. */ @api reportValidity() { this.valid = this.checkValidity(); if (!this.valid) { this.setCustomValidity(); } } /** * Check validity without updating the UI * @returns {boolean} */ @api checkValidity() { if (this.required) { return isNotEmpty(this.value); } return true; } /** * Set custom validity - custom since geAutocomplete does not use lightning-input * @param errorMessage, custom message for custom validity */ @api setCustomValidity(errorMessage) { let autocomplete = this.template.querySelector('c-ge-autocomplete'); autocomplete.setCustomError(errorMessage); } @api clearCustomValidity() { let autocomplete = this.template.querySelector('c-ge-autocomplete'); autocomplete.clearCustomError(); } /** * Handle text input change, and retrieve lookup options. * @param event */ handleChange(event) { window.clearTimeout(this.delayTimeout); this.displayValue = event.detail; if (this.displayValue && this.displayValue.length > 1) { this.delayTimeout = setTimeout(() => this.retrieveLookupOptions(this.displayValue, this.targetObjectApiName), DELAY); } } /** * Handle user selecting an option from the dropdown list. * @param event */ handleSelect(event) { this.displayValue = event.detail.displayValue; this.value = event.detail.value; this.dispatchChangeEvent({ value: this.value, displayValue: this.displayValue, fieldApiName: this.fieldApiName }); this.options = []; } /** * When field loses focus, clear any available options so dropdown closes. */ handleFocusOut() { this.options = []; } /** * When field gains focus, re-run search if no option is currently selected. */ handleFocusIn() { if (!this.value && this.displayValue && this.displayValue.length > 1) { this.retrieveLookupOptions(this.displayValue, this.targetObjectApiName); } } @api set objectDescribeInfo(newVal) { this._objectDescribeInfo = newVal; if (typeof newVal !== 'undefined') { // needed for @wire reactive property this.targetObjectApiName = this.fieldInfo.referenceToInfos[0].apiName; } } getQueryFields() { const fields = ['Id', 'Name']; return fields.map(f => `${this.targetObjectApiName}.${f}`); } get objectDescribeInfo() { return this._objectDescribeInfo; } get fieldInfo() { if (this.objectDescribeInfo && this.objectDescribeInfo) { return this.objectDescribeInfo.fields[this.fieldApiName]; } } /** * Gets the SObject icon for the object that we're looking up to. * @returns {string} */ get targetObjectIconName() { if (this.targetObjectInfo && this.targetObjectInfo.data) { if (this.targetObjectInfo.data.themeInfo) { const {iconUrl} = this.targetObjectInfo.data.themeInfo; const re = /\/(standard|custom)\/([a-zA-Z0-9]+)/; const result = re.exec(iconUrl); // explicitly handle only standard and custom icon sets if (result !== null) { if (result[1] === 'standard') { return 'standard:' + result[2]; } else if (result[1] === 'custom') { return 'custom:' + result[2]; } } } } } /** * Async function for retrieving lookup options. * @param searchValue String to search for. * @param sObjectType Object type to search e.g. Account * @returns {Promise<void>} */ retrieveLookupOptions = async (searchValue, sObjectType) => { if (sObjectType === 'RecordType') { // if searching RecordTypes, set WHERE SObjectType clause to filter results. this.options = await doSearchRecordType({searchValue, sObjectType: this.objectApiName}); } else { this.options = await doSearch({searchValue, sObjectType}); } }; @api setSelected(lookupResult) { if (lookupResult.value === null) { this.reset(); } else { this.value = lookupResult.value || null; this.displayValue = lookupResult.displayValue || null; const autocomplete = this.template.querySelector('c-ge-autocomplete'); autocomplete.setValue({value: this.value, displayValue: this.displayValue}); } if (this.value && !this.displayValue) { // Use getRecord to get the displayValue this._getRecordId = this.value; this.queryFields = this.getQueryFields().splice(0); } } @api reset(setDefaults = true) { if (setDefaults) { this.value = this.defaultValue; this.displayValue = this._defaultDisplayValue; } else { this.value = null; this.displayValue = ''; } let autocomplete = this.template.querySelector('c-ge-autocomplete'); autocomplete.setValue({value: this.value, displayValue: this.displayValue}); if (this.value) { this.dispatchChangeEvent({ value: this.value, displayValue: this.displayValue, fieldApiName: this.fieldApiName }); } } dispatchChangeEvent(data) { this.dispatchEvent(new CustomEvent('change', { detail: { value: data.value, displayValue: data.displayValue, fieldApiName: data.fieldApiName } })); } }
JavaScript
0.000001
@@ -416,16 +416,73 @@ uilder'; +%0Aimport RECORD_TYPE from '@salesforce/schema/RecordType'; %0A%0Aconst @@ -6484,20 +6484,33 @@ === -'RecordType' +RECORD_TYPE.objectApiName ) %7B%0A
504f6022099e18b1fac595cdafcd6f4455b04b18
add missing privileges en label
client/i18n/i18n-en.js
client/i18n/i18n-en.js
export default { main: { navTitle: 'The<strong>Skeleton</strong>', title: 'TheSkeleton' }, common: { action: 'Action', add: 'Add', addNew: 'Add new {0}', addOrModify: 'Add or modify {0}', delete: 'Delete {0}', deleteConfirm: 'Confirm Delete', deleteConfirmation: 'Are you sure you want to delete {0}?', deleteSuccess: '{0} deleted', modify: 'Modify {0} ({1})', save: 'Save', update: 'Update {0}', updateSuccess: '{0} updated', view: 'View {0}' }, admin: { role: { title: 'Roles', subtitleAssignPrivilege: 'Assign privilege to role', label: 'role', labelCode: 'Code', labelDescription: 'Description' }, user: { title: 'Users', subtitleAssignRole: 'Assign role to user', label: 'user', labelEmail: 'Email', labelRoles: 'Roles', labelUsername: 'Username' } }, profile: { basic: { title: 'Basic', subtitle: 'Update your basic profile', labelEmail: 'Email', labelUsername: 'Username', messageChangeUsername: 'If you change your username, you will need to sign in again' }, password: { title: 'Password', subtitle: 'Update your password', labelPasswordConfirm: 'Confirm new password', labelPasswordNew: 'New password', labelPasswordOld: 'Old password', messagePasswordUpdated: 'Password updated' } } }
JavaScript
0.000029
@@ -695,16 +695,53 @@ ription' +,%0A labelPrivileges: 'Privileges' %0A %7D,%0A
3f0bd0796f4b481c11f7fd0a7f9e0425c2e06317
add test dummies for api
test/integration/api_test.js
test/integration/api_test.js
var Code = require('code'); var Lab = require('lab'); var lab = exports.lab = Lab.script(); var sinon = require('sinon'); var proxyquire = require('proxyquire').noPreserveCache(); lab.experiment('api', function() { lab.test('force process exit after migrations have been run', { parallel : true}, function(done, onCleanup) { var process_exit = process.exit, argv = process.argv, called = false, config = { cwd: __dirname }; // register cleanup method and start preparing the test onCleanup(teardown); overwriteExit(); var dbmigrate = stubApiInstance(true, { './lib/commands/up.js': upStub }, config); dbmigrate.setConfigParam('force-exit', true); dbmigrate.silence(true); /** * We have set force-exit above, this should end up in db-migrate * executing process.exit on the final callback. * Process.exit has been overwritten and will finally call validate. * * The test validation takes place in validate() */ dbmigrate.up(); /** * Final validation after process.exit should have been called. */ function validate() { Code.expect(called).to.be.true(); done(); } function upStub(internals) { internals.onComplete({ driver: { close: sinon.stub().callsArg(0) } }, internals); } /** * Create a migration with the programatic API and overwrite process.exit. */ function overwriteExit() { process.exit = function(err) { var ret = called; called = true; process.exit = process_exit; if(err) process.exit.apply(arguments); Code.expect(ret).to.be.false(); validate(); }; } function teardown(next) { process.exit = process_exit; process.argv = argv; return next(); } }); lab.test('should load config from parameter', { parallel : true}, function(done) { var options = { env: 'dev', cwd: process.cwd() + '/test/integration', config: { dev: { driver: 'sqlite3', filename: ':memory:' }, pg: { driver: 'pg', database: 'db_api_test' } } }; var api = stubApiInstance(true, {}, options); var actual = api.config; var expected = options.config; delete expected.getCurrent; delete actual.getCurrent; Code.expect(actual).to.equal(expected); done(); }); }); function stubApiInstance(isModule, stubs, options, callback) { delete require.cache[require.resolve('../../api.js')]; delete require.cache[require.resolve('optimist')]; var mod = proxyquire('../../api.js', stubs), plugins = {}; return new mod(plugins, isModule, options, callback); };
JavaScript
0
@@ -195,16 +195,36 @@ t('api', + %7B parallel: true %7D, functio @@ -2525,16 +2525,716 @@ );%0A %7D); +%0A%0A lab.test.skip('should do something', %7B parallel: true %7D, function(done) %7B%0A%0A var api = stubApiInstance(true, %7B%0A './lib/commands/up.js': upStub%0A %7D);%0A%0A api.up();%0A%0A function upStub() %7B%0A%0A done();%0A %7D%0A %7D);%0A%0A lab.test.skip('should do something', %7B parallel: true %7D, function(done) %7B%0A%0A var api = stubApiInstance(true, %7B%0A './lib/commands/down.js': downStub%0A %7D);%0A%0A api.down();%0A%0A function downStub() %7B%0A%0A done();%0A %7D%0A %7D);%0A%0A lab.test.skip('should do something', %7B parallel: true %7D, function(done) %7B%0A%0A var api = stubApiInstance(true, %7B%0A './lib/commands/sync.js': syncStub%0A %7D);%0A%0A api.sync();%0A%0A function syncStub() %7B%0A%0A done();%0A %7D%0A %7D); %0A%7D);%0A%0Afu
3581fa3997e48275bb190d450b83f450724ba54f
Add require to test example.
test/loader.examples.spec.js
test/loader.examples.spec.js
import test from 'ava'; import examplesLoader from '../loaders/examples.loader'; test('should return valid, parsable JS', t => { let exampleMarkdown = ` # header <div/> text \`\`\` <span/> \`\`\` `; let result = examplesLoader.call({}, exampleMarkdown); t.truthy(result); t.notThrows(() => new Function(result), SyntaxError); // eslint-disable-line no-new-func }); // componentName query option test('should replace all occurrences of __COMPONENT__ with provided query.componentName', t => { const exampleMarkdown = ` <div> <__COMPONENT__> <span>text</span> <span>Name of component: __COMPONENT__</span> </__COMPONENT__> <__COMPONENT__ /> </div> `; const result = examplesLoader.call({ query: '?componentName=FooComponent' }, exampleMarkdown); t.notRegex(result, /__COMPONENT__/); t.regex(result, /FooComponent/); t.is(result.match(/FooComponent/g).length, 4); });
JavaScript
0
@@ -158,16 +158,46 @@ header%0A%0A +%09const _ = require('lodash');%0A %09%3Cdiv/%3E%0A
d4718198abeea6fcd1eaa5ac32995e73a4d3a877
add webp bundle to webpack
scripts/webpack.renderer.config.js
scripts/webpack.renderer.config.js
const path = require('path'); const fs = require('fs'); const webpack = require('webpack'); const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; // const BabiliWebpackPlugin = require('babili-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const { VueLoaderPlugin } = require('vue-loader'); const { dependencies } = require('../package.json'); /** * List of node_modules to include in webpack bundle * * Required for specific packages like Vue UI libraries * that provide pure *.vue files that need compiling * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals */ const whiteListedModules = [ 'vue', 'vuetify', 'vue-router', 'vue-i18n', 'vuex', 'maven-artifact-version', '@vue/composition-api', '@xmcl/text-component', '@xmcl/model', 'three', 'three-orbit-controls', 'vue-virtual-scroll-list' ]; /** * @type {import('webpack').Configuration} */ const rendererConfig = { mode: process.env.NODE_ENV, // devtool: 'source-map', devtool: '#eval-source-map', // devtool: '#cheap-module-eval-source-map', entry: { renderer: path.join(__dirname, '../src/renderer/windows/main/index.ts'), logger: path.join(__dirname, '../src/renderer/windows/logger/index.ts'), setup: path.join(__dirname, '../src/renderer/windows/setup/index.ts'), }, externals: [ ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)), ], module: { rules: [ { test: /\.styl$/, loader: 'css-loader!stylus-loader?paths=node_modules/bootstrap-stylus/stylus/' }, { test: /\.css$/, use: ['vue-style-loader', 'css-loader'], }, { test: /\.vue$/, use: { loader: 'vue-loader', options: { extractCSS: process.env.NODE_ENV === 'production', loaders: { sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1', scss: 'vue-style-loader!css-loader!sass-loader', }, }, }, }, { test: /\.ts$/, use: [ 'cache-loader', { loader: 'thread-loader', }, { loader: 'ts-loader', options: { appendTsSuffixTo: [/\.vue$/], happyPackMode: true }, } ], exclude: /node_modules/, include: [path.join(__dirname, '../src/renderer'), path.join(__dirname, '../src/universal')], }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, use: { loader: 'url-loader', query: { limit: 10000, name: 'imgs/[name].[ext]', }, }, }, { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, use: { loader: 'url-loader', query: { limit: 10000, name: 'fonts/[name].[ext]', }, }, }, ], }, node: { __dirname: process.env.NODE_ENV !== 'production', __filename: process.env.NODE_ENV !== 'production', }, plugins: [ // new ForkTsCheckerWebpackPlugin({ // vue: true, // // eslint: true, // tsconfig: path.resolve(__dirname, '../tsconfig.json'), // }), new VueLoaderPlugin(), new MiniCssExtractPlugin({ filename: 'styles.css' }), new HtmlWebpackPlugin({ filename: 'main.html', chunks: ['renderer'], template: path.resolve(__dirname, '../src/index.ejs'), minify: { collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, }, nodeModules: process.env.NODE_ENV !== 'production' ? path.resolve(__dirname, '../node_modules') : false, }), new HtmlWebpackPlugin({ filename: 'logger.html', chunks: ['logger'], template: path.resolve(__dirname, '../src/index.ejs'), minify: { collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, }, nodeModules: process.env.NODE_ENV !== 'production' ? path.resolve(__dirname, '../node_modules') : false, }), new HtmlWebpackPlugin({ filename: 'setup.html', chunks: ['setup'], template: path.resolve(__dirname, '../src/index.ejs'), minify: { collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, }, nodeModules: process.env.NODE_ENV !== 'production' ? path.resolve(__dirname, '../node_modules') : false, }), new webpack.NoEmitOnErrorsPlugin(), ], output: { filename: '[name].js', libraryTarget: 'var', path: path.join(__dirname, '../dist/electron'), }, resolve: { alias: { '@renderer': path.join(__dirname, '../src/renderer'), '@': path.join(__dirname, '../src/renderer'), '@universal': path.join(__dirname, '../src/universal'), }, extensions: ['.ts', '.js', '.vue', '.json', '.css', '.node'], }, target: 'web', }; /** * Adjust rendererConfig for development settings */ if (process.env.NODE_ENV !== 'production') { rendererConfig.plugins.push( new webpack.DefinePlugin({ __static: `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`, }), ); } /** * Adjust rendererConfig for production settings */ if (process.env.NODE_ENV === 'production') { rendererConfig.devtool = ''; rendererConfig.plugins.push( new CopyWebpackPlugin([ { from: path.join(__dirname, '../static'), to: path.join(__dirname, '../dist/electron/static'), ignore: ['.*'], }, ]), new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"', }), new webpack.LoaderOptionsPlugin({ minimize: true, }), new BundleAnalyzerPlugin({ analyzerMode: 'static', generateStatsFile: true, reportFilename: path.join(__dirname, '../dist/renderer.report.html'), statsFilename: path.join(__dirname, '../dist/renderer.stat.json'), openAnalyzer: false, }), ); } module.exports = rendererConfig;
JavaScript
0.000055
@@ -3272,16 +3272,21 @@ %7Cgif%7Csvg +%7Cwebp )(%5C?.*)?
d9075909a8ff01c3829c814bd8d28630c4ab7201
fix some tests
test/patch/WebSocket.spec.js
test/patch/WebSocket.spec.js
'use strict'; describe('WebSocket', function () { var socket, TEST_SERVER_URL = 'ws://localhost:8001', flag; beforeEach(function (done) { socket = new WebSocket(TEST_SERVER_URL); socket.addEventListener('open', done); }); afterEach(function () { socket.close(); }); it('should work with addEventListener', function () { var parent = window.zone; socket.addEventListener('message', function (contents) { expect(window.zone.parent).toBe(parent); expect(contents).toBe('HI'); done(); }); socket.send('hi'); }); it('should respect removeEventListener', function (done) { var log = ''; function logOnMessage () { log += 'a'; expect(log).toEqual('a'); socket.removeEventListener('message', logOnMessage); socket.send('hi'); setTimeout(function () { expect(log).toEqual('a'); done(); }, 10); }; socket.addEventListener('message', logOnMessage); socket.send('hi'); }); it('should work with onmessage', function (done) { var parent = window.zone; socket.onmessage = function (contents) { expect(window.zone.parent).toBe(parent); expect(contents.data).toBe('hi'); done(); }; socket.send('hi'); }); it('should only allow one onmessage handler', function (done) { var log = ''; socket.onmessage = function () { log += 'a'; expect(log).toEqual('b'); done(); }; socket.onmessage = function () { log += 'b'; expect(log).toEqual('b'); done(); }; socket.send('hi'); }); it('should handle removing onmessage', function () { var log = ''; socket.onmessage = function () { log += 'a'; }; socket.onmessage = null; socket.send('hi'); expect(log).toEqual(''); }); });
JavaScript
0.00011
@@ -262,27 +262,75 @@ h(function ( -) %7B +done) %7B%0A socket.addEventListener('close', done); %0A socket. @@ -389,32 +389,36 @@ ner', function ( +done ) %7B%0A var pare @@ -565,24 +565,29 @@ contents +.data ).toBe(' HI');%0A @@ -582,10 +582,10 @@ Be(' -HI +hi ');%0A @@ -1064,32 +1064,124 @@ 'hi');%0A %7D);%0A%0A +// TODO(vicb) this test is not working%0A // https://github.com/angular/zone.js/issues/81%0A x it('should work @@ -1803,32 +1803,36 @@ age', function ( +done ) %7B%0A var log @@ -1956,34 +1956,92 @@ ');%0A - expect(log).toEqual('' +%0A setTimeout(function() %7B%0A expect(log).toEqual('');%0A done();%0A %7D, 500 );%0A
bf1bcf671ef131fbc403b520abfd1b1c1737b185
change min-char to max-char
test/rules/availableRules.js
test/rules/availableRules.js
import test from 'ava'; import rules from '../../lib/rules/availableRules'; test('rules endWithDot', (t) => { const rulesObj = { 'end-with-dot': false, }; const endWithDot = rules.endWithDot('input with dot.', { rules: rulesObj }).check(); const endWithoutDot = rules.endWithDot('input with dot', { rules: rulesObj }).check(); t.false(endWithDot); t.true(endWithoutDot); }); test('rules minChar', (t) => { const rulesObj = { 'min-char': 10, }; const notMinChar = rules.minChar('less', { rules: rulesObj }).check(); const minChar = rules.minChar('this are more than 10 characters', { rules: rulesObj }).check(); t.false(notMinChar); t.true(minChar); }); test('-1 in minChar', (t) => { const rulesObj = { 'min-char': -1, }; const shortText = rules.minChar('n', { rules: rulesObj }).check(); const longText = rules.minChar('this are more than 10 characters', { rules: rulesObj }).check(); t.true(shortText); t.true(longText); }); test('rules mxChar', (t) => { const rulesObj = { 'max-char': 72, }; const moreThanMaxChar = rules.maxChar('this are more than 72 characters, believe me or not but the value moreThanMaxChar will be false ;-P', { rules: rulesObj }).check(); const lessThanMaxChar = rules.maxChar('this are less than 72 characters', { rules: rulesObj }).check(); t.false(moreThanMaxChar); t.true(lessThanMaxChar); }); test('-1 in maxChar', (t) => { const rulesObj = { 'min-char': -1, }; const longText = rules.maxChar('this are more than 72 characters, believe me or not but the value moreThanMaxChar will be true ;-P', { rules: rulesObj }).check(); const shortText = rules.maxChar('this are less than 72 characters', { rules: rulesObj }).check(); t.true(longText); t.true(shortText); });
JavaScript
0.999262
@@ -1442,34 +1442,34 @@ esObj = %7B%0A 'm -in +ax -char': -1,%0A %7D;
16b659d114cdb69c1132de9d46bb5c1622cffc8e
Fix indentation
test/test-markdown-socket.js
test/test-markdown-socket.js
import assert from 'assert'; import fs from 'fs'; import helper from './lib/helper'; import http from 'http'; import MarkdownSocket from '../src/markdown-socket'; import { w3cwebsocket as WebSocket } from 'websocket'; describe('MarkdownSocket', () => { let server; let mdSocket; beforeEach(done => { helper.makeDirectory('md-root'); helper.createFile('md-root/test.md', '# hello'); server = http.createServer((req, res) => { res.end('hello'); }); mdSocket = new MarkdownSocket(helper.path('md-root')); mdSocket.listenTo(server); server.listen(1234, done); }); afterEach(done => { helper.clean(); mdSocket.close(); server.close(done); }); it('handles a websocket connection', done => { let client = new WebSocket('ws://localhost:1234/test.md'); client.onopen = () => { done(); }; }); it('cannot handle a non markdown connection', done => { let client = new WebSocket('ws://localhost:1234'); client.onerror = () => { done(); }; }); it('opens a Markdown file and sends the parsed HTML', done => { let client = new WebSocket('ws://localhost:1234/test.md'); client.onmessage = message => { assert.equal(message.data, '<h1 id="hello">hello</h1>\n'); done(); }; }); it('sends parsed HTML data again when the file is updated', done => { const callback = err => { if (err) { done(err); } }; let called = 0; let client = new WebSocket('ws://localhost:1234/test.md'); client.onmessage = message => { switch (called) { case 0: assert.equal(message.data, '<h1 id="hello">hello</h1>\n'); fs.writeFile(helper.path('md-root/test.md'), '```js\nvar a=10;\n```', callback); break; case 1: assert.equal(message.data, '<pre><code class="hljs language-js"><span class="hljs-keyword">var</span> a=<span class="hljs-number">10</span>;\n</code></pre>\n'); fs.writeFile(helper.path('md-root/test.md'), '* nested\n * nnested\n * nnnested', callback); break; case 2: assert.equal(message.data, '<ul>\n<li>nested\n<ul>\n<li>nnested\n<ul>\n<li>nnnested</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n'); done(); break; } called += 1; }; }); it('ignores when there is no file for the path', done => { let client = new WebSocket('ws://localhost:1234/no-file.md'); client.onmessage = message => { assert.equal(message.data, 'Not found'); done(); }; }); });
JavaScript
0.017244
@@ -1768,26 +1768,24 @@ 1:%0A - assert.equal
78f419860447c215946d54413844f87991c31c1c
Add sunburst toPNG() test
test/test.charts.sunburst.js
test/test.charts.sunburst.js
describe('Sunburst', () => { beforeEach(() => { //Append default chart div var div = document.createElement('div'); div.innerHTML = '<div id="chart"></div>'; document.body.appendChild(div); }); afterEach(() => { var el = document.getElementById('chart'); el.parentNode.removeChild(el); }); describe('constructor()', () => { it('throws a "Missing constructor parameters" if the data parameter is missing', () => { assert.throws(() => { var chart = new Sunburst(); }, Error, 'Missing constructor parameters'); }); it('will construct a bar chart given some data', () => { var data = { "name": "sequences", "children": [ { "name": "home", "children": [ { "name": "home", "value": 50 }, { "name": "about", "children": [ { "name": "contact", "value": 25 } ] }, { "name": "product", "children": [ { "name": "product", "children": [ { "name": "cart", "value": 25 } ] } ] } ] } ] }; var chart = new Sunburst(data); assert.isOk(chart); }); it('throws a "Wrong data format" TypeError if data is not an object neither an array', () => { var data = 'wrong parameter'; assert.throws(() => { var chart = new Sunburst(data); }, TypeError, 'Wrong data format'); }); }); describe('chart functions ', () => { it.skip('toPNG()', (done) => { // TODO var data = [{ key: 'serie1', values: [{ x: 0, y: 1 }, { x: 1, y: 2 }] }]; var chart = new Barchart(data); chart.draw(); //wait for image creation setTimeout(() => { var result = chart.toPNG((uri) => { assert.isOk(uri); }); done(); }, 500); }); }); });
JavaScript
0.000003
@@ -1686,13 +1686,8 @@ it -.skip ('to @@ -1741,69 +1741,662 @@ a = -%5B%7B key: 'serie1' +%7B%0A %22name%22: %22sequences%22,%0A %22children%22: %5B%0A %7B %22name%22: %22home%22,%0A %22children%22: %5B%0A %7B %22name%22: %22home%22 , +%22 value -s: %5B%7B x: 0, y: 1 %7D, %7B x: 1, y +%22: 50 %7D,%0A %7B %22name%22: %22about%22,%0A %22children%22: %5B%0A %7B %22name%22: %22contact%22,%0A %22value%22: 25%0A %7D%0A %5D%0A %7D,%0A %7B %22name%22: %22product%22,%0A %22children%22: %5B%0A %7B %22name%22: %22product%22,%0A %22children%22: %5B%0A %7B %22name%22: %22cart%22, %22value%22 : 2 +5 %7D -%5D %7D%5D +%0A %5D%0A %7D%0A %5D%0A %7D%0A %5D%0A %7D%0A %5D%0A %7D ;%0A @@ -2419,15 +2419,15 @@ new -Barchar +Sunburs t(da
c71fe1fe634505137d9122ae907982fa52d064a7
Update gulpfile.js
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'); var $ = require('gulp-load-plugins')(); var del = require('del'); var runSequence = require('run-sequence'); var path = require('path'); var through = require('through2'); var swig = require('swig'); var browserSync = require('browser-sync').create(); var reload = browserSync.reload; var site = require('./site.json'); var dist = './dist'; gulp.task('default', ['clean'], function(cb) { runSequence( ['scripts'], ['styles', 'assets', 'pages'], ['reorg'], ['prod-clean'], cb); }); gulp.task('clean', del.bind(null, [dist])); gulp.task('prod-clean', function(cb) { del.sync([dist+'/**/*.map', '!'+dist]); }); /* Upload the site */ gulp.task('deploy', function () { return $.surge({ project: dist, domain: 'collectivebuilding.info' }); }); /* Compiles and builds styles */ gulp.task('styles', function() { return gulp.src(['assets/styles/**/*.styl', 'components/**/*.styl']) .pipe($.plumber({errorHandler: handleErrors})) .pipe($.sourcemaps.init()) .pipe($.stylus({ compress: true })) .pipe($.autoprefixer()) .pipe($.csso()) .pipe($.concat('styles.css')) .pipe($.sourcemaps.write('.')) .pipe(gulp.dest(dist+'/css')) }); /* Copies images, keeping folder structure */ gulp.task('assets', function () { return gulp.src('assets/**/*.{png,jpg,svg,ico}') .pipe(gulp.dest(dist)); }); /* Generates an HTML file for each md file in pages directory */ gulp.task('pages', function () { return gulp.src('content/*.md') .pipe($.plumber({errorHandler: handleErrors})) .pipe($.frontMatter({property: 'page', remove: true})) .pipe($.marked()) .pipe(applyTemplate()) .pipe($.htmlmin({ removeComments: true, collapseWhitespace: true })) .pipe($.foreach(function(stream, file) { // place each page into its own directory as the index file for more friendly URLs var name = path.basename(file.path, '.html'); return stream .pipe($.rename('index.html')) .pipe($.if((name === 'index'), gulp.dest(dist))) .pipe($.if((name !== 'index'), gulp.dest(dist+'/'+name))); })); }); /* Shift some things around to tidy up */ gulp.task('reorg', function(cb) { runSequence( ['move-404'], ['del-mess'], cb); }); gulp.task('move-404', function () { return gulp.src(dist+'/404/index.html') .pipe($.rename('404.html')) .pipe(gulp.dest(dist)); }); gulp.task('del-mess', function(cb) { del.sync([dist+'/404/']); del.sync([dist+'/legal/']); del.sync([dist+'/community/']); }); /* Combines component scripts */ gulp.task('scripts', function () { return gulp.src('components/**/*.js') .pipe($.plumber({errorHandler: handleErrors})) .pipe($.sourcemaps.init()) .pipe($.concat('scripts.js')) .pipe($.sourcemaps.write('.')) .pipe(gulp.dest(dist+'/js')); }); /* Fires up a server for development */ gulp.task('dev', ['styles', 'assets', 'pages', 'scripts'], function() { browserSync.init({ notify: false, server: { baseDir: [dist] } }); gulp.watch(['assets/styles/**/*.styl', 'components/**/*.styl'], ['styles', reload]); gulp.watch(['components/**/*.js'], ['scripts', reload]); gulp.watch(['templates/*.html', 'content/**/*.md', 'components/**/*.html'], ['pages', reload]); gulp.watch(['assets/**/*.{png,jpg,svg,ico}'], ['assets', reload]); }); // doesn't work in windows // gulp.task('deploy', ['default'], function() { // return gulp.src(dist+'/**/*.*') // .pipe($.ghPages()); // }); /*---------------------------------------------------------------------- HELPERS */ /** * Generates an HTML file based on a template and file metadata */ function applyTemplate() { return through.obj(function(file, enc, cb) { var data = { site: site, page: file.page, content: file.contents.toString() }; var templateFile = path.join(__dirname, 'templates', file.page.template + '.html'); var tpl = swig.compileFile(templateFile, {cache: false}); file.contents = new Buffer(tpl(data), 'utf8'); this.push(file); cb(); }); } /** * Handle errors so the stream isn't broken, and pops up an OS alert to keep the user informed of build errors */ function handleErrors() { var args = Array.prototype.slice.call(arguments); // Send error to notification center with gulp-notify $.notify.onError({ title: "Build error", message: "<%= error%>", showStack: true }).apply(this, args); // Keep gulp from hanging on this task this.emit('end'); }
JavaScript
0.000001
@@ -372,19 +372,19 @@ t = './d -ist +ocs ';%0A%0Agulp @@ -665,147 +665,8 @@ );%0A%0A -/*%0A%09Upload the site%0A */%0Agulp.task('deploy', function () %7B%0A%09return $.surge(%7B%0A%09%09project: dist,%0A%09%09domain: 'collectivebuilding.info'%0A%09%7D);%0A%7D);%0A%0A /*%0A%09
ad9c6281fdb7b53c61abd39cc057ddf8963587fa
fix parse errors with useref and copy ui-bootstrap
gulpfile.js
gulpfile.js
/** * Created by Kelvin on 8/4/2016. */ var gulp = require('gulp'); var del = require('del'); var merge = require('merge-stream'); var runSequence = require('run-sequence'); var minifyCss = require('gulp-minify-css'); var uglify = require('gulp-uglify'); var ngAnnotate = require('gulp-ng-annotate'); var gulpif = require('gulp-if'); var revReplace = require('gulp-rev-replace'); var useref = require('gulp-useref'); var rev = require('gulp-rev'); var htmlmin = require('gulp-htmlmin'); // delete everything in the www folder gulp.task('clean-dist', function () { return del([ 'dist/**/*' ]); }); // copy over images, fonts and 3rd party css html gulp.task('copy-files', function() { var imgs = gulp.src('app/images/**/*') .pipe(gulp.dest('dist/images')); // copy over css files var cssFiles = ['app/css/swipebox.css', 'app/css/style-v2.css', 'app/css/style-responsive-v2.css']; var css = gulp.src(cssFiles) .pipe(minifyCss()) .pipe(gulp.dest('dist/css')); var preMinifiedCss = gulp.src('app/css/animate.min.css') .pipe(gulp.dest('dist/css')); var fonts = gulp.src('app/fonts/**/*') .pipe(gulp.dest('dist/fonts')); // copy over urip js files var minifiedJSArray = ['app/js/minified/SmoothScroll.min.js', 'app/js/minified/classie.min.js', 'app/js/minified/jquery.nav.min.js', 'app/js/minified/jquery.swipebox.min.js', 'app/js/minified/expandableGallery.min.js', 'app/js/minified/jquery.counterup.min.js', 'app/js/minified/jquery-css-transform.min.js', 'app/js/minified/jquery-animate-css-rotate-scale.min.js', 'app/js/minified/jquery.quicksand.min.js', 'app/js/minified/headhesive.min.js', 'app/js/minified/scrollReveal.min.js', 'app/js/minified/jquery.countdown.min.js']; var preMinifiedJS = gulp.src(minifiedJSArray) .pipe(gulp.dest('dist/js/minified')); var jsFiles = gulp.src(['app/js/modernizr.js', 'app/js/v2.js', 'app/js/jquery.stellar.js']) .pipe(uglify()) .pipe(gulp.dest('dist/js')); var templates = gulp.src('app/app/**/*.html') .pipe(htmlmin({removeComments: true, collapseWhitespace: true, conservativeCollapse: true})) .pipe(gulp.dest('dist/app')); return merge(imgs, css, preMinifiedCss,preMinifiedJS,jsFiles,templates, fonts); }); gulp.task('build-html', function () { var condition = function(file) { var filesToRev = { 'vendor.css': true, 'app.js': true, 'vendor.js': true, 'app.css': true }; return filesToRev[file.basename]; }; // concatenate, annotate, minify our vendor js files // concatenate, annotate, minify our js files return gulp.src("app/index.html") .pipe(useref()) // Concatenate with gulp-useref .pipe(gulpif('js/*.js',ngAnnotate())) .pipe(gulpif('js/*.js',uglify())) .pipe(gulpif('css/*.css', minifyCss())) // Minify vendor CSS sources .pipe(gulpif(condition, rev())) // Rename the concatenated files .pipe(revReplace()) // Substitute in new filenames .pipe(htmlmin({removeComments: true})) .pipe(gulp.dest('dist')); }); var imagemin = require('gulp-imagemin'); gulp.task('image-min', function() { return gulp.src('app/images/thumbnail-strip/*') .pipe(imagemin()) .pipe(gulp.dest('dist/images')); }); gulp.task('build', function(callback) { runSequence('clean-dist', ['copy-files'], 'build-html', callback); });
JavaScript
0
@@ -2054,24 +2054,167 @@ ist/js'));%0A%0A + var uiBootstrap = gulp.src('app/js/ui-bootstrap/ui-bootstrap-custom-tpls-2.0.1.min.js')%0A .pipe(gulp.dest('dist/js/ui-bootstrap'));%0A%0A var temp @@ -3290,32 +3290,34 @@ lenames%0A +// .pipe(htmlmin(%7Br @@ -3382,161 +3382,137 @@ );%0A%0A -var imagemin = require('gulp-imagemin');%0A%0Agulp.task('image-min', function() %7B%0A return gulp.src('app/images/thumbnail-strip/*')%0A .pipe(imagemin( +%0A%0Agulp.task('minify-index-html', function() %7B%0A return gulp.src('dist/index.html')%0A .pipe(htmlmin(%7BremoveComments: true%7D ))%0A @@ -3535,31 +3535,24 @@ p.dest('dist -/images '));%0A%7D);%0A%0A%0A%0A @@ -3666,16 +3666,37 @@ d-html', + 'minify-index-html', %0A
927bfd4b3bbfb907778c8f382b85fefcacba0b3c
Update list of cached files
gulpfile.js
gulpfile.js
/** * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * 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. */ 'use strict'; /* eslint-env node */ /* eslint require-jsdoc: 0 */ const del = require('del'); const gulp = require('gulp'); const fs = require('fs-extra'); const semver = require('semver'); const copy = require('gulp-copy'); const csso = require('gulp-csso'); const ghPages = require('gh-pages'); const terser = require('gulp-terser'); const eslint = require('gulp-eslint'); const connect = require('gulp-connect'); const htmlmin = require('gulp-htmlmin'); const replace = require('gulp-replace'); const workbox = require('workbox-build'); const {series, parallel} = require('gulp'); const inlinesource = require('gulp-inline-source'); let _appVersion; const SRC_DIR = 'src'; const DEST_DIR = 'build'; const TEMP_DIR = '.tmp'; const TERSER_OPTS = { compress: { drop_console: true, }, output: { beautify: false, max_line_len: 120, indent_level: 2, }, }; /** *************************************************************************** * Bump Version Number *****************************************************************************/ /** * Bumps the version number in the package.json file. * * @param {string} release - Type of release patch|minor|major. * @return {Promise}. */ function bumpVersion(release) { release = release || 'patch'; return fs.readJson('package.json') .then((data) => { const currentVersion = data.version; const nextVersion = semver.inc(currentVersion, release); data.version = nextVersion; return fs.writeJson('package.json', data, {spaces: 2}); }); } function bumpPatch() { return bumpVersion('patch'); } function bumpMinor() { return bumpVersion('patch'); } function bumpMajor() { return bumpVersion('patch'); } exports.bumpPatch = bumpPatch; exports.bumpMinor = bumpMinor; exports.bumpMajor = bumpMajor; /** *************************************************************************** * Clean *****************************************************************************/ function clean() { return del(['build/**', '.tmp/**']); } exports.clean = clean; /** *************************************************************************** * Linting & Doc Generation *****************************************************************************/ function lint() { const filesToLint = [ 'gulpfile.js', 'src/index.html', 'src/inline-scripts/*', ]; const config = { useEslintrc: true, }; return gulp.src(filesToLint) .pipe(eslint(config)) .pipe(eslint.format()) .pipe(eslint.failAfterError()); } exports.lint = lint; /** *************************************************************************** * Generate Service Worker *****************************************************************************/ function generateServiceWorker() { return workbox.generateSW({ globDirectory: DEST_DIR, globPatterns: [ '**/*.{html,js,png,ico,mp3,json}', ], swDest: `${DEST_DIR}/service-worker.js`, clientsClaim: true, skipWaiting: true, offlineGoogleAnalytics: true, runtimeCaching: [ { urlPattern: /^https:\/\/fonts\.gstatic\.com/, handler: 'CacheFirst', options: { cacheName: 'googleapis', expiration: {maxEntries: 30}, }, }, ], }).then(({warnings}) => { for (const warning of warnings) { // eslint-disable-next-line no-console console.log(warning); } }); } exports.generateServiceWorker = generateServiceWorker; /** *************************************************************************** * Build *****************************************************************************/ function buildCSS() { const cssoOpts = { sourceMap: true, }; return gulp.src(`${SRC_DIR}/styles/*.css`) .pipe(csso(cssoOpts)) .pipe(gulp.dest(`${TEMP_DIR}/styles/`)); } function buildJS() { return gulp.src(`${SRC_DIR}/inline-scripts/*.js`) .pipe(terser(TERSER_OPTS)) .pipe(gulp.dest(`${TEMP_DIR}/inline-scripts`)); } function copyHTML() { const filesToCopy = [ `${SRC_DIR}/index.html`, ]; return gulp.src(filesToCopy) .pipe(copy(TEMP_DIR, {prefix: 1})); } function buildHTML() { const inlineOpts = { compress: false, pretty: false, }; const htmlMinOpts = { collapseWhitespace: true, minifyCSS: true, minifyJS: false, removeComments: true, }; const buildDate = new Date().toISOString(); const packageJSON = fs.readJsonSync('package.json'); _appVersion = packageJSON.version; return gulp.src(`${TEMP_DIR}/index.html`) .pipe(inlinesource(inlineOpts)) .pipe(replace('[[BUILD_DATE]]', buildDate)) .pipe(replace('[[VERSION]]', _appVersion)) .pipe(htmlmin(htmlMinOpts)) .pipe(gulp.dest(TEMP_DIR)); } function copyStatic() { const filesToCopy = [ `${TEMP_DIR}/index.html`, `${SRC_DIR}/icons/**/*`, `${SRC_DIR}/images/**/*`, `${SRC_DIR}/sounds/**/*`, `${SRC_DIR}/manifest.json`, `${SRC_DIR}/robots.txt`, `${SRC_DIR}/humans.txt`, ]; return gulp.src(filesToCopy) .pipe(copy(DEST_DIR, {prefix: 1})); } exports.buildCSS = buildCSS; exports.buildJS = buildJS; exports.buildHTML = buildHTML; exports.copyStatic = copyStatic; exports.build = series( clean, parallel(copyHTML, buildCSS, buildJS), buildHTML, copyStatic ); exports.buildProd = series( clean, parallel(copyHTML, buildCSS, buildJS), buildHTML, copyStatic, generateServiceWorker ); /** *************************************************************************** * Development - serving *****************************************************************************/ function serveDev() { return connect.server({root: 'src'}); } function serveProd() { return connect.server({root: 'build'}); } exports.serve = serveDev; exports.serveProd = serveProd; /** *************************************************************************** * Deploy *****************************************************************************/ function deployToGHPages(cb) { const opts = { message: 'Auto-generated deploy commit.', }; if (_appVersion) { opts.tag = _appVersion; } return ghPages.publish('build', opts, (err) => { if (err) { throw err; } cb(); }); } exports.deployProd = series( lint, clean, bumpPatch, parallel(copyHTML, buildCSS, buildJS), buildHTML, copyStatic, generateServiceWorker, deployToGHPages );
JavaScript
0
@@ -3511,20 +3511,19 @@ png, -ico,mp3,json +jpg,gif,ico %7D',%0A
c67780863445db5a195b25f2e0a4b5a7171877da
Copy Bootstrap files to ./build
gulpfile.js
gulpfile.js
var gulp = require('gulp'), jade = require('gulp-jade'), watch = require('gulp-watch'), sass = require('gulp-sass'), minify = require('gulp-minify'); var templates = './src/templates/**/*.jade'; var styles = './src/sass/**/*.scss'; var images = [ './img/**/*.jpg', './img/**/*.png' ]; gulp.task('templates', function() { gulp.src(templates) .pipe(jade()) .pipe(minify()) .pipe(gulp.dest('./build/')); }); gulp.task('styles', function() { gulp.src(styles) .pipe(sass().on('error', sass.logError)) .pipe(minify()) .pipe(gulp.dest('./build/css/')); }); gulp.task('images', function() { gulp.src(images) .pipe(gulp.dest('./build/img/')); }); gulp.task('watch', function() { var sources = [templates, styles]; gulp.src(sources) .pipe(watch(sources)); }); gulp.task('dev', function() { gulp.src(templates) .pipe(watch(templates, {verbose: true})) .pipe(jade()) .pipe(gulp.dest('./build/')); gulp.src(styles) .pipe(watch(styles, {verbose: true})) .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('./build/css/')); }); gulp.task('default', ['templates', 'styles', 'images']);
JavaScript
0
@@ -460,32 +460,268 @@ ', function() %7B%0A + // Bootstrap base%0A gulp.src('./lib/bootstrap-theme/dist/toolkit-startup.min.*')%0A .pipe(gulp.dest('./build/css/'));%0A gulp.src('./lib/bootstrap-theme/dist/toolkit.min.js*')%0A .pipe(gulp.dest('./build/js/'));%0A%0A // Customisations%0A gulp.src(style
303c39dd973fe8b635667b66937b9c2cea9a2c54
add watch task
gulpfile.js
gulpfile.js
'use strict'; const fs = require('fs'); const gulp = require('gulp'); const handlebars = require('gulp-compile-handlebars'); const rename = require('gulp-rename'); const uglify = require('gulp-uglify'); const pump = require('pump'); /** * load a bunch of files. * * @param {object} manifest An object specifying the files you want to load * @returns {object} An object containing the contents of the files */ function loadFiles(manifest) { let files = []; for ( let name in manifest ) { files.push({ path: manifest[name], name: name }); } const tasks = files.map((file) => { return new Promise((resolve, reject) => { fs.readFile(file.path, {encoding: 'utf-8'}, function(err, data) { if ( err ) { reject(err); } else { resolve(data); } }); }); }); return Promise.all(tasks) .catch((err) => { throw err; }) .then((results) => { let finalOut = {}; for ( let i = 0; i < results.length; ++i ) { finalOut[files[i].name] = results[i]; } return finalOut; }); } gulp.task('build', function() { return loadFiles({ ent: 'entities.json', chars: 'chars.txt' }).then((result) => { const ent = JSON.parse(result.ent); let chars = result.chars.split(''); chars = chars.map(function(c) { return ent[c] || c; }); const data = { symbols: chars }; const options = { compile: { noEscape: true }, helpers: { chars: function() { const result = []; for ( let i = 0; i < this.symbols.length; ++i ) { result.push("\"" + this.symbols[i] + "\""); } return "[" + result.toString() + "]"; } } }; return gulp.src('src/*.js') .pipe(handlebars(data, options)) .pipe(gulp.dest('dist/')) }).catch((err) => { throw err; }); }); gulp.task('minify', ['build'], (cb) => { const uglifyOpts = { preserveComments: 'license' }; /** * gulp-uglify recommends the use of the `pump` module * for better error reporting * * https://github.com/terinjokes/gulp-uglify/tree/master/docs/why-use-pump */ pump([ gulp.src('dist/*[!.min].js'), uglify(uglifyOpts), rename({suffix: '.min'}), gulp.dest('dist/') ], cb); }); gulp.task('default', ['build', 'minify']);
JavaScript
0.001904
@@ -2720,32 +2720,112 @@ %5D, cb);%0A%7D);%0A%0A +gulp.task('watch', () =%3E %7B%0A gulp.watch('src/*.js', %5B'build', 'minify'%5D)%0A%7D);%0A%0A gulp.task('defau @@ -2847,12 +2847,21 @@ 'minify' +, 'watch' %5D);%0A
626e33eb3d21069ac9c6d0c352e5e6a48011439a
Fix CSS relative pathing
gulpfile.js
gulpfile.js
var babelify = require("babelify"), browserify = require("browserify"), cleanhtml = require("gulp-cleanhtml"), concat = require("gulp-concat"), del = require("del"), eslint = require("gulp-eslint"), globby = require("globby"), gulp = require("gulp"), gutil = require("gulp-util"), karma = require("karma"), merge = require("merge-stream"), cleanCSS = require("gulp-clean-css"), nunjucksGulp = require("./util/nunjucks-gulp"), rename = require("gulp-rename"), source = require("vinyl-source-stream"), uglify = require("gulp-uglify"); var srcDir = "src/"; var config = { appFile: "app.js", buildDir: "build/", distDir: "dist/", srcDir: srcDir }; // Build all the things! gulp.task("build", ["build:copy", "build:css", "build:html", "build:js"]); // Clean build directory gulp.task("build:clean", function() { return del(["build/*", "dist/*"]); }); // Copy files that don't require any build process gulp.task("build:copy", function() { gulp.src(["src/images/*"]). pipe(gulp.dest("build/images")); return gulp.src(["src/static/*"]). pipe(gulp.dest("build/static")); }); // Build CSS gulp.task("build:css", function() { return gulp.src("src/css/entries/*.css"). pipe(cleanCSS({ keepSpecialComments: 0, relativeTo: "", root: "", })). pipe(gulp.dest("build/css")); }); // Build extension! gulp.task("build:dist", ["build:dist:copy", "build:dist:js"]); gulp.task("build:dist:copy", ["build"], function() { return gulp.src(["build/**/*"]). pipe(gulp.dest("dist")); }); gulp.task("build:dist:js", ["build:js", "build:dist:copy"], function() { del(["dist/js/*"]); return gulp.src(["build/js/**/*.js"]). pipe(uglify()). on('error', gutil.log). pipe(gulp.dest("dist/js")); }); // Compile and compress HTML files gulp.task("build:html", function() { return gulp.src(["src/html/**/*.html", "!src/html/templates/**/*"]) .pipe(nunjucksGulp({ templateDir: srcDir + "html/templates", })) .pipe(cleanhtml()) .pipe(gulp.dest("build")); }); // Build the browserify bundle including the app gulp.task("build:js", ["lint"], function(done) { function basename(filePath) { var components = filePath.split(/\//); return components[components.length - 1]; } function bundleEntry(entryFile) { var bundle = browserify({ debug: true, entries: entryFile }); return bundle. transform("babelify", { presets: ["es2015"] }). bundle(). pipe(source(basename(entryFile))). on("error", function(err) { gutil.log(err); this.emit("end"); }). pipe(gulp.dest(config.buildDir + "js")); } var entries = globby.sync([config.srcDir + "js/entries/*.js"]), bundles = [], i; for (var i = 0; i < entries.length; ++i) { bundles.push(bundleEntry(entries[i])); } return merge.apply(this, bundles). on("alldone", done); }); // Lint JS gulp.task("lint", function() { return gulp.src("src/js/**/*.js"). pipe(eslint()). pipe(eslint.format()); }); // Test for the more vanilla, transpiled build product. gulp.task("test", ["lint"], function(done) { var opts = { configFile: __dirname + "/config/karma/build.conf.js", singleRun: true }; new karma.Server.start(opts, done); }); // Test task for situations where more introspection is needed. gulp.task("test:chrome", ["lint"], function(done) { var opts = { autoWatch: true, browsers: ["Chrome"], configFile: __dirname + "/config/karma/build.conf.js" }; new karma.Server.start(opts, done); }); // Watch files and run tasks on changes gulp.task("watch", function() { paths = [ "config/**/*.js", "gulpfile.js", "src/**/*.*", "test/**/*.js" ]; gulp.watch(paths, ["build"]); }); gulp.task("default", ["test"]);
JavaScript
0.000021
@@ -1280,16 +1280,18 @@ iveTo: %22 +./ %22,%0A
e78d872bc13cf45e980ea14740288328c2a16c46
Update gulp file
gulpfile.js
gulpfile.js
'use strict' var gulp = require('gulp') var electron = require('electron-connect').server.create() // gulp.task('default', ['serve']) // gulp.task('serve', () => { // console.log('watching') // // Start browser process // electron.start() // // Reload renderer process // gulp.watch(['index.js', 'player.js', 'index.html', 'assets/css/*.css', 'modules/*.js'], electron.restart) // // Reload renderer process // // gulp.watch(['player.js', 'templates/index.tmpl'], electron.restart) // }) gulp.task('serve', () => { electron.start() gulp.watch(['index.js', 'player.js', 'index.html', 'assets/css/*.css', 'modules/*.js']).on('change', function(event) { console.log(event.path); console.log(event.type); electron.restart // code to execute }); });
JavaScript
0.000001
@@ -98,416 +98,8 @@ ()%0A%0A -// gulp.task('default', %5B'serve'%5D)%0A%0A// gulp.task('serve', () =%3E %7B%0A// console.log('watching')%0A%0A// // Start browser process%0A// electron.start()%0A%0A// // Reload renderer process%0A// gulp.watch(%5B'index.js', 'player.js', 'index.html', 'assets/css/*.css', 'modules/*.js'%5D, electron.restart)%0A%0A// // Reload renderer process%0A// // gulp.watch(%5B'player.js', 'templates/index.tmpl'%5D, electron.restart)%0A// %7D)%0A%0A gulp @@ -247,142 +247,46 @@ e', -function (event) + =%3E %7B%0A - console.log(event.path);%0A console.log(event.type);%0A electron.restart%0A // code to execute +electron.restart %0A %7D) -; %0A%7D) -; %0A
ebfcb400912080883d4929d65f822090a34e3264
Add dev task to watch both src, and docs
gulpfile.js
gulpfile.js
var gulp = require("gulp"); var sass = require("gulp-sass"); var nano = require("gulp-cssnano"); var sourcemaps = require("gulp-sourcemaps"); /* Build civil.css */ gulp.task("build", function () { gulp.src("./sass/**/*.scss") .pipe(sourcemaps.init()) .pipe(sass({ //outputStyle: "compressed", includePaths: ["./bower_components/bourbon/app/assets/stylesheets/"] })) .pipe(nano()) .pipe(sourcemaps.write(".")) .pipe(gulp.dest("./dist")); }); gulp.task("build:watch", ["build"], function () { gulp.watch("./sass/**/*.scss", ["build"]); }); /* Build docs */ gulp.task("build:docs", ["copy:docs"], function () { gulp.src("./docs/sass/**/*.scss") .pipe(sourcemaps.init()) .pipe(sass({ //outputStyle: "compressed", includePaths: [ "./bower_components/bourbon/app/assets/stylesheets", "./sass"] })) .pipe(nano()) .pipe(sourcemaps.write(".")) .pipe(gulp.dest("./docs/css")); }); gulp.task("build:docs:watch", ["build:docs"], function () { gulp.watch("./docs/sass/**/*.scss", ["build:docs"]); }); /* Copy civil.css latest build for docs */ gulp.task("copy:docs", function () { gulp.src(["./dist/civil.css", "./dist/syntax.css"]) .pipe(gulp.dest("./docs/css")); gulp.src("dist/civil.js") .pipe(gulp.dest("./docs/js")); }); gulp.task("default", ["src", "docs"]); gulp.task("src", ["build"]); gulp.task("docs", ["build:docs"]);
JavaScript
0
@@ -662,23 +662,8 @@ cs%22, - %5B%22copy:docs%22%5D, fun @@ -1412,32 +1412,193 @@ ocs/js%22));%0A%7D);%0A%0A +/*%0A Watch src and docs%0A */%0Agulp.task(%22dev%22, function () %7B%0A gulp.watch(%22./sass/**/*.scss%22, %5B%22build%22%5D);%0A gulp.watch(%22./docs/sass/**/*.scss%22, %5B%22docs%22%5D);%0A%7D);%0A%0A gulp.task(%22defau @@ -1664,24 +1664,37 @@ sk(%22docs%22, %5B +%22copy:docs%22, %22build:docs%22
b62ce8a4f7283718b1ce6000e4ec9f5e91b18194
update build scripts
gulpfile.js
gulpfile.js
const gulp = require('gulp'); const glob = require('glob'); const shell = cmd => require('child_process').execSync(cmd, { stdio: [0, 1, 2] }); const del = require('del'); const source = require('vinyl-source-stream'); const buffer = require('vinyl-buffer'); const $ = require('gulp-load-plugins')(); const seq = require('run-sequence'); const browserify = require('browserify'); const watchify = require('watchify'); const tsify = require('tsify'); const minify = require('gulp-uglify/composer')(require('uglify-es'), console); const Server = require('karma').Server; const pkg = require('./package.json'); const config = { browsers: ['Chrome', 'Firefox'].concat((os => { switch (os) { case 'Windows_NT': return ['Edge']; case 'Darwin': return []; default: return []; } })(require('os').type())), ts: { dist: { src: [ '*.ts' ], dest: 'dist' }, test: { src: [ '*.ts', 'src/**/*.ts', 'test/**/*.ts' ], dest: 'dist' } }, banner: [ `/*! ${pkg.name} v${pkg.version} ${pkg.repository.url} | (c) 2012, ${pkg.author} | ${pkg.license} License */`, '' ].join('\n'), module: ` (function (root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); } else if (typeof module === 'object' && module.exports) { module.exports = factory(); } else { root.returnExports = factory(); } }(typeof self !== 'undefined' ? self : this, function () { return require('atomic-promise'); })); `, }; function compile({ src, dest }, opts = {}) { let done = true; const force = !!opts.plugin && opts.plugin.includes(watchify); const b = browserify(Object.values(src).map(p => glob.sync(p)), { cache: {}, packageCache: {}, ...opts, }) .require(`./index.ts`, { expose: pkg.name }) .plugin(tsify, { global: true, ...require('./tsconfig.json').compilerOptions }) .on('update', () => void bundle()); return bundle(); function bundle() { console.time('bundle'); return b .bundle() .on("error", err => done = console.log(err + '')) .pipe(source(`${pkg.name}.js`)) .pipe(buffer()) .once('finish', () => console.timeEnd('bundle')) .once("finish", () => done || force || process.exit(1)) .pipe(gulp.dest(dest)); } } gulp.task('ts:watch', function () { return compile(config.ts.test, { plugin: [watchify], }); }); gulp.task('ts:test', function () { return compile(config.ts.test); }); gulp.task('ts:dist', function () { return compile(config.ts.dist) .pipe($.unassert()) .pipe($.header(config.banner)) .pipe($.footer(config.module)) .pipe(gulp.dest(config.ts.dist.dest)) .pipe($.rename({ extname: '.min.js' })) .pipe(minify({ output: { comments: /^!/ } })) .pipe(gulp.dest(config.ts.dist.dest)); }); gulp.task('karma:watch', function (done) { new Server({ configFile: __dirname + '/karma.conf.js', browsers: config.browsers, preprocessors: { 'dist/*.js': ['espower'] }, }, done).start(); }); gulp.task('karma:test', function (done) { new Server({ configFile: __dirname + '/karma.conf.js', browsers: config.browsers, preprocessors: { 'dist/*.js': ['coverage', 'espower'] }, reporters: ['dots', 'coverage'], singleRun: true }, done).start(); }); gulp.task('karma:ci', function (done) { new Server({ configFile: __dirname + '/karma.conf.js', browsers: config.browsers, preprocessors: { 'dist/*.js': ['coverage', 'espower'] }, reporters: ['dots', 'coverage', 'coveralls'], singleRun: true }, done).start(); }); gulp.task('clean', function () { return del([config.ts.dist.dest, './gh-pages/assets/**/lib']); }); gulp.task('install', function () { shell('npm i --no-shrinkwrap'); }); gulp.task('update', function () { shell('bundle update'); shell('ncu -ua'); shell('npm i -DE typescript@next --no-shrinkwrap'); shell('npm i --no-shrinkwrap'); }); gulp.task('watch', ['clean'], function (done) { seq( 'ts:test', [ 'ts:watch', 'karma:watch' ], done ); }); gulp.task('test', ['clean'], function (done) { seq( 'ts:test', 'karma:test', 'ts:dist', done ); }); gulp.task('site', ['dist'], function () { return gulp.src([ `dist/${pkg.name}.js`, ]) .pipe(gulp.dest('./gh-pages/assets/js/lib')); }); gulp.task('view', ['site'], function () { shell('bundle exec jekyll serve -s ./gh-pages -d ./gh-pages/_site --incremental'); }); gulp.task('dist', ['clean'], function (done) { seq( 'ts:dist', done ); }); gulp.task('ci', ['clean'], function (done) { seq( 'ts:test', 'karma:ci', 'karma:ci', 'karma:ci', 'dist', 'site', done ); });
JavaScript
0.000003
@@ -3352,24 +3352,44 @@ coverage'%5D,%0A + concurrency: 1,%0A singleRu @@ -3670,24 +3670,44 @@ overalls'%5D,%0A + concurrency: 1,%0A singleRu
e39ea1f4dfaad75a58fecf562916f3603d838ea4
add the missing original source files content into shadydom.min.js.map
gulpfile.js
gulpfile.js
/** * @license * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ 'use strict'; /* eslint-env node */ /* eslint-disable no-console */ let gulp = require('gulp'); let compilerPackage = require('google-closure-compiler'); let sourcemaps = require('gulp-sourcemaps'); let rename = require('gulp-rename'); let closureCompiler = compilerPackage.gulp(); let rollup = require('gulp-rollup'); const size = require('gulp-size'); gulp.task('default', () => { return gulp.src('./src/*.js') .pipe(sourcemaps.init()) .pipe(closureCompiler({ new_type_inf: true, compilation_level: 'ADVANCED', language_in: 'ES6_STRICT', language_out: 'ES5_STRICT', isolation_mode: 'IIFE', assume_function_wrapper: true, js_output_file: 'shadydom.min.js', warning_level: 'VERBOSE', rewrite_polyfills: false, externs: 'externs/shadydom.js' })) .pipe(size({showFiles: true, showTotal: false, gzip: true})) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./')) }); gulp.task('debug', () => { return gulp.src('src/*.js') .pipe(rollup({ entry: 'src/shadydom.js', format: 'iife', moduleName: 'shadydom' })) .pipe(rename('shadydom.min.js')) .pipe(size({showFiles: true, showTotal: false, gzip: true})) .pipe(gulp.dest('./')) })
JavaScript
0.000004
@@ -939,24 +939,37 @@ './src/*.js' +, %7Bbase: '.'%7D )%0A .pipe(
a8b9587271b4d48047d00b8d6b053cd55f5bd1e6
Fix collections online reference.
gulpfile.js
gulpfile.js
// ------------------------------------------ // Require - sorted alphabetically after npm name // ------------------------------------------ require('dotenv').config({silent: true}); var gulp = require('gulp') var sequence = require('run-sequence') // ------------------------------------------ // Get the gulp content from the main // ------------------------------------------ require('collections-online/build/gulp')(gulp, __dirname); // ------------------------------------------ // Combining tasks // ------------------------------------------ gulp.task('build', function (callback) { // put stuff in arrays that you'd want to run in parallel sequence(['clean', 'bower'], ['css', 'js', 'svg'], callback) }) // ------------------------------------------ // Default task // ------------------------------------------ gulp.task('default', function (callback) { if (process.env.NODE_ENV === 'development') { sequence(['build'], ['watch'], callback) } else { sequence(['build'], callback) } })
JavaScript
0
@@ -385,16 +385,18 @@ equire(' +./ collecti
2cfa6f0ea4dee916d0d07525c8b1bdac09f3a4cc
Clean up .tmp when build
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'); var $ = require('gulp-load-plugins')(); var runSequence = require('run-sequence'); var bs = require('browser-sync').create(); var del = require('del'); gulp.task('lint', function () { return gulp.src('app/js/**/*.js') .pipe($.eslint()) .pipe($.eslint.format()) .pipe($.eslint.failAfterError()); }); gulp.task('serve', ['styles'], function () { bs.init({ notify: false, port: 9000, open: true, server: { baseDir: ['.tmp', 'app'] } }); gulp.watch([ 'app/**/*.html', 'app/js/**/*.js' ]).on('change', bs.reload); gulp.watch('app/_sass/**/*.scss', ['styles', bs.reload]); gulp.watch('app/js/**/*.js', ['lint']); }); gulp.task('clean', del.bind(null, ['dist'])); gulp.task('styles', function () { return gulp.src('app/_sass/*.scss') .pipe($.sourcemaps.init()) .pipe($.sass().on('error', $.sass.logError)) .pipe($.autoprefixer({ browsers: [ 'last 2 versions', 'Explorer >= 8', 'Firefox ESR', 'Android >= 2.3', 'iOS >= 7' ] })) .pipe($.sourcemaps.write()) .pipe(gulp.dest('.tmp/css')) .pipe($.minifyCss()) .pipe(gulp.dest('dist/css')); }); gulp.task('scripts', function () { return gulp.src('app/js/**/*.js') .pipe($.uglify()) .pipe(gulp.dest('dist/js')); }); gulp.task('html', function () { return gulp.src('app/**/*.html') .pipe($.htmlmin({ collapseWhitespace: true })) .pipe(gulp.dest('dist')); }); gulp.task('build', ['clean'], function (callback) { runSequence(['styles', 'scripts', 'html'], callback); }); gulp.task('default', function (callback) { runSequence('lint', 'build', callback); });
JavaScript
0.000001
@@ -745,16 +745,24 @@ (null, %5B +'.tmp', 'dist'%5D)
1c0bb27b2dbb6e3a7b9b63c3b687eba95d458f8a
add debug for fonts task
gulpfile.js
gulpfile.js
/*global -$ */ 'use strict'; // generated on 2015-06-05 using generator-gulp-webapp 0.3.0 var gulp = require('gulp'); var $ = require('gulp-load-plugins')(); var browserSync = require('browser-sync'); var reload = browserSync.reload; var del = require('del'); var fs = require('fs'); var semver = require('semver'); var pkg = (function () { return JSON.parse(fs.readFileSync('./package.json', 'utf8')); })(); gulp.task('styles', function () { return gulp.src('app/styles/main.scss') .pipe($.sourcemaps.init()) .pipe($.sass({ outputStyle: 'nested', // libsass doesn't support expanded yet precision: 10, includePaths: ['.'], onError: console.error.bind(console, 'Sass error:') })) .pipe($.postcss([ require('autoprefixer-core')({browsers: ['last 4 versions']}) ])) .pipe($.sourcemaps.write()) .pipe(gulp.dest('.tmp/styles')) .pipe(reload({stream: true})); }); gulp.task('jshint', function () { return gulp.src('app/scripts/**/*.js') .pipe(reload({stream: true, once: true})) .pipe($.jshint()) .pipe($.jshint.reporter('jshint-stylish')) .pipe($.if(!browserSync.active, $.jshint.reporter('fail'))); }); gulp.task('html', ['styles'], function () { var assets = $.useref.assets({searchPath: ['.tmp', 'app', '.']}); return gulp.src('app/*.html') .pipe(assets) .pipe($.if('*.js', $.uglify())) .pipe($.if('*.css', $.csso())) .pipe(assets.restore()) .pipe($.useref()) .pipe($.if('*.html', $.minifyHtml({conditionals: true, loose: true}))) .pipe(gulp.dest('dist')); }); gulp.task('images', function () { return gulp.src('app/images/**/*') .pipe($.cache($.imagemin({ progressive: true, interlaced: true, // don't remove IDs from SVGs, they are often used // as hooks for embedding and styling svgoPlugins: [{cleanupIDs: false}] }))) .pipe(gulp.dest('dist/images')); }); gulp.task('fonts', function () { return gulp.src(require('main-bower-files')({ filter: '**/*.{eot,svg,ttf,woff,woff2}' }).concat('app/fonts/**/*')) .pipe(gulp.dest('.tmp/fonts')) .pipe(gulp.dest('dist/fonts')); }); gulp.task('extras', function () { return gulp.src([ 'app/*.*', 'app/CNAME', '!app/*.html' ], { dot: true }).pipe(gulp.dest('dist')); }); gulp.task('clean', del.bind(null, ['.tmp', 'dist'])); gulp.task('serve', ['styles', 'fonts'], function () { browserSync({ notify: false, port: 9000, server: { baseDir: ['.tmp', 'app'], routes: { '/bower_components': 'bower_components' } } }); // watch for changes gulp.watch([ 'app/*.html', 'app/scripts/**/*.js', 'app/images/**/*', '.tmp/fonts/**/*' ]).on('change', reload); gulp.watch('app/styles/**/*.scss', ['styles']); gulp.watch('app/fonts/**/*', ['fonts']); gulp.watch('bower.json', ['wiredep', 'fonts']); }); // inject bower components gulp.task('wiredep', function () { var wiredep = require('wiredep').stream; gulp.src('app/styles/*.scss') .pipe(wiredep({ ignorePath: /^(\.\.\/)+/ })) .pipe(gulp.dest('app/styles')); gulp.src('app/*.html') .pipe(wiredep({ ignorePath: /^(\.\.\/)*\.\./ })) .pipe(gulp.dest('app')); }); gulp.task('build', ['jshint', 'html', 'images', 'fonts', 'extras'], function () { return gulp.src('dist/**/*').pipe($.size({title: 'build', gzip: true})); }); gulp.task('default', ['clean'], function () { gulp.start('build'); }); gulp.task('gitSemver', function () { return gulp.src(['app/manifest.json', 'bower.json', 'package.json']) .pipe($.git.commit('Update semver to v'+pkg.version)) .pipe($.git.push('origin', 'master')); }); // bump versions on package/bower/manifest gulp.task('bump', function () { // increment version var newVer = semver.inc(pkg.version, 'patch'); pkg.version = newVer; // uses gulp-filter var manifestFilter = $.filter(['manifest.json']); var regularJsons = $.filter(['*', '!manifest.json']); return gulp.src(['./bower.json', './package.json', './app/manifest.json']) .pipe($.bump({ version: newVer })) .pipe(manifestFilter) .pipe(gulp.dest('./app')) .pipe(manifestFilter.restore()) .pipe(regularJsons) .pipe(gulp.dest('./')); }); gulp.task('upstream', ['build'], function () { return gulp.src('dist') .pipe($.subtree({ remote: 'upstream', branch: 'master', message: 'New build v'+pkg.version })) .pipe($.clean()); }); gulp.task('deploy', ['clean', 'bump', 'gitSemver'], function () { gulp.start('upstream'); });
JavaScript
0.000002
@@ -249,24 +249,74 @@ ire('del');%0A +var mainBowerFiles = require('main-bower-files');%0A var fs = req @@ -2023,35 +2023,22 @@ src( -require(' main --b +B ower --f +F iles -') (%7B%0A @@ -2079,16 +2079,38 @@ ,woff2%7D' +,%0A debugging: false %0A %7D).co
3f5281608bd0f6da9aafb519270ba5031be5c3ca
Add Gulp-Nodemon Function
gulpfile.js
gulpfile.js
const gulp = require('gulp'); const less = require('gulp-less'); const pug = require('gulp-pug'); const bower = require('gulp-bower'); const autoprefixer = require('autoprefixer'); const imagemin = require('gulp-imagemin'); const postcss = require('gulp-postcss'); const cleancss = require('gulp-clean-css'); const renamecss = require('gulp-rename'); const sync = require('browser-sync'); const colors = require('colors'); const deploy = "public"; gulp.task('less', function () { return gulp.src('views/less/*.less') .pipe(less()) .pipe(gulp.dest('views/css')) }); gulp.task('prefix', function () { return gulp.src('views/css/*.css') .pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] })] )) .pipe(gulp.dest('views/css')) }); gulp.task('minify', function() { return gulp.src('views/css/*.css') .pipe(cleancss()) .pipe(gulp.dest('views/css')); }); gulp.task('renamecss', function () { return gulp.src('views/css/*.css') .pipe(renamecss({extname: ".min.css"})) .pipe(gulp.dest(deploy + '/css')) }); gulp.task('img', function () { gulp.src('views/img/*') .pipe(imagemin()) .pipe(gulp.dest(deploy + '/img')) }); gulp.task('pug', function () { return gulp.src('views/pug/*.pug') .pipe(pug()) .pipe(gulp.dest(deploy)) }); gulp.task('bower', function() { return bower('bower_modules/') .pipe(gulp.dest(deploy)) }); gulp.task('sync', ['img', 'bower', 'less', 'prefix', 'minify', 'renamecss', 'pug'], function() { sync({ server: { baseDir: deploy } }); gulp.watch('views/img/*', ['img']); gulp.watch('views/less/*.less', ['less']); gulp.watch('views/css/*.css', ['prefix', 'minify', 'renamecss']); gulp.watch('views/pug/*', ['pug']); gulp.watch('views/pug/include/*', ['pug']); gulp.watch(deploy + '/css/*.css').on('change', sync.reload); gulp.watch(deploy + '/*.html').on('change', sync.reload); gulp.watch(deploy + '/img/*').on('change', sync.reload); return console.log("Sync Successful!".green); }); gulp.task('build', ['img', 'bower', 'less', 'prefix', 'minify', 'renamecss', 'pug'], function() { return console.log("Build Successful!".green); });
JavaScript
0.000001
@@ -340,24 +340,65 @@ p-rename');%0A +const nodemon = require('gulp-nodemon');%0A const sync = @@ -483,16 +483,131 @@ blic%22;%0A%0A +gulp.task('pug', function () %7B%0A return gulp.src('views/*.pug')%0A .pipe(pug())%0A .pipe(gulp.dest(deploy))%0A%7D);%0A%0A gulp.tas @@ -1336,35 +1336,37 @@ %7D);%0A%0Agulp.task(' -pug +bower ', function () %7B @@ -1352,33 +1352,32 @@ bower', function - () %7B%0A return gu @@ -1378,51 +1378,30 @@ urn -gulp.src('views/pug/*.pug')%0A .pipe(pug() +bower('bower_modules/' )%0A @@ -1435,37 +1435,39 @@ %7D);%0A%0Agulp.task(' -bower +nodemon ', function() %7B%0A @@ -1454,32 +1454,34 @@ emon', function( +cb ) %7B%0A return bow @@ -1481,146 +1481,225 @@ urn -bower('bower_modules/')%0A .pipe(gulp.dest(deploy))%0A%7D);%0A%0Agulp.task('sync', %5B'img', 'bower', 'less', 'prefix', 'minify', 'renamecss', 'pug +nodemon(%7B%0A script: './bin/www'%0A // script: './bin/www/app.js'%0A %7D)%0A .on('start', function () %7B%0A cb();%0A %7D)%0A .on('error', function(err) %7B%0A throw err;%0A %7D);%0A%7D);%0A%0Agulp.task('sync', %5B'nodemon '%5D, @@ -1768,16 +1768,54 @@ %7D%0A %7D);%0A + gulp.watch('views/*.pug', %5B'pug'%5D);%0A gulp.w @@ -1961,93 +1961,8 @@ %5D);%0A - gulp.watch('views/pug/*', %5B'pug'%5D);%0A gulp.watch('views/pug/include/*', %5B'pug'%5D);%0A%0A gu @@ -2209,24 +2209,31 @@ k('build', %5B +'pug', 'img', 'bowe @@ -2279,15 +2279,8 @@ css' -, 'pug' %5D, f
862f75ca9ee9c3f72a2904a8fbf106e14fa327d6
reorganize tasks
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var gutil = require('gulp-util'); var rename = require('gulp-rename'); var uglify = require('gulp-uglify'); var Karma = require('karma').Server; var argv = require('minimist')(process.argv.slice(2)); gulp.task('lint', function () { gutil.log(gutil.colors.red('@todo: Implement eslint step.')); }); gulp.task('test', function (done) { new Karma({ configFile: __dirname + '/karma.conf.js', singleRun: !argv.tdd }, done).start(); }); gulp.task('test:browser', function (done) { new Karma({ configFile: __dirname + '/karma.conf.js', singleRun: !argv.tdd, browsers: [ 'Firefox', 'Chrome', 'Opera' ] }, done).start(); }); gulp.task('ci', ['lint', 'test']); gulp.task('build', function () { return gulp .src('src/bindNotifier.js') .pipe(rename('angular-bind-notifier.js')) .pipe(gulp.dest('dist')) .pipe(rename('angular-bind-notifier.min.js')) .pipe(uglify()) .pipe(gulp.dest('dist')); }); gulp.task('package', ['lint', 'test', 'build']); gulp.task('default', ['build']);
JavaScript
0.998987
@@ -681,44 +681,8 @@ );%0A%0A -gulp.task('ci', %5B'lint', 'test'%5D);%0A%0A gulp @@ -928,32 +928,72 @@ ('dist'));%0A%7D);%0A%0A +gulp.task('ci', %5B'lint', 'test'%5D);%0A gulp.task('packa
5d4d78428dc8137fbd775ececaa98530643006dc
Remove `fonts` gulp task from default task
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'); var sass = require('gulp-sass'); gulp.task('default', ['sass', 'fonts'], function () { }); gulp.task('sass', function () { return gulp.src('./styles/warriormachines_2016/theme/sass/app.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('./styles/warriormachines_2016/theme/gulp-generated/css')); }); gulp.task('fonts', function() { gulp.src('./node_modules/font-awesome/fonts/**/*.{eot,svg,ttf,woff,woff2}') .pipe(gulp.dest('./styles/warriormachines_2016/theme/gulp-generated/fonts')); }); gulp.task('sass:watch', function () { gulp.watch('./styles/warriormachines_2016/theme/sass/app.scss', ['sass']); });
JavaScript
0
@@ -102,17 +102,8 @@ ass' -, 'fonts' %5D, f
91ee0160c09c47718e256f1ce334384be97aac2a
update build scripts
gulpfile.js
gulpfile.js
const gulp = require('gulp'); const glob = require('glob'); const shell = cmd => require('child_process').execSync(cmd, { stdio: [0, 1, 2] }); const del = require('del'); const extend = require('extend'); const source = require('vinyl-source-stream'); const buffer = require('vinyl-buffer'); const $ = require('gulp-load-plugins')(); const seq = require('run-sequence'); const browserify = require('browserify'); const tsify = require('tsify'); const Server = require('karma').Server; const pkg = require('./package.json'); const config = { browsers: ['Chrome', 'Firefox'].concat((os => { switch (os) { case 'Windows_NT': return ['Edge']; case 'Darwin': return []; default: return []; } })(require('os').type())), ts: { dist: { src: [ '*.ts' ], dest: 'dist' }, test: { src: [ '*.ts', 'src/**/*.ts', 'test/**/*.ts' ], dest: 'dist' }, bench: { src: [ '*.ts', 'benchmark/**/*.ts' ], dest: 'dist' } }, banner: [ `/*! ${pkg.name} v${pkg.version} ${pkg.repository.url} | (c) 2016, ${pkg.author} | ${pkg.license} License */`, '' ].join('\n'), clean: { dist: 'dist' } }; function compile(paths) { let done = true; return browserify({ basedir: '.', debug: false, entries: Object.values(paths).map(p => glob.sync(p)), cache: {}, packageCache: {} }) .require(`./${pkg.name}.ts`, { expose: pkg.name }) .plugin(tsify, require('./tsconfig.json').compilerOptions) .bundle() .on("error", err => done = console.log(err + '')) .pipe(source(`${pkg.name}.js`)) .pipe(buffer()) .pipe($.derequire()) .once("finish", () => done || process.exit(1)); } gulp.task('ts:watch', function () { gulp.watch(config.ts.test.src, ['ts:test']); }); gulp.task('ts:test', function () { return compile(config.ts.test.src) .pipe(gulp.dest(config.ts.test.dest)); }); gulp.task('ts:bench', function () { return compile(config.ts.bench.src) .pipe($.unassert()) .pipe(gulp.dest(config.ts.bench.dest)); }); gulp.task('ts:dist', function () { return compile(config.ts.dist.src) .pipe($.unassert()) .pipe($.header(config.banner)) .pipe(gulp.dest(config.ts.dist.dest)) .pipe($.uglify({ preserveComments: 'license' })) .pipe($.rename({ extname: '.min.js' })) .pipe(gulp.dest(config.ts.dist.dest)); }); gulp.task('karma:watch', function (done) { new Server({ configFile: __dirname + '/karma.conf.js', browsers: config.browsers, preprocessors: { 'dist/*.js': ['espower'] }, }, done).start(); }); gulp.task('karma:test', function (done) { new Server({ configFile: __dirname + '/karma.conf.js', browsers: config.browsers, reporters: ['dots', 'coverage'], preprocessors: { 'dist/*.js': ['coverage', 'espower'] }, singleRun: true }, done).start(); }); gulp.task('karma:bench', function (done) { new Server({ configFile: __dirname + '/karma.conf.js', browsers: config.browsers, singleRun: true }, done).start(); }); gulp.task('karma:ci', function (done) { new Server({ configFile: __dirname + '/karma.conf.js', browsers: config.browsers, reporters: ['dots', 'coverage', 'coveralls'], preprocessors: { 'dist/*.js': ['coverage', 'espower'] }, singleRun: true }, done).start(); }); gulp.task('clean', function () { return del([config.clean.dist]); }); gulp.task('install', function () { shell('npm i'); }); gulp.task('update', function () { shell('ncu -ua'); shell('npm i'); }); gulp.task('watch', ['clean'], function () { seq( 'ts:test', [ 'ts:watch', 'karma:watch' ] ); }); gulp.task('test', ['clean'], function (done) { seq( 'ts:test', 'karma:test', function () { done(); } ); }); gulp.task('bench', ['clean'], function (done) { seq( 'ts:bench', 'karma:bench', function () { done(); } ); }); gulp.task('dist', ['clean'], function (done) { seq( 'ts:dist', done ); }); gulp.task('ci', ['clean'], function (done) { seq( 'ts:test', 'karma:ci', 'dist', function () { done(); } ); });
JavaScript
0.000003
@@ -1428,16 +1428,45 @@ nc(p)),%0A + bundleExternal: false,%0A ca
9338f31daf291b42ddef17fa0bc2cd36332678db
Increase test timeout
gulpfile.js
gulpfile.js
'use strict'; var path = require('path'); var gulp = require('gulp'); var eslint = require('gulp-eslint'); var excludeGitignore = require('gulp-exclude-gitignore'); var mocha = require('gulp-mocha'); var istanbul = require('gulp-istanbul'); var nsp = require('gulp-nsp'); var plumber = require('gulp-plumber'); var coveralls = require('gulp-coveralls'); gulp.task('static', function () { return gulp.src('**/*.js') .pipe(excludeGitignore()) .pipe(eslint()) .pipe(eslint.format()) .pipe(eslint.failAfterError()); }); gulp.task('nsp', function (cb) { nsp({package: path.resolve('package.json')}, cb); }); gulp.task('pre-test', function () { return gulp.src('generators/**/*.js') .pipe(excludeGitignore()) .pipe(istanbul({ includeUntested: true })) .pipe(istanbul.hookRequire()); }); gulp.task('test', ['pre-test'], function (cb) { var mochaErr; gulp.src('test/**/*.js') .pipe(plumber()) .pipe(mocha({reporter: 'spec'})) .on('error', function (err) { mochaErr = err; }) .pipe(istanbul.writeReports()) .on('end', function () { cb(mochaErr); }); }); gulp.task('watch', function () { gulp.watch(['generators/**/*.js', 'test/**'], ['test']); }); gulp.task('coveralls', ['test'], function () { if (!process.env.CI) { return undefined; } return gulp.src(path.join(__dirname, 'coverage/lcov.info')) .pipe(coveralls()); }); gulp.task('prepublish', ['nsp']); gulp.task('default', ['static', 'test', 'coveralls']);
JavaScript
0.000001
@@ -968,16 +968,31 @@ : 'spec' +, timeout: 4000 %7D))%0A
89e833e8c83a07ecabb3c34da4c7c596f1780866
Remove archive when running gulp clean
gulpfile.js
gulpfile.js
const babelify = require('babelify'); const browserify = require('browserify'); const buffer = require('vinyl-buffer'); const cssnano = require('gulp-cssnano'); const del = require('del'); const gulp = require('gulp'); const gutil = require('gulp-util'); const htmlmin = require('gulp-htmlmin'); const jsonMinify = require('gulp-json-minify'); const source = require('vinyl-source-stream'); const uglify = require('gulp-uglify'); const zip = require('gulp-zip'); function processJsFile(fileName, debug) { // https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-uglify-sourcemap.md let uglifyConfigs = {}; // remove console.log if debug is false if (!debug) { uglifyConfigs = { compress: { pure_funcs: [ 'console.log', 'console.error', ], }, }; } const b = browserify({ entries: `src/js/${fileName}.js`, }).transform(babelify.configure({ presets: ['es2015'], })).bundle() .on('error', gutil.log) .pipe(source(`${fileName}.js`)) .pipe(buffer()); if (!debug) { b.pipe(uglify(uglifyConfigs)); } b.pipe(gulp.dest('dist/js')); } function buildJs(debug) { processJsFile('eventPage', debug); processJsFile('options', debug); processJsFile('popup', debug); processJsFile('content-google', debug); processJsFile('content-duckduckgo', debug); } function buildCss() { gulp.src('src/css/*.css') .pipe(cssnano()) .on('error', gutil.log) .pipe(gulp.dest('dist/css')); } function buildHtml() { gulp.src('src/html/*.html') .pipe(htmlmin({ collapseWhitespace: true, removeComments: true, })) .on('error', gutil.log) .pipe(gulp.dest('dist/html')); } function buildManifest() { gulp.src([ 'src/manifest.json', ]).pipe(jsonMinify()) .pipe(gulp.dest('dist')); } function buildImg() { gulp.src([ 'src/img/*', ]).pipe(gulp.dest('dist/img')); } function buildMisc() { gulp.src([ 'node_modules/jquery/dist/jquery.min.js', ]).pipe(gulp.dest('src/js/lib')) .pipe(gulp.dest('dist/js/lib')); gulp.src([ 'src/js/lib/jquery.tooltipster.min.js', ]).pipe(gulp.dest('dist/js/lib')); gulp.src([ 'src/css/lib/tooltipster.css', ]).pipe(cssnano()) .pipe(gulp.dest('dist/css/lib')); } gulp.task('js', () => { buildJs(false); }); gulp.task('js:debug', () => { buildJs(true); }); gulp.task('css', () => { buildCss(); }); gulp.task('html', () => { buildHtml(); }); gulp.task('manifest', () => { buildManifest(); }); gulp.task('img', () => { buildImg(); }); gulp.task('misc', () => { buildMisc(); }); gulp.task('build', ['clean'], () => { buildJs(false); buildCss(); buildHtml(); buildManifest(); buildImg(); buildMisc(); }); gulp.task('zip', () => { gulp.src('dist/**') .pipe(zip('archive.zip')) .pipe(gulp.dest('.')); }); gulp.task('build:debug', ['clean'], () => { buildJs(true); buildCss(); buildHtml(); buildManifest(); buildImg(); buildMisc(); }); gulp.task('clean', () => del([ 'dist/**', ]) ); gulp.task('watch', () => { gulp.watch('src/js/*.js', ['js']); gulp.watch('src/css/*.css', ['css']); gulp.watch('src/html/*.html', ['html']); gulp.watch('src/img/*', ['img']); gulp.watch('src/manifest.json', ['manifest']); }); gulp.task('watch:debug', () => { gulp.watch('src/js/*.js', ['js:debug']); gulp.watch('src/css/*.css', ['css']); gulp.watch('src/html/*.html', ['html']); gulp.watch('src/img/*', ['img']); gulp.watch('src/manifest.json', ['manifest']); }); gulp.task('default', ['build']);
JavaScript
0
@@ -3020,16 +3020,18 @@ ', () =%3E + %7B %0A del(%5B @@ -3050,17 +3050,84 @@ *',%0A %5D) -%0A +;%0A del(%5B%0A 'archive/**',%0A %5D);%0A del(%5B%0A 'archive.zip',%0A %5D);%0A%7D );%0A%0Agulp
a0cb142a4e717e6fe048f4e435d842a14f076106
write sourcemaps as separate files
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var less = require('gulp-less'); var path = require('path'); var minifyCSS = require('gulp-minify-css'); var rename = require('gulp-rename'); var sourcemaps = require('gulp-sourcemaps'); gulp.task('css', function () { return gulp.src('./jupyter_notebook/static/style/*.less') .pipe(sourcemaps.init()) .pipe(less({ paths: [ path.join(__dirname, 'less', 'includes') ] })) .pipe(minifyCSS()) .pipe(rename({ suffix: '.min' })) .pipe(sourcemaps.write()) .pipe(gulp.dest('./jupyter_notebook/static/style')); });
JavaScript
0.000001
@@ -521,16 +521,20 @@ s.write( +'./' ))%0A .
e8ed6bd36a70494949e4f9ec0071970df3427d99
Add js files to watch task
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var express = require('express'); var uglify = require('gulp-uglify'); var sass = require('gulp-sass'); var rename = require('gulp-rename'); var autoprefixer = require('gulp-autoprefixer'); var minifycss = require('gulp-minify-css'); var port = 4000; gulp.task('express', function(){ var app = express(); app.use(require('connect-livereload')({port: 4002})); app.use(express.static(__dirname)); app.listen(port); }); gulp.task('style', function(){ return gulp.src('src/style/*.scss') .pipe(sass({style: 'expanded'})) .pipe(gulp.dest('src/style')); }); gulp.task('watch', function() { gulp.watch('src/style/*.scss', ['style']); gulp.watch('src/style/*.css', notifyLiveReload, ['style']); gulp.watch('index.html', notifyLiveReload); }); var tinylr; gulp.task('livereload', function() { tinylr = require('tiny-lr')(); tinylr.listen(4002); }); function notifyLiveReload(event) { var fileName = require('path').relative(__dirname, event.path); tinylr.changed({ body: { files: [fileName] } }); } gulp.task('server', ['style', 'express', 'livereload', 'watch'], function(){ console.log('Awesomeness happens at local port: ' + port); });
JavaScript
0.000001
@@ -783,16 +783,63 @@ eload);%0A + gulp.watch('src/js/*.js', notifyLiveReload);%0A %7D);%0A%0A%0Ava
4ceb13e31390ff05943dc440a6001dab04c209c3
rename semantic tasks and append them at the end of the file
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var gutil = require('gulp-util'); var bower = require('bower'); var concat = require('gulp-concat'); var sass = require('gulp-sass'); var minifyCss = require('gulp-minify-css'); var rename = require('gulp-rename'); var sh = require('shelljs'); var paths = { sass: ['./scss/**/*.scss'] }; gulp.task('default', ['copy-semantic', 'sass', 'move-semantic-assets']); gulp.task('sass', function(done) { gulp.src('./scss/ionic.app.scss') .pipe(sass()) .on('error', sass.logError) .pipe(gulp.dest('./www/css/')) .pipe(minifyCss({ keepSpecialComments: 0 })) .pipe(rename({ extname: '.min.css' })) .pipe(gulp.dest('./www/css/')) .on('end', done); }); gulp.task('copy-semantic', function(){ gulp.src('./www/lib/semantic/dist/semantic.css') .pipe(rename('_semantic.scss')) .pipe(gulp.dest('./scss/vendor/')); }); gulp.task('move-semantic-assets', function(){ gulp.src('./www/lib/semantic/dist/themes/**/*', {base: './www/lib/semantic/dist/'}) .pipe(gulp.dest('./www/css/')); }); gulp.task('watch', function() { gulp.watch(paths.sass, ['copy-semantic', 'sass', 'move-semantic-assets']); }); gulp.task('install', ['git-check'], function() { return bower.commands.install() .on('log', function(data) { gutil.log('bower', gutil.colors.cyan(data.id), data.message); }); }); gulp.task('git-check', function(done) { if (!sh.which('git')) { console.log( ' ' + gutil.colors.red('Git is not installed.'), '\n Git, the version control system, is required to download Ionic.', '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' ); process.exit(1); } done(); });
JavaScript
0.000003
@@ -332,37 +332,32 @@ default', %5B' -copy- semantic ', 'sass', ' @@ -336,32 +336,41 @@ ult', %5B'semantic +-move-css ', 'sass', 'move @@ -357,37 +357,32 @@ -css', 'sass', ' -move- semantic-assets' @@ -366,32 +366,37 @@ ass', 'semantic- +move- assets'%5D);%0A%0Agulp @@ -722,29 +722,21 @@ p.task(' -copy-semantic +watch ', funct @@ -732,32 +732,33 @@ tch', function() + %7B%0A gulp.src('./ @@ -754,403 +754,70 @@ ulp. -src('./www/lib/semantic/dist/semantic.css')%0A .pipe(rename('_semantic.scss'))%0A .pipe(gulp.dest('./scss/vendor/'));%0A%7D);%0A%0Agulp.task('move-semantic-assets', function()%7B%0A gulp.src('./www/lib/semantic/dist/themes/**/*', %7Bbase: './www/lib/semantic/dist/'%7D)%0A .pipe(gulp.dest('./www/css/'));%0A%7D);%0A%0Agulp.task('watch', function() %7B%0A gulp.watch(paths.sass, %5B'copy-semantic', 'sass', 'move-semantic +watch(paths.sass, %5B'semantic-move-css', 'sass', 'semantic-move -ass @@ -1464,12 +1464,420 @@ done();%0A%7D);%0A +%0A/*%0A Tasks to copy and setup Semantic UI css and assets%0A*/%0A%0Agulp.task('semantic-move-css', function()%7B%0A gulp.src('./www/lib/semantic/dist/semantic.css')%0A .pipe(rename('_semantic.scss'))%0A .pipe(gulp.dest('./scss/vendor/'));%0A%7D);%0A%0Agulp.task('semantic-move-assets', function()%7B%0A gulp.src('./www/lib/semantic/dist/themes/**/*', %7Bbase: './www/lib/semantic/dist/'%7D)%0A .pipe(gulp.dest('./www/css/'));%0A%7D);%0A
4c298b7f1bf79a58b38e40be86a057e8a5bb6f88
Update Package
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'); var sass = require('gulp-sass'); var cssnano = require('gulp-cssnano'); var sourcemaps = require('gulp-sourcemaps'); var autoprefixer = require('gulp-autoprefixer'); gulp.task('sass', function () { gulp.src('./src/sass/**/*.scss') .pipe(sourcemaps.init()) .pipe(sass().on('error', sass.logError)) .pipe(autoprefixer({ browsers: ['last 2 versions'], cascade: false })) .pipe(cssnano()) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/css/')) }); //Watch task gulp.task('default', function () { gulp.watch('./src/sass/**/*.scss', ['sass']); });
JavaScript
0.000001
@@ -214,20 +214,24 @@ p.task(' -sass +workflow ', funct @@ -621,20 +621,24 @@ css', %5B' -sass +workflow '%5D);%0A%7D);
98fefcbe6da06b208d79cd42492a30d2e09608e9
refresh on css update
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var minifyHTML = require('gulp-minify-html'); var uglify = require('gulp-uglify'); var jshint = require('gulp-jshint'); var changed = require('gulp-changed'); var imagemin = require('gulp-imagemin'); var autoprefix = require('gulp-autoprefixer'); var minifyCSS = require('gulp-minify-css'); var del = require('del'); var concat = require('gulp-concat'); var refresh = require('gulp-livereload'); var modRewrite = require('connect-modrewrite'); var RevAll = require('gulp-rev-all'); var runSequence = require('run-sequence'); var sourcemaps = require('gulp-sourcemaps'); var paths = { dist: 'dist', jshint: [ 'app/scripts/**/*.js', 'app/theme/**/*.js' ], html: 'app/**/*.html', misc: 'app/*.{txt,htaccess,ico}', scripts: [ 'app/scripts/config.js', 'app/scripts/main.js', 'app/scripts/**/init.js', 'app/scripts/**/*.js' ], theme: { dist: 'dist/theme', css: 'app/theme/styles/**/*.css', images: 'app/theme/**/*.{png,gif,jpg,jpec,ico,svg,mp4}', fonts: 'app/theme/fonts/**/*', scripts: [ 'app/theme/lib/**/*.js', 'app/theme/**/*.js' ] }, lib: { dist: 'dist/lib', scripts: [ 'app/lib/jquery.min.js', 'app/lib/angular.min.js', 'app/lib/*.js' // NOTE: no folder glob, or it would clobber .ie ], ie: 'app/lib/ie/*.js' } }; var host = { port: '8080', lrPort: '35729' }; var env = process.env.NODE_ENV || 'development'; // Empties folders to start fresh gulp.task('clean', function (cb) { return del(['dist/*', '!dist/media'], cb); }); gulp.task('jshint', function () { return gulp.src(paths.jshint) .pipe(jshint()) .pipe(jshint.reporter(require('jshint-stylish'))); }); gulp.task('html', function () { return gulp.src(paths.html) .pipe(changed(paths.dist)) .pipe(minifyHTML({ collapseWhitespace: true, collapseBooleanAttributes: true, removeCommentsFromCDATA: true, removeOptionalTags: true, conditionals: true, quotes: true, empty: true })) .pipe(gulp.dest(paths.dist)); }); gulp.task('misc', function () { return gulp.src(paths.misc) .pipe(gulp.dest(paths.dist)); }); gulp.task('scripts', function () { return gulp.src(paths.scripts) .pipe(sourcemaps.init()) .pipe(concat('main.js')) .pipe(uglify({ mangle: false })) .pipe(sourcemaps.write('./maps')) .pipe(gulp.dest(paths.dist + '/scripts')) .pipe(refresh()); }); gulp.task('theme.css', function () { return gulp.src(paths.theme.css) .pipe(autoprefix('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) .pipe(minifyCSS()) .pipe(gulp.dest(paths.theme.dist + '/styles')); }); gulp.task('theme.fonts', function() { return gulp.src(paths.theme.fonts) .pipe(gulp.dest(paths.theme.dist + '/fonts')); }); gulp.task('theme.scripts', function () { return gulp.src(paths.theme.scripts) .pipe(sourcemaps.init()) .pipe(concat('main.js')) .pipe(uglify({ mangle: false })) .pipe(sourcemaps.write('./maps')) .pipe(gulp.dest(paths.theme.dist)) .pipe(refresh()); }); gulp.task('theme.images', function () { return gulp.src(paths.theme.images) .pipe(changed(paths.theme.dist)) .pipe(imagemin()) .pipe(gulp.dest(paths.theme.dist)); }); gulp.task('lib.scripts', function () { return gulp.src(paths.lib.scripts) .pipe(concat('lib.js')) .pipe(gulp.dest(paths.lib.dist)); }); // IE libs can stick together, but need to be separate from other libs gulp.task('lib.ie', function() { return gulp.src(paths.lib.ie) .pipe(concat('ie-libs.js')) .pipe(gulp.dest(paths.lib.dist)); }); gulp.task('watch',function(){ refresh.listen({ basePath: paths.dist }); gulp.start('livereload'); gulp.watch(["app/**/*.html"],['html']); gulp.watch(["app/**/*.css"],['theme.css']); gulp.watch(["app/scripts/**/*.js"],['scripts']); gulp.watch(["app/theme/**/*.js"],['theme.scripts']); }); gulp.task('livereload', function(){ var path = require('path'); var express = require('express'); var app = express(); var staticFolder = path.join(__dirname, 'dist'); app.use(modRewrite([ '!\\. /index.html [L]' ])) .use(express.static(staticFolder)); app.listen( host.port, function() { console.log('server started: http://localhost:' + host.port); return gulp; }); }); gulp.task('revision', function(){ if(env === 'production') { var revAll = new RevAll({ dontUpdateReference: [/^((?!.js|.css).)*$/g], dontRenameFile: [/^((?!.js|.css).)*$/g] }); gulp.src('dist/**') .pipe(revAll.revision()) .pipe(gulp.dest('dist')); } }); gulp.task('lib', ['lib.ie', 'lib.scripts']); gulp.task('theme', [ 'theme.css', 'theme.fonts', 'theme.scripts', 'theme.images' ]); // For production gulp.task('build', function(){ // note: revision has a short circuit for dev runSequence('clean', [ 'html', 'misc', 'scripts', 'theme', 'lib' ], 'revision'); }); // For development gulp.task('serve', ['default']); gulp.task('default', ['build'], function(){ gulp.start('watch'); });
JavaScript
0
@@ -2964,24 +2964,49 @@ '/styles')) +%0A .pipe(refresh()) ;%0A%7D);%0A%0Agulp.
845e57f2cab964a47607f7959676cf97cbc4edec
Improve gulpfile.js (minify task) [ci skip]
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var source = require('vinyl-source-stream'); var browserify = require('browserify'); var uglify = require('gulp-uglify'); var exec = require('child_process').exec; var rename = require('gulp-rename'); var watch = require('gulp-watch'); var Server = require('karma').Server; gulp.task('build', function(cb) { exec('browserify --transform babelify --standalone Cape lib/cape.js > dist/cape.js', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }) }); gulp.task('minify', function() { return gulp.src('dist/cape.js') .pipe(uglify()) .pipe(rename('cape.min.js')) .pipe(gulp.dest('./dist')); }) gulp.task('watch', function() { gulp.watch('./lib/**/*.js', ['build']); }); gulp.task('test', ['build'], function (done) { new Server({ configFile: __dirname + '/test/karma.conf.js', singleRun: true }, function(exitCode) { process.exit(exitCode) }).start(); }); gulp.task('default', ['build']);
JavaScript
0.000023
@@ -606,16 +606,66 @@ uglify() +.on('error', function(e) %7B%0A console.log(e)%0A %7D) )%0A .pip
da112318be3b7988afd60971a953938b2d7e245f
Update deploy script
gulpfile.js
gulpfile.js
// Include gulp var gulp = require('gulp'); // Include Our Plugins var sass = require('gulp-sass'), jshint = require('gulp-jshint'), concat = require('gulp-concat'), uglify = require('gulp-uglify'), rename = require('gulp-rename'), notify = require('gulp-notify'), sourcemaps = require('gulp-sourcemaps'); // Paths var SRC = 'assets'; var DEST = 'dist'; var STYLES_SRC = SRC + '/stylesheets'; var STYLES_DEST = DEST + '/stylesheets'; var JAVASCRIPT_SRC = SRC + '/javascript'; var JAVASCRIPT_DEST = DEST + '/javascript'; var IMAGE_SRC = SRC + '/images'; var IMAGE_DEST = DEST + '/images'; var HTML_SRC = SRC; var HTML_DEST = DEST; var CNAME_SRC = SRC; var CNAME_DEST = DEST; var ROOT = DEST; // Tasks // ---------------------------------------- // Lint Task gulp.task('lint', function() { return gulp.src(JAVASCRIPT_SRC + '/**/*.js') .pipe(jshint()) .pipe(jshint.reporter('default')); }); // Compile and Source Map our Sass gulp.task('dev:scss', function() { return gulp.src(STYLES_SRC + '/main.scss') .pipe(sourcemaps.init()) .pipe(sass()) .on('error', notify.onError({ title: 'Sass Compile Error', sound: 'Basso' })) .pipe(sourcemaps.write()) .pipe(gulp.dest(STYLES_DEST)); }); // Concatenate & Minify JS gulp.task('scripts', function() { gulp.src(JAVASCRIPT_SRC + '/**/*.js') .pipe(concat('bundle.js')) .pipe(uglify()) .pipe(gulp.dest(JAVASCRIPT_DEST)); }); // Move Images to Dist gulp.task('images', function () { gulp.src(IMAGE_SRC + '/**/*.*') .pipe(gulp.dest(IMAGE_DEST)); }); // Refresh when HTML changes gulp.task('html', function () { gulp.src(HTML_SRC + '/**/*.html') .pipe(gulp.dest(HTML_DEST)); }); gulp.task('domain-config', function() { gulp.src(CNAME_SRC + '/' + 'CNAME') .pipe(gulp.dest(CNAME_DEST + '/')); }); // Watch files for changes gulp.task('watch', function () { // Watch .html files gulp.watch([HTML_SRC + '/**/*.html'], ['html']); // Watch .scss files gulp.watch([STYLES_SRC + '/**/*.scss'], ['dev:scss']); // Watch .js files gulp.watch([JAVASCRIPT_SRC + '/**/*.js'], ['scripts']); // Watch image directory gulp.watch([IMAGE_SRC + '/**/*.*'], ['images']); }); // Default Task gulp.task('default', ['html', 'dev:scss', 'scripts', 'watch', 'images', 'domain-config']);
JavaScript
0.000001
@@ -655,27 +655,28 @@ CNAME_SRC = -SRC +'./' ;%0Avar CNAME_
737b338bbf3296f17b4c35a9749d6efcf0311889
Stringify CouchDB push error response
gulpfile.js
gulpfile.js
'use strict'; var fs = require('fs'); var browserify = require('browserify'); var glob = require('glob'); var gulp = require('gulp'); var partialify = require('partialify'); var push = require('couch-push'); var source = require('vinyl-source-stream'); var argv = require('yargs').argv; var config = require('./config.json'); var couch_url; if (argv.url) { couch_url = argv.url; } else if (config.env && config.env['default'] && config.env['default'].db) { couch_url = config.env['default'].db; } else { // TODO: make this hault console.log('You must supply the URL to your CouchDB instance (via --url or config.json'); } gulp.task('sprung', function() { var b = browserify({ entries: './src/main.js', debug: true, transform: [partialify] }); return b.bundle() .pipe(source('app.js')) .pipe(gulp.dest('./_design/sprung/_attachments/')); }); gulp.task('docs', function() { glob('_docs/*', function(err, matches) { if (err) throw err; matches.forEach(function(doc) { var type = doc.split('~')[0]; if (type === '_docs/type' && fs.existsSync(doc + '/index.js')) { // we have a type definition, build its component browserify({ entries: './' + doc + '/index.js', debug: true, transform: [partialify] }) .bundle() .pipe(source('component.js')) .pipe(gulp.dest('./' + doc + '/_attachments/')); } push(couch_url, doc, function(err, resp) { if (err) throw JSON.stringify(err); console.log(resp); }); }); }); }); gulp.task('apps', function() { glob('_design/*', function(err, matches) { if (err) throw err; matches.forEach(function(ddoc) { push(couch_url, ddoc, function(err, resp) { if (err) throw err; console.log(resp); }); }); }); }); gulp.task('default', ['sprung', 'apps', 'docs']);
JavaScript
0.999995
@@ -1809,27 +1809,43 @@ (err) throw +JSON.stringify( err +) ;%0A
4c52508e4ff8ab37eda4f18132b47b7155e20c2a
image:watch task
gulpfile.js
gulpfile.js
'use-strict'; ////////////////////////////// // Requires ////////////////////////////// var autoprefixer = require('gulp-autoprefixer'); var browserSync = require('browser-sync').create(); var gulp = require('gulp'); var jshint = require('gulp-jshint'); var plumber = require('gulp-plumber'); var rename = require('gulp-rename'); var sass = require('gulp-sass'); var stylish = require('jshint-stylish'); ////////////////////////////// // Variables ////////////////////////////// var dirs = { 'images': 'dev/images/*.{png,jpg,jpeg}', 'markdown': 'dev/patterns/**/*.md', 'sass': { 'main': 'dev/*.scss', 'patterns': 'dev/patterns/**/*.scss', 'lint': [ 'dev/patterns/**/*.scss', 'dev/dev.scss', '!dev/*.css' ] }, 'js': { 'lint': [ 'Gulpfile.js', '*.json', 'dev/dev.js', 'dev/patterns/**/package.json' ] }, 'html': { 'reload': [ 'dev/index.html', 'dev/patterns/**/html/*.html' ] } }; ////////////////////////////// // BrowserSync ////////////////////////////// gulp.task('browser-sync', function() { browserSync.init({ logPrefix: "Pattern Library", server: { baseDir: "./dev" } }); }); ////////////////////////////// // HTML Tasks ////////////////////////////// gulp.task('html:reload', function() { gulp.watch(dirs.html.reload).on('change', browserSync.reload); }); ////////////////////////////// // JavaScript Tasks ////////////////////////////// gulp.task('jshint', function() { return gulp.src(dirs.js.lint) .pipe(plumber()) .pipe(jshint()) .pipe(jshint.reporter(stylish)); }); gulp.task('jshint:watch', function() { gulp.watch(dirs.js.lint, ['jshint']); }); gulp.task('js:reload', function() { gulp.watch(dirs.js.lint).on('change', browserSync.reload); }); ////////////////////////////// // Sass Tasks ////////////////////////////// gulp.task('sass', function() { return gulp.src(dirs.sass.main) .pipe(rename('_pattern-library.scss')) .pipe(gulp.dest('dist')) .pipe(sass().on('error', sass.logError)) .pipe(autoprefixer({ browsers: ['> 1%', 'last 2 versions'] })) .pipe(gulp.dest('dev')) .pipe(browserSync.stream()); }); gulp.task('sass:dist', function() { return gulp.src(dirs.sass.patterns) .pipe(gulp.dest('dist/patterns')); }) gulp.task('sass:watch', function() { gulp.watch([dirs.sass.main, dirs.sass.patterns], ['sass', 'sass:dist']); }); ////////////////////////////// // Image Tasks ////////////////////////////// gulp.task('image', function() { return gulp.src(dirs.images) .pipe(gulp.dest('dist/images')); }); ////////////////////////////// // Markdown Tasks ////////////////////////////// gulp.task('markdown', function() { return gulp.src(dirs.markdown) .pipe(gulp.dest('dist/patterns')); }); ////////////////////////////// // Running Tasks ////////////////////////////// gulp.task('build', ['sass', 'sass:dist', 'image', 'markdown']); gulp.task('watch', ['sass:watch', 'jshint:watch', 'html:reload', 'js:reload']); gulp.task('default', ['browser-sync', 'build', 'watch']);
JavaScript
0.999787
@@ -2618,32 +2618,113 @@ images'));%0A%7D);%0A%0A +gulp.task('image:watch', function() %7B%0A gulp.watch(dirs.images, %5B'image'%5D);%0A%7D);%0A%0A //////////////// @@ -3011,21 +3011,8 @@ ss', - 'sass:dist', 'im @@ -3081,16 +3081,31 @@ :watch', + 'image:watch', 'html:r
4809e005ddaee8fcbd0d3bd5b28d8b1ffb10b208
Include Reticle.js
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var jsdoc = require('gulp-jsdoc3'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var _libfiles = [ 'node_modules/three/examples/js/controls/DeviceOrientationControls.js', 'node_modules/three/examples/js/effects/CardboardEffect.js', 'node_modules/tween.js/src/Tween.js', 'src/lib/OrbitControls.js', 'src/lib/GSVPano.js', 'src/lib/modifier/BendModifier.js', ]; var _panolensfiles = [ 'src/Panolens.js', 'src/DataImage.js', 'src/Modes.js', 'src/util/Utils.js', 'src/util/ImageLoader.js', 'src/util/TextureLoader.js', 'src/util/CubeTextureLoader.js', 'src/panorama/Panorama.js', 'src/panorama/ImagePanorama.js', 'src/panorama/GoogleStreetviewPanorama.js', 'src/panorama/CubePanorama.js', 'src/panorama/BasicPanorama.js', 'src/panorama/VideoPanorama.js', 'src/panorama/EmptyPanorama.js', 'src/interface/Tile.js', 'src/interface/TileGroup.js', 'src/interface/SpriteText.js', 'src/widget/Widget.js', 'src/infospot/Infospot.js', 'src/viewer/Viewer.js', 'src/util/font/Bmfont.js' ]; var _readme = [ 'README.md' ]; var jsdocConfig = { opts: { destination: './docs' }, templates: { outputSourceFiles: true, theme: 'paper' } }; gulp.task( 'default', [ 'minify', 'docs' ] ); gulp.task( 'minify', function() { return gulp.src( _libfiles.concat( _panolensfiles ) ) .pipe( concat( 'panolens.js', { newLine: ';' } ) ) .pipe( gulp.dest( './build/' ) ) .pipe( concat( 'panolens.min.js' ) ) .pipe( uglify() ) .pipe( gulp.dest( './build/' ) ); }); gulp.task( 'docs', function() { return gulp.src( _panolensfiles.concat( _readme ), {read: false} ) .pipe( jsdoc( jsdocConfig ) ); });
JavaScript
0
@@ -851,24 +851,53 @@ norama.js',%0A +%09'src/interface/Reticle.js',%0A %09'src/interf
8a51f787fb69ddef5b7558dbb96adbdbfa781601
Change name of the default task ingulpfile
gulpfile.js
gulpfile.js
//------------------------------------------------------------------- // PLUGINS //------------------------------------------------------------------- // plugins var gulp = require("gulp"), plugins = require("gulp-load-plugins")(), del = require("del"), browserSync = require("browser-sync"), historyApiFallback = require('connect-history-api-fallback'), runSequence = require("run-sequence"), webpack = require('webpack'), webpackStream = require('webpack-stream'), webpackDevMiddleware = require('webpack-dev-middleware'), webpackHotMiddleware = require('webpack-hot-middleware'), webpackConfig = require('./webpack.config'), babel = require('babel-core'), reporters = require('jasmine-reporters'); //------------------------------------------------------------------- // SETUP //------------------------------------------------------------------- // environments var app = "app/"; var dev = ".tmp/"; var prod = "dist/"; //folders var styles = "assets/styles"; var scripts = "assets/scripts"; var images = "assets/images"; var fonts = "assets/fonts"; var AUTOPREFIXER_BROWSERS = [ "ie >= 9", "ie_mob >= 10", "ff >= 30", "chrome >= 34", "safari >= 7", "opera >= 23", "ios >= 7", "android >= 4", "bb >= 10", ]; //------------------------------------------------------------------- // TASKS //------------------------------------------------------------------- gulp.task("styles", function() { return gulp.src(app + styles + "/**/*.scss") .pipe(plugins.plumber()) .pipe(plugins.sourcemaps.init()) .pipe(plugins.sass({ includePaths: ["./node_modules/frontendler-sass"] }).on("error", plugins.sass.logError)) .pipe(plugins.autoprefixer(AUTOPREFIXER_BROWSERS)) .pipe(plugins.sourcemaps.write()) .pipe(gulp.dest(dev + styles)) .pipe(browserSync.stream()) .pipe(plugins.size({ title: "styles", })); }); gulp.task("scripts", function() { return gulp.src(app + scripts + "/main.js") .pipe(plugins.plumber()) .pipe(webpackStream(webpackConfig.PROD)) .pipe(gulp.dest(dev + scripts)) .pipe(plugins.size({ title: "scripts" })); }); gulp.task("images", function() { return gulp.src(app + images + "/**/*") .pipe(plugins.plumber()) .pipe(plugins.cache(plugins.imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))) .pipe(gulp.dest(prod + images)) .pipe(plugins.size({ title: "images" })); }); gulp.task("html", function() { return gulp.src([app + "**/*.html"]) .pipe(plugins.plumber()) .pipe(plugins.useref({ searchPath: "{" + dev + "," + app + "}" })) .pipe(plugins.if("*.js", plugins.uglify())) .pipe(plugins.if("*.css", plugins.cssnano())) .pipe(plugins.if("*.html", plugins.minifyHtml())) .pipe(gulp.dest(prod)) .pipe(plugins.size({ title: "useref total" })); }); //------------------------------------------------------------------- // WATCH //------------------------------------------------------------------- gulp.task("clean:dev", del.bind(null, [dev])); gulp.task("serve:dev", function() { var bundler = webpack(webpackConfig.DEV); browserSync({ // tunnel: "frontendler", logConnections: true, logFileChanges: true, logPrefix: "Frontendler", server: { baseDir: [dev, app], middleware: [ webpackDevMiddleware(bundler, { publicPath: webpackConfig.DEV.output.publicPath, stats: { colors: true } }), webpackHotMiddleware(bundler), historyApiFallback() ] } }); gulp.watch([app + styles + "/**/*.scss"], ["styles"]); gulp.watch([app + fonts + "**/*"], ["fonts", browserSync.reload]); gulp.watch([app + images + "/**/*"], browserSync.reload); }); gulp.task("watch", ["clean:dev"], function(cb) { runSequence(["styles"], "serve:dev", cb); }); //------------------------------------------------------------------- // BUILD //------------------------------------------------------------------- gulp.task("clean:prod", del.bind(null, [prod])); gulp.task("copy:prod", function() { gulp.src([app + fonts + "/**/*.{eot,svg,ttf,woff}"]) .pipe(gulp.dest(prod + fonts)); gulp.src([app + "*.*", "node_modules/apache-server-configs/dist/.htaccess"], { dot: true }) .pipe(gulp.dest(prod)); }); gulp.task("build", ["clean:prod"], function(cb) { runSequence(["styles", "scripts", "images", "copy:prod"], "html", cb); }); //------------------------------------------------------------------- // TEST //------------------------------------------------------------------- gulp.task("test:server", function() { var bundler = webpack(webpackConfig.TEST); browserSync({ logConnections: true, logFileChanges: true, logPrefix: "Frontendler", server: { baseDir: ['test/'], middleware: [ webpackDevMiddleware(bundler, { publicPath: webpackConfig.TEST.output.publicPath, quiet: false, stats: { colors: true } }), webpackHotMiddleware(bundler), historyApiFallback() ] } }); gulp.watch(["test/**/*.js"], browserSync.reload); }); gulp.task('test',function(){ webpackConfig.PROD.devtool = ""; return gulp.src(['test/**/*.js']) .pipe(plugins.plumber()) .pipe(webpackStream(webpackConfig.PROD)) .pipe(gulp.dest('.test/')) .pipe(plugins.jasmine()); });
JavaScript
0.000002
@@ -4180,21 +4180,23 @@ p.task(%22 -watch +default %22, %5B%22cle
ef2403befb84ff07c8c83d8c36f6feed459eab0f
add git tagging/bump/etc
gulpfile.js
gulpfile.js
// // Knockout-Modal // MIT Licensed // var gulp = require('gulp'); var plugins = require('gulp-load-plugins')(); var config = { css: { src: 'styles/knockout-modal.less', dst: 'dist/', less_opts: {}, }, connect: { port: 4040, livereload: { port: 4041 }, root: [ 'spec/', 'dist/', '.', 'bower_components/', ] }, watch: { js: ['index.js', 'spec/test.js'], html: 'spec/*.html', less: ['styles/*', 'spec/test.css'] } }; gulp.task('less', function () { return gulp.src(config.css.src) .pipe(plugins.less(config.css.less_opts).on('error', console.log)) .pipe(plugins.autoprefixer()) .pipe(gulp.dest(config.css.dst)) .pipe(plugins.connect.reload()); }) gulp.task('connect', function () { plugins.connect.server(config.connect); }) gulp.task('html', function () { gulp.src(config.watch.html) .pipe(plugins.connect.reload()); }); gulp.task('js', function () { gulp.src(config.watch.js) .pipe(plugins.connect.reload()); }); gulp.task('watch', ['less', 'html', 'js'], function () { gulp.watch(config.watch.less, ['less']) gulp.watch(config.watch.html, ['html']) gulp.watch(config.watch.js, ['js']) }) gulp.task('live', ['watch', 'connect']) gulp.task('default', ['live'])
JavaScript
0.000001
@@ -496,16 +496,527 @@ %7D%0A%7D;%0A%0A +// from https://github.com/ikari-pl/gulp-tag-version%0Afunction inc(importance) %7B%0A return gulp.src(%5B'./package.json', './bower.json'%5D)%0A .pipe(plugins.bump(%7Btype: importance%7D))%0A .pipe(gulp.dest('./'))%0A .pipe(plugins.git.commit('bumps package version'))%0A .pipe(plugins.filter('package.json'))%0A .pipe(plugins.tagVersion())%0A%7D%0A%0Agulp.task('patch', function() %7B return inc('patch'); %7D)%0Agulp.task('feature', function() %7B return inc('minor'); %7D)%0Agulp.task('release', function() %7B return inc('major'); %7D)%0A%0A%0A gulp.tas
b9114b1808e7512a1becf031d37ec939e74ee1f1
remove unused code
gulpfile.js
gulpfile.js
process.env.NODE_ENV = '"release"'; var gulp = require('gulp'), rename = require('gulp-rename'), browserify = require('browserify'), sass = require('gulp-sass'), babel = require('gulp-babel'), gulpSequence = require('gulp-sequence'), miniPackageJson = require('./scripts/gulp-mini-package-json'), componentPropTypeJson = require('./scripts/gulp-component-prop-type-json'); function printError(e) { console.error(e.toString()); } /** * sass compile */ gulp.task('sass', function () { return gulp.src('./src/**/*.scss') .pipe(sass()) .on('error', printError) .pipe(gulp.dest('./dist')); }); /** * es compile */ gulp.task('es', function () { return gulp.src('./src/**/*.js') .pipe(babel({ plugins: ['transform-runtime'] })) .on('error', printError) .pipe(gulp.dest('./dist')); }); /** * copy extra files to dist */ gulp.task('copyAssets', function () { return gulp.src('./assets/**') .pipe(gulp.dest('./dist/assets')); }); gulp.task('copyNpmFiles', function () { return gulp.src(['README.md', './LICENSE']) .pipe(gulp.dest('./dist')); }); gulp.task('copyPackageJson', function () { return gulp.src('./package.json') .pipe(miniPackageJson()) .pipe(gulp.dest('./dist')); }); gulp.task('copyFiles', gulpSequence('copyAssets', 'copyNpmFiles', 'copyPackageJson')); /** * generate props type json include name, type, default and desc of components */ gulp.task('propType', function () { return gulp.src(['./src/**/*.js', '!./src/**/index.js']) .pipe(componentPropTypeJson()) .pipe(rename(function (path) { path.dirname = ''; path.extname = '.json'; })) .pipe(gulp.dest('./examples/assets/propTypes')); }); /** * build components for npm publish */ gulp.task('build', gulpSequence('sass', 'es', 'copyFiles')); /** * watch components src files */ gulp.task('watch', function () { gulp.watch('./src/**/*.scss', ['sass']); gulp.watch('./src/**/*.js', ['es']); });
JavaScript
0.000017
@@ -99,48 +99,8 @@ '),%0A - browserify = require('browserify'),%0A
3e797d86c91c167556ad31c6597e09c962b5134a
fix buid task
gulpfile.js
gulpfile.js
var browsersync = require('browser-sync'); var reload = browsersync.reload; var gulp = require('gulp'); var rename = require('gulp-rename'); var runSequence = require('run-sequence'); var pkg = require('./package.json'); var autoprefixerBrowsers = ['> 1%', 'last 2 version', 'Firefox ESR', 'Opera 12.1', 'IE 8', 'IE 9']; var headerBanner = [ '/*!', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', ' * @link <%= pkg.homepage %>', ' * @author <%= pkg.author %>', ' * @license <%= pkg.license %>', ' */', ''].join('\n'); module.exports = { 'browsersync': { server: './_public' }, 'uninstall': { files: [ './dist', './_public', './docs/static/build', './scss/vendor' ] }, 'rubysass': { src: './scss/sircus.scss', dest: './docs/static/build', rubySassOptions: { sourcemap: true, noCache: true, // style:'' }, autoprefixer: autoprefixerBrowsers, fallback:{ use:false, colorHexOptions:{rgba: true} }, filter:'**/*.css', headerBanner : true, banner:headerBanner, pkg: pkg, notify :"Compiled Sass" }, 'csslint': { setting:'./.csslintrc', src: './docs/static/build/sircus.css' }, 'cssmin': { src: './docs/static/build/sircus.css', dest: './docs/static/build' }, 'ghpage' : { src : './_public/**/*', remoteUrl : 'https://github.com/sircus/sircus.github.io.git', branch : 'master' }, 'hugo' : { src : './docs' }, 'bump': { version: pkg.version, // base src: './bower.json', // dest: '.' }, 'pagespeed': { production: 'http://sircus.blivesta.com', strategy: 'mobile' }, 'stylestats' :{ src: './dist/sircus.css' } }; gulp.task('bower', require('gulptasks/lib/bower')); gulp.task('rubysass', require('gulptasks/lib/rubysass')); gulp.task('csslint', require('gulptasks/lib/csslint')); gulp.task('cssmin', require('gulptasks/lib/cssmin')); gulp.task('stylestats', require('gulptasks/lib/stylestats')); gulp.task('deploy', require('gulptasks/lib/ghpage')); gulp.task('bump', require('gulptasks/lib/bump')); gulp.task('hugo', require('gulptasks/lib/hugo')); gulp.task('uninstall', require('gulptasks/lib/uninstall')); gulp.task('pagespeed', require('gulptasks/lib/pagespeed')); gulp.task('browsersync', require('gulptasks/lib/browsersync')); gulp.task('default',['browsersync'],function() { gulp.watch(['./scss/**/*.scss'], ['rubysass']); gulp.watch(['./docs/**/*.{html,css,md}'], ['hugo',reload]); gulp.watch(['./_public'], reload); }); gulp.task('dist',function() { return gulp.src('./docs/static/build/**.css') .pipe(gulp.dest('./dist')); }); gulp.task('bower-html5-reset',function() { return gulp.src('./bower_components/HTML5-Reset/assets/css/reset.css') .pipe(rename('_html5-reset.scss')) .pipe(gulp.dest('./scss/vendor/')); }); gulp.task('bower-normalize',function() { return gulp.src('./bower_components/normalize.css/normalize.css') .pipe(rename('_normalize.scss')) .pipe(gulp.dest('./scss/vendor/')); }); gulp.task('build', function() { runSequence( 'bower','uninstall', ['bower-html5-reset','bower-normalize'], 'rubysass', [ // 'csslint', 'cssmin'], 'hugo', ['bump','dist'], 'stylestats', ['default'] ); });
JavaScript
0.998909
@@ -3174,24 +3174,27 @@ nstall',%0A + // %5B'bower-htm
a135d7b24482f593db753281da87a7207fda8ef4
remove font-awesome from build process
gulpfile.js
gulpfile.js
var elixir = require('laravel-elixir') require('laravel-elixir-vue-2') elixir(function (mix) { mix.copy('./node_modules/font-awesome/fonts/**', 'public/fonts') mix.copy('./assets/images/**', './public/images') mix.sass('./assets/scss/app.scss', './public/css/app.css') mix.webpack('./app/index.js', './public/js/app.js') })
JavaScript
0.000001
@@ -93,77 +93,8 @@ ) %7B%0A - mix.copy('./node_modules/font-awesome/fonts/**', 'public/fonts')%0A
7c1bd5088330d5ecfa80fcc003890dc74a01444b
Use nicer path for examples
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var browserify = require('browserify'); var del = require('del'); var es = require('event-stream'); var fs = require('fs'); var ghPages = require('gulp-gh-pages'); var gutil = require('gulp-util'); var inject = require('gulp-inject'); var markdown = require('gulp-markdown'); var path = require('path'); var plumber = require('gulp-plumber'); var sass = require('gulp-sass'); var source = require('vinyl-source-stream'); var through = require('through2'); gulp.task('assets', copyAssets); gulp.task('sass', compileScss); gulp.task('scripts', compileScripts); gulp.task('build:core', ['assets', 'sass', 'scripts']); gulp.task('build:examples', ['build:core'], buildIndexFile); gulp.task('build', ['build:core', 'build:examples']); gulp.task('clean', cleanOutDir); gulp.task('deploy', ['build:examples'], deployGhPages); gulp.task('default', ['build:examples']); var outDir = 'out'; function copyAssets() { return gulp.src(['src/examples/**/*', '!src/examples/index.html', '!src/examples/**/*.scss', '!src/examples/**/*.js']) .pipe(gulp.dest(outDir)); } function compileScss() { return gulp.src('src/examples/**/*.scss') .pipe(sass()) .pipe(gulp.dest(outDir)); } function compileScripts(cb) { var scriptStreams = []; var basePath = path.resolve('src/examples'); gulp.src('src/examples/**/main.js') .pipe(through.obj(function (file, enc, callback) { var relativePath = path.dirname(file.path).substring(basePath.length); var stream = browserify(file.path) .transform('babelify') .bundle() .on('error', gutil.log) .pipe(source('main.js')) .pipe(gulp.dest(outDir + '/' + relativePath)) scriptStreams.push(stream); callback(); })) .on('data', gutil.log) .on('end', function () { es.merge.apply(null, scriptStreams) .on('end', cb); }); } function buildIndexFile(cb) { return gulp.src('src/index.html') // Examples .pipe(inject(gulp.src('src/examples/**/index.html').pipe(markdown()), { starttag : '<!-- inject:examples -->', transform : function (filePath, file) { // return file contents as string return '<li><a href="' + file.relative + '">' + file.relative + '</a></li>\n'; } })) // Documentation .pipe(inject(gulp.src('README.md').pipe(markdown()), { starttag : '<!-- inject:docs -->', transform : function (filePath, file) { // return file contents as string return file.contents.toString('utf8'); } })) .pipe(gulp.dest(outDir)); } function deployGhPages() { return gulp.src(outDir + '/**') .pipe(ghPages()); } function cleanOutDir(cb) { del([outDir, '.publish'], cb); }
JavaScript
0
@@ -2165,32 +2165,82 @@ tents as string%0A + console.log(nameFromPath(file.relative));%0A return ' @@ -2275,24 +2275,37 @@ ve + '%22%3E' + +nameFromPath( file.relativ @@ -2301,24 +2301,25 @@ ile.relative +) + '%3C/a%3E%3C/li @@ -2323,10 +2323,8 @@ /li%3E -%5Cn ';%0A @@ -2631,32 +2631,142 @@ p.dest(outDir)); +%0A%0A function nameFromPath(relativePath) %7B%0A return relativePath.substring(0, relativePath.indexOf('/'));%0A %7D %0A%7D%0A%0Afunction dep
248371ab9727408bd7541d9d14a42384f2694d79
include templates in replace
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'), ts = require('gulp-typescript'), clean = require('gulp-clean'), processhtml = require('gulp-processhtml'), uglify = require('gulp-uglify'), fs = require('fs'), replace = require('gulp-replace'); var releaseFolder = "release"; var packageJson = JSON.parse(fs.readFileSync('./package.json')); gulp.task('clean', function (callback) { return gulp.src(releaseFolder, {read: false}) .pipe(clean()); callback(); }); /** * Compile TypeScript and include references to library and app .d.ts files. */ gulp.task('compile-ts', ['clean'], function (callback) { var tsProject = ts.createProject('tsconfig.json', {outFile: "app.js"}); var tsResult = tsProject.src().pipe(ts(tsProject)); return tsResult.js.pipe(gulp.dest("./")); callback(); }); gulp.task('copy-release', ['clean'], function () { gulp.src([ './templates/**/*.html', './lib/**/*.js', './assets/**/*.*', './css/**/*.css' ], {base: './'}) .pipe(gulp.dest(releaseFolder)); }); gulp.task('process-html', ['clean'], function () { return gulp.src("index.html") .pipe(processhtml()) .pipe(gulp.dest(releaseFolder)); }); gulp.task('uglify', ['compile-ts'], function () { return gulp.src("app.js") .pipe(uglify()) .pipe(gulp.dest(releaseFolder)); }); gulp.task('replace', ['uglify','process-html'], function () { return gulp.src([releaseFolder + '/index.html',releaseFolder + '/app.js']) .pipe(replace( "__applicationVersionNumber__", packageJson.version )) .pipe(gulp.dest(releaseFolder)); }); gulp.task('default', ['clean','compile-ts','copy-release','process-html','uglify','replace']);
JavaScript
0
@@ -847,24 +847,32 @@ , function ( +callback ) %7B%0A%09gulp.sr @@ -1007,32 +1007,47 @@ releaseFolder)); +%0A%0A%09%09callback(); %0A%7D);%0A%0Agulp.task( @@ -1075,32 +1075,40 @@ an'%5D, function ( +callback ) %7B%0A%09return gulp @@ -1181,32 +1181,50 @@ releaseFolder)); +%0A%0A%09 %09callback(); %0A%7D);%0A%0Agulp.task( @@ -1251,32 +1251,40 @@ ts'%5D, function ( +callback ) %7B%0A%09return gulp @@ -1348,32 +1348,50 @@ releaseFolder)); +%0A%0A%09 %09callback(); %0A%7D);%0A%0Agulp.task( @@ -1425,16 +1425,31 @@ ss-html' +,'copy-release' %5D, funct @@ -1493,21 +1493,20 @@ der + '/ -index +**/* .html',r
549495015b8ccb55fa5abeb49cae663512d9dadb
Add events.js to scripts array to compile
gulpfile.js
gulpfile.js
const gulp = require('gulp'); const sass = require('gulp-sass'); const autoprefixer = require('gulp-autoprefixer'); const uglify = require('gulp-uglify'); const cleanCSS = require('gulp-clean-css'); const imagemin = require('gulp-imagemin'); const fileInclude = require('gulp-file-include'); const concat = require('gulp-concat'); const babel = require('gulp-babel'); // **UIKit Only** scripts to concatenate and minify. const UIKitScripts = [ 'src/uikit/js/uikit.js', 'src/uikit/js/components/slideshow.js' ]; // **Created Only** scripts to concatenate and minify. const scripts = [ 'src/js/main.js' ]; gulp.task('sass', () => { return gulp.src('src/sass/main.scss') .pipe(sass()) .pipe(autoprefixer({ browsers: ['last 3 versions'] })) .pipe(cleanCSS()) .pipe(concat('main.min.css')) .pipe(gulp.dest('build/css')); }); gulp.task('uk-scripts', () => { return gulp.src(UIKitScripts) .pipe(concat('uikit.min.js')) .pipe(gulp.dest('build/js')) .pipe(uglify()) .pipe(gulp.dest('build/js')); }); gulp.task('scripts', () => { return gulp.src(scripts) .pipe(concat('main.min.js')) .pipe(babel({ presets: ['es2015'] })) .pipe(gulp.dest('build/js')) .pipe(uglify()) .pipe(gulp.dest('build/js')); }); gulp.task('html', () => { return gulp.src(['src/index.html']) .pipe(fileInclude({ prefix: '@@', basepath: '@file' })) .pipe(gulp.dest('build')); }); gulp.task('img', () => { return gulp.src('src/img/*') .pipe(imagemin()) .pipe(gulp.dest('build/img')); }); gulp.task('default', ['sass', 'uk-scripts', 'scripts', 'html', 'img'], () => { gulp.watch('src/sass/*.scss', ['sass']); gulp.watch('src/js/*.js', ['scripts']); gulp.watch(['src/index.html', 'src/partials/*.html'], ['html']); });
JavaScript
0
@@ -604,20 +604,22 @@ 'src/js/ -main +events .js'%0A
185ed595f4191ba85d73a2d03aeac4f824bdc96e
add gulpfile to jshint scripts
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var filter = require('gulp-filter'); var less = require('gulp-less'); var uglify = require('gulp-uglify'); var minify_css = require('gulp-minify-css'); var rename = require('gulp-rename'); var jshint = require('gulp-jshint'); var jshint_stylish = require('jshint-stylish'); var bower = require('gulp-bower'); var browserify = require('gulp-browserify'); var ng_template_cache = require('gulp-angular-templatecache'); var nodemon = require('gulp-nodemon'); var es = require('event-stream'); var gconcat = require('gulp-concat'); var paths = { css: './src/css/**/*', views_ng: './src/views_ng/**/*', scripts: ['./src/server/**/*', './src/client/**/*'], server_main: './src/server/server.js', client_main: './src/client/main.js', client_externals: [ './bower_components/alertify.js/lib/alertify.min.js', ] }; gulp.task('bower', function() { return bower(); }); gulp.task('css', function() { return gulp.src(paths.css) .pipe(less()) .pipe(rename('styles.css')) .pipe(gulp.dest('build/public/css')) .pipe(minify_css()) .pipe(rename('styles.min.css')) .pipe(gulp.dest('build/public/css')); }); gulp.task('jshint', function() { return gulp.src(paths.scripts) .pipe(jshint()) .pipe(jshint.reporter(jshint_stylish)) .pipe(jshint.reporter('fail')); }); gulp.task('ng', function() { return gulp.src(paths.views_ng) .pipe(ng_template_cache()) .pipe(gulp.dest('build/')); }); gulp.task('js', ['bower', 'jshint'], function() { // single entry point to browserify return es.merge( gulp.src(paths.client_main) .pipe(browserify({ insertGlobals: true, debug: true })), gulp.src(paths.client_externals) ).pipe(gconcat('bundle.js')) .pipe(gulp.dest('build/public/js')) .pipe(uglify()) .pipe(rename('bundle.min.js')) .pipe(gulp.dest('build/public/js')); }); gulp.task('install', ['css', 'js']); var nodemon_instance; gulp.task('serve', ['install'], function() { if (!nodemon_instance) { nodemon_instance = nodemon({ script: paths.server_main, watch: 'src/__manual_watch__/', ext: '__manual_watch__', verbose: true, }).on('restart', function() { console.log('~~~ restart server ~~~'); }); } else { nodemon_instance.emit('restart'); } }); gulp.task('start_dev', ['serve'], function() { return gulp.watch('src/**/*', ['serve']); }); gulp.task('start_prod', function() { console.log('~~~ START PROD ~~~'); require(paths.server_main); }); if (process.env.DEV_MODE === 'dev') { gulp.task('start', ['start_dev']); } else { gulp.task('start', ['start_prod']); } gulp.task('default', ['start']);
JavaScript
0
@@ -673,16 +673,33 @@ nt/**/*' +, './gulpfile.js' %5D,%0A%09serv
8110a958586b429c653df77f667dd6df7569e228
add cssnext options
gulpfile.js
gulpfile.js
'use strict'; var browserSync = require('browser-sync'); var browserReload = browserSync.reload; var cssnano = require('cssnano'); var cssnext = require('postcss-cssnext'); var cssimport = require('postcss-import') var del = require('del'); var gulp = require('gulp'); var header = require('gulp-header'); var jshint = require('gulp-jshint'); var pkg = require('./package.json'); var postcss = require('gulp-postcss'); var rename = require('gulp-rename'); var runSequence = require('run-sequence'); var stylish = require('jshint-stylish'); var uglify = require('gulp-uglify'); var banner = [ '/*!', ' * <%= pkg.name %> v<%= pkg.version %>', ' * <%= pkg.description %>', ' * <%= pkg.homepage %>', ' * License : <%= pkg.license %>', ' * Author : <%= pkg.author %>', ' */', '', ''].join('\n'); var dirs = { src:'./src', dist:'./dist', sandbox:'./sandbox', }; gulp.task('css', function () { var processors = [ cssimport, cssnext, ]; return gulp .src(dirs.src + '/css/drawer.css') .pipe(postcss(processors)) .pipe(header(banner, { pkg: pkg })) .pipe(gulp.dest(dirs.dist + '/css')) .pipe(postcss([ cssnano({ discardComments: { removeAll: true } }) ])) .pipe(header(banner, { pkg: pkg })) .pipe(rename({ suffix: '.min' })) .pipe(gulp.dest(dirs.dist + '/css')); }); gulp.task('js', function(){ return gulp .src(dirs.src + '/js/drawer.js') .pipe(jshint()) .pipe(jshint.reporter(stylish)) .pipe(header(banner, { pkg:pkg })) .pipe(gulp.dest(dirs.dist + '/js')) .pipe(uglify()) .pipe(rename({ suffix: '.min' })) .pipe(header(banner, { pkg:pkg })) .pipe(gulp.dest(dirs.dist + '/js')); }); gulp.task('cleanup', function(cb){ return del([ dirs.dist ], cb); }); gulp.task('serve', function() { browserSync.init({ server: { baseDir: '.', directory: true } }); gulp.watch([ dirs.src + '/css/**/*.css'], ['css']); gulp.watch([ dirs.src + '/js/*.js'], ['js']); gulp.watch([ dirs.dist + '/**/*.min.{css,js}', dirs.sandbox + '/*.{css,html}' ]).on('change', browserReload); }); gulp.task('default', ['build'], function(cb) { runSequence('serve', cb); }); gulp.task('build', ['cleanup'], function(cb){ runSequence('js', 'css', cb); });
JavaScript
0
@@ -937,17 +937,96 @@ cssnext -, +(%7B%0A features: %7B%0A colorRgba: false,%0A rem: false%0A %7D%0A %7D) %0A %5D;%0A
2e504c3ae75625c6fe0701ed7817fbfd69546cc9
Remove file extension from glob pattern
gulpfile.js
gulpfile.js
'use strict' const { src, dest, watch, series, parallel } = require('gulp') const uglify = require('gulp-uglify') const rename = require('gulp-rename') const rtlcss = require('gulp-rtlcss') const sass = require('gulp-sass') const sourcemaps = require('gulp-sourcemaps') const typescript = require('gulp-typescript') const postcss = require('gulp-postcss') const cssnano = require('cssnano') const mqpacker = require('css-mqpacker') const mqsort = require('sort-css-media-queries') const focus = require('postcss-focus') const newer = require('gulp-newer') const rimraf = require('rimraf') const chmodr = require('chmodr') const tsConfig = require('./tsconfig.json') const paths = { styles: { src: ['./assets/styles/**/*.scss'], dest: './dist/styles' }, scripts: { src: tsConfig.include, dest: tsConfig.compilerOptions.outDir }, vendor: { dest: { dist: './dist/vendor', assets: './assets/vendor' } } } function _scripts(done) { src(paths.scripts.src) .pipe(newer(paths.scripts.dest)) .pipe(sourcemaps.init()) .pipe(typescript(tsConfig.compilerOptions)) .pipe(uglify()) .pipe(rename({'suffix': '.min'})) .pipe(sourcemaps.write()) .pipe(dest(paths.scripts.dest)) done() } function _styles(done) { src(paths.styles.src) .pipe(newer(paths.styles.dest)) .pipe(sourcemaps.init()) .pipe(sass().on('error', sass.logError)) .pipe(postcss([focus(), mqpacker({sort: mqsort}), cssnano()])) .pipe(rename({'suffix': '.min'})) .pipe(sourcemaps.write()) .pipe(dest(paths.styles.dest)) .pipe(rtlcss()) .pipe(rename(path => path.basename = path.basename.replace('.min', '-rtl.min') )) .pipe(dest(paths.styles.dest)) done() } function _vendor(done) { src([ './node_modules/html5shiv/dist/html5shiv.min.js', './node_modules/respond.js/dest/respond.min.js', './node_modules/what-input/dist/what-input.min.js', './node_modules/jquery/dist/jquery.min.js', './node_modules/jquery-migrate/dist/jquery-migrate.min.js' ]) .pipe(newer(paths.vendor.dest.dist)) .pipe(dest(paths.vendor.dest.dist)) src(['./node_modules/normalize.css/normalize.css']) .pipe(newer(paths.vendor.dest.dist)) .pipe(postcss([cssnano()])) .pipe(rename({'suffix': '.min'})) .pipe(dest(paths.vendor.dest.dist)) src(['./node_modules/@fortawesome/fontawesome-free/js/all.min.js']) .pipe(newer(paths.vendor.dest.dist)) .pipe(rename({'basename': 'font-awesome.min'})) .pipe(dest(paths.vendor.dest.dist)) src(['./node_modules/@fortawesome/fontawesome-free/js/v4-shims.min.js']) .pipe(newer(paths.vendor.dest.dist)) .pipe(rename({'basename': 'font-awesome-v4-shims.min'})) .pipe(dest(paths.vendor.dest.dist)) src(['./node_modules/@grottopress/scss/**']) .pipe(newer(paths.vendor.dest.assets)) .pipe(dest(`${paths.vendor.dest.assets}/@grottopress/scss`)) done() } function _watch() { watch(paths.scripts.src, {ignoreInitial: false}, _scripts) watch(paths.styles.src, {ignoreInitial: false}, _styles) } function _clean(done) { rimraf('./dist', done) } function _chmod(done) { const perm = 0o755 chmodr('./bin', perm, done) chmodr('./vendor/bin', perm, done) chmodr('./node_modules/.bin', perm, done) } exports.styles = _styles exports.scripts = _scripts exports.vendor = _vendor exports.watch = _watch exports.clean = _clean exports.chmod = _chmod exports.default = series(parallel(_styles, _scripts), _watch)
JavaScript
0
@@ -732,13 +732,8 @@ **/* -.scss '%5D,%0A
cb6fd36d30b1f854fdcc4ffdddaf58c7a1cc5937
Add new software to gulpfile
gulpfile.js
gulpfile.js
var gulp = require('gulp'), sass = require('gulp-ruby-sass'), autoprefixer = require('gulp-autoprefixer'), minifycss = require('gulp-minify-css'), jshint = require('gulp-jshint'), uglify = require('gulp-uglify'), rename = require('gulp-rename'), clean = require('gulp-clean'), concat = require('gulp-concat'), cache = require('gulp-cache'), express = require('express'), livereload = require('gulp-livereload'), lr = require('tiny-lr'), lrserver = lr(), server = express(), livereloadport = 35729, serverport = 5000; server.use(livereload({ port: livereloadport })); server.use(express.static(__dirname + '/dist/')); gulp.task('styles', function() { return gulp.src('src/sass/main.scss') .pipe(sass({ style: 'expanded' })) .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) .pipe(gulp.dest('dist/assets/css')) .pipe(rename({suffix: '.min'})) .pipe(minifycss()) .pipe(gulp.dest('dist/assets/css')) .pipe(livereload(lrserver)); }); gulp.task('scripts', function() { return gulp.src('src/js/**/*.js') .pipe(jshint('.jshintrc')) .pipe(jshint.reporter('default')) .pipe(concat('main.js')) .pipe(gulp.dest('dist/assets/js')) .pipe(rename({suffix: '.min'})) .pipe(uglify()) .pipe(gulp.dest('dist/assets/js')) .pipe(livereload(lrserver)); }); //gulp.task('images', function() { // return gulp.src('src/img/**/*') // .pipe(cache(imageop({ optimizationLevel: 5, progressive: true, interlaced: true }))) // .pipe(gulp.dest('dist/assets/img')) // .pipe(livereload(lrserver)); //}); gulp.task('clean', function() { return gulp.src(['dist/assets/css', 'dist/assets/js', 'dist/assets/img'], {read: false}) .pipe(clean()); }); gulp.task('serve', function() { server.listen(serverport); lrserver.listen(livereloadport); }); gulp.task('default', ['clean'], function() { gulp.start('styles', 'scripts'); }); gulp.task('watch', function() { gulp.start('serve'); // Watch .scss files gulp.watch('src/sass/**/*.scss', ['styles']); // Watch .js files gulp.watch('src/js/**/*.js', ['scripts']); // Watch image files // gulp.watch('src/img/**/*', ['images']); });
JavaScript
0
@@ -148,24 +148,73 @@ nify-css'),%0A + cmq = require('gulp-combine-media-queries'),%0A jshint = @@ -523,24 +523,87 @@ 'tiny-lr'),%0A + uncss = require('gulp-uncss'),%0A glob = require('glob'),%0A lrserver @@ -950,73 +950,147 @@ sion -', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4' +s'))%0A .pipe(uncss(%7B%0A html: glob.sync('dist/**/*.html'),%0A ignore: %5B/is-/, /not-/%5D%0A %7D))%0A .pipe(cmq(%7B%0A log: true%0A %7D ))%0A @@ -1609,254 +1609,8 @@ );%0A%0A -//gulp.task('images', function() %7B%0A// return gulp.src('src/img/**/*')%0A// .pipe(cache(imageop(%7B optimizationLevel: 5, progressive: true, interlaced: true %7D)))%0A// .pipe(gulp.dest('dist/assets/img'))%0A// .pipe(livereload(lrserver));%0A//%7D);%0A%0A gulp @@ -1695,27 +1695,8 @@ /js' -, 'dist/assets/img' %5D, %7B @@ -2136,82 +2136,7 @@ );%0A%0A - // Watch image files%0A // gulp.watch('src/img/**/*', %5B'images'%5D);%0A%0A%09%0A %7D);
e24fa4c123f2a25e6ba7be1ab99873b8c1a3c401
Add Babel Loader for `.js`
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var path = require('path'); var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); config = { docs: { entry: ['webpack-dev-server/client?http://localhost:9100', 'webpack/hot/dev-server', './docs/index.js'], output: { path: path.join(__dirname, 'build'), filename: 'bundle.js', publicPath: 'http://localhost:9100/build/' }, module: { loaders: [ { exclude: /node_modules/, test: /\.js$/, loaders: ['react-hot-loader'] }, { test: /\.jsx$/, exclude: /node_modules/, loaders: ['react-hot-loader', 'jsx-loader', 'babel-loader', 'react-map-styles'] }, { test: /\.css$/, loaders: [ 'style-loader', 'css-loader' ] }, { test: /\.md$/, loaders: [ 'html-loader' ] } ] }, resolve: { alias: { 'react-context': path.resolve(__dirname, './src/context.jsx'), 'react': path.resolve(__dirname, './node_modules/react') }, extensions: ['', '.js', '.jsx'], fallback: [ path.resolve(__dirname, './modules') ] }, plugins: [ new webpack.HotModuleReplacementPlugin({ quiet: true }), new webpack.NoErrorsPlugin() ], devtool: 'eval', quiet: true } }; gulp.task('docs', function(done) { done(); return new WebpackDevServer(webpack(config.docs), { publicPath: config.docs.output.publicPath, hot: true, stats: { cached: false, cachedAssets: false, exclude: ['node_modules', 'components'] } }).listen(9100, 'localhost', function(err, result) { if (err) { return console.log(err); } else { return console.log('webpack dev server listening at localhost:9100'); } }); }); gulp.task('static', function(done){ prodConfig = { entry: ['./docs/index.js'], output: { path: path.join(__dirname, '/build'), filename: 'bundle.js', publicPath: '/build/' }, module: { loaders: [{ test: /\.jsx$/, exclude: /node_modules/, loaders: ['jsx-loader', 'babel-loader', 'react-map-styles'] }, { test: /\.coffee$/, loaders: ['coffee-loader'] }, { test: /\.cjsx$/, loaders: ['coffee-jsx-loader', 'react-map-styles'] }, { test: /\.css$/, loaders: [ 'style-loader', 'css-loader' ] }, { test: /\.md$/, loaders: [ 'html-loader' ] } ] }, resolve: { alias: { 'react-context': path.resolve(__dirname, './src/context.jsx'), 'react': path.resolve(__dirname, './node_modules/react') }, extensions: ['', '.js', '.coffee', '.jsx', '.cjsx'], fallback: [path.resolve(__dirname, './modules')] }, plugins: [ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } }), new webpack.optimize.DedupePlugin(), // new webpack.optimize.UglifyJsPlugin({ // mangle: { // except: ['exports', 'require'] // }, // sourceMap: false, // output: {comments: false} // }), // new webpack.optimize.CommonsChunkPlugin("common.js") ], devtool: 'eval', quiet: true }; webpack(prodConfig, function(err, stats){ if(err) { throw new Error(err); } done(); }); }); gulp.task('default', ['docs']);
JavaScript
0
@@ -544,32 +544,48 @@ eact-hot-loader' +, 'babel-loader' %5D%0A %7D, %7B%0A @@ -2094,34 +2094,8 @@ %5B%7B%0A - test: /%5C.jsx$/,%0A @@ -2139,32 +2139,43 @@ -loaders: %5B'jsx- +test: /%5C.js$/,%0A loader -', +s: %5B 'bab @@ -2184,36 +2184,16 @@ -loader' -, 'react-map-styles' %5D%0A @@ -2218,22 +2218,19 @@ est: /%5C. -coffee +jsx $/,%0A @@ -2239,106 +2239,73 @@ -loaders: %5B'coffee-loader'%5D%0A %7D, %7B%0A test: /%5C.cjsx$/,%0A loaders: %5B'coffee-jsx +exclude: /node_modules/,%0A loaders: %5B'jsx-loader', 'babel -loa
ad2f2674be9eea9aa1ae598fa7d39051fd6271fb
test gulp commit
gulpfile.js
gulpfile.js
const gulp = require('gulp'); const rename = require("gulp-rename"); const replace = require("gulp-replace"); const ts = require('gulp-typescript'); const concat = require('gulp-concat'); const fs = require('fs'); const sourcemaps = require('gulp-sourcemaps'); const runSequence = require('run-sequence'); const bump = require('gulp-bump'); const child_process = require('child_process'); const spawn = child_process.spawn; let projectTypings = ts.createProject('src/tsconfig.json'); let projectCommonjs = ts.createProject('src/tsconfig.json', { target: "es6", }); gulp.task("publish", function(done) { runSequence('dist', 'increment-version', "commit-release", 'npm-publish', done); }) gulp.task('increment-version', function() { return gulp.src('./package.json') .pipe(bump()) .pipe(gulp.dest('./')); }); gulp.task('commit-release', function(done) { let json = JSON.parse(fs.readFileSync(__dirname + "/package.json").toString()); child_process.exec(`git add .; git commit -m "Release ${json.version}" -a; git tag v${json.version}; git push origin master --tags`, (error, stdout, stderr) => { if (error) { console.error(`exec error: ${error}`); return; } console.log(`stdout: ${stdout}`); console.log(`stderr: ${stderr}`); done(); }); }); gulp.task('npm-publish', function(done) { var publish = spawn('npm', ['publish'], { stdio: 'inherit' }) publish.on('close', function(code) { if (code === 8) { gulp.log('Error detected, waiting for changes...'); } done() }); }); gulp.task("commit", ["dist"], function() { const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question('What are the updates? ', (text) => { // TODO: Log the answer in a database child_process.exec(`git add .; git commit -m "${text}" -a; git push origin master`, (error, stdout, stderr) => { if (error) { console.error(`exec error: ${error}`); return; } console.log(`stdout: ${stdout}`); console.log(`stderr: ${stderr}`); done(); }); rl.close(); }); }); gulp.task("dist-typings", () => { let result = gulp.src('src/**/*.ts') .pipe(projectTypings()); return result.dts.pipe(gulp.dest('dist/typings')); }); gulp.task("dist-commonjs", () => { let result = gulp.src('src/**/*.ts') .pipe(sourcemaps.init()) .pipe(projectCommonjs()); return result.js.pipe(gulp.dest('dist/commonjs')); }); gulp.task("test-build", ["build"], () => { return runSequence("webpack") }); gulp.task('build', function() { let result = gulp.src('src/**/*.ts') .pipe(sourcemaps.init()) .pipe(projectCommonjs()); return result.js.pipe(gulp.dest('build/commonjs')); }); let node; gulp.task('hello', function() { if (node) node.kill() node = spawn('node', ['hello.js'], { stdio: 'inherit' }) node.on('close', function(code) { if (code === 8) { gulp.log('Error detected, waiting for changes...'); } }); }); gulp.task('watch', ['build'], function() { gulp.watch(['assets/**/*.js'], () => { runSequence('hello'); }); gulp.watch(['src/**/*.ts'], () => { runSequence('build'); }); }); gulp.task('dist', ['dist-typings', 'dist-commonjs'], function() { });
JavaScript
0.000001
@@ -1658,32 +1658,36 @@ ist%22%5D, function( +done ) %7B%0A const re
ba0b6cc0c9052513e9d247855ec7761f96daf644
Include *.json to be removed
gulpfile.js
gulpfile.js
const gulp = require('gulp'); const babel = require('gulp-babel'); const uglify = require('gulp-uglify-es').default; const clean = require('gulp-clean'); const eslint = require('gulp-eslint'); const gulpIf = require('gulp-if'); const mocha = require('gulp-mocha'); const sourcemaps = require('gulp-sourcemaps'); const livereload = require('gulp-livereload'); const sequence = require('run-sequence'); const symlink = require('gulp-symlink'); const fs = require('fs'); const path = require('path'); const rmdir = require('rmdir'); const yaml = require('gulp-yaml'); gulp.task('lintSrcs', () => { return gulp .src(['./src/**/*.js']) .pipe( eslint({ useEslintrc: true, fix: true }) ) .pipe(eslint.format()) .pipe( gulpIf(file => { return file.eslint != null && file.eslint.fixed; }, gulp.dest('./src')) ) .pipe(eslint.failAfterError()); }); gulp.task('lintTests', () => { return gulp .src(['./tests/**/*.js']) .pipe( eslint({ emitWarning: true, useEslintrc: true, fix: true }) ) .pipe(eslint.format()) .pipe( gulpIf(file => { return file.eslint != null && file.eslint.fixed; }, gulp.dest('./tests')) ) .pipe(eslint.failAfterError()); }); gulp.task('lint', done => { sequence('lintSrcs', 'lintTests', done); }); gulp.task('clean', () => { gulp .src([ './dist/*', './dist', './*.tgz', './services/environment', './services/start_systemd.sh', './services/systemd/candy-red.service', './services/systemd/environment' ]) .pipe(clean({ force: true })); }); gulp.task('nodes', () => { return Promise.all( fs .readdirSync('node_modules/') .filter(f => f.indexOf('local-node-') === 0) .filter(f => { try { return fs.statSync(`node_modules/${f}`).isDirectory(); } catch (_) { return false; } }) .map(f => { return new Promise((resolve, reject) => rmdir(`node_modules/${f}`, err => { if (err) { return reject(err); } return resolve(); }) ); }) ).then(() => { return gulp.src('./dist/nodes/local-*').pipe( symlink(f => { return path.join(`node_modules/${f.relative}`); }) ); }); }); gulp.task('copyResources', () => { gulp .src([ './src/**/*.{css,ico,png,html,json,yaml,yml}', '!./src/mo/**/*.{yaml,yml}' ]) .pipe(gulp.dest('./dist')); }); gulp.task('favicons', () => { return gulp .src('./src/public/images/icon*.png') .pipe(gulp.dest('./node_modules/node-red-dashboard/dist')); }); gulp.task('mo', () => { return gulp .src(['./src/mo/**/*.{yaml,yml}']) .pipe(yaml({ safe: true })) .pipe(gulp.dest('./dist/mo')); }); gulp.task('buildSrcs', ['copyResources', 'mo', 'favicons'], () => { return gulp .src('./src/**/*.js') .pipe(sourcemaps.init()) .pipe( babel({ minified: true, compact: true, configFile: './.babelrc' }) ) .on('error', console.error.bind(console)) .pipe( uglify({ mangle: {}, compress: { dead_code: true, drop_debugger: true, properties: true, unused: true, toplevel: true, if_return: true, drop_console: false, conditionals: true, unsafe_math: true, unsafe: true } }) ) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./dist')) .pipe(livereload()); }); gulp.task('build', done => { sequence('buildSrcs', 'nodes', done); }); gulp.task('copyTestResources', () => { gulp .src('./tests/**/*.{css,ico,png,html,json,yaml,yml}') .pipe(gulp.dest('./dist')); }); gulp.task('buildTests', ['buildSrcs', 'copyTestResources'], () => { return gulp .src('./tests/**/*.js') .pipe(sourcemaps.init()) .pipe(babel({ configFile: './.babelrc' })) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./dist')); }); gulp.task('watch', ['build'], () => { livereload.listen(); gulp.watch('./src/*.js', ['build']); }); gulp.task('runTests', () => { return gulp .src(['./dist/**/*.test.js'], { read: false }) .pipe( mocha({ require: ['source-map-support/register'], reporter: 'spec' }) ) .once('error', () => process.exit(1)) .once('end', () => process.exit()); }); gulp.task('test', done => { sequence('lint', 'buildTests', 'runTests', done); }); gulp.task('default', ['build']);
JavaScript
0
@@ -1434,16 +1434,36 @@ ist/*',%0A + './dist/*.*',%0A '.
9a572bfc146fdb7337188ef4a74681d83826cb82
Fix gulpfile
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var concat = require('gulp-concat'); var rev = require('gulp-rev'); var minifyCSS = require('gulp-cssnano'); var uglifyJS = require('gulp-uglify'); gulp.task('copy-fonts', function() { var fontPaths = [ './public/vendor/bootstrap/fonts/**', './public/vendor/font-awesome/fonts/**' ]; gulp.src(fontPaths) .pipe(gulp.dest('./dist/fonts/')); }); gulp.task('build-css', ['copy-fonts'], function() { var cssPaths = [ './public/vendor/bootstrap/css/bootstrap.css', './public/vendor/bootstrap/css/bootstrap-theme.css', './public/vendor/font-awesome/css/font-awesome.css', './public/vendor/bootstrap-markdown/css/bootstrap-markdown.min.css', './public/css/bootstrap_overrides.css', './public/css/general.css' ]; gulp.src(cssPaths) .pipe(concat('all.css')) .pipe(minifyCSS()) .pipe(gulp.dest('./dist/')); }); gulp.task('build-js', function() { var jsPaths = [ 'public/vendor/jquery/jquery-2.1.3.min.js', 'public/vendor/jquery-hotkeys/jquery.hotkeys.js', 'public/vendor/timeago/jquery.timeago.js', 'public/vendor/markdown/markdown.js', 'public/vendor/bootstrap-markdown/js/bootstrap-markdown.js', 'public/vendor/jquery-appear/jquery.appear.js', 'public/vendor/bootstrap/js/bootstrap.js', 'public/vendor/js/bootstrap.js', // Symlinked to node_modules/autolinker 'public/vendor/autolinker/dist/Autolinker.js', 'public/vendor/xbbcode/xbbcode/bbcode.js', // Symlinked to server/bbcode.js // Don't bundle typeahead since it's just used on edit_topic.js right now // 'public/vendor/typeahead/typeahead.bundle.js', 'public/js/bbcode_editor.js', ]; gulp.src(jsPaths) .pipe(concat('all.js')) .pipe(uglifyJS()) .pipe(gulp.dest('./dist/')); }); gulp.task('build-chat-js', function() { var paths = [ 'public/js/chat.js' ]; gulp.src(paths) .pipe(concat('chat.js')) .pipe(uglifyJS()) .pipe(gulp.dest('./dist/')); }); // // Note: I usually have to run `gulp build-assets` twice for it // to work. Need to look into why. // gulp.task('build-assets', ['build-css', 'build-js', 'build-chat-js'], function() { gulp.src(['dist/all.css', 'dist/all.js', 'dist/chat.js']) .pipe(rev()) .pipe(gulp.dest('dist')) .pipe(rev.manifest()) .pipe(gulp.dest('dist')); });
JavaScript
0.00011
@@ -312,32 +312,39 @@ onts/**'%0A %5D;%0A +return gulp.src(fontPat @@ -343,24 +343,24 @@ (fontPaths)%0A - .pipe( @@ -776,32 +776,39 @@ ral.css'%0A %5D;%0A +return gulp.src(cssPath @@ -1691,32 +1691,39 @@ tor.js',%0A %5D;%0A +return gulp.src(jsPaths @@ -1905,16 +1905,23 @@ %0A %5D;%0A +return gulp.src @@ -2205,18 +2205,25 @@ ion() %7B%0A - +return gulp.src
5fa5474c4cd1aad56c27efe554051c11b34afc8f
Change task
gulpfile.js
gulpfile.js
'use strict'; // Includes packages var gulp = require('gulp'); var sass = require('gulp-sass'); var autoprefixer = require('gulp-autoprefixer'); var mergeMediaQueries = require('gulp-merge-media-queries'); var cleanCss = require('gulp-clean-css'); var notify = require('gulp-notify'); // Paths variables var paths = { dist : 'dist', mainsass : ['src/style.scss'], scss : ['src/**/*.scss' ] }; // Compile SASS gulp.task('sass', function () { return gulp.src(paths.scss) .pipe(sass().on('error', sass.logError)) .pipe(autoprefixer({browsers: ['IE 8', 'IE 9', 'last 5 versions']})) .pipe(mergeMediaQueries()) .pipe(cleanCss()) .pipe(gulp.dest(paths.dist)) .pipe(notify({ message: 'Task SASS. Compiled successful. Happy Code!', onLast: true})); }); // Rerun the task when a file changes gulp.task('watch', function() { gulp.watch(paths.scss, ['sass']); }); // Run default task gulp.task('default', ['sass', 'watch']);
JavaScript
0.999983
@@ -748,20 +748,8 @@ ful. - Happy Code! ', o
4a8e19cd02265b81030aaf70619350fab20fb935
Update gulpfile.js
gulpfile.js
gulpfile.js
/* 创建Gulp配置文件 */ //引入 gulp var gulp = require('gulp'); //引入功能组件 var compass = require('gulp-compass'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var sourcemaps = require('gulp-sourcemaps'); var del = require('del'); var jshint = require('gulp-jshint'); var sass = require('gulp-sass'); var sourcemaps = require('gulp-sourcemaps'); var autoprefixer = require('gulp-autoprefixer'); var minifycss = require('gulp-minify-css'); var rename = require('gulp-rename'); // 图像处理 var imagemin = require('gulp-imagemin'); //十分大 var pngquant = require('imagemin-pngquant'); var spritesmith = require('gulp.spritesmith'); var imageResize = require('gulp-image-resize'); // 错误处理 var plumber = require("gulp-plumber"); var stylish = require("jshint-stylish"); // 开发辅助 var pkg = require('./package.json'); //获得配置文件中相关信息 var chalk = require('chalk'); //美化日志 var dateFormat = require('dateformat'); //获得自然时间 var csscomb = require('gulp-csscomb'); //CSS规范排序 // 打包发布 var zip = require('gulp-zip'); var ftp = require('gulp-ftp'); // 设置相关路径 var paths = { assets: 'assets', sass: 'dev/css/sass/**/*', css: 'dev/css', js: 'dev/js/**/*', //js文件相关目录 img: 'dev/img/**/*', //图片相关 }; gulp.task('clean', function(cb) { del(['build'], cb); }); // Sass 处理 gulp.task('sass', function() { gulp.src(paths.sass) .pipe(plumber()) .pipe(sourcemaps.init()) .pipe(sass()) .pipe(concat('style.css')) .pipe(gulp.dest(paths.css)) .pipe(minifycss()) .pipe(sourcemaps.write({ sourceRoot: '/css/sass' })) .pipe(rename('dev.min.css')) .pipe(gulp.dest('assets/css')); gulp.src(paths.sass) .pipe(plumber()) .pipe(sass()) .pipe(concat('style.css')) .pipe(csscomb()) .pipe(rename('uncompressed.css')) .pipe(gulp.dest('assets/css')) .pipe(gulp.dest(paths.css)) .pipe(minifycss()) .pipe(rename('all.min.css')) .pipe(gulp.dest('assets/css')); }); // JS检查 gulp.task('lint', function() { return gulp.src(paths.js) .pipe(jshint()) .pipe(jshint.reporter('default')); }); gulp.task('scripts', function() { // Minify and copy all JavaScript (except vendor scripts) // with sourcemaps all the way down gulp.src(paths.js) .pipe(plumber()) .pipe(sourcemaps.init()) .pipe(jshint()) .pipe(jshint.reporter(stylish)) .pipe(uglify({ compress: { drop_console: true } })) .pipe(concat('all.min.js')) .pipe(gulp.dest('assets/js')) .pipe(rename('dev.min.js')) .pipe(sourcemaps.write()) .pipe(gulp.dest('assets/js')); }); // 处理图像 gulp.task('image', function() { return gulp.src(paths.img) .pipe(imagemin({ progressive: true, svgoPlugins: [{ removeViewBox: false }], use: [pngquant()] })) .pipe(gulp.dest('assets/images')); }); /** * 自动生成@2x图片精灵 * $ gulp sprite * algorithm排列有top-down,left-right,diagonal,alt-diagonal,binary-tree五种方式,根据需求选择 * 参考:https://github.com/Ensighten/spritesmith#algorithms * 此task生成的为@2x的高清图 */ gulp.task('retinasprite', function(cb) { del(['dev/img/*.png'], function() { console.log(chalk.red('[清理] 删除旧有精灵')) }); var spriteData = gulp.src('dev/sprites/*.png').pipe(spritesmith({ imgName: '[email protected]', cssName: '_sprite.scss', algorithm: 'binary-tree', padding: 10 //建议留白10像素 })); spriteData.img.pipe(gulp.dest('dev/img/')); // 输出合成图片 spriteData.css.pipe(gulp.dest('dev/css/sass/')).on('end', cb) console.log(chalk.green('[缩略] 生成高清图')) }); /** * 自动生成@1x图片精灵 * 在retinasprite执行后自动生成标清精灵 */ gulp.task('standardsprite', ['retinasprite'], function(cb) { console.log(chalk.green('[缩略] 生成标清图')) gulp.src('dev/img/[email protected]').pipe(imageResize({ width: '50%' })) .pipe(rename('sprite.png')) .pipe(gulp.dest('dev/img/')).on('end', cb) }) gulp.task('sprite2assets', ['retinasprite', 'standardsprite'], function() { console.log(chalk.green('[转移] 复制精灵图到资源目录')) gulp.src('dev/img/*.png').pipe(gulp.dest('assets/images/')) }) /** * 文件变更监听 * $ gulp watch */ gulp.task('watch', function() { console.log(chalk.green('[监听] 启动gulp watch自动编译')) gulp.watch(paths.js, ['scripts']); gulp.watch(paths.sass, ['sass']); }); /** * 生成最终交付文件夹 * $ gulp build * */ gulp.task('build', function() { del(['build'], function() { console.log(chalk.red('[清理] 删除旧有build文件夹')) }); gulp.src('*.html').pipe(gulp.dest('build')) gulp.src('assets/**/!(*dev*)*').pipe(gulp.dest('build/assets')) }); /** * 压缩最终的文件 * 自动增加当前时间戳 + 项目名称 * $ gulp zip */ gulp.task('zip', function() { var now = new Date(); del(['zipped/*.zip'], function() { console.log(chalk.red('[清理] 删除旧有压缩包')) }); console.log(chalk.red('[压缩] 打包最终文件')) gulp.src('build/**/*') .pipe(zip(dateFormat(now, 'yyyy-mmmm-dS-h-MMTT') + '-' + pkg.name + '.zip')) .pipe(gulp.dest('zipped/')) }); gulp.task('ftp', function() { console.log(chalk.red('[发布] 上传到内网服务器')) gulp.src('build/**/*') .pipe(ftp({ host: '10.97.19.100', user: 'ftp', pass: '123456', remotePath: pkg.name })) .pipe(gutil.noop()); }); gulp.task('sprite', ['retinasprite', 'standardsprite', 'sprite2assets']); gulp.task('default', ['watch', 'scripts']); gulp.task('watch:base', ['watch']);
JavaScript
0.000001
@@ -320,54 +320,8 @@ ');%0A -var sourcemaps = require('gulp-sourcemaps');%0A%0A %0Avar
8f60f934e77c84fa62e587d0364ecb84ee6b2a98
add hbs to the default gulp task
gulpfile.js
gulpfile.js
var del = require('del') , metadata = require('./package') , path = require('path') , nconf = require('nconf') var gulp = require('gulp') , concat = require('gulp-concat') , cssmin = require('gulp-cssmin') , gutil = require('gulp-util') , gzip = require('gulp-gzip') , handlebars = require('gulp-compile-handlebars') , less = require('gulp-less') , rename = require('gulp-rename') , tar = require('gulp-tar') , uglify = require('gulp-uglify') , watch = require('gulp-watch') var bowerComponents = './bower_components' , dist = './assets' , src = './src' nconf.file('./config.json') gulp.task('default', ['less', 'js', 'assets', 'vendor']) gulp.task('less', function () { gutil.log('Compiling less files.') return gulp.src(path.join(src, 'less/app.less')) .pipe(less({ paths: [path.join(src, 'less')] })) .pipe(cssmin()) .pipe(rename({basename: 'style'})) .pipe(gulp.dest(path.join(dist, 'css'))) }) gulp.task('js', function () { gutil.log('Compiling js files.') return gulp.src(path.join(src, 'js/*.js')) .pipe(uglify()) .pipe(rename({basename: 'all', suffix:'.min'})) .pipe(gulp.dest(path.join(dist, 'js'))) }) gulp.task('hbs', function () { var context = nconf.get() return gulp.src(path.join(src, 'hbs/*.hbs')) .pipe(handlebars(context)) .pipe(gulp.dest('./partials')) }) gulp.task('assets', function () { var blogCover = path.join(src, 'img', 'the-wheat-field.jpg') return gulp.src(blogCover) .pipe(gulp.dest(path.join(dist, 'img'))) }) gulp.task('vendor', ['vendor-css', 'vendor-js', 'vendor-assets']) gulp.task('vendor-css', ['vendor-less'], function () { var highlight = path.join(bowerComponents, 'highlightjs', 'styles', 'rainbow.css') var vendorLess = path.join('tmp', 'vendor-less.css') return gulp.src([highlight, vendorLess]) .pipe(concat('vendor.css')) .pipe(cssmin()) .pipe(gulp.dest(path.join(dist, 'vendor'))) }) gulp.task('vendor-less', function () { var fontawesome = path.join(bowerComponents, 'fontawesome', 'less') return gulp.src(path.join(src, 'vendor-less', 'fontawesome.less')) .pipe(less({paths: [fontawesome]})) .pipe(rename({basename: 'vendor-less'})) .pipe(gulp.dest('tmp')) }) gulp.task('vendor-js', function () { var highlight = path.join(bowerComponents, 'highlightjs', 'highlight.pack.js') return gulp.src([highlight]) .pipe(concat('vendor.js')) .pipe(uglify()) .pipe(gulp.dest(path.join(dist, 'vendor'))) }) gulp.task('vendor-assets', function () { var fontawesome = path.join(bowerComponents, 'fontawesome') return gulp.src(path.join(fontawesome, 'fonts/*.*'), {base: fontawesome}) .pipe(gulp.dest(path.join(dist, 'vendor'))) }) gulp.task('watch', function () { gulp.watch(path.join(src, 'less/*.less'), ['less']) //watch(path.join(src, 'js/*.js'), compileJs) }) gulp.task('clean', function (cb) { del([path.join(dist, 'vendor'), path.join(dist, 'css'), path.join(dist, 'js'), 'tmp', release + '.tar.gz'], cb) }) gulp.task('package', ['default'], function () { var packageName = metadata.name + '-' + metadata.version return gulp.src([path.join(dist, '**/*.*'), 'partials/*.*', '*.hbs', 'package.json'], {base: '.'}) .pipe(tar(packageName + '.tar')) .pipe(gzip()) .pipe(gulp.dest('.')) })
JavaScript
0.000001
@@ -579,16 +579,73 @@ './src' +%0A , packageName = metadata.name + '-' + metadata.version %0A%0Anconf. @@ -702,16 +702,23 @@ ', 'js', + 'hbs', 'assets @@ -2976,17 +2976,19 @@ %7B%0A del( -%5B + %5B path.joi @@ -3004,16 +3004,24 @@ vendor') +%0A , path.j @@ -3036,16 +3036,24 @@ , 'css') +%0A , path.j @@ -3071,153 +3071,198 @@ js') -, 'tmp', release + '.tar.gz'%5D, cb)%0A%7D)%0A%0Agulp.task('package', %5B'default'%5D, function () %7B%0A var packageName = metadata.name + '-' + metadata.version +%0A , path.join('./partials/%7Bdisqus,google-analytics%7D.hbs')%0A , 'tmp'%0A , packageName + '.tar.gz'%0A %5D%0A , cb%0A )%0A%7D)%0A%0Agulp.task('package', %5B'default'%5D, function () %7B%0A %0A r
a5c676b6ec71b49f947609ec6f935ef141fbefac
Fix paths on gulpfile
gulpfile.js
gulpfile.js
/** ================================== * Gulpfile * ==================================== * - Info * - Config * - Paths * - Modules * - Tasks * - Browser Sync * - Clean * - Connect Sync * - Reload * - Styles * - Scripts * - Pages * - Images * - Libs * - JS * - CSS * - Fonts * - Watch * - Default * - Build * ================================== * ================================== **/ var packageJson = require('./package.json'), // Info projectName = packageJson.name, // Config config = { compressed: true, format: 'wordpress', localhost: '127.0.0.1', port: '3001' }, // Paths paths = { default: { basePath: 'www/', scripts: 'src/js/**/*.js', scriptsDest: 'www/js', styles: 'src/css/**/*.sass', stylesDest: 'www/css', images: 'src/img/**/*.*', imagesDest: 'www/img', pages: 'src/**/*.jade', fontsDest: 'www/fonts', }, wordpress: { basePath: 'wordpress/wp-content/themes/'+projectName, scripts: 'src/js/**/*.js', scriptsDest: 'wordpress/wp-content/themes/'+projectName+'/js', styles: 'src/css/**/*.sass', stylesDest: 'wordpress/wp-content/themes/'+projectName+'/css', images: 'src/img/**/*.*', imagesDest: 'wordpress/wp-content/themes/'+projectName+'/img', pages: 'src/**/*.jade', fontsDest: 'wordpress/wp-content/themes/'+projectName+'/fonts' } }, // Modules gulp = require('gulp'), plumber = require('gulp-plumber'), rename = require('gulp-rename'), autoprefixer = require('gulp-autoprefixer'), minifyCss = require('gulp-minify-css'), concat = require('gulp-concat'), uglify = require('gulp-uglify'), imagemin = require('gulp-imagemin'), cache = require('gulp-cache'), sass = require('gulp-sass'), browserSync = require('browser-sync'), flatten = require('gulp-flatten'), gulpFilter = require('gulp-filter'), jade = require('gulp-jade-php'), connect = require('gulp-connect-php'), gulpsync = require('gulp-sync')(gulp), del = require('del'), mainBowerFiles = require('gulp-main-bower-files'); // Tasks paths = paths[config.format]; // Browser Sync gulp.task('browser-sync', function() { browserSync({ server: { baseDir: paths.basePath } }); }); // Clean gulp.task('clean', function() { return del([ paths.basePath ]); }); // Connect Sync gulp.task('connect-sync', function() { connect.server({ port: config.port, base: paths.basePath, livereload: true }, function (){ browserSync({ proxy: config.localhost+':'+config.port }); }); }); // Reload gulp.task('reload', function () { browserSync.reload(); }); // Styles gulp.task('styles', function(){ gulp.src([paths.styles]) .pipe(plumber({ errorHandler: function (error) { console.log(error.message); this.emit('end'); }})) .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) .pipe(rename({suffix: '.min'})) .pipe(autoprefixer(['last 2 versions', 'ie 8', 'ie 9', '> 1%'])) .pipe(gulp.dest(paths.stylesDest)) .pipe(browserSync.reload({stream:true})) }); // Scripts gulp.task('scripts', function(){ return gulp.src([paths.scripts]) .pipe(plumber({ errorHandler: function (error) { console.log(error.message); this.emit('end'); }})) .pipe(concat('main.js')) .pipe(rename({suffix: '.min'})) .pipe(uglify()) .pipe(gulp.dest(paths.scriptsDest)) .pipe(browserSync.reload({stream:true})) }); // Pages gulp.task('pages', function(){ return gulp.src([paths.pages]) .pipe(plumber({ errorHandler: function (error) { console.log(error.message); this.emit('end'); }})) .pipe(jade({ pretty: !config.compressed, locals:{ echo:function(str){ return "<?php echo $"+str+"; ?>" } } })) .pipe(gulp.dest(paths.basePath)) .pipe(browserSync.reload({stream:true})) }); // Images gulp.task('images', function(){ gulp.src([paths.images]) .pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))) .pipe(gulp.dest(paths.imagesDest)); }); // Libs gulp.task('libs', function() { var jsFilter = gulpFilter('**/*.js', {restore: true}); var cssFilter = gulpFilter('**/*.css', {restore: true}); var fontFilter = gulpFilter(['**/*.eot', '**/*.woff' , '**/*.woff2' , '**/*.svg', '**/*.ttf'], {restore: true}); return gulp.src('./bower.json') .pipe(mainBowerFiles()) .pipe(plumber({ errorHandler: function (error) { console.log(error.message); this.emit('end'); }})) // JS .pipe(jsFilter) .pipe(concat('libs.js')) .pipe(rename({suffix: ".min"})) .pipe(uglify()) .pipe(gulp.dest(paths.scriptsDest)) .pipe(jsFilter.restore) //CSS .pipe(cssFilter) .pipe(minifyCss({compatibility: 'ie8'})) .pipe(concat('libs.min.css')) .pipe(gulp.dest(paths.stylesDest)) .pipe(cssFilter.restore) // Fonts .pipe(fontFilter) .pipe(flatten()) .pipe(gulp.dest(paths.fontsDest)); }); // Watch gulp.task('watch',function(){ gulp.watch(paths.styles, ['styles']); gulp.watch(paths.scripts, ['scripts']); gulp.watch(paths.pages, ['pages']); gulp.watch(paths.images, ['images']); gulp.task('reload'); }); // Default gulp.task('default', gulpsync.sync([ 'build', 'watch', 'connect-sync' ]) ); // Build gulp.task('build', gulpsync.sync([ 'clean', 'styles', 'scripts', 'pages', 'images', 'libs' ]) );
JavaScript
0.000004
@@ -877,32 +877,55 @@ src/**/*.jade',%0A + pagesDest: 'www/',%0A fontsDest: ' @@ -987,39 +987,9 @@ ess/ -wp-content/themes/'+projectName +' ,%0A @@ -1305,24 +1305,83 @@ **/*.jade',%0A + pagesDest: 'wordpress/wp-content/themes/'+projectName,%0A fontsDes @@ -2469,24 +2469,25 @@ paths. -basePath +pagesDest %0A %5D);%0A%7D @@ -4065,24 +4065,25 @@ t(paths. -basePath +pagesDest ))%0A .
5957fde7c8f9990be8fcf579bdac3a1ccac42dde
add tasks to compile sass, and fix bug where watchScripts task might be watching the wrong folder
gulpfile.js
gulpfile.js
"use strict"; var gulp = require('gulp'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var rename = require('gulp-rename'); var maps = require('gulp-sourcemaps'); var JS_SOURCE_DIR = 'js/'; var JS_DEST_DIR = 'public_html/scripts/'; var DIST_NAME = 'app'; //name of compiled file to be served i.e. app.js and app.min.js gulp.task('concatScripts', function(){ return gulp.src(['app'].map(function(file){return JS_SOURCE_DIR + file + '.js';})) .pipe(maps.init()) .pipe(concat(DIST_NAME + '.js')) .pipe(maps.write('./')) .pipe(gulp.dest(JS_DEST_DIR)); }); gulp.task('minifyScripts', ['concatScripts'], function(){ return gulp.src(JS_DEST_DIR + DIST_NAME + '.js') .pipe(uglify()) .pipe(rename(DIST_NAME + '.min.js')) .pipe(gulp.dest(JS_DEST_DIR)); }); gulp.task('watchScripts', function(){ gulp.watch('js/**/*.js', ['minifyScripts']); }); gulp.task('build', ['minifyScripts']); gulp.task('default', ['build']);
JavaScript
0
@@ -185,16 +185,49 @@ emaps'); +%0Avar sass = require('gulp-sass'); %0A%0Avar JS @@ -377,16 +377,93 @@ min.js%0A%0A +var SASS_SOURCE_DIR = 'sass/';%0Avar STYLES_DEST_DIR = 'public_html/styles/';%0A%0A gulp.tas @@ -949,20 +949,33 @@ p.watch( -'js/ +JS_SOURCE_DIR + ' **/*.js' @@ -993,32 +993,300 @@ cripts'%5D);%0A%7D);%0A%0A +gulp.task('sass', function() %7B%0A gulp.src(SASS_SOURCE_DIR + '**/*.scss')%0A .pipe(sass().on('error', sass.logError))%0A .pipe(gulp.dest(STYLES_DEST_DIR));%0A%7D);%0Agulp.task('watchSass',function() %7B%0A gulp.watch(SASS_SOURCE_DIR + '**/*.scss', %5B'sass'%5D);%0A%7D);%0A%0A gulp.task('build @@ -1300,24 +1300,32 @@ nifyScripts' +, 'sass' %5D);%0Agulp.tas