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

🎉 Docs アプリを追加 #24

Merged
merged 2 commits into from
Jan 7, 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
19 changes: 19 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,22 @@ jobs:

- name: Build
run: bun run build --filter=frontend

docs:
runs-on: ubuntu-22.04
needs: changed
if: needs.changed.outputs.docs == 'true'
permissions:
contents: read
steps:
- name: Checkout
uses: actions/[email protected]

- name: Setup Bun
uses: oven-sh/[email protected]

- name: Install deps (with cache)
run: bun install --filter=docs --frozen-lockfile

- name: Build
run: bun run build --filter=docs
47 changes: 47 additions & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,50 @@ jobs:
gitHubAccessToken: ${{ steps.app-token.outputs.token }}
locale: ja
urls: ${{ steps.cloudflare-pages.outputs.url }}

docs:
runs-on: ubuntu-22.04
needs: changed
if: needs.changed.outputs.docs == 'true'

permissions:
contents: read
deployments: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Create GitHub App Token
uses: actions/[email protected]
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}

- name: Setup Bun
uses: oven-sh/[email protected]

- name: Install deps (with cache)
run: bun install --filter=docs --frozen-lockfile

- name: Build
run: bun run build --filter=docs

- name: Publish to Cloudflare Pages
uses: cloudflare/[email protected]
id: cloudflare-pages
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: nito-docs
directory: ./apps/docs/dist
gitHubToken: ${{ steps.app-token.outputs.token }}
branch: develop

- name: Lighthouse
uses: foo-software/[email protected]
with:
gitHubAccessToken: ${{ steps.app-token.outputs.token }}
locale: ja
urls: ${{ steps.cloudflare-pages.outputs.url }}
49 changes: 49 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,52 @@ jobs:
locale: ja
prCommentEnabled: true
urls: ${{ steps.cloudflare-pages.outputs.url }}

docs:
runs-on: ubuntu-22.04
needs: changed
if: needs.changed.outputs.docs == 'true'

permissions:
contents: read
deployments: write
pull-requests: write

steps:
- name: Checkout
uses: actions/[email protected]

- name: Create GitHub App Token
uses: actions/[email protected]
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}

- name: Setup Bun
uses: oven-sh/[email protected]

- name: Install deps (with cache)
run: bun install --filter=docs --frozen-lockfile

- name: Build
run: bun run build --filter=docs

- name: Publish to Cloudflare Pages
uses: cloudflare/[email protected]
id: cloudflare-pages
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: nito-docs
directory: ./apps/docs/dist
gitHubToken: ${{ steps.app-token.outputs.token }}
branch: preview

- name: Lighthouse
uses: foo-software/[email protected]
with:
gitHubAccessToken: ${{ steps.app-token.outputs.token }}
locale: ja
prCommentEnabled: true
urls: ${{ steps.cloudflare-pages.outputs.url }}
47 changes: 47 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,50 @@ jobs:
gitHubAccessToken: ${{ steps.app-token.outputs.token }}
locale: ja
urls: ${{ steps.cloudflare-pages.outputs.url }}

docs:
runs-on: ubuntu-22.04
needs: changed
if: needs.changed.outputs.docs == 'true'

permissions:
contents: read
deployments: write

steps:
- name: Checkout
uses: actions/[email protected]

- name: Create GitHub App Token
uses: actions/[email protected]
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}

- name: Setup Bun
uses: oven-sh/[email protected]

- name: Install deps (with cache)
run: bun install --filter=docs --frozen-lockfile

- name: Build
run: bun run build --filter=docs

- name: Publish to Cloudflare Pages
uses: cloudflare/[email protected]
id: cloudflare-pages
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: nito-docs
directory: ./apps/docs/dist
gitHubToken: ${{ steps.app-token.outputs.token }}
branch: main

- name: Lighthouse
uses: foo-software/[email protected]
with:
gitHubAccessToken: ${{ steps.app-token.outputs.token }}
locale: ja
urls: ${{ steps.cloudflare-pages.outputs.url }}
21 changes: 21 additions & 0 deletions 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
54 changes: 54 additions & 0 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Starlight Starter Kit: Basics

