Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yujonglee committed Jun 21, 2024
1 parent c46a15d commit 2dfdce8
Show file tree
Hide file tree
Showing 25 changed files with 241 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
on:
push:
branches:
- main
paths:
- js/apps/docs/**
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: js
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: js/package-lock.json
- run: npm ci -w @canary/docs
- run: npm run build -w @canary/docs
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy js/apps/docs/dist --project-name=canary-docs
21 changes: 21 additions & 0 deletions js/apps/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
1 change: 1 addition & 0 deletions js/apps/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @canary/docs
56 changes: 56 additions & 0 deletions js/apps/docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";

// https://astro.build/config
export default defineConfig({
redirects: { "/": "/intro/readme/" },
site: "https://docs.getcanary.dev",
integrations: [
starlight({
title: "🐤 Canary",
social: {
github: "https://github.com/fastrepl/canary",
},
editLink: {
baseUrl: "https://github.com/fastrepl/canary/js/apps/docs",
},
sidebar: [
{
label: "Start Here",
items: [
{ label: "README", link: "/intro/readme/" },
{ label: "Self-host", link: "/intro/self-host/" },
{ label: "Cloud", link: "/intro/cloud/" },
],
},
{
label: "Sources",
items: [
{ label: "Overview", link: "/sources/overview/" },
{ label: "Website", link: "/sources/website/" },
{ label: "Github", link: "/sources/github/" },
],
},
{
label: "Clients",
items: [
{ label: "Overview", link: "/clients/overview/" },
{ label: "Website", link: "/clients/website/" },
{ label: "Discord", link: "/clients/discord/" },
],
},
{
label: "Packages",
collapsed: true,
autogenerate: { directory: "packages" },
},
{
label: "Miscellaneous",
collapsed: true,
autogenerate: { directory: "others" },
},
],
customCss: ["./src/styles/theme.css"],
}),
],
});
19 changes: 19 additions & 0 deletions js/apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@canary/docs",
"type": "module",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build --outDir=./dist",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/starlight": "^0.24.2",
"astro": "^4.10.2",
"sharp": "^0.32.5",
"typescript": "^5.4.5"
}
}
1 change: 1 addition & 0 deletions js/apps/docs/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added js/apps/docs/src/assets/houston.webp
Binary file not shown.
6 changes: 6 additions & 0 deletions js/apps/docs/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineCollection } from "astro:content";
import { docsSchema } from "@astrojs/starlight/schema";

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
};
7 changes: 7 additions & 0 deletions js/apps/docs/src/content/docs/clients/discord.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Discord
---

If valid `DISCORD_BOT_TOKEN` is provided as an environment variable, Discord client will be enabled.

Endpoint url is `<BASE_URL>/api/discord`.
10 changes: 10 additions & 0 deletions js/apps/docs/src/content/docs/clients/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: What is Client?
---

`Client` is a way to let users interact with `Canary`.

Currently, we support two clients:

- [Website](/clients/website/)
- [Discord](/clients/discord/)
3 changes: 3 additions & 0 deletions js/apps/docs/src/content/docs/clients/website.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Website
---
5 changes: 5 additions & 0 deletions js/apps/docs/src/content/docs/intro/cloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Cloud
---

Not available yet.
5 changes: 5 additions & 0 deletions js/apps/docs/src/content/docs/intro/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: What is Canary?
---

**`Canary`** provides you all the tools to provide **`Ask AI`** to your users, especially developers.
5 changes: 5 additions & 0 deletions js/apps/docs/src/content/docs/intro/self-host.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Self-host
---

[![Railway Template](https://railway.app/button.svg)](https://railway.app/template/mn9WJT?referralCode=IQ76H8)
3 changes: 3 additions & 0 deletions js/apps/docs/src/content/docs/others/ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: AI
---
5 changes: 5 additions & 0 deletions js/apps/docs/src/content/docs/packages/core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "@canary/core"
---

https://github.com/fastrepl/canary/tree/main/js/packages/core
5 changes: 5 additions & 0 deletions js/apps/docs/src/content/docs/packages/docusaurus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "@canary/docusaurus"
---

This is intended to be a drop-in replacement for `docusaurus-lunr-search`.
5 changes: 5 additions & 0 deletions js/apps/docs/src/content/docs/packages/starlight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "@canary/starlight"
---

This is intended to be a drop-in replacement for built-in search-bar.
5 changes: 5 additions & 0 deletions js/apps/docs/src/content/docs/packages/web-widget.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "@canary/web-widget"
---

This is a [Web Component](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) that can be used in any website to add a modal.
3 changes: 3 additions & 0 deletions js/apps/docs/src/content/docs/sources/github.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Github
---
10 changes: 10 additions & 0 deletions js/apps/docs/src/content/docs/sources/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: What is Source?
---

`Source` is a way to provide information to `Canary`.

Currently, we support two sources:

- [Website](/sources/website/)
- [Github](/sources/github/)
3 changes: 3 additions & 0 deletions js/apps/docs/src/content/docs/sources/website.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Website
---
2 changes: 2 additions & 0 deletions js/apps/docs/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />
30 changes: 30 additions & 0 deletions js/apps/docs/src/styles/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Dark mode colors. */
:root {
--sl-color-accent-low: #312000;
--sl-color-accent: #8a6100;
--sl-color-accent-high: #e8c384;
--sl-color-white: #ffffff;
--sl-color-gray-1: #eeeeee;
--sl-color-gray-2: #c2c2c2;
--sl-color-gray-3: #8b8b8b;
--sl-color-gray-4: #585858;
--sl-color-gray-5: #383838;
--sl-color-gray-6: #272727;
--sl-color-black: #181818;
}

/* Light mode colors. */
:root[data-theme="light"] {
--sl-color-accent-low: #efd3a5;
--sl-color-accent: #8c6300;
--sl-color-accent-high: #442e00;
--sl-color-white: #181818;
--sl-color-gray-1: #272727;
--sl-color-gray-2: #383838;
--sl-color-gray-3: #585858;
--sl-color-gray-4: #8b8b8b;
--sl-color-gray-5: #c2c2c2;
--sl-color-gray-6: #eeeeee;
--sl-color-gray-7: #f6f6f6;
--sl-color-black: #ffffff;
}
3 changes: 3 additions & 0 deletions js/apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "astro/tsconfigs/strict"
}

0 comments on commit 2dfdce8

Please sign in to comment.