This repository has been archived by the owner on Jan 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial conversion of guides to asciidoc * add initial structure for antora (cherry picked from commit 0e9c79c) * fix heading levels * add script for local authoring * set correct docs start page * revert silencing http server * make component name shorter * update docsite script * change cli docs generator for asciidoc * add initial version of cli and lib docs * fix asciidoc admonitions * remove docs for previous versions
- Loading branch information
1 parent
624e49f
commit 1695e10
Showing
334 changed files
with
6,021 additions
and
20,799 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,60 @@ | ||
#!/usr/bin/env node | ||
|
||
import React from 'react'; | ||
import program from '../../src/bin/program'; | ||
import { renderToStaticMarkup } from 'react-dom/server'; | ||
import { writeFileSync, existsSync, mkdirSync } from 'fs'; | ||
import Main from '../components/Main'; | ||
import Command from '../components/Command'; | ||
import { writeFileSync } from 'fs'; | ||
import { ensureDirSync } from 'fs-extra'; | ||
import path from 'path'; | ||
import process from 'process'; | ||
|
||
const outputPath = 'docs/build'; | ||
const outputPath = '../docs/modules/cli'; | ||
|
||
function formatContent(id, title, content) { | ||
return `--- | ||
id: cli_${id} | ||
title: ${title} | ||
--- | ||
function render(cmd) { | ||
const description = cmd.description() || ''; | ||
const options = cmd.options.map(o => `\`${o.flags}\`:: ${o.description}`).join('\n'); | ||
|
||
${content} | ||
return `\ | ||
== ${cmd.name()} | ||
Usage: \`${cmd.name()} ${cmd.usage()}\` | ||
${description} | ||
${options} | ||
`; | ||
} | ||
|
||
function writeMd(id, title, content) { | ||
const data = formatContent(id, title, content); | ||
writeFileSync(path.resolve(outputPath, `cli_${id}.md`), data); | ||
function writeAdoc(id, title, content) { | ||
const data = content; | ||
writeFileSync(path.resolve(outputPath, 'pages', `${id}.adoc`), data); | ||
} | ||
|
||
function makeSidebar(program) { | ||
const makeEntry = name => `* xref:${name}.adoc[${name}]`; | ||
const commands = program.commands | ||
// TODO: remove filtering status command before next major release | ||
.filter(command => command.name() !== 'status') | ||
.map(command => `cli_${command.name()}`); | ||
return { | ||
'cli-api': { | ||
commands: ['cli_main', ...commands], | ||
}, | ||
}; | ||
.map(command => makeEntry(command.name())); | ||
return ['.CLI', makeEntry('main'), ...commands].join('\n'); | ||
} | ||
|
||
function run() { | ||
if (!existsSync(outputPath)) { | ||
mkdirSync(outputPath); | ||
} | ||
ensureDirSync(outputPath); | ||
ensureDirSync(path.join(outputPath, 'pages')); | ||
|
||
const main = renderToStaticMarkup(React.createElement(Main, { program })); | ||
writeMd('main', 'zos', main); | ||
const main = render(program); | ||
writeAdoc('main', 'zos', main); | ||
|
||
program.commands | ||
// TODO: remove filtering status command before next major release | ||
.filter(command => command.name() !== 'status') | ||
.forEach(command => { | ||
const content = renderToStaticMarkup(React.createElement(Command, { command })); | ||
writeMd(command.name(), command.name(), content); | ||
const content = render(command); | ||
writeAdoc(command.name(), command.name(), content); | ||
}); | ||
|
||
const sidebar = makeSidebar(program); | ||
writeFileSync(path.resolve(outputPath, 'sidebars.json'), JSON.stringify(sidebar, null, 2)); | ||
writeFileSync(path.resolve(outputPath, 'nav.adoc'), sidebar); | ||
} | ||
|
||
run(); | ||
console.log(`Docs generated in ${process.cwd()}/${outputPath}`); | ||
console.log(`Docs generated in ${path.resolve(outputPath)}`); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
node_modules/ | ||
openzeppelin-docs/ | ||
docs/node_modules | ||
docs/website/build | ||
|
||
modules/lib | ||
modules/cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: 'sdk' | ||
title: 'SDK' | ||
version: '2.4' | ||
nav: | ||
- modules/ROOT/nav.adoc | ||
- modules/cli/nav.adoc | ||
- modules/lib/nav.adoc |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.