-
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * prep for migration * wip * updates * Update docs * Fix git tracking for docusaurus * Tons of updates * Remove old website * Updates * Fix docusaurus config * Fix docusaurus path * Fix docs helper * Update docs with codesandboxes * Update create script
- Loading branch information
1 parent
7ff1065
commit 7a361f3
Showing
116 changed files
with
7,113 additions
and
3,464 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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
const packageName = process.env.LERNA_PACKAGE_NAME; | ||
const newReadmeFileName = packageName.startsWith("@rooks") | ||
? packageName.split("@rooks/")[1] | ||
: packageName; | ||
|
||
const writeFileSync = require("fs").writeFileSync; | ||
const readFileSync = require("fs").readFileSync; | ||
const parseReadme = require("./parse-readme"); | ||
|
||
function ls() { | ||
let readmeFileContent = readFileSync(`./README.md`, "utf8"); | ||
readmeFileContent = parseReadme(readmeFileContent); | ||
let examplesFileContent = null; | ||
try { | ||
examplesFileContent = readFileSync(`./Examples.md`, "utf8"); | ||
} catch (err) { | ||
console.log("Could not read examples in package: " + newReadmeFileName); | ||
} | ||
let frontMatter = `id: ${newReadmeFileName} | ||
title: ${newReadmeFileName} | ||
hide_title: true | ||
sidebar_label: ${newReadmeFileName}`; | ||
if (newReadmeFileName === "rooks") { | ||
frontMatter = `${frontMatter} | ||
slug: /`; | ||
} | ||
const fileBody = examplesFileContent | ||
? ` | ||
${readmeFileContent} | ||
--- | ||
## Codesandbox Examples | ||
${examplesFileContent} | ||
` | ||
: readmeFileContent; | ||
|
||
const updatedFileContent = `--- | ||
${frontMatter} | ||
--- | ||
${fileBody} | ||
`; | ||
writeFileSync( | ||
`../docusaurus/docs/${newReadmeFileName}.md`, | ||
updatedFileContent, | ||
"utf8" | ||
); | ||
} | ||
|
||
function addToSidebarJson() { | ||
if (newReadmeFileName === "rooks") { | ||
return; | ||
} | ||
let currentSidebarJson; | ||
let fileContent; | ||
try { | ||
fileContent = readFileSync(`../docusaurus/sidebars.json`, "utf8"); | ||
currentSidebarJson = JSON.parse(fileContent); | ||
if ( | ||
Object.keys(currentSidebarJson.docs["Independent Packages"]).includes( | ||
"newReadmeFileName" | ||
) | ||
) { | ||
return; | ||
} | ||
const independentPackages = Array.from( | ||
new Set( | ||
[ | ||
...currentSidebarJson.docs["Independent Packages"], | ||
newReadmeFileName, | ||
].sort() | ||
) | ||
); | ||
const newSidebarJson = { | ||
...currentSidebarJson, | ||
docs: { | ||
...currentSidebarJson.docs, | ||
["Independent Packages"]: independentPackages, | ||
}, | ||
}; | ||
writeFileSync( | ||
`../docusaurus/sidebars.json`, | ||
JSON.stringify(newSidebarJson, null, 2), | ||
"utf-8" | ||
); | ||
} catch (err) { | ||
console.log("----"); | ||
console.log(err); | ||
console.log("----"); | ||
} | ||
} | ||
|
||
try { | ||
ls(); | ||
addToSidebarJson(); | ||
} catch (err) { | ||
console.log(err); | ||
} |
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,19 @@ | ||
var fromMarkdown = require("mdast-util-from-markdown"); | ||
var compact = require("mdast-util-compact"); | ||
var toMarkdown = require("mdast-util-to-markdown"); | ||
const normalizeHeadings = require('mdast-normalize-headings') | ||
|
||
function parseReadme(readmeContent) { | ||
try { | ||
var tree = fromMarkdown(readmeContent); | ||
tree = compact(tree); | ||
tree = normalizeHeadings(tree) | ||
const md = toMarkdown(tree); | ||
return md; | ||
} catch (err) { | ||
console.log("ERROR in readme parse", err); | ||
return readmeContent; | ||
} | ||
} | ||
|
||
module.exports = parseReadme; |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### Basic Usage | ||
|
||
<iframe | ||
src="https://codesandbox.io/embed/quizzical-glitter-emrtj?expanddevtools=1&fontsize=14&hidenavigation=1&module=%2Fsrc%2FApp.js&theme=dark" | ||
style={{ | ||
width: "100%", | ||
height: 500, | ||
border: 0, | ||
borderRadius: 4, | ||
overflow: "hidden" | ||
}} | ||
title="quizzical-glitter-emrtj" | ||
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" | ||
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" | ||
/> |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ build/ | |
yarn.lock | ||
node_modules | ||
i18n/* | ||
.docusaurus/* |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.