diff --git a/post-install.js b/post-install.js index 61728b2..ffcc982 100644 --- a/post-install.js +++ b/post-install.js @@ -1,23 +1,15 @@ const fs = require('fs'); -function runModifyBuffer( path ) { +try { + const nativeStrategyPath = require.resolve("@truffle/compile-solidity/dist/compilerSupplier/loadingStrategies/Native.js"); + const maxBuffer = '1024 * 1024 * 50'; const maxBufferRequired = '1024 * 1024 * 1024'; - const nativeStrategy = fs.readFileSync(path, 'utf8'); + const nativeStrategy = fs.readFileSync(nativeStrategyPath, 'utf8'); const modifiedNativeStrategy = nativeStrategy.replace(maxBuffer, maxBufferRequired); - fs.writeFileSync(path, modifiedNativeStrategy); -} - -let nativeStrategyPath = require.resolve("@truffle/compile-solidity/dist/compilerSupplier/loadingStrategies/Native.js"); - -if (fs.existsSync(nativeStrategyPath)) { - return runModifyBuffer(nativeStrategyPath); -} - -nativeStrategyPath = '../@truffle/compile-solidity/dist/compilerSupplier/loadingStrategies/Native.js'; - -if (fs.existsSync(nativeStrategyPath)) { - return runModifyBuffer(nativeStrategyPath); -} + fs.writeFileSync(nativeStrategyPath, modifiedNativeStrategy); +} catch (e) { + console.info(e); +} \ No newline at end of file