mirror of https://github.com/embarklabs/embark.git
feat(@embark/pipeline): enable choosing which fields to filter out
This commit is contained in:
parent
f9fb302740
commit
b5c81bd41a
|
@ -52,7 +52,9 @@ module.exports = {
|
|||
//strategy: 'implicit',
|
||||
|
||||
// minimalContractSize, when set to true, tells Embark to generate contract files without the heavy bytecodes
|
||||
// Using filteredFields lets you customize which field you want to filter out of the contract file (requires minimalContractSize: true)
|
||||
// minimalContractSize: false,
|
||||
// filteredFields: [],
|
||||
|
||||
contracts: {
|
||||
// example:
|
||||
|
|
|
@ -52,7 +52,9 @@ module.exports = {
|
|||
//strategy: 'implicit',
|
||||
|
||||
// minimalContractSize, when set to true, tells Embark to generate contract files without the heavy bytecodes
|
||||
// Using filteredFields lets you customize which field you want to filter out of the contract file (requires minimalContractSize: true)
|
||||
// minimalContractSize: false,
|
||||
// filteredFields: [],
|
||||
|
||||
contracts: {
|
||||
SimpleStorage: {
|
||||
|
|
|
@ -52,7 +52,9 @@ module.exports = {
|
|||
//strategy: 'implicit',
|
||||
|
||||
// minimalContractSize, when set to true, tells Embark to generate contract files without the heavy bytecodes
|
||||
// Using filteredFields lets you customize which field you want to filter out of the contract file (requires minimalContractSize: true)
|
||||
// minimalContractSize: false,
|
||||
// filteredFields: [],
|
||||
|
||||
contracts: {
|
||||
// example:
|
||||
|
|
|
@ -343,11 +343,17 @@ class Pipeline {
|
|||
async.each(contracts, (contract, eachCb) => {
|
||||
if (self.embark.config.contractsConfig.minimalContractSize) {
|
||||
contract = Object.assign({}, contract);
|
||||
delete contract.code;
|
||||
delete contract.runtimeBytecode;
|
||||
delete contract.realRuntimeBytecode;
|
||||
delete contract.gasEstimates;
|
||||
delete contract.swarmHash;
|
||||
|
||||
const filteredFields = self.embark.config.contractsConfig.filteredFields || [
|
||||
'code',
|
||||
'runtimeBytecode',
|
||||
'realRuntimeBytecode',
|
||||
'gasEstimates',
|
||||
'swarmHash'
|
||||
];
|
||||
filteredFields.forEach(filteredField => {
|
||||
delete contract[filteredField];
|
||||
});
|
||||
}
|
||||
self.fs.writeJson(dappPath(
|
||||
self.buildDir,
|
||||
|
|
Loading…
Reference in New Issue