-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
25 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { InternalConfig, UserConfig } from "./types/config"; | ||
import { InternalConfig, UserConfig } from './types/config'; | ||
|
||
export async function getConfig(configPath: string): Promise<InternalConfig> { | ||
const configModule = await import(configPath); | ||
const userConfig: UserConfig = 'default' in configModule ? configModule.default : configModule; | ||
if (!userConfig.contracts) throw new Error('Config must specify a root directory'); | ||
const configModule = await import(configPath); | ||
const userConfig: UserConfig = 'default' in configModule ? configModule.default : configModule; | ||
if (!userConfig.contracts) throw new Error('Config must specify a root directory'); | ||
|
||
return { | ||
contracts: userConfig.contracts, | ||
root: userConfig.root || './', | ||
enforceInheritdoc: userConfig.enforceInheritdoc ?? true, | ||
constructorNatspec: userConfig.constructorNatspec ?? false, | ||
ignore: userConfig.ignore || [] | ||
} | ||
} | ||
return { | ||
contracts: userConfig.contracts, | ||
root: userConfig.root || './', | ||
enforceInheritdoc: userConfig.enforceInheritdoc ?? true, | ||
constructorNatspec: userConfig.constructorNatspec ?? false, | ||
ignore: userConfig.ignore || [], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { UserConfig } from './types/config'; | ||
export { UserConfig } from './types/config'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,4 @@ function getArguments() { | |
}, | ||
}) | ||
.parseSync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
export interface UserConfig { | ||
include: string; // Required: Glob pattern of files to process. | ||
exclude?: string[]; // Optional: Glob patterns of files to exclude. | ||
root?: string; // Optional: The target root directory. | ||
enforceInheritdoc?: boolean; // Optional: If set to true, all external and public functions must have @inheritdoc. | ||
constructorNatspec?: boolean; // Optional: True if constructor natspec is mandatory. | ||
include: string; // Required: Glob pattern of files to process. | ||
exclude?: string[]; // Optional: Glob patterns of files to exclude. | ||
root?: string; // Optional: The target root directory. | ||
enforceInheritdoc?: boolean; // Optional: If set to true, all external and public functions must have @inheritdoc. | ||
constructorNatspec?: boolean; // Optional: True if constructor natspec is mandatory. | ||
} | ||
|
||
// Config type after all the default values are applied | ||
export interface InternalConfig { | ||
include: string; | ||
exclude: string[]; | ||
root: string; | ||
enforceInheritdoc: boolean; | ||
constructorNatspec: boolean; | ||
include: string; | ||
exclude: string[]; | ||
root: string; | ||
enforceInheritdoc: boolean; | ||
constructorNatspec: boolean; | ||
} |