Skip to content

Commit

Permalink
Docusaurus draft + typedoc
Browse files Browse the repository at this point in the history
  • Loading branch information
xray-robot committed Jun 25, 2024
1 parent 818cd69 commit a3ebeca
Show file tree
Hide file tree
Showing 33 changed files with 10,150 additions and 257 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
node_modules
test/private.spec.ts
docs
test/private.spec.ts
6 changes: 3 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
package.json
package-lock.json
dist
src/misc/lucid
src/misc/uplc
docs
docs/node_modules
docs/build
docs/.docusaurus
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ npm i cardano-web3-js

## Documentation

* Playground: [https://xray.app/graph/cardano-web3-js](https://xray.app/graph/cardano-web3-js)
* Typedoc: [https://xray-network.github.io/cardano-web3-js](https://xray-network.github.io/cardano-web3-js/)
* Docs: [https://cardano-web3-js.org](https://cardano-web3-js.org)
* Typedoc API: [https://cardano-web3-js.org](https://cardano-web3-js.org/api)
* Playground: [https://cardano-web3-js.org](https://cardano-web3-js.org/playground)

## Basic Usage

Expand Down
26 changes: 26 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*


# Don't include auto generated docs of current version
docs/api

docs/libdocs
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
}
5 changes: 5 additions & 0 deletions docs/docs/docs/getting-started/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
label: 'Getting Started'
collapsible: true
collapsed: false
link: null
position: 1
7 changes: 7 additions & 0 deletions docs/docs/docs/getting-started/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
slug: /
sidebar_position: 1
sidebar_label: Introduction
---

# Introduction
6 changes: 6 additions & 0 deletions docs/docs/docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
sidebar_position: 2
sidebar_label: Quickstart
---

# Quickstart
5 changes: 5 additions & 0 deletions docs/docs/docs/glossary/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 20
sidebar_label: "Glossary"
title: Glossary
---
3 changes: 3 additions & 0 deletions docs/docs/playground/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: "CardanoWeb3js Playground"
---
146 changes: 146 additions & 0 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
const lightCodeTheme = require("prism-react-renderer").themes.github
const darkCodeTheme = require("prism-react-renderer").themes.dracula
const { join } = require("path")

/** @type {import('@docusaurus/types').Config} */
const config = {
title: "CardanoWeb3js",
tagline: "Versatile TypeScript library designed for seamless integration with the Cardano blockchain",
url: "https://cardano-web3-js.xray.app",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "throw",
onBrokenAnchors: "log",
favicon: "img/cardano-web3-js.svg",
organizationName: "xray-network",
projectName: "CardanoWeb3js",
markdown: {
format: "md", // MDX for .mdx files, MD for .md files
parseFrontMatter: async (params) => {
const result = await params.defaultParseFrontMatter(params)
// Replace {inputs} with "inputs" in the description, CML has wrong MDX markdown docs/docs/api/types/namespaces/CML/classes/TransactionBuilder.md
result.frontMatter.description = result.frontMatter.description?.replaceAll("{inputs}", "inputs")
return result
},
},
i18n: {
defaultLocale: "en",
locales: ["en"],
},
plugins: [
"@docusaurus/theme-live-codeblock",
"docusaurus-lunr-search",
[
"docusaurus-plugin-typedoc",
{
entryPoints: ["../src"],
// entryPointStrategy: "expand",
readme: "none",
tsconfig: "../tsconfig.json",
},
],
],
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
path: "./docs",
sidebarPath: require.resolve("./sidebars.js"),
routeBasePath: "/",
editUrl: "https://github.com/xray-network/cardano-web3-js/docs",
},
theme: {
customCss: require.resolve("./static/css/custom.css"),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: "CardanoWeb3js",
logo: {
src: "img/cardano-web3-js.svg",
},
items: [
{
to: "/docs/getting-started/quickstart",
activeBasePath: "/docs",
label: "Documentation",
position: "left",
},
{
to: "/api",
activeBasePath: "/api",
label: "API",
position: "left",
},
{
to: "/playground",
label: "Playground",
position: "left",
},
{
to: "https://xray.app",
label: "XRAY/App",
position: "right",
},
{
href: 'https://github.com/xray-network/cardano-web3-js',
position: 'right',
className: 'header-github-link',
},
// {
// href: "https://github.com/xray-network/cardano-web3-js/",
// label: "GitHub",
// position: "right",
// },
],
},
footer: {
style: "dark",
copyright: `Copyright © ${new Date().getFullYear()} XRAY/Network. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
liveCodeBlock: {
playgroundPosition: "bottom",
},
image: "https://pbs.twimg.com/profile_images/1746099108937363456/duG_Pqem_400x400.jpg",
metadata: [
{
name: "keywords",
content: "cardano-web3-js, cardano, web3, cardano api, blockchain, smart contracts, dapps, dApp development",
},
{
name: "description",
content:
"CardanoWeb3js is a versatile TypeScript library designed for seamless integration with the Cardano blockchain",
},
{ name: "og:title", content: "CardanoWeb3js Documentation" },
{
name: "og:description",
content:
"CardanoWeb3js is a versatile TypeScript library designed for seamless integration with the Cardano blockchain",
},
{ name: "og:type", content: "website" },
{ name: "og:url", content: "https://cardano-web3-js.org" },
{ name: "og:image", content: "https://cardano-web3-js.org/img/cardano-web3-js.jpg" },
{ name: "twitter:card", content: "summary_large_image" },
{ name: "twitter:title", content: "CardanoWeb3js Documentation" },
{
name: "twitter:description",
content:
"CardanoWeb3js is a versatile TypeScript library designed for seamless integration with the Cardano blockchain",
},
{ name: "twitter:image", content: "https://cardano-web3-js.org/img/cardano-web3-js-large.jpg" },
],
}),
}

module.exports = config
54 changes: 54 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "cardano-web3-js-docs",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@docusaurus/theme-live-codeblock": "^3.4.0",
"@mdx-js/react": "^3.0.1",
"classnames": "^2.3.2",
"clsx": "^2.1.1",
"docusaurus-lunr-search": "^3.4.0",
"prism-react-renderer": "^2.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.4.0",
"@tsconfig/docusaurus": "^2.0.3",
"docusaurus-plugin-typedoc": "^1.0.1",
"docusaurus-plugin-typedoc-api": "^4.2.0",
"typedoc": "^0.26.2",
"typedoc-monorepo-link-types": "^0.0.4",
"typedoc-plugin-extras": "^3.0.0",
"typedoc-plugin-markdown": "^4.1.0",
"typedoc-plugin-mdn-links": "^3.2.1",
"typedoc-plugin-merge-modules": "^5.1.0",
"typescript": "^5.4.5"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
17 changes: 17 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
guidesSidebar: [{ type: "autogenerated", dirName: "docs" }],
typedocSidebar: [
{
type: "category",
label: "Typedoc API",
link: {
type: "doc",
id: "api/index",
},
items: require("./docs/api/typedoc-sidebar.cjs"),
},
],
}

module.exports = sidebars
Empty file added docs/static/.nojekyll
Empty file.
Loading

0 comments on commit a3ebeca

Please sign in to comment.