|
|
@ -7,6 +7,7 @@ import { Build, buildSite } from './docgen/site' |
|
|
|
import { loadTemplates } from './docgen/templates' |
|
|
|
import { loadTemplates } from './docgen/templates' |
|
|
|
import { SolcInput, SolcOutput } from 'solidity-ast/solc' |
|
|
|
import { SolcInput, SolcOutput } from 'solidity-ast/solc' |
|
|
|
import { render } from './docgen/render' |
|
|
|
import { render } from './docgen/render' |
|
|
|
|
|
|
|
import { normalizeContractPath } from './docgen/utils/normalizeContractPath' |
|
|
|
|
|
|
|
|
|
|
|
export class DocGenClient extends PluginClient { |
|
|
|
export class DocGenClient extends PluginClient { |
|
|
|
private currentTheme |
|
|
|
private currentTheme |
|
|
@ -45,19 +46,30 @@ export class DocGenClient extends PluginClient { |
|
|
|
input: input, |
|
|
|
input: input, |
|
|
|
output: output |
|
|
|
output: output |
|
|
|
} |
|
|
|
} |
|
|
|
this.fileName = fileName |
|
|
|
const test = normalizeContractPath(fileName) |
|
|
|
this.eventEmitter.emit('compilationFinished', this.build, fileName) |
|
|
|
console.log({ test }) |
|
|
|
|
|
|
|
this.fileName = test |
|
|
|
|
|
|
|
this.eventEmitter.emit('compilationFinished', this.build, test) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async docgen(builds: Build[], userConfig?: Config): Promise<void> { |
|
|
|
async docgen(builds: Build[], userConfig?: Config): Promise<void> { |
|
|
|
|
|
|
|
console.log('docgen called') |
|
|
|
const config = { ...defaults, ...userConfig } |
|
|
|
const config = { ...defaults, ...userConfig } |
|
|
|
|
|
|
|
console.log({ config }) |
|
|
|
const templates = await loadTemplates(config.theme, config.root, config.templates) |
|
|
|
const templates = await loadTemplates(config.theme, config.root, config.templates) |
|
|
|
|
|
|
|
console.log({ templates }) |
|
|
|
const site = buildSite(builds, config, templates.properties ?? {}) |
|
|
|
const site = buildSite(builds, config, templates.properties ?? {}) |
|
|
|
|
|
|
|
console.log({ site }) |
|
|
|
const renderedSite = render(site, templates, config.collapseNewlines) |
|
|
|
const renderedSite = render(site, templates, config.collapseNewlines) |
|
|
|
const docs: string[] = [] |
|
|
|
const docs: string[] = [] |
|
|
|
|
|
|
|
console.log('docs created!!') |
|
|
|
|
|
|
|
console.log({ renderedSite }) |
|
|
|
for (const { id, contents } of renderedSite) { |
|
|
|
for (const { id, contents } of renderedSite) { |
|
|
|
const temp = `${this.fileName.split('/')[1].split('.')[0]}.${id.split('.')[1]}` |
|
|
|
const pathArray = this.fileName.split('/') |
|
|
|
|
|
|
|
console.log({ pathArray }) |
|
|
|
|
|
|
|
const temp = `${pathArray[pathArray.length - 1]}.${id.split('.')[1]}` |
|
|
|
|
|
|
|
console.log(temp) |
|
|
|
const newFileName = `docs/${temp}` |
|
|
|
const newFileName = `docs/${temp}` |
|
|
|
await this.call('fileManager', 'setFile', newFileName , contents) |
|
|
|
await this.call('fileManager', 'setFile', newFileName , contents) |
|
|
|
docs.push(newFileName) |
|
|
|
docs.push(newFileName) |
|
|
@ -75,6 +87,8 @@ export class DocGenClient extends PluginClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async generateDocs() { |
|
|
|
async generateDocs() { |
|
|
|
this.docgen([this.build]) |
|
|
|
const builds = [this.build] |
|
|
|
|
|
|
|
console.log({ builds }) |
|
|
|
|
|
|
|
this.docgen(builds) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|