Skip to content

Commit

Permalink
adds docusarus doc site
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasrice committed May 13, 2024
1 parent 296a1d4 commit a5d5294
Show file tree
Hide file tree
Showing 25 changed files with 15,367 additions and 2 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main

jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
- run: npm ci
- run: npm run build
- run: npm run api-report
- run: npm run docs:api-report
- run: cd docs-site
- name: Install dependencies
run: npm ci
- name: Build website
run: npm build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- run: npm ci
- run: npm run build
- run: npm run api-report
- run: npm run docs
- run: npm run docs:api-report
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build Pages
Expand Down
21 changes: 21 additions & 0 deletions doc-site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader
api-reference

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

npm-debug.log*
yarn-debug.log*
yarn-error.log*
3 changes: 3 additions & 0 deletions doc-site/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')],
};
47 changes: 47 additions & 0 deletions doc-site/docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
sidebar_position: 1
---

# Tutorial Intro WOO

Let's discover **Docusaurus in less than 5 minutes**.

## Getting Started

Get started by **creating a new site**.

Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**.

### What you'll need

- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.

## Generate a new site

Generate a new Docusaurus site using the **classic template**.

The classic template will automatically be added to your project after you run the command:

```bash
npm init docusaurus@latest my-website classic
```

You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor.

The command also installs all necessary dependencies you need to run Docusaurus.

## Start your site

Run the development server:

```bash
cd my-website
npm run start
```

The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there.

The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/.

Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes.
79 changes: 79 additions & 0 deletions doc-site/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { themes as prismThemes } from "prism-react-renderer";
import type { Config } from "@docusaurus/types";
import * as Preset from "@docusaurus/preset-classic";

const config: Config = {
title: "Design Token Library",
tagline: "A TypeScript library for managing Design Token Libraries",
favicon: "img/favicon.ico",

// Set the production url of your site here
url: "https://nicholasrice.github.io",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/design-token-library/",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "nicholasrice", // Usually your GitHub org/user name.
projectName: "design-token-library", // Usually your repo name.

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},

presets: [
[
"classic",
{
docs: {
sidebarPath: "./sidebars.ts",
},
theme: {
customCss: "./src/css/custom.css",
},
} satisfies Preset.Options,
],
],

themeConfig: {
navbar: {
title: "Design Token Library",
items: [
{
type: "docSidebar",
sidebarId: "tutorialSidebar",
position: "left",
label: "Docs",
},
{
sidebarId: "apiSidebar",
position: "left",
label: "API Reference",
to: "docs/api-reference/design-token-library",
},
{
href: "https://github.com/nicholasrice/design-token-library",
position: "right",
},
],
},
footer: {
style: "dark",
copyright: `Copyright © ${new Date().getFullYear()}. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
};

export default config;
Loading

0 comments on commit a5d5294

Please sign in to comment.