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('solidity', {ipc: this.ipc, useDashboard: this.useDashboard});
|
||||
this.registerModule('vyper');
|
||||
this.registerModule('contracts_manager', {compileOnceOnly: options.compileOnceOnly});
|
||||
this.registerModule('contracts_manager', {plugins: this.plugins, compileOnceOnly: options.compileOnceOnly});
|
||||
}
|
||||
|
||||
deploymentService(options) {
|
||||
|
|
|
@ -57,6 +57,10 @@ Plugins.prototype.loadInternalPlugin = function(pluginName, pluginConfig) {
|
|||
var plugin;
|
||||
try {
|
||||
plugin = require(pluginPath);
|
||||
|
||||
if (plugin.default) {
|
||||
plugin = plugin.default;
|
||||
}
|
||||
} catch(_e) {
|
||||
pluginPath = fs.embarkPath('modules/' + pluginName);
|
||||
plugin = require(pluginPath);
|
||||
|
|
|
@ -13,6 +13,7 @@ class ContractsManager {
|
|||
const self = this;
|
||||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.plugins = options.plugins;
|
||||
|
||||
this.contracts = {};
|
||||
this.contractDependencies = {};
|
||||
|
@ -226,6 +227,11 @@ class ContractsManager {
|
|||
|
||||
if(resetContracts) self.contracts = {};
|
||||
async.waterfall([
|
||||
function beforeBuild(callback) {
|
||||
self.plugins.emitAndRunActionsForEvent("build:beforeAll", () => {
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function loadContractFiles(callback) {
|
||||
self.events.request("config:contractsFiles", (contractsFiles) => {
|
||||
self.contractsFiles = contractsFiles;
|
||||
|
|
|
@ -114,6 +114,7 @@ describe('embark.Contracts', function() {
|
|||
};
|
||||
|
||||
let contractsManager = new ContractsManager(embarkObj, {
|
||||
plugins: plugins,
|
||||
contractDirectories: ['app/contracts']
|
||||
});
|
||||
|
||||
|
@ -239,6 +240,7 @@ describe('embark.Contracts', function() {
|
|||
}
|
||||
|
||||
let contractsManager = new ContractsManager(embarkObj, {
|
||||
plugins: plugins,
|
||||
contractDirectories: ['app/contracts']
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue