Skip to content

Commit cf3cc6e

Browse files
authored
Merge pull request #345 from GenSpectrum/lapis2-docs
Lapis v2 docs
2 parents 3412b7c + 40383da commit cf3cc6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+11322
-0
lines changed

lapis2-docs/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Create a .env file with this input might NOT work. You might need to properly set CONFIG_FILE as an
2+
# environment variable.
3+
CONFIG_FILE=../lapis2/src/test/resources/config/testDatabaseConfig.yaml

lapis2-docs/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# build output
2+
dist/
3+
# generated types
4+
.astro/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# logs
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
pnpm-debug.log*
14+
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store

lapis2-docs/.prettierrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"printWidth": 120,
3+
"tabWidth": 4,
4+
"trailingComma": "all",
5+
"semi": true,
6+
"jsxSingleQuote": true,
7+
"singleQuote": true,
8+
"quoteProps": "consistent",
9+
"proseWrap": "always",
10+
"plugins": ["prettier-plugin-astro"],
11+
"overrides": [
12+
{
13+
"files": "*.astro",
14+
"options": {
15+
"parser": "astro"
16+
}
17+
}
18+
]
19+
}

lapis2-docs/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Starlight Starter Kit: Basics
2+
3+
```
4+
npm create astro@latest -- --template starlight
5+
```
6+
7+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
8+
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
9+
10+
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
11+
12+
## 🚀 Project Structure
13+
14+
Inside of your Astro + Starlight project, you'll see the following folders and files:
15+
16+
```
17+
.
18+
├── public/
19+
├── src/
20+
│ ├── assets/
21+
│ ├── content/
22+
│ │ ├── docs/
23+
│ │ └── config.ts
24+
│ └── env.d.ts
25+
├── astro.config.mjs
26+
├── package.json
27+
└── tsconfig.json
28+
```
29+
30+
Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on
31+
its file name.
32+
33+
Images can be added to `src/assets/` and embedded in Markdown with a relative link.
34+
35+
Static assets, like favicons, can be placed in the `public/` directory.
36+
37+
## 🧞 Commands
38+
39+
All commands are run from the root of the project, from a terminal:
40+
41+
| Command | Action |
42+
| :------------------------ | :----------------------------------------------- |
43+
| `npm install` | Installs dependencies |
44+
| `npm run dev` | Starts local dev server at `localhost:3000` |
45+
| `npm run build` | Build your production site to `./dist/` |
46+
| `npm run preview` | Preview your build locally, before deploying |
47+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
48+
| `npm run astro -- --help` | Get help using the Astro CLI |
49+
50+
## 👀 Want to learn more?
51+
52+
Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build),
53+
or jump into the [Astro Discord server](https://astro.build/chat).

lapis2-docs/astro.config.mjs

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import { defineConfig } from 'astro/config';
2+
import starlight from '@astrojs/starlight';
3+
import react from '@astrojs/react';
4+
import { hasFeature } from './src/config.ts';
5+
6+
import tailwind from '@astrojs/tailwind';
7+
8+
// https://astro.build/config
9+
export default defineConfig({
10+
integrations: [
11+
starlight({
12+
title: 'LAPIS',
13+
social: {
14+
github: 'https://github.com/GenSpectrum/LAPIS',
15+
},
16+
customCss: ['./src/styles/custom.css'],
17+
editLink: {
18+
baseUrl: 'https://github.com/GenSpectrum/LAPIS/tree/main/lapis2-docs/',
19+
},
20+
sidebar: [
21+
{
22+
label: 'Getting started',
23+
items: [
24+
{
25+
label: 'Introduction',
26+
link: '/getting-started/introduction',
27+
},
28+
{
29+
label: 'Generate your request',
30+
link: '/getting-started/generate-your-request',
31+
},
32+
],
33+
},
34+
{
35+
label: 'References',
36+
items: [
37+
{
38+
label: 'Endpoints',
39+
link: '/references/endpoints/',
40+
},
41+
{
42+
label: 'Fields',
43+
link: '/references/fields/',
44+
},
45+
{
46+
label: 'Filters',
47+
link: '/references/filters/',
48+
},
49+
{
50+
label: 'Open API / Swagger',
51+
link: '/references/open-api-definition/',
52+
},
53+
],
54+
},
55+
{
56+
label: 'Concepts',
57+
items: filterAvailableConcepts([
58+
{
59+
label: 'Data versions',
60+
link: '/concepts/data-versions/',
61+
},
62+
{
63+
label: 'Mutation filters',
64+
link: '/concepts/mutation-filters/',
65+
},
66+
{
67+
label: 'Pango lineage query',
68+
link: '/concepts/pango-lineage-query/',
69+
onlyIfFeature: 'sarsCoV2VariantQuery',
70+
},
71+
{
72+
label: 'Request methods: GET and POST',
73+
link: '/concepts/request-methods/',
74+
},
75+
{
76+
label: 'Response format',
77+
link: '/concepts/response-format/',
78+
},
79+
{
80+
label: 'Variant query',
81+
link: '/concepts/variant-query/',
82+
onlyIfFeature: 'sarsCoV2VariantQuery',
83+
},
84+
]),
85+
},
86+
],
87+
}),
88+
react(),
89+
tailwind(),
90+
],
91+
// Process images with sharp: https://docs.astro.build/en/guides/assets/#using-sharp
92+
image: {
93+
service: {
94+
entrypoint: 'astro/assets/services/sharp',
95+
},
96+
},
97+
});
98+
99+
/**
100+
* TODO Not sure if this is actually a good solution. The filtering now happens at compile time but ideally, it happens
101+
* at runtime (so that the user/maintainer does not need to re-compile for their own config).
102+
*/
103+
function filterAvailableConcepts(pages) {
104+
return pages
105+
.filter((p) => !p.onlyIfFeature || hasFeature(p.onlyIfFeature))
106+
.map(({ label, link }) => ({
107+
label,
108+
link,
109+
}));
110+
}

0 commit comments

Comments
 (0)