sol-straightener is an NPM package to straighten the Solidity smart contracts for various purposes. It fetches the content of each imported file and returns the straightened version. It works inside a file.
npm install --save sol-straightener
const Straightener = require('sol-straightener');
let result = await Straightener.straighten(<solidity/file/path>);
An import straightened file contents will be returned which can be used for further processing or writing a file.
Currently it handles import
of files from:
- relative directories, e.g;
import "./lib/SafeMath.sol";
- All parent
node_modules
directories, e.g;import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
- Github, e.g;
import "github.com/oraclize/ethereum-api/oraclizeAPI_0.5.sol";
Contribution in any form is most welcome.