diff --git a/.changeset/mighty-horses-beam.md b/.changeset/mighty-horses-beam.md new file mode 100644 index 0000000..c97294d --- /dev/null +++ b/.changeset/mighty-horses-beam.md @@ -0,0 +1,9 @@ +--- +'starlight-openapi': minor +--- + +Adds support for Astro v5, drops support for Astro v4. + +⚠️ **BREAKING CHANGE:** The minimum supported version of Starlight is now `0.30.0`. + +Please follow the [upgrade guide](https://github.com/withastro/starlight/releases/tag/%40astrojs/starlight%400.30.0) to update your project. diff --git a/.node-version b/.node-version index 4a97274..860cc50 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -v18.14.1 +v18.17.1 diff --git a/.vscode/settings.json b/.vscode/settings.json index a64edaa..e4a6ee6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "eslint.experimental.useFlatConfig": true, + "eslint.useFlatConfig": true, "eslint.validate": [ "javascript", "javascriptreact", diff --git a/docs/.prettierignore b/docs/.prettierignore deleted file mode 100644 index db24125..0000000 --- a/docs/.prettierignore +++ /dev/null @@ -1,13 +0,0 @@ -.astro -.github/blocks -.next -.vercel -.vscode-test -.vscode-test-web -build -coverage -dist -dist-ssr -out -pnpm-lock.yaml -src/content/docs/api diff --git a/docs/package.json b/docs/package.json index 81a9f24..2789564 100644 --- a/docs/package.json +++ b/docs/package.json @@ -11,18 +11,17 @@ "build": "astro build", "preview": "astro preview", "astro": "astro", - "lint": "eslint . --cache --max-warnings=0", - "format": "prettier -w --cache --ignore-unknown ." + "lint": "eslint . --cache --max-warnings=0" }, "dependencies": { - "@astrojs/starlight": "0.26.0", - "@hideoo/starlight-plugins-docs-components": "^0.2.2", - "astro": "4.11.1", - "sharp": "0.32.6", + "@astrojs/starlight": "^0.30.2", + "@hideoo/starlight-plugins-docs-components": "^0.3.0", + "astro": "^5.0.9", + "sharp": "^0.33.5", "starlight-openapi": "workspace:*" }, "engines": { - "node": ">=18.14.1" + "node": ">=18.17.1" }, "packageManager": "pnpm@8.6.12", "private": true, @@ -38,7 +37,8 @@ "homepage": "https://github.com/HiDeoo/starlight-openapi", "repository": { "type": "git", - "url": "https://github.com/HiDeoo/starlight-openapi.git" + "url": "https://github.com/HiDeoo/starlight-openapi.git", + "directory": "docs" }, "bugs": "https://github.com/HiDeoo/starlight-openapi/issues" } diff --git a/docs/src/content.config.ts b/docs/src/content.config.ts new file mode 100644 index 0000000..0ae6ac4 --- /dev/null +++ b/docs/src/content.config.ts @@ -0,0 +1,7 @@ +import { docsLoader } from '@astrojs/starlight/loaders' +import { docsSchema } from '@astrojs/starlight/schema' +import { defineCollection } from 'astro:content' + +export const collections = { + docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), +} diff --git a/docs/src/content/config.ts b/docs/src/content/config.ts deleted file mode 100644 index ee1d27f..0000000 --- a/docs/src/content/config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { docsSchema, i18nSchema } from '@astrojs/starlight/schema' -import { defineCollection } from 'astro:content' - -export const collections = { - docs: defineCollection({ schema: docsSchema() }), - i18n: defineCollection({ type: 'data', schema: i18nSchema() }), -} diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx index 89bcaeb..d68f774 100644 --- a/docs/src/content/docs/index.mdx +++ b/docs/src/content/docs/index.mdx @@ -17,7 +17,7 @@ hero: icon: rocket - text: Demo link: /api/petstore/operations/addpet/ - icon: external + icon: right-arrow variant: minimal --- diff --git a/eslint.config.js b/eslint.config.mjs similarity index 100% rename from eslint.config.js rename to eslint.config.mjs diff --git a/package.json b/package.json index 5c51664..5e57a8c 100644 --- a/package.json +++ b/package.json @@ -7,24 +7,25 @@ "type": "module", "scripts": { "test": "pnpm --stream -r test", - "lint": "pnpm -r lint", - "format": "pnpm -r format", + "lint": "astro check --noSync && pnpm -r lint", + "format": "prettier -w --cache --ignore-unknown .", "version": "pnpm changeset version && pnpm i --no-frozen-lockfile" }, "devDependencies": { - "@changesets/changelog-github": "0.5.0", - "@changesets/cli": "2.27.10", - "@hideoo/eslint-config": "3.0.0", - "@hideoo/prettier-config": "2.0.0", - "@hideoo/tsconfig": "2.0.1", - "astro": "4.11.1", - "eslint": "8.56.0", - "prettier": "3.0.3", - "prettier-plugin-astro": "0.12.0", - "typescript": "5.1.6" + "@astrojs/check": "^0.9.4", + "@changesets/changelog-github": "^0.5.0", + "@changesets/cli": "^2.27.10", + "@hideoo/eslint-config": "^4.0.0", + "@hideoo/prettier-config": "^2.0.0", + "@hideoo/tsconfig": "^2.0.1", + "astro": "^5.0.9", + "eslint": "^9.17.0", + "prettier": "^3.4.2", + "prettier-plugin-astro": "^0.14.1", + "typescript": "^5.7.2" }, "engines": { - "node": ">=18.14.1" + "node": ">=18.17.1" }, "packageManager": "pnpm@8.6.12", "private": true, diff --git a/packages/starlight-openapi/.prettierignore b/packages/starlight-openapi/.prettierignore deleted file mode 100644 index 40f1830..0000000 --- a/packages/starlight-openapi/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -.astro -.github/blocks -.next -.vercel -.vscode-test -.vscode-test-web -build -coverage -dist -dist-ssr -out -pnpm-lock.yaml diff --git a/packages/starlight-openapi/components/Items.astro b/packages/starlight-openapi/components/Items.astro index b72bfc1..0eb1988 100644 --- a/packages/starlight-openapi/components/Items.astro +++ b/packages/starlight-openapi/components/Items.astro @@ -1,6 +1,6 @@ --- import { getBound, getType, type Items } from '../libs/items' -import { isSchemaObjectObject } from '../libs/schemaObject' +import { isSchemaObjectObject, type SchemaObject as SchemaObjectType } from '../libs/schemaObject' import SchemaObject from './schema/SchemaObject.astro' import Tag from './Tag.astro' @@ -11,7 +11,7 @@ interface Props { items: Items negated?: boolean | undefined nullable?: boolean | undefined - parents?: SchemaObject[] + parents?: SchemaObjectType[] } const { hideExample, items, negated, nullable, parents = [] } = Astro.props @@ -47,7 +47,11 @@ const enumItems = items.enum ?? items.items?.enum /> {enumItems && } -{items.items && isSchemaObjectObject(items.items) && } +{ + items.items && isSchemaObjectObject(items.items) && ( + + ) +}