Skip to content

Commit

Permalink
push as it is; not working
Browse files Browse the repository at this point in the history
  • Loading branch information
trueberryless committed Nov 26, 2024
1 parent 4944aab commit bff666d
Show file tree
Hide file tree
Showing 26 changed files with 359 additions and 361 deletions.
194 changes: 194 additions & 0 deletions docs/.astro/astro/content.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
declare module 'astro:content' {
interface Render {
'.mdx': Promise<{
Content: import('astro').MarkdownInstance<{}>['Content'];
headings: import('astro').MarkdownHeading[];
remarkPluginFrontmatter: Record<string, any>;
components: import('astro').MDXInstance<{}>['components'];
}>;
}
}

declare module 'astro:content' {
interface RenderResult {
Content: import('astro/runtime/server/index.js').AstroComponentFactory;
headings: import('astro').MarkdownHeading[];
remarkPluginFrontmatter: Record<string, any>;
}
interface Render {
'.md': Promise<RenderResult>;
}

export interface RenderedContent {
html: string;
metadata?: {
imagePaths: Array<string>;
[key: string]: unknown;
};
}
}

declare module 'astro:content' {
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;

export type CollectionKey = keyof AnyEntryMap;
export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>;

export type ContentCollectionKey = keyof ContentEntryMap;
export type DataCollectionKey = keyof DataEntryMap;

type AllValuesOf<T> = T extends any ? T[keyof T] : never;
type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf<
ContentEntryMap[C]
>['slug'];

/** @deprecated Use `getEntry` instead. */
export function getEntryBySlug<
C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}),
>(
collection: C,
// Note that this has to accept a regular string too, for SSR
entrySlug: E,
): E extends ValidContentEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;

/** @deprecated Use `getEntry` instead. */
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
collection: C,
entryId: E,
): Promise<CollectionEntry<C>>;

export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
collection: C,
filter?: (entry: CollectionEntry<C>) => entry is E,
): Promise<E[]>;
export function getCollection<C extends keyof AnyEntryMap>(
collection: C,
filter?: (entry: CollectionEntry<C>) => unknown,
): Promise<CollectionEntry<C>[]>;

export function getEntry<
C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}),
>(entry: {
collection: C;
slug: E;
}): E extends ValidContentEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;
export function getEntry<
C extends keyof DataEntryMap,
E extends keyof DataEntryMap[C] | (string & {}),
>(entry: {
collection: C;
id: E;
}): E extends keyof DataEntryMap[C]
? Promise<DataEntryMap[C][E]>
: Promise<CollectionEntry<C> | undefined>;
export function getEntry<
C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}),
>(
collection: C,
slug: E,
): E extends ValidContentEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;
export function getEntry<
C extends keyof DataEntryMap,
E extends keyof DataEntryMap[C] | (string & {}),
>(
collection: C,
id: E,
): E extends keyof DataEntryMap[C]
? Promise<DataEntryMap[C][E]>
: Promise<CollectionEntry<C> | undefined>;

/** Resolve an array of entry references from the same collection */
export function getEntries<C extends keyof ContentEntryMap>(
entries: {
collection: C;
slug: ValidContentEntrySlug<C>;
}[],
): Promise<CollectionEntry<C>[]>;
export function getEntries<C extends keyof DataEntryMap>(
entries: {
collection: C;
id: keyof DataEntryMap[C];
}[],
): Promise<CollectionEntry<C>[]>;

export function render<C extends keyof AnyEntryMap>(
entry: AnyEntryMap[C][string],
): Promise<RenderResult>;

export function reference<C extends keyof AnyEntryMap>(
collection: C,
): import('astro/zod').ZodEffects<
import('astro/zod').ZodString,
C extends keyof ContentEntryMap
? {
collection: C;
slug: ValidContentEntrySlug<C>;
}
: {
collection: C;
id: keyof DataEntryMap[C];
}
>;
// Allow generic `string` to avoid excessive type errors in the config
// if `dev` is not running to update as you edit.
// Invalid collection names will be caught at build time.
export function reference<C extends string>(
collection: C,
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;

type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer<
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
>;

type ContentEntryMap = {
"docs": {
"configuration.mdx": {
id: "configuration.mdx";
slug: "configuration";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".mdx"] };
"getting-started.mdx": {
id: "getting-started.mdx";
slug: "getting-started";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".mdx"] };
"index.mdx": {
id: "index.mdx";
slug: "index";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".mdx"] };
"version-extraction-algorithm.mdx": {
id: "version-extraction-algorithm.mdx";
slug: "version-extraction-algorithm";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".mdx"] };
};

};

