Skip to content

Commit 7daa773

Browse files
authored
Add docs site (#1094)
1 parent c76a9ed commit 7daa773

File tree

1,493 files changed

+7526
-1464
lines changed

Some content is hidden

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

1,493 files changed

+7526
-1464
lines changed

.all-contributorsrc

-749
This file was deleted.

.github/workflows/ci.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,11 @@ jobs:
2121
- uses: actions/setup-node@v3
2222
- run: pnpm i
2323
- run: npm run lint
24-
test:
25-
runs-on: ubuntu-latest
26-
steps:
27-
- uses: actions/checkout@v3
28-
- uses: pnpm/action-setup@v2
29-
with:
30-
version: 8
31-
- uses: actions/setup-node@v3
32-
with:
33-
node-version: 20
34-
- run: pnpm i
35-
- run: npm run test:coverage
3624
test-node-versions:
3725
runs-on: ubuntu-latest
3826
strategy:
3927
matrix:
40-
node-version: [16.x, 18.x]
28+
node-version: [16.x, 18.x, 20.x]
4129
steps:
4230
- uses: actions/checkout@v3
4331
- uses: pnpm/action-setup@v2

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.DS_Store
2-
coverage/
32
dist
43
node_modules

.node-version .nvm

File renamed without changes.

README.md

+9-392
Large diffs are not rendered by default.

codecov.yml

-5
This file was deleted.

docs/.astro/types.d.ts

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
declare module 'astro:content' {
2+
interface Render {
3+
'.md': Promise<{
4+
Content: import('astro').MarkdownInstance<{}>['Content'];
5+
headings: import('astro').MarkdownHeading[];
6+
remarkPluginFrontmatter: Record<string, any>;
7+
}>;
8+
}
9+
}
10+
11+
declare module 'astro:content' {
12+
export { z } from 'astro/zod';
13+
export type CollectionEntry<C extends keyof typeof entryMap> =
14+
(typeof entryMap)[C][keyof (typeof entryMap)[C]];
15+
16+
// TODO: Remove this when having this fallback is no longer relevant. 2.3? 3.0? - erika, 2023-04-04
17+
/**
18+
* @deprecated
19+
* `astro:content` no longer provide `image()`.
20+
*
21+
* Please use it through `schema`, like such:
22+
* ```ts
23+
* import { defineCollection, z } from "astro:content";
24+
*
25+
* defineCollection({
26+
* schema: ({ image }) =>
27+
* z.object({
28+
* image: image(),
29+
* }),
30+
* });
31+
* ```
32+
*/
33+
export const image: never;
34+
35+
// This needs to be in sync with ImageMetadata
36+
export type ImageFunction = () => import('astro/zod').ZodObject<{
37+
src: import('astro/zod').ZodString;
38+
width: import('astro/zod').ZodNumber;
39+
height: import('astro/zod').ZodNumber;
40+
format: import('astro/zod').ZodUnion<
41+
[
42+
import('astro/zod').ZodLiteral<'png'>,
43+
import('astro/zod').ZodLiteral<'jpg'>,
44+
import('astro/zod').ZodLiteral<'jpeg'>,
45+
import('astro/zod').ZodLiteral<'tiff'>,
46+
import('astro/zod').ZodLiteral<'webp'>,
47+
import('astro/zod').ZodLiteral<'gif'>,
48+
import('astro/zod').ZodLiteral<'svg'>
49+
]
50+
>;
51+
}>;
52+
53+
type BaseSchemaWithoutEffects =
54+
| import('astro/zod').AnyZodObject
55+
| import('astro/zod').ZodUnion<import('astro/zod').AnyZodObject[]>
56+
| import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]>
57+
| import('astro/zod').ZodIntersection<
58+
import('astro/zod').AnyZodObject,
59+
import('astro/zod').AnyZodObject
60+
>;
61+
62+
type BaseSchema =
63+
| BaseSchemaWithoutEffects
64+
| import('astro/zod').ZodEffects<BaseSchemaWithoutEffects>;
65+
66+
export type SchemaContext = { image: ImageFunction };
67+
68+
type BaseCollectionConfig<S extends BaseSchema> = {
69+
schema?: S | ((context: SchemaContext) => S);
70+
};
71+
export function defineCollection<S extends BaseSchema>(
72+
input: BaseCollectionConfig<S>
73+
): BaseCollectionConfig<S>;
74+
75+
type EntryMapKeys = keyof typeof entryMap;
76+
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
77+
type ValidEntrySlug<C extends EntryMapKeys> = AllValuesOf<(typeof entryMap)[C]>['slug'];
78+
79+
export function getEntryBySlug<
80+
C extends keyof typeof entryMap,
81+
E extends ValidEntrySlug<C> | (string & {})
82+
>(
83+
collection: C,
84+
// Note that this has to accept a regular string too, for SSR
85+
entrySlug: E
86+
): E extends ValidEntrySlug<C>
87+
? Promise<CollectionEntry<C>>
88+
: Promise<CollectionEntry<C> | undefined>;
89+
export function getCollection<C extends keyof typeof entryMap, E extends CollectionEntry<C>>(
90+
collection: C,
91+
filter?: (entry: CollectionEntry<C>) => entry is E
92+
): Promise<E[]>;
93+
export function getCollection<C extends keyof typeof entryMap>(
94+
collection: C,
95+
filter?: (entry: CollectionEntry<C>) => unknown
96+
): Promise<CollectionEntry<C>[]>;
97+
98+
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
99+
type InferEntrySchema<C extends keyof typeof entryMap> = import('astro/zod').infer<
100+
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
101+
>;
102+
103+
const entryMap: {
104+
"docs": {
105+
"about.md": {
106+
id: "about.md",
107+
slug: "about",
108+
body: string,
109+
collection: "docs",
110+
data: InferEntrySchema<"docs">
111+
} & { render(): Render[".md"] },
112+
"advanced.md": {
113+
id: "advanced.md",
114+
slug: "advanced",
115+
body: string,
116+
collection: "docs",
117+
data: InferEntrySchema<"docs">
118+
} & { render(): Render[".md"] },
119+
"cli.md": {
120+
id: "cli.md",
121+
slug: "cli",
122+
body: string,
123+
collection: "docs",
124+
data: InferEntrySchema<"docs">
125+
} & { render(): Render[".md"] },
126+
"introduction.md": {
127+
id: "introduction.md",
128+
slug: "introduction",
129+
body: string,
130+
collection: "docs",
131+
data: InferEntrySchema<"docs">
132+
} & { render(): Render[".md"] },
133+
"node.md": {
134+
id: "node.md",
135+
slug: "node",
136+
body: string,
137+
collection: "docs",
138+
data: InferEntrySchema<"docs">
139+
} & { render(): Render[".md"] },
140+
"openapi-fetch/about.md": {
141+
id: "openapi-fetch/about.md",
142+
slug: "openapi-fetch/about",
143+
body: string,
144+
collection: "docs",
145+
data: InferEntrySchema<"docs">
146+
} & { render(): Render[".md"] },
147+
"openapi-fetch/api.md": {
148+
id: "openapi-fetch/api.md",
149+
slug: "openapi-fetch/api",
150+
body: string,
151+
collection: "docs",
152+
data: InferEntrySchema<"docs">
153+
} & { render(): Render[".md"] },
154+
"openapi-fetch/examples.md": {
155+
id: "openapi-fetch/examples.md",
156+
slug: "openapi-fetch/examples",
157+
body: string,
158+
collection: "docs",
159+
data: InferEntrySchema<"docs">
160+
} & { render(): Render[".md"] },
161+
"openapi-fetch/index.md": {
162+
id: "openapi-fetch/index.md",
163+
slug: "openapi-fetch",
164+
body: string,
165+
collection: "docs",
166+
data: InferEntrySchema<"docs">
167+
} & { render(): Render[".md"] },
168+
},
169+
170+
};
171+
172+
type ContentConfig = typeof import("../src/content/config");
173+
}

