-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
54 lines (46 loc) · 1.31 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const shell = require('shelljs');
const parser = require('@solidity-parser/parser');
const fs = require('fs');
const path = require('path');
const log = console.log;
const targets = [
{
repo: "https://github.com/OpenZeppelin/openzeppelin-contracts.git",
folder: "openzeppelin-contracts",
branch: "master",
contracts: "contracts"
},
{
repo: "https://github.com/omisego/plasma-contracts.git",
folder: "plasma-contracts",
branch: "master",
contracts: "plasma_framework/contracts"
},
{
repo: "https://github.com/Synthetixio/synthetix.git",
folder: "synthetix",
branch: "alpha",
contracts: "contracts"
},
];
function parseAll(){
for (target of targets){
log();
log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
log(`Parsing ${target.folder} `);
log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
log();
shell.exec(`git clone ${target.repo}`);
shell.cd(`${target.folder}`);
shell.exec(`git checkout ${target.branch}`);
const contracts = shell.ls(path.join(target.contracts, `**/*.sol`));
for (contract of contracts){
log(`> ${contract}`);
const file = fs.readFileSync(contract, 'utf-8');
parser.parse(file, {range: true});
}
shell.cd('..');
shell.rm('-rf', target.folder);
}
}
parseAll()