From dbfbb98647b59797c855b5d6871a18d2a3c87256 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 18 Feb 2022 14:24:06 +0530 Subject: [PATCH] save compilation result in file --- .../src/lib/compiler-metadata.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index dfd4ade1dd..bf83805509 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -23,7 +23,7 @@ export class CompilerMetadata extends Plugin { } _MetadataFileName (path, contractName) { - return this.joinPath(path, this.innerPath, contractName + '_metadata.json') + return this.joinPath(path, this.innerPath, contractName + '_compResult.json') } onActivation () { @@ -51,28 +51,22 @@ export class CompilerMetadata extends Plugin { async _setArtefacts (content, contract, path) { content = content || '{}' + const fileName = this._JSONFileName(path, contract.name) + const metadataFileName = this._MetadataFileName(path, contract.name) + + if (contract && contract.object) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(contract.object, null, '\t')) + let metadata try { metadata = JSON.parse(content) } catch (e) { console.log(e) } - const fileName = this._JSONFileName(path, contract.name) - const metadataFileName = this._MetadataFileName(path, contract.name) - const deploy = metadata.deploy || {} this.networks.forEach((network) => { deploy[network] = this._syncContext(contract, deploy[network] || {}) }) - let parsedMetadata - try { - parsedMetadata = JSON.parse(contract.object.metadata) - } catch (e) { - console.log(e) - } - if (parsedMetadata) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(parsedMetadata, null, '\t')) - const data = { deploy, data: {