You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
748 B
22 lines
748 B
2 years ago
|
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;
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
};
|