Merge pull request #506 from embark-framework/bug_fix/slow-pipeline

Speed up the webpack process a little bit
This commit is contained in:
Iuri Matias 2018-06-12 12:15:02 -04:00 committed by GitHub
commit 4ebeb86c3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 12 deletions

View File

@ -1,31 +1,23 @@
let path = require('path');
let globule = require('globule');
let merge = require('merge');
let http = require('follow-redirects').http; let http = require('follow-redirects').http;
let https = require('follow-redirects').https; let https = require('follow-redirects').https;
let shelljs = require('shelljs');
var tar = require('tar');
var propose = require('propose');
var Web3 = require('web3');
var Web3EthAbi = require('web3-eth-abi');
const constants = require('../constants');
//let fs = require('../core/fs.js');
let o_fs = require('fs-extra');
function joinPath() { function joinPath() {
const path = require('path');
return path.join.apply(path.join, arguments); return path.join.apply(path.join, arguments);
} }
function filesMatchingPattern(files) { function filesMatchingPattern(files) {
const globule = require('globule');
return globule.find(files, {nonull: true}); return globule.find(files, {nonull: true});
} }
function fileMatchesPattern(patterns, intendedPath) { function fileMatchesPattern(patterns, intendedPath) {
const globule = require('globule');
return globule.isMatch(patterns, intendedPath); return globule.isMatch(patterns, intendedPath);
} }
function recursiveMerge(target, source) { function recursiveMerge(target, source) {
const merge = require('merge');
return merge.recursive(target, source); return merge.recursive(target, source);
} }
@ -82,6 +74,7 @@ function httpsGetJson(url, callback) {
} }
function runCmd(cmd, options) { function runCmd(cmd, options) {
const shelljs = require('shelljs');
let result = shelljs.exec(cmd, options || {silent: true}); let result = shelljs.exec(cmd, options || {silent: true});
if (result.code !== 0) { if (result.code !== 0) {
console.log("error doing.. " + cmd); console.log("error doing.. " + cmd);
@ -94,10 +87,12 @@ function runCmd(cmd, options) {
} }
function cd(folder) { function cd(folder) {
const shelljs = require('shelljs');
shelljs.cd(folder); shelljs.cd(folder);
} }
function sed(file, pattern, replace) { function sed(file, pattern, replace) {
const shelljs = require('shelljs');
shelljs.sed('-i', pattern, replace, file); shelljs.sed('-i', pattern, replace, file);
} }
@ -106,6 +101,7 @@ function exit(code) {
} }
function downloadFile(url, dest, cb) { function downloadFile(url, dest, cb) {
const o_fs = require('fs-extra');
var file = o_fs.createWriteStream(dest); var file = o_fs.createWriteStream(dest);
(url.substring(0,5) === 'https' ? https : http).get(url, function(response) { (url.substring(0,5) === 'https' ? https : http).get(url, function(response) {
response.pipe(file); response.pipe(file);
@ -119,6 +115,8 @@ function downloadFile(url, dest, cb) {
} }
function extractTar(filename, packageDirectory, cb) { function extractTar(filename, packageDirectory, cb) {
const o_fs = require('fs-extra');
const tar = require('tar');
o_fs.createReadStream(filename).pipe( o_fs.createReadStream(filename).pipe(
tar.x({ tar.x({
strip: 1, strip: 1,
@ -130,6 +128,7 @@ function extractTar(filename, packageDirectory, cb) {
} }
function proposeAlternative(word, _dictionary, _exceptions) { function proposeAlternative(word, _dictionary, _exceptions) {
const propose = require('propose');
let exceptions = _exceptions || []; let exceptions = _exceptions || [];
let dictionary = _dictionary.filter((entry) => { let dictionary = _dictionary.filter((entry) => {
return exceptions.indexOf(entry) < 0; return exceptions.indexOf(entry) < 0;
@ -142,6 +141,7 @@ function pwd() {
} }
function getExternalContractUrl(file) { function getExternalContractUrl(file) {
const constants = require('../constants');
let url; let url;
const RAW_URL = 'https://raw.githubusercontent.com/'; const RAW_URL = 'https://raw.githubusercontent.com/';
const MALFORMED_ERROR = 'Malformed Github URL for '; const MALFORMED_ERROR = 'Malformed Github URL for ';
@ -187,18 +187,22 @@ function getExternalContractUrl(file) {
} }
function hexToNumber(hex){ function hexToNumber(hex){
const Web3 = require('web3');
return Web3.utils.hexToNumber(hex); return Web3.utils.hexToNumber(hex);
} }
function decodeParams(typesArray, hexString){ function decodeParams(typesArray, hexString){
var Web3EthAbi = require('web3-eth-abi');
return Web3EthAbi.decodeParameters(typesArray, hexString); return Web3EthAbi.decodeParameters(typesArray, hexString);
} }
function toChecksumAddress(address) { function toChecksumAddress(address) {
const Web3 = require('web3');
return Web3.utils.toChecksumAddress(address); return Web3.utils.toChecksumAddress(address);
} }
function sha3(arg) { function sha3(arg) {
const Web3 = require('web3');
return Web3.utils.sha3(arg); return Web3.utils.sha3(arg);
} }