Merge pull request #407 from ethereum/feature-metadata-saver

Adding metadata save on each compile
pull/5370/head
yann300 4 years ago committed by GitHub
commit f81568b1df
  1. 5
      apps/remix-ide-e2e/src/tests/generalSettings.test.ts
  2. 7
      apps/remix-ide/src/app/files/compiler-metadata.js

@ -27,6 +27,11 @@ module.exports = {
.pause(3000)
.click('*[data-id="verticalIconsKindfileExplorers"]')
.openFile('browser/artifacts/Ballot.json')
.openFile('browser/artifacts/Ballot_metadata.json')
.getEditorValue((content) => {
const metadata = JSON.parse(content)
browser.assert.equal(metadata.language, 'Solidity')
})
},
'Should add new github access token': function (browser: NightwatchBrowser) {

@ -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(JSON.parse(contract.object.metadata), null, '\t'))
var data = {
deploy,
data: {

Loading…
Cancel
Save