Skip to content

Commit

Permalink
program logic
Browse files Browse the repository at this point in the history
  • Loading branch information
trueberryless committed Nov 26, 2024
1 parent 3af55ab commit 5df2975
Show file tree
Hide file tree
Showing 41 changed files with 241 additions and 795 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "trueberryless-org/starlight-cooler-credit" }
{ "repo": "trueberryless-org/starlight-plugin-show-latest-version" }
],
"commit": false,
"fixed": [],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
env:
REGISTRY: docker.io
IMAGE_OWNER: trueberryless
IMAGE_NAME: starlight-cooler-credit
IMAGE_NAME: starlight-plugin-show-latest-version
NODE_VERSION: 20

jobs:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ concurrency:
env:
REGISTRY: docker.io
IMAGE_OWNER: trueberryless
IMAGE_NAME: starlight-cooler-credit
IMAGE_NAME: starlight-plugin-show-latest-version
NODE_VERSION: 20

jobs:
changes:
name: Filter
runs-on: ubuntu-latest
outputs:
starlight-cooler-credit: ${{ steps.filter.outputs.starlight-cooler-credit }}
starlight-plugin-show-latest-version: ${{ steps.filter.outputs.starlight-plugin-show-latest-version }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand All @@ -30,8 +30,8 @@ jobs:
id: filter
with:
filters: |
starlight-cooler-credit:
- 'packages/starlight-cooler-credit/**'
starlight-plugin-show-latest-version:
- 'packages/starlight-plugin-show-latest-version/**'
changesets:
name: Changesets
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Read version from package.json
id: get_version
run: |
VERSION=$(jq -r '.version' packages/starlight-cooler-credit/package.json)
VERSION=$(jq -r '.version' packages/starlight-plugin-show-latest-version/package.json)
echo "IMAGE_TAG=$VERSION" >> $GITHUB_ENV
publish:
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
run: pnpm i

- run: |
cd packages/starlight-cooler-credit
cd packages/starlight-plugin-show-latest-version
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -132,7 +132,7 @@ jobs:
- id: extract-changelog
uses: sean0x42/[email protected]
with:
file: packages/starlight-cooler-credit/CHANGELOG.md
file: packages/starlight-plugin-show-latest-version/CHANGELOG.md
pattern: ${{ needs.image-tag.outputs.IMAGE_TAG }}

- uses: ncipollo/release-action@v1
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# `starlight-cooler-credit`
# `starlight-plugin-show-latest-version`

Add a nice credit to Starlight or Astro at the bottom of Table of Contents.

## Package

If you are looking for the Starlight plugin package, you can find it in the [`packages/starlight-cooler-credit/`](/packages/starlight-cooler-credit/) directory.
If you are looking for the Starlight plugin package, you can find it in the [`packages/starlight-plugin-show-latest-version/`](/packages/starlight-plugin-show-latest-version/) directory.

## Project structure

This project uses pnpm workspaces to develop a single Starlight plugin from the `packages/starlight-cooler-credit/` directory. A Starlight documentation site is also available in the `docs/` directory that is also used for testing and demonstrating the Starlight plugin.
This project uses pnpm workspaces to develop a single Starlight plugin from the `packages/starlight-plugin-show-latest-version/` directory. A Starlight documentation site is also available in the `docs/` directory that is also used for testing and demonstrating the Starlight plugin.

## License

Expand Down
208 changes: 0 additions & 208 deletions docs/.astro/astro/content.d.ts
Original file line number Diff line number Diff line change
@@ -1,208 +0,0 @@
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"] };
"de/configuration.mdx": {
id: "de/configuration.mdx";
slug: "de/configuration";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".mdx"] };
"de/getting-started.mdx": {
id: "de/getting-started.mdx";
slug: "de/getting-started";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".mdx"] };
"de/index.mdx": {
id: "de/index.mdx";
slug: "de";
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"] };
};

};

type DataEntryMap = {

};

type AnyEntryMap = ContentEntryMap & DataEntryMap;

export type ContentConfig = typeof import("../../src/content/config.js");
}
18 changes: 9 additions & 9 deletions docs/.astro/integrations/_astrojs_starlight/i18n-plugins.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
declare namespace StarlightApp {
type PluginUIStringKeys = {
'starlightCoolerCredit.starlight.description': string;
'starlightCoolerCredit.astro.title': string;
'starlightCoolerCredit.astro.description': string;
'starlightCoolerCredit.starlight-blog.title': string;
'starlightCoolerCredit.starlight-blog.description': string;
};
interface I18n extends PluginUIStringKeys {}
}
type PluginUIStringKeys = {
"starlightPluginShowLatestVersion.starlight.description": string;
"starlightPluginShowLatestVersion.astro.title": string;
"starlightPluginShowLatestVersion.astro.description": string;
"starlightPluginShowLatestVersion.starlight-blog.title": string;
"starlightPluginShowLatestVersion.starlight-blog.description": string;
};
interface I18n extends PluginUIStringKeys {}
}
5 changes: 5 additions & 0 deletions docs/.astro/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"_variables": {
"lastUpdateCheck": 1732631781468
}
}
1 change: 0 additions & 1 deletion docs/.astro/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/// <reference types="astro/client" />
/// <reference path="integrations/_astrojs_starlight/i18n-plugins.d.ts" />
/// <reference path="astro/content.d.ts" />
Loading

0 comments on commit 5df2975

Please sign in to comment.