diff options
author | F. Eugene Aumson <gene@aumson.org> | 2018-08-24 21:18:33 +0800 |
---|---|---|
committer | F. Eugene Aumson <gene@aumson.org> | 2018-08-29 20:51:01 +0800 |
commit | a1959df911741d0424a952fa4a63c5dcc1135524 (patch) | |
tree | 61a9682aa21143a98f00a67c98558a6a3f962f74 /packages/sol-doc | |
parent | 775d1efd4607a4097704fe3c4f7ae1156b2c1a6f (diff) | |
download | dexon-sol-tools-a1959df911741d0424a952fa4a63c5dcc1135524.tar dexon-sol-tools-a1959df911741d0424a952fa4a63c5dcc1135524.tar.gz dexon-sol-tools-a1959df911741d0424a952fa4a63c5dcc1135524.tar.bz2 dexon-sol-tools-a1959df911741d0424a952fa4a63c5dcc1135524.tar.lz dexon-sol-tools-a1959df911741d0424a952fa4a63c5dcc1135524.tar.xz dexon-sol-tools-a1959df911741d0424a952fa4a63c5dcc1135524.tar.zst dexon-sol-tools-a1959df911741d0424a952fa4a63c5dcc1135524.zip |
add devdoc support to solc typings, and use it
Diffstat (limited to 'packages/sol-doc')
-rw-r--r-- | packages/sol-doc/src/solidity_doc_generator.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index c57a4779c..fa3c40dcc 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -43,13 +43,19 @@ export class SolidityDocGenerator { const contracts = _.keys(compiledSolidityModule); for (const contract of contracts) { const compiledContract = compiledSolidityModule[contract]; + if (_.isUndefined(compiledContract.abi)) { + throw new Error('compiled contract did not contain ABI output.'); + } + if (_.isUndefined(compiledContract.devdoc)) { + throw new Error('compiled contract did not contain devdoc output.'); + } - // TODO: modify typescript-typings/types/solc/index.d.ts... it doesn't currently support devdoc! - // tslint:disable-next-line:no-unnecessary-type-assertion tsc says abi[0] has no property `name` and won't compile without the `as`, but tslint says the `as` is unnecssary. logUtils.log( - `TODO: extract data from ${contract}'s abi (eg ${ + `TODO: extract data from ${contract}'s abi (eg name, which is "${ (compiledContract.abi[0] as MethodAbi).name - }, etc) and devdoc outputs, and insert it into \`doc\``, + }", etc) and devdoc (eg title, which is "${ + compiledContract.devdoc.title + }") outputs, and insert it into \`doc\``, ); } } |