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
var webpack = require('webpack'); | |
var MemoryFS = require('memory-fs'); | |
var SingleEntryDependency = require('webpack/lib/dependencies/SingleEntryDependency'); | |
var fs = new MemoryFS(); | |
fs.mkdirpSync('/src'); | |
fs.writeFileSync('/src/app.js', 'require("./dep.js")', 'utf-8'); | |
fs.writeFileSync('/src/dep.js', 'module.exports = function(msg){console.log(msg)}', 'utf-8'); | |
fs.writeFileSync('/src/extra-entry.js', 'require("./dep.js")', 'utf-8'); |
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 {Compilation} compilation Webpack compilation | |
* @returns {{ | |
* byChunkName: {chunkName: Array<{name: string, source: string}>}, | |
* extra: Array<{name: string, source: string}> | |
* }} | |
*/ | |
var getAssets = function (compilation) { | |
var EXTRA_ASSETS_CHUNK_NAME = '__extra_assets__'; | |
var stats = compilation.getStats().toJson(); |
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 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 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, |
NewerOlder