【开发合约编译脚本】const fs = require('fs');const solc = require('solc');const path = require('path');const compiled path = path.resolve(_dirname,'../contracts','name.sol');fs.removeSync(compiledPath);fs.ensureDirSync(compiledPath);const contract path = path.resolve(_dirname',../comtracts','name.sol');const contractSource = fs.readFile(contractPath,'utf-8');let compileResult = solc.compile(contractSource,1);if(Array.is Array(compileResult.error)&&compileResult.errors.length){ throw new error(compileResult.errors.length.errors[0]);}Object.keys(result.contracts) forEach(name=>{ let contractName = name.replace('/^:/,''); let filePath = path.resolve(_dirname,'../compiled',`${contractName}.json); console log("Saving JSON file to",filePath);});加油

!