aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-07 19:46:44 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-07 19:46:44 +0800
commitfad7dc9f04f39e754ac0ec437736c7bee33fa28e (patch)
tree136113973a9e885f96f256df4bb39b8137d342d7 /packages/deployer
parent7c1e05d33c2fd5d026ce69ac96d0b2096b1a9cdb (diff)
downloaddexon-sol-tools-fad7dc9f04f39e754ac0ec437736c7bee33fa28e.tar
dexon-sol-tools-fad7dc9f04f39e754ac0ec437736c7bee33fa28e.tar.gz
dexon-sol-tools-fad7dc9f04f39e754ac0ec437736c7bee33fa28e.tar.bz2
dexon-sol-tools-fad7dc9f04f39e754ac0ec437736c7bee33fa28e.tar.lz
dexon-sol-tools-fad7dc9f04f39e754ac0ec437736c7bee33fa28e.tar.xz
dexon-sol-tools-fad7dc9f04f39e754ac0ec437736c7bee33fa28e.tar.zst
dexon-sol-tools-fad7dc9f04f39e754ac0ec437736c7bee33fa28e.zip
Use named constants
Diffstat (limited to 'packages/deployer')
-rw-r--r--packages/deployer/src/compiler.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index 4d2058880..db06ccf43 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -43,7 +43,9 @@ import {
} from './utils/types';
import { utils } from './utils/utils';
+type TYPE_ALL_FILES_IDENTIFIER = '*';
const ALL_CONTRACTS_IDENTIFIER = '*';
+const ALL_FILES_IDENTIFIER = '*';
const SOLC_BIN_DIR = path.join(__dirname, '..', '..', 'solc_bin');
const DEFAULT_CONTRACTS_DIR = path.resolve('contracts');
const DEFAULT_ARTIFACTS_DIR = path.resolve('artifacts');
@@ -55,7 +57,7 @@ const DEFAULT_COMPILER_SETTINGS: solc.CompilerSettings = {
enabled: false,
},
outputSelection: {
- '*': {
+ [ALL_FILES_IDENTIFIER]: {
[ALL_CONTRACTS_IDENTIFIER]: ['abi', 'evm.bytecode.object'],
},
},
@@ -72,19 +74,20 @@ export class Compiler {
private _contractsDir: string;
private _compilerSettings: solc.CompilerSettings;
private _artifactsDir: string;
- private _specifiedContracts: string[] | '*';
+ private _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER;
/**
* Instantiates a new instance of the Compiler class.
* @return An instance of the Compiler class.
*/
constructor(opts: CompilerOptions) {
+ // TODO: Look for config file in parent directories if not found in current directory
const config: CompilerOptions = fs.existsSync(CONFIG_FILE)
? JSON.parse(fs.readFileSync(CONFIG_FILE).toString())
: {};
this._contractsDir = opts.contractsDir || config.contractsDir || DEFAULT_CONTRACTS_DIR;
this._compilerSettings = opts.compilerSettings || config.compilerSettings || DEFAULT_COMPILER_SETTINGS;
this._artifactsDir = opts.artifactsDir || config.artifactsDir || DEFAULT_ARTIFACTS_DIR;
- this._specifiedContracts = opts.contracts || config.contracts || '*';
+ this._specifiedContracts = opts.contracts || config.contracts || ALL_CONTRACTS_IDENTIFIER;
this._nameResolver = new NameResolver(path.resolve(this._contractsDir));
const resolver = new FallthroughResolver();
resolver.appendResolver(new URLResolver());