Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzolewis committed May 21, 2024
0 parents commit d4021bc
Show file tree
Hide file tree
Showing 38 changed files with 8,221 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["docs"]
}
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
if: ${{ github.repository_owner == 'lorenzolewis' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 18

- name: Install dependencies
run: pnpm install

- name: Create Release Pull Request
uses: changesets/action@v1
with:
version: pnpm run version
publish: pnpm changeset publish
commit: "[ci] release"
title: "[ci] release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
21 changes: 21 additions & 0 deletions .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
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cSpell.enableFiletypes": ["mdx"]
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 🗄️ Starlight Multi-Sidebar

Have multiple sidebars in your Starlight site!

Visit the documentation for instructions on how to use: https://starlight-multi-sidebar.pages.dev
54 changes: 54 additions & 0 deletions 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).
32 changes: 32 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightMultiSidebar from "@lorenzo_lewis/starlight-nav";
import starlightLinksValidatorPlugin from "starlight-links-validator";

// https://astro.build/config
export default defineConfig({
site: "https://starlight-nav.pages.dev",
integrations: [
starlight({
title: "🗄️ Starlight Multi-Sidebar",
social: {
github: "https://github.com/lorenzolewis/starlight-multi-sidebar",
},
sidebar: [
{
label: "Docs",
autogenerate: { directory: "docs" },
},
{
label: "Samples",
autogenerate: { directory: "sample" },
badge: "Demo",
},
],
plugins: [
starlightMultiSidebar({ switcherStyle: "horizontalList" }),
starlightLinksValidatorPlugin(),
],
}),
],
});
23 changes: 23 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "docs",
"private": true,
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/starlight": "^0.23.1",
"@lorenzo_lewis/starlight-multi-sidebar": "workspace:*",
"astro": "^4.8.6",
"sharp": "^0.33.4",
"starlight-links-validator": "^0.8.0",
"starlight-package-managers": "^0.5.0",
"typescript": "^5.4.5"
}
}
1 change: 1 addition & 0 deletions 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 docs/src/assets/houston.webp
Binary file not shown.
6 changes: 6 additions & 0 deletions 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() }),
};
60 changes: 60 additions & 0 deletions docs/src/content/docs/_quick-start.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Steps } from "@astrojs/starlight/components";
import { PackageManagers } from "starlight-package-managers";

<Steps>

1. Setup a Starlight Site: https://starlight.astro.build/getting-started/

2. Install the `starlight-multi-sidebar` plugin:

<PackageManagers pkg="@lorenzo_lewis/starlight-multi-sidebar" />

3. Update the `integrations.starlight.plugins` object in `astro.config.mjs` to include the `starlight-multi-sidebar` plugin:

```ts ins={4, 10}
// astro.config.mjs
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightMultiSidebar from "@lorenzo_lewis/starlight-multi-sidebar";

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
plugins: [starlightMultiSidebar()],
}),
],
});
```

4. All top-level items in `integrations.starlight.sidebar` are turned into their own sidebar. Configure each desired sidebar:

```ts ins={11-20}
// astro.config.mjs
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightMultiSidebar from "@lorenzo_lewis/starlight-multi-sidebar";

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
plugins: [starlightMultiSidebar],
sidebar: [
{
label: "Guides",
autogenerate: { directory: "reference" },
},
{
label: "Reference",
autogenerate: { directory: "reference" },
},
],
}),
],
});
```

5. All done! ✨

</Steps>
9 changes: 9 additions & 0 deletions docs/src/content/docs/docs/changelog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Changelog
sidebar:
order: 3
---

import Changelog from "../../../../../packages/starlight-multi-sidebar/CHANGELOG.md";

<Changelog />
35 changes: 35 additions & 0 deletions docs/src/content/docs/docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Configuration
sidebar:
order: 2
---

There are a few options that can be passed to `starlight-multi-sidebar`. See below for how to configure each of those options

```ts {11-13}
// astro.config.mjs
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightMultiSidebar from "@lorenzo_lewis/starlight-multi-sidebar";

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
plugins: [
starlightMultiSidebar({
switcherStyle: "horizontalList",
}),
],
}),
],
});
```

## `switcherStyle`

**Type:** `"dropdown" | "horizontalList"`

**Default:** `"horizontalList"`

Specifies which style should be used for the sidebar.
25 changes: 25 additions & 0 deletions docs/src/content/docs/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Getting Started
sidebar:
order: 1
---

:::caution

This package is still in alpha. There are known issues with accessibility that have not been addressed. If any issues are found please [open an issue on GitHub](https://github.com/lorenzolewis/starlight-multi-sidebar/issues).

:::

There are cases where having multiple sidebars for a Starlight site can be useful. [Starlight does not currently support this natively](https://github.com/withastro/starlight/discussions/959), but this Starlight plugin gives a minimal implementation of this.

:::tip

Take a look at the sidebar on this page to see what this looks like!

:::

## Setup Instructions

import Setup from "../_quick-start.mdx";

<Setup />
19 changes: 19 additions & 0 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: 🗄️ Starlight Multi-Sidebar
description: Enable multiple sidebars with your Starlight site.
hero:
tagline: Enable multiple sidebars with your Starlight site.
image:
file: ../../assets/houston.webp
actions:
- text: Get Started
link: /docs/
icon: right-arrow
variant: primary
---

import QuickStart from "./_quick-start.mdx";

## Quick Start

<QuickStart />
Loading

0 comments on commit d4021bc

Please sign in to comment.