docs/astro.config.mjs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from "astro/config";
2+
import preact from "@astrojs/preact";
3+
import react from "@astrojs/react";
4+
5+
// https://astro.build/config
6+
export default defineConfig({
7+
integrations: [preact(), react()],
8+
site: `https://openapi-typescript.pages.dev`,
9+
vite: {},
10+
});

docs/package.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "openapi-typescript-docs",
3+
"version": "0.0.0",
4+
"type": "module",
5+
"scripts": {
6+
"build": "astro build",
7+
"dev": "astro dev"
8+
},
9+
"dependencies": {
10+
"@algolia/client-search": "^4.17.0",
11+
"@astrojs/preact": "^2.1.0",
12+
"@astrojs/react": "^2.1.3",
13+
"@docsearch/css": "^3.3.4",
14+
"@docsearch/react": "^3.3.4",
15+
"@types/node": "^18.16.3",
16+
"@types/react": "^18.2.5",
17+
"@types/react-dom": "^18.2.3",
18+
"astro": "^2.4.1",
19+
"preact": "^10.13.2",
20+
"react": "^18.2.0",
21+
"react-dom": "^18.2.0",
22+
"sass": "^1.62.1"
23+
},
24+
"devDependencies": {
25+
"html-escaper": "^3.0.3"
26+
}
27+
}

docs/public/assets/github.svg

+1
Loading

docs/public/assets/openapi-fetch.svg

+1
Loading

docs/public/assets/openapi-schema.png

13.7 KB
Loading

docs/public/assets/openapi-ts.svg

+1
Loading

0 commit comments

Comments
 (0)