mirror of https://github.com/embarklabs/embark.git
feat: add new event before build
This commit is contained in:
parent
17cec1b787
commit
db35d7f573
|
@ -212,7 +212,7 @@ class Engine {
|
||||||
this.registerModule('compiler', {plugins: this.plugins, disableOptimizations: options.disableOptimizations});
|
this.registerModule('compiler', {plugins: this.plugins, disableOptimizations: options.disableOptimizations});
|
||||||
this.registerModule('solidity', {ipc: this.ipc, useDashboard: this.useDashboard});
|
this.registerModule('solidity', {ipc: this.ipc, useDashboard: this.useDashboard});
|
||||||
this.registerModule('vyper');
|
this.registerModule('vyper');
|
||||||
this.registerModule('contracts_manager', {compileOnceOnly: options.compileOnceOnly});
|
this.registerModule('contracts_manager', {plugins: this.plugins, compileOnceOnly: options.compileOnceOnly});
|
||||||
}
|
}
|
||||||
|
|
||||||
deploymentService(options) {
|
deploymentService(options) {
|
||||||
|
|
|
@ -57,6 +57,10 @@ Plugins.prototype.loadInternalPlugin = function(pluginName, pluginConfig) {
|
||||||
var plugin;
|
var plugin;
|
||||||
try {
|
try {
|
||||||
plugin = require(pluginPath);
|
plugin = require(pluginPath);
|
||||||
|
|
||||||
|
if (plugin.default) {
|
||||||
|
plugin = plugin.default;
|
||||||
|
}
|
||||||
} catch(_e) {
|
} catch(_e) {
|
||||||
pluginPath = fs.embarkPath('modules/' + pluginName);
|
pluginPath = fs.embarkPath('modules/' + pluginName);
|
||||||
plugin = require(pluginPath);
|
plugin = require(pluginPath);
|
||||||
|
|
|
@ -13,6 +13,7 @@ class ContractsManager {
|
||||||
const self = this;
|
const self = this;
|
||||||
this.logger = embark.logger;
|
this.logger = embark.logger;
|
||||||
this.events = embark.events;
|
this.events = embark.events;
|
||||||
|
this.plugins = options.plugins;
|
||||||
|
|
||||||
this.contracts = {};
|
this.contracts = {};
|
||||||
this.contractDependencies = {};
|
this.contractDependencies = {};
|
||||||
|
@ -226,6 +227,11 @@ class ContractsManager {
|
||||||
|
|
||||||
if(resetContracts) self.contracts = {};
|
if(resetContracts) self.contracts = {};
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
|
function beforeBuild(callback) {
|
||||||
|
self.plugins.emitAndRunActionsForEvent("build:beforeAll", () => {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
},
|
||||||
function loadContractFiles(callback) {
|
function loadContractFiles(callback) {
|
||||||
self.events.request("config:contractsFiles", (contractsFiles) => {
|
self.events.request("config:contractsFiles", (contractsFiles) => {
|
||||||
self.contractsFiles = contractsFiles;
|
self.contractsFiles = contractsFiles;
|
||||||
|
|
|
@ -114,6 +114,7 @@ describe('embark.Contracts', function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
let contractsManager = new ContractsManager(embarkObj, {
|
let contractsManager = new ContractsManager(embarkObj, {
|
||||||
|
plugins: plugins,
|
||||||
contractDirectories: ['app/contracts']
|
contractDirectories: ['app/contracts']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -239,6 +240,7 @@ describe('embark.Contracts', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let contractsManager = new ContractsManager(embarkObj, {
|
let contractsManager = new ContractsManager(embarkObj, {
|
||||||
|
plugins: plugins,
|
||||||
contractDirectories: ['app/contracts']
|
contractDirectories: ['app/contracts']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue