Skip to content

Commit

Permalink
feat: rename testMode to debugMode
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlak committed Feb 19, 2022
1 parent 037eaad commit 6e06f12
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const config: HardhatUserConfig = {
// Your Hardhat config...
dodoc: {
runOnCompile: true,
testMode: true,
debugMode: true,
// More options...
},
};
Expand All @@ -107,7 +107,7 @@ Here are all the configuration parameters that are currently available, but as s
| `exclude` | List of all the contract / interface / library names to exclude from the documentation generation | `[]` |
| `outputDir` | Output directory of the documentation | `docs` |
| `templatePath` | Path to the documentation template | `./template.sqrl` |
| `testMode` | Test mode generating additional JSON files used for debugging | `false` |
| `debugMode` | Test mode generating additional JSON files used for debugging | `false` |
| `keepFileStructure` | True if you want to preserve your contracts file structure | `true` |

## 💅 Customize
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const config: HardhatUserConfig = {
sources: './examples/contracts/',
},
dodoc: {
testMode: true,
debugMode: true,
outputDir: './examples/docs',
},
};
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extendConfig((config: HardhatConfig, userConfig: Readonly<HardhatUserConfig>) =>
include: userConfig.dodoc?.include || [],
exclude: userConfig.dodoc?.exclude || [],
runOnCompile: userConfig.dodoc?.runOnCompile !== undefined ? userConfig.dodoc?.runOnCompile : true,
testMode: userConfig.dodoc?.testMode || false,
debugMode: userConfig.dodoc?.debugMode || false,
outputDir: userConfig.dodoc?.outputDir || './docs',
templatePath: userConfig.dodoc?.templatePath || path.join(__dirname, './template.sqrl'),
keepFileStructure: userConfig.dodoc?.keepFileStructure ?? true,
Expand Down Expand Up @@ -59,7 +59,7 @@ task(TASK_COMPILE, async (args, hre, runSuper) => {
const buildInfo = await hre.artifacts.getBuildInfo(qualifiedName);
const info = buildInfo?.output.contracts[source][name] as CompilerOutputContractWithDocumentation;

if (config.testMode) {
if (config.debugMode) {
console.log('ABI:\n');
console.log(JSON.stringify(info.abi, null, 4));
console.log('\n\n');
Expand Down Expand Up @@ -189,7 +189,7 @@ task(TASK_COMPILE, async (args, hre, runSuper) => {
},
);

if (config.testMode) {
if (config.debugMode) {
await fs.promises.writeFile(
path.join(config.outputDir, testFileName),
JSON.stringify(docs[i], null, 4), {
Expand Down
4 changes: 2 additions & 2 deletions src/type-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare module 'hardhat/types/config' {
include?: string[];
exclude?: string[];
runOnCompile?: boolean;
testMode?: boolean;
debugMode?: boolean;
templatePath?: string;
outputDir?: string;
keepFileStructure?: boolean;
Expand All @@ -18,7 +18,7 @@ declare module 'hardhat/types/config' {
include: string[];
exclude: string[];
runOnCompile: boolean;
testMode: boolean;
debugMode: boolean;
templatePath: string;
outputDir: string;
keepFileStructure: boolean;
Expand Down

0 comments on commit 6e06f12

Please sign in to comment.