don't browserify signale

pull/5370/head
yann300 6 years ago
parent 91469bbdd1
commit c7895af8df
  1. 2
      remix-solidity/src/compiler/compiler.js
  2. 8
      remix-tests/src/compiler.js
  3. 45
      remix-tests/src/index.js

@ -73,7 +73,7 @@ function Compiler (handleImportCall) {
function onInternalCompilerLoaded () {
if (worker === null) {
var compiler
var userAgent = (typeof (navigator) != 'undefined') && navigator.userAgent ? navigator.userAgent.toLowerCase() : "-"
var userAgent = (typeof (navigator) !== 'undefined') && navigator.userAgent ? navigator.userAgent.toLowerCase() : '-'
if (typeof (window) === 'undefined' || userAgent.indexOf(' electron/') > -1) {
compiler = require('solc')
} else {

@ -2,7 +2,6 @@
let fs = require('fs')
var async = require('async')
var path = require('path')
const signale = require('signale')
let RemixCompiler = require('remix-solidity').Compiler
String.prototype.regexIndexOf = function (regex, startpos) {
@ -10,6 +9,9 @@ String.prototype.regexIndexOf = function (regex, startpos) {
return (indexOf >= 0) ? (indexOf + (startpos || 0)) : indexOf
}
var userAgent = (typeof (navigator) !== 'undefined') && navigator.userAgent ? navigator.userAgent.toLowerCase() : '-'
var isBrowser = !(typeof (window) === 'undefined' || userAgent.indexOf(' electron/') > -1)
// TODO: replace this with remix's own compiler code
function compileFileOrFiles (filename, isDirectory, cb) {
let compiler, filepath
@ -52,7 +54,7 @@ function compileFileOrFiles (filename, isDirectory, cb) {
], function (err, result) {
let errors = (result.errors || []).filter((e) => e.type === 'Error' || e.severity === 'error')
if (errors.length > 0) {
signale.fatal(errors)
if (!isBrowser) require('signale').fatal(errors)
return cb(new Error('errors compiling'))
}
cb(err, result.contracts)
@ -91,7 +93,7 @@ function compileContractSources (sources, importFileCb, cb) {
], function (err, result) {
let errors = (result.errors || []).filter((e) => e.type === 'Error' || e.severity === 'error')
if (errors.length > 0) {
signale.fatal(errors)
if (!isBrowser) require('signale').fatal(errors)
return cb(new Error('errors compiling'))
}
cb(err, result.contracts)

@ -1,7 +1,6 @@
const async = require('async')
const path = require('path')
const fs = require('fs')
const { Signale } = require('signale')
require('colors')
let Compiler = require('./compiler.js')
@ -17,28 +16,6 @@ var createWeb3Provider = function () {
return web3
}
// signale configuration
const options = {
types: {
result: {
badge: '\t✓',
label: '',
color: 'greenBright'
},
name: {
badge: '\n\t◼',
label: '',
color: 'white'
},
error: {
badge: '\t✘',
label: '',
color: 'redBright'
}
}
}
const signale = new Signale(options)
var runTestSources = function (contractSources, testCallback, resultCallback, finalCallback, importFileCb) {
async.waterfall([
function compile (next) {
@ -119,6 +96,28 @@ var runTestSources = function (contractSources, testCallback, resultCallback, fi
}
var runTestFiles = function (filepath, isDirectory, web3) {
const { Signale } = require('signale')
// signale configuration
const options = {
types: {
result: {
badge: '\t✓',
label: '',
color: 'greenBright'
},
name: {
badge: '\n\t◼',
label: '',
color: 'white'
},
error: {
badge: '\t✘',
label: '',
color: 'redBright'
}
}
}
const signale = new Signale(options)
async.waterfall([
function compile (next) {
Compiler.compileFileOrFiles(filepath, isDirectory, next)

Loading…
Cancel
Save