Allow the docs not to just be in a folder called docs

Also:
- regex escaping
- update api documentation
This commit is contained in:
Joel Marcey 2017-11-09 09:55:26 -08:00
parent dc0c1390c4
commit e273dfc13b
5 changed files with 25 additions and 9 deletions

View file

@ -21,7 +21,8 @@ let versions;
if (ENABLE_VERSIONING) {
versions = require(CWD + "/versions.json");
}
require("../../server/readMetadata.js").generateMetadataDocs();
const readMetadata = require("../../server/readMetadata.js");
readMetadata.generateMetadataDocs();
const Metadata = require("../metadata.js");
// language dropdown nav item for when translations are enabled
@ -221,9 +222,10 @@ class HeaderNav extends React.Component {
}
let search = false;
headerLinks.forEach(link => {
if (link.doc && !fs.existsSync(CWD + "/../docs/")) {
if (link.doc && !fs.existsSync(CWD + "/../" + readMetadata.getDocsPath() + "/")) {
throw new Error(
"You have 'doc' in your headerLinks, but no 'docs' folder exists one level up from " +
"You have 'doc' in your headerLinks, but no '" + readMetadata.getDocsPath() +
"' folder exists one level up from " +
"'website' folder. Did you run `docusaurus-init` or `npm run examples`? If so, " +
"make sure you rename 'docs-examples-from-docusaurus' to 'docs'."
);
@ -231,7 +233,7 @@ class HeaderNav extends React.Component {
if (link.blog && !fs.existsSync(CWD + "/blog/")) {
throw new Error(
"You have 'blog' in your headerLinks, but no 'blog' folder exists in your " +
"website folder. Did you run `docusaurus-init` or `npm run examples`? If so, " +
"'website' folder. Did you run `docusaurus-init` or `npm run examples`? If so, " +
"make sure you rename 'blog-examples-from-docusaurus' to 'blog'."
);
}