-
Notifications
You must be signed in to change notification settings - Fork 10
/
CompilerConfiguration.ts
32 lines (28 loc) · 1.12 KB
/
CompilerConfiguration.ts
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
require("dotenv").config();
import * as path from "path";
export class CompilerConfiguration {
public readonly contractSourceRoot: string;
public readonly outputRoot: string;
public readonly contractInterfacesOutputPath: string;
public readonly abiOutputPath: string;
public readonly contractOutputPath: string;
public constructor(contractSourceRoot: string, outputRoot: string) {
this.contractSourceRoot = contractSourceRoot;
this.outputRoot = outputRoot;
this.contractInterfacesOutputPath = path.join(
contractSourceRoot,
"../libraries",
"ContractInterfaces.ts"
);
this.abiOutputPath = path.join(outputRoot, "abi.json");
this.contractOutputPath = path.join(outputRoot, "contracts.json");
}
public static create(): CompilerConfiguration {
const contractSourceRoot = path.join(__dirname, "../../source/contracts/");
const outputRoot =
typeof process.env.OUTPUT_PATH === "undefined"
? path.join(__dirname, "../../output/contracts/")
: path.normalize(<string>process.env.OUTPUT_ROOT);
return new CompilerConfiguration(contractSourceRoot, outputRoot);
}
}