Update docs pipeline to solidity-docgen@0.6 (#3707)

(cherry picked from commit c52625018b)
This commit is contained in:
Francisco
2022-09-30 12:52:45 -03:00
committed by Francisco Giordano
parent f0de978a9e
commit 50501a751e
24 changed files with 610 additions and 6038 deletions

21
docs/config.js Normal file
View File

@ -0,0 +1,21 @@
const path = require('path');
const fs = require('fs');
/** @type import('solidity-docgen/dist/config').UserConfig */
module.exports = {
outputDir: 'docs/modules/api/pages',
templates: 'docs/templates',
exclude: ['mocks'],
pageExtension: '.adoc',
pages: (_, file, config) => {
// For each contract file, find the closest README.adoc and return its location as the output page path.
const sourcesDir = path.resolve(config.root, config.sourcesDir);
let dir = path.resolve(config.root, file.absolutePath);
while (dir.startsWith(sourcesDir)) {
dir = path.dirname(dir);
if (fs.existsSync(path.join(dir, 'README.adoc'))) {
return path.relative(sourcesDir, dir) + config.pageExtension;
}
}
},
};