[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)

```
npm create astro@latest -- --template starlight
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!

## 🚀 Project Structure

Inside of your Astro + Starlight project, you'll see the following folders and files:

```
.
├── public/
├── src/
│ ├── assets/
│ ├── content/
│ │ ├── docs/
│ │ └── config.ts
│ └── env.d.ts
├── astro.config.mjs
├── package.json
└── tsconfig.json
```

Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.

Images can be added to `src/assets/` and embedded in Markdown with a relative link.

Static assets, like favicons, can be placed in the `public/` directory.

## 🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |

## 👀 Want to learn more?

Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
27 changes: 27 additions & 0 deletions apps/docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: 'NITO Docs',
social: {
github: 'https://github.com/2rabs/nito',
},
sidebar: [
{
label: 'Guides',
items: [
// Each item here is one entry in the navigation menu.
{ label: 'Example Guide', link: '/guides/example/' },
],
},
{
label: 'Reference',
autogenerate: { directory: 'reference' },
},
],
}),
],
});
23 changes: 23 additions & 0 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "docs",
"private": true,
"type": "module",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro",
"clean": "bun clean:astro; bun clean:dist",
"clean:astro": "rimraf .astro",
"clean:dist": "rimraf dist"
},
"dependencies": {
"@astrojs/check": "0.3.4",
"@astrojs/starlight": "0.15.2",
"@astrojs/ts-plugin": "1.3.1",
"astro": "4.1.1",
"sharp": "0.32.6",
"typescript": "5.3.3"
}
}
1,655 changes: 1,655 additions & 0 deletions 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 apps/docs/src/assets/nito-circle.webp
Binary file not shown.
7 changes: 7 additions & 0 deletions apps/docs/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineCollection } from 'astro:content';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
};
11 changes: 11 additions & 0 deletions apps/docs/src/content/docs/guides/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Example Guide
description: A guide in my new Starlight docs site.
---

Guides lead a user through a specific task they want to accomplish, often with a sequence of steps.
Writing a good guide requires thinking about what your users are trying to do.

## Further reading

- Read [about how-to guides](https://diataxis.fr/how-to-guides/) in the Diátaxis framework
36 changes: 36 additions & 0 deletions apps/docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Welcome to NITO
description: Get started building your docs site with Starlight.
template: splash
hero:
tagline: Congrats on setting up a new NITO project!
image:
file: ../../assets/nito-circle.webp
actions:
- text: Example Guide
link: /guides/example/
icon: right-arrow
variant: primary
- text: Read the Starlight docs
link: https://starlight.astro.build
icon: external
---

import { Card, CardGrid } from '@astrojs/starlight/components';

## Next steps

<CardGrid stagger>
<Card title="Update content" icon="pencil">
Edit `src/content/docs/index.mdx` to see this page change.
</Card>
<Card title="Add new content" icon="add-document">
Add Markdown or MDX files to `src/content/docs` to create new pages.
</Card>
<Card title="Configure your site" icon="setting">
Edit your `sidebar` and other config in `astro.config.mjs`.
</Card>
<Card title="Read the docs" icon="open-book">
Learn more in [the Starlight Docs](https://starlight.astro.build/).
</Card>
</CardGrid>
11 changes: 11 additions & 0 deletions apps/docs/src/content/docs/reference/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Example Reference
description: A reference page in my new Starlight docs site.
---

Reference pages are ideal for outlining how things work in terse and clear terms.
Less concerned with telling a story or addressing a specific use case, they should give a comprehensive outline of what you're documenting.

## Further reading

- Read [about reference](https://diataxis.fr/reference/) in the Diátaxis framework
2 changes: 2 additions & 0 deletions 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" />
10 changes: 10 additions & 0 deletions apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"plugins": [
{
"name": "@astrojs/ts-plugin"
}
]
}
}
Binary file modified bun.lockb
Binary file not shown.
Loading