Adding metadata save on each compile

feature-metadata-saver
Edi 4 years ago
parent 81a5f1a78c
commit 0e5f1abb9d
  1. 7
      apps/remix-ide/src/app/files/compiler-metadata.js

@ -24,6 +24,10 @@ class CompilerMetadata extends Plugin {
return path + '/' + this.innerPath + '/' + contractName + '.json'
}
_MetadataFileName(path, contractName) {
return path + '/' + this.innerPath + '/' + contractName + '_metadata' + '.json'
}
onActivation () {
var self = this
this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
@ -36,6 +40,7 @@ class CompilerMetadata extends Plugin {
if (contract.file !== source.target) return
var fileName = self._JSONFileName(path, contract.name)
var metadataFileName = self._MetadataFileName(path, contract.name)
provider.get(fileName, (error, content) => {
if (!error) {
content = content || '{}'
@ -51,6 +56,8 @@ class CompilerMetadata extends Plugin {
deploy[network] = self._syncContext(contract, deploy[network] || {})
})
provider.set(metadataFileName, JSON.stringify(contract.object.metadata, null, '\t'));
var data = {
deploy,
data: {

Loading…
Cancel
Save