conflict in en.json

This commit is contained in:
Jonathan Rainville 2018-05-16 16:41:15 -04:00
parent 3c0fda5a40
commit 1c125a019c
3 changed files with 114 additions and 14 deletions

View File

@ -96,6 +96,7 @@
"help": "help", "help": "help",
"quit": "quit", "quit": "quit",
"Error Compiling/Building contracts: ": "Error Compiling/Building contracts: ", "Error Compiling/Building contracts: ": "Error Compiling/Building contracts: ",
"file not found, creating it...": "file not found, creating it..."
"{{className}} has code associated to it but it's configured as an instanceOf {{parentContractName}}": "{{className}} has code associated to it but it's configured as an instanceOf {{parentContractName}}", "{{className}} has code associated to it but it's configured as an instanceOf {{parentContractName}}": "{{className}} has code associated to it but it's configured as an instanceOf {{parentContractName}}",
"downloading {{packageName}} {{version}}....": "downloading {{packageName}} {{version}}....", "downloading {{packageName}} {{version}}....": "downloading {{packageName}} {{version}}....",
"Swarm node is offline...": "Swarm node is offline...", "Swarm node is offline...": "Swarm node is offline...",

View File

@ -1,6 +1,6 @@
const fs = require('../core/fs.js'); const fs = require('../core/fs.js');
const async = require('async'); const async = require('async');
const child_process = require('child_process'); const ProcessLauncher = require('../process/processLauncher');
const utils = require('../utils/utils.js'); const utils = require('../utils/utils.js');
const constants = require('../constants'); const constants = require('../constants');
@ -69,22 +69,18 @@ class Pipeline {
// JS files // JS files
async.waterfall([ async.waterfall([
function runWebpack(next) { function runWebpack(next) {
const webpackProcess = child_process.fork(utils.joinPath(__dirname, 'webpackProcess.js')); const webpackProcess = new ProcessLauncher({
modulePath: utils.joinPath(__dirname, 'webpackProcess.js'),
logger: self.logger,
normalizeInput: self.normalizeInput
});
console.log('Starting process');
webpackProcess.send({action: constants.pipeline.init, options: {}}); webpackProcess.send({action: constants.pipeline.init, options: {}});
webpackProcess.send({action: constants.pipeline.build, file, importsList}); webpackProcess.send({action: constants.pipeline.build, file, importsList});
webpackProcess.on('message', function (msg) { webpackProcess.subscribeTo('result', constants.pipeline.built, (msg) => {
if (msg.result === constants.pipeline.built) {
webpackProcess.disconnect(); webpackProcess.disconnect();
return next(msg.error); return next(msg.error);
}
if (msg.result === constants.process.log) {
if (self.logger[msg.type]) {
return self.logger[msg.type](self.normalizeInput(msg.message));
}
self.logger.debug(self.normalizeInput(msg.message));
}
}); });
}, },

View File

@ -0,0 +1,103 @@
const child_process = require('child_process');
const constants = require('../constants');
class ProcessLauncher {
constructor(options) {
this.process = child_process.fork(options.modulePath);
this.logger = options.logger;
this.normalizeInput = options.normalizeInput;
this.subscriptions = {};
this._subscribeToMessages();
}
_subscribeToMessages() {
const self = this;
this.process.on('message', (msg) => {
console.log('Received message', msg);
if (msg.result === constants.process.log) {
if (self.logger[msg.type]) {
return self.logger[msg.type](self.normalizeInput(msg.message));
}
self.logger.debug(self.normalizeInput(msg.message));
return;
}
const messageKeys = Object.keys(msg);
const subscriptionsKeys = Object.keys(self.subscriptions);
let subscriptions;
let messageKey;
// Find if the message contains a key that we are subscribed to
messageKeys.some(_messageKey => {
return subscriptionsKeys.some(subscriptionKey => {
if (_messageKey === subscriptionKey) {
subscriptions = self.subscriptions[subscriptionKey];
messageKey = _messageKey;
return true;
}
return false;
});
});
if (subscriptions) {
console.log('Found the subscriptions');
let subscription;
// Find if we are subscribed to one of the values
subscriptions.some(sub => {
if (msg[messageKey] === sub.value) {
subscription = sub;
return true;
}
return false;
});
if (subscription) {
console.log('Found the sub and calling');
// We are subscribed to that message, call the callback
subscription.callback(msg);
}
}
});
}
subscribeTo(key, value, callback) {
console.log('Subscribe to ', key, value);
if (this.subscriptions[key]) {
this.subscriptions[key].push(value);
return;
}
this.subscriptions[key] = [{value, callback}];
console.log('Subs', this.subscriptions);
}
unsubscribeTo(key, value) {
if (!value) {
this.subscriptions[key] = [];
}
if (this.subscriptions[key]) {
this.subscriptions[key].filter((val, index) => {
if (val.value === value) {
this.subscriptions[key] = this.subscriptions[key].splice(index, 1);
}
});
}
}
unsubsribeToAll() {
this.subscriptions = {};
}
send() {
this.process.send(...arguments);
}
disconnect() {
this.process.disconnect();
}
kill() {
this.process.kill(...arguments);
}
}
module.exports = ProcessLauncher;