Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [M3-7538] - Cloud Manager Docs with Vitepress #10027

Merged
merged 13 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy Cloud Manager Docs

on:
push:
branches: [develop]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want to target master eventually? I think it's ok for now but open to feedback

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My vote would be keeping develop with this setup. Our docs are mostly targeted at developers and we want them looking at our latest documentation at all times.

I also hold this opinion on Storybook but I don't think many agree

If we start building multiple environments (like design.dev.linode.com or docs.cloud.dev.linode.com) then it would be a different story imo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My vote would be keeping develop with this setup. Our docs are mostly targeted at developers and we want them looking at our latest documentation at all times.

I'd agree with this.


permissions:
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Pages
uses: actions/configure-pages@v3

- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.21
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pinning bun version for good measure


- name: Build with VitePress
run: bunx vitepress@1.0.0-rc.35 build docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs/.vitepress/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,6 @@ nohup.out
packages/manager/bundle_analyzer_report.html

**/manager/src/dev-tools/*.local.*

# vitepress
docs/.vitepress/cache
29 changes: 29 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { guides } from "./plugins/sidebar";

export default {
title: "Cloud Manager Docs",
description: "Akamai Cloud Manger Documentation",
srcDir: "./",
base: "/manager/",
themeConfig: {
logo: "/akamai-wave.svg",
nav: [
{ text: "Home", link: "/" },
{ text: "Getting Started", link: "/GETTING_STARTED" },
{ text: "Contributing", link: "/CONTRIBUTING" },
],
search: {
provider: "local",
},
sidebar: [
{
text: "Development Guide",
items: guides,
},
],
socialLinks: [
{ icon: "github", link: "https://github.com/linode/manager" },
],
},
head: [["link", { rel: "icon", href: "/manager/favicon.ico" }]],
};
38 changes: 38 additions & 0 deletions docs/.vitepress/plugins/sidebar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as fs from "fs";
import * as path from "path";

const DEVELOPMENT_GUIDE_PATH = "./docs/development-guide";

interface MarkdownInfo {
text: string;
link: string;
}

/**
* Aggregates the pages in the development-guide and populates the left sidebar.
*/
const scanDirectory = (directoryPath: string): MarkdownInfo[] => {
const markdownFiles = fs
.readdirSync(directoryPath)
.filter((file) => file.endsWith(".md"));
const markdownInfoArray: MarkdownInfo[] = [];

markdownFiles.forEach((file) => {
const filePath = path.join(directoryPath, file);
const fileContent = fs.readFileSync(filePath, "utf-8");

const titleMatch = fileContent.match(/^#\s+(.*)/m);
const title = titleMatch ? titleMatch[1] : "Untitled";

const markdownInfo: MarkdownInfo = {
text: title,
link: `/development-guide/${file}`,
};

markdownInfoArray.push(markdownInfo);
});

return markdownInfoArray;
};

export const guides = scanDirectory(DEVELOPMENT_GUIDE_PATH);
4 changes: 4 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ Feel free to open an issue to report a bug or request a feature.
`Added`, `Fixed`, `Changed`, `Removed`, `Tech Stories`, `Tests`, `Upcoming Features`

Two reviews from members of the Cloud Manager team are required before merge. After approval, all pull requests are squash merged.

## Docs

To run the docs development server locally, [install Bun](https://bun.sh/) and start the server: `yarn docs`.
4 changes: 2 additions & 2 deletions docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
```

10. Navigate to the root directory of the repository, then start Cloud Manager and the JS client with `yarn up`.
11. After installation, Cloud Manager should be running at http://localhost:3000.
11. After installation, Cloud Manager should be running at `http://localhost:3000`.

## Serving a production build of Cloud Manager

Expand All @@ -63,4 +63,4 @@ expose the Vite dev server, you can use the following command.

```bash
yarn up:expose
```
```
2 changes: 1 addition & 1 deletion docs/development-guide/08-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const { getByTestId } = renderWithTheme(<MyComponent />, {

#### Mocking with Mock Service Worker

We support mocking API requests both in test suites and the browser using the [msw](https://www.npmjs.com/package/msw) library. See [07-mocking-data](07-mocking-data.md) for more details.
We support mocking API requests both in test suites and the browser using the [msw](https://www.npmjs.com/package/msw) library. See [09-mocking-data](09-mocking-data.md) for more details.

These mocks are automatically enabled for tests (using `beforeAll` and `afterAll` in src/setupTests.ts, which is run when setting up the Vitest environment).

Expand Down
15 changes: 15 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Akamai Cloud Manager Documentation

## Get Started

To setup Cloud Manager and get ready for development, process to the [get started docs](GETTING_STARTED.md).

## Contributing

If you already have your development environment set up, please read the [contributing guidelines](CONTRIBUTING.md) to get help in creating your first Pull Request.

To report a bug or request a feature in Cloud Manager, please [open a GitHub Issue](https://github.com/linode/manager/issues/new). For general feedback, use [linode.com/feedback](https://www.linode.com/feedback/).

## Development Guide

Please consult our [development guide](development-guide/01-repository-structure.md) to start contributing!
9 changes: 9 additions & 0 deletions docs/public/akamai-wave.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 docs/public/favicon.ico
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"changeset": "node scripts/changelog/changeset.mjs",
"generate-changelogs": "node scripts/changelog/generate-changelogs.mjs",
"coverage": "yarn workspace linode-manager coverage",
"coverage:summary": "yarn workspace linode-manager coverage:summary"
"coverage:summary": "yarn workspace linode-manager coverage:summary",
"docs": "bunx vitepress@1.0.0-rc.35 dev docs"
abailly-akamai marked this conversation as resolved.
Show resolved Hide resolved
},
"resolutions": {
"minimist": "^1.2.3",
Expand Down
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10027-added-1704309699899.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Added
---

Cloud Manager Documentation microsite with vitepress ([#10027](https://github.com/linode/manager/pull/10027))