This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const { promisify } = require('util'); | |
const compareImages = promisify(require('looks-same')); | |
const createDiffImage = promisify(require('looks-same').createDiff); | |
const resembleCompareImages = require('resemblejs/compareImages'); | |
const sharp = require('sharp'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ts = require('typescript'); | |
const IMPORT_RE = /(.*)\.pcss$/; | |
const REPLACE_TO = '$1.css'; | |
module.exports = function () { | |
return function (context) { | |
function visitor(node) { | |
const isImport = ts.isImportDeclaration(node); | |
const moduleName = isImport && node.moduleSpecifier ? node.moduleSpecifier.text : null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const spriteSize = { | |
width: 610.6, | |
height: 248.5 | |
}; | |
const symbolSize = { | |
width: 610.6, | |
height: 108.5 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (wallaby) => { | |
const config = { | |
files: [ | |
{ pattern: 'lib/*.js' }, | |
{ pattern: 'lib/**/*.js' }, | |
{ pattern: 'test/tests-*.js', instrument: false } | |
], | |
tests: [ | |
{ pattern: 'test/*.test.js' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const data = require('./server-data.json'); | |
const server = express(); | |
const responseHeaders = { | |
'Content-Type': 'application/javascript', | |
'Access-Control-Allow-Origin': '*' | |
}; | |
server.get('/products/releases', (req, res) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./styles.css'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compiler.plugin('compilation', function(compilation) { | |
compilation.plugin('chunk-asset', function (chunk, filename) { | |
// chunk.name can be useful, usually it's name of entrypoint | |
delete this.assets[filename]; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devServer: { | |
// It suppress error shown in console, so it has to be set to false. | |
quiet: false, | |
// It suppress everything except error, so it has to be set to false as well | |
// to see success build. | |
noInfo: false, | |
stats: { | |
// Config for minimal console.log mess. | |
assets: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} src Markdown source. | |
* @param {string} [delimiter='---'] Front matter delimiter. --- by default. | |
* @returns {{meta: Object, body: string}} | |
*/ | |
function parseYAMLFrontMatter(src, delimiter) { | |
var delimiter = delimiter || '---'; | |
var meta = null; | |
var body = src; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAdditionalAssets(compilation) { | |
var stats = compilation.getStats().toJson(); | |
var modules = stats.modules; | |
var chunks = {}; | |
modules.forEach(function (module) { | |
var moduleChunks = module.chunks; | |
var isNormalModule = module.chunks.length > 0 && module.assets.length == 0; | |
if (isNormalModule) | |
return; |
NewerOlder