type DataEntryMap = {

};

type AnyEntryMap = ContentEntryMap & DataEntryMap;

export type ContentConfig = typeof import("./../../src/content/config.js");
}
16 changes: 7 additions & 9 deletions docs/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import starlightPluginsDocsComponents from "@trueberryless-org/starlight-plugins
export default defineConfig({
integrations: [
starlight({
title: "Starlight Cooler Credit",
title: "Starlight Plugin Show Latest Version",
logo: {
light: "./src/assets/logo-light.png",
dark: "./src/assets/logo-dark.png",
Expand All @@ -25,20 +25,18 @@ export default defineConfig({
starlightPluginsDocsComponents({
pluginName: "starlight-plugin-show-latest-version",
showcaseProps: {
entries: [
{
thumbnail: "./src/assets/rainsberger.ca.webp",
href: "https://www.rainsberger.ca",
title: "Sarah Rainsberger",
},
],
entries: [],
},
}),
],
sidebar: [
{
label: "Start Here",
items: [{ slug: "getting-started" }, { slug: "configuration" }],
items: [
{ slug: "getting-started" },
{ slug: "configuration" },
{ slug: "version-extraction-algorithm" },
],
},
],
social: {
Expand Down
Binary file removed docs/src/assets/rainsberger.ca.webp
Binary file not shown.
39 changes: 0 additions & 39 deletions docs/src/components/LanguagesList.astro

This file was deleted.

7 changes: 0 additions & 7 deletions docs/src/components/TranslationsList.astro

This file was deleted.

57 changes: 8 additions & 49 deletions docs/src/content/docs/configuration.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Configuration
description: An overview of all the configuration options supported by the Starlight Cooler Credit plugin.
description: An overview of all the configuration options supported by the Starlight Plugin Show Latest Version plugin.
---

The Starlight Cooler Credit plugin can be configured inside the `astro.config.mjs` configuration file of your project:
The Starlight Plugin Show Latest Version plugin can be configured inside the `astro.config.mjs` configuration file of your project:

```js {11}
// astro.config.mjs
Expand All @@ -27,60 +27,19 @@ export default defineConfig({

## Configuration options

The Starlight Cooler Credit plugin accepts the following configuration options:
The Starlight Plugin Show Latest Version plugin accepts the following configuration options:

### `credit`
### `repo`

**Type:**
**Type:** `string`

```ts
"Astro" |
"Starlight" |
"Starlight Blog" |
{
title: string | Record<string, string>;
href: string;
description?: string | Record<string, string> | undefined;
}
```

**Default:** `"Starlight"`

The `credit` option allows you to configure the credit text displayed in the table of contents of the Starlight website. There are [three preconfigured options](#preconfigured-options): `"Astro"`, `"Starlight"`, and `"Starlight Blog"`. You can also provide a custom object to configure the credit text for each locale.

:::note
Please note that if you want to provide credit text for each locale, that there has to be at least the locale value of your [`defaultLocale`](https://starlight.astro.build/reference/configuration/#defaultlocale) configured.
:::
Provide the repository slug where your Starlight plugin is released.
This slug must follow the syntax: `{{owner}}/{{repo}}`.

Here is an example for a custom configuration:

```ts
starlightPluginShowLatestVersion({
credit: {
title: {
en: "Built with Astro",
de: "Erstellt mit Astro",
},
href: "https://docs.astro.build/",
description: {
en: "Want to build your own static website?",
de: "Willst du deine eigene statische Website erstellen?",
},
},
repo: "trueberryless-org/starlight-plugin-show-latest-version",
}),
```

#### Preconfigured options

The `Astro`, `Starlight`, and `Starlight Blog` options are preconfigured and can be used without any additional configuration.

import LanguagesList from "../../components/LanguagesList.astro";
import TranslationsList from "../../components/TranslationsList.astro";

<LanguagesList startsSentence /> translated UI strings are provided out of the box.

To provide translations for additional languages you support — or override the default ones — check the [“Translate Starlight’s UI”](https://starlight.astro.build/guides/i18n/#translate-starlights-ui) guide in the Starlight documentation.

These are the English defaults of the existing strings Starlight Cooler Credit ships with:

<TranslationsList />
Loading

0 comments on commit bff666d

Please sign in to comment.