From 0ea13553d0e5543f0a3c850b39f07b9ce2afb0ad Mon Sep 17 00:00:00 2001 From: Jordan Shatford Date: Thu, 4 Apr 2024 14:52:47 +1100 Subject: [PATCH 1/2] chore(docs): add support for localization --- .changeset/quiet-schools-matter.md | 5 +++++ docs/.vitepress/{config.ts => config/en.ts} | 21 ++++++--------------- docs/.vitepress/config/index.ts | 11 +++++++++++ docs/.vitepress/config/shared.ts | 19 +++++++++++++++++++ docs/index.md | 1 - 5 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 .changeset/quiet-schools-matter.md rename docs/.vitepress/{config.ts => config/en.ts} (61%) create mode 100644 docs/.vitepress/config/index.ts create mode 100644 docs/.vitepress/config/shared.ts diff --git a/.changeset/quiet-schools-matter.md b/.changeset/quiet-schools-matter.md new file mode 100644 index 000000000..3c0f3551e --- /dev/null +++ b/.changeset/quiet-schools-matter.md @@ -0,0 +1,5 @@ +--- +"openapi-ts-docs": minor +--- + +docs: add support for localization of docs diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config/en.ts similarity index 61% rename from docs/.vitepress/config.ts rename to docs/.vitepress/config/en.ts index f1908f545..0c981de81 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config/en.ts @@ -1,15 +1,9 @@ -import { defineConfig } from 'vitepress' +import { defineConfig } from "vitepress"; -// https://vitepress.dev/reference/site-config export default defineConfig({ - title: "OpenAPI TypeScript", + lang: 'en-US', description: "Turn your OpenAPI specification into a beautiful TypeScript client", - head: [ - ['link', { rel: 'icon', type: 'image/png', href: '/logo.png' }], - ], themeConfig: { - // https://vitepress.dev/reference/default-theme-config - logo: '/logo.png', nav: [ { text: 'Guide', link: '/introduction' }, ], @@ -23,11 +17,8 @@ export default defineConfig({ { text: 'Configuration', link: '/configuration' }, { text: 'Interceptors', link: '/interceptors' }, { text: 'Migrating', link: '/migrating' }, - ] - } + ], + }, ], - socialLinks: [ - { icon: 'github', link: 'https://github.com/hey-api/openapi-ts' } - ] - } -}) + }, +}); diff --git a/docs/.vitepress/config/index.ts b/docs/.vitepress/config/index.ts new file mode 100644 index 000000000..1529e4e3c --- /dev/null +++ b/docs/.vitepress/config/index.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'vitepress'; + +import en from './en'; +import shared from './shared'; + +export default defineConfig({ + ...shared, + locales: { + root: { label: 'English', ...en }, + }, +}); diff --git a/docs/.vitepress/config/shared.ts b/docs/.vitepress/config/shared.ts new file mode 100644 index 000000000..e6c642f98 --- /dev/null +++ b/docs/.vitepress/config/shared.ts @@ -0,0 +1,19 @@ +import { defineConfig } from 'vitepress'; + +export default defineConfig({ + title: "OpenAPI TypeScript", + lastUpdated: true, + sitemap: { + hostname: 'https://heyapi.vercel.app', + }, + head: [ + ['link', { rel: 'icon', type: 'image/png', href: '/logo.png' }], + ], + themeConfig: { + logo: '/logo.png', + socialLinks: [ + { icon: 'npm', link: 'https://www.npmjs.com/package/@hey-api/openapi-ts' }, + { icon: 'github', link: 'https://github.com/hey-api/openapi-ts' }, + ], + } +}); diff --git a/docs/index.md b/docs/index.md index 60582260f..cba100f1d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,5 +1,4 @@ --- -# https://vitepress.dev/reference/default-theme-home-page layout: home hero: From 324be084c4029b990c300a963ed8f3c0fc6669d6 Mon Sep 17 00:00:00 2001 From: Jordan Shatford Date: Thu, 4 Apr 2024 15:00:47 +1100 Subject: [PATCH 2/2] chore(docs): update readme to include logo --- README.md | 8 +++++--- docs/.vitepress/config/en.ts | 4 ++-- docs/.vitepress/config/shared.ts | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f9617cf73..85cefea68 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# OpenAPI TypeScript 👋 - -✨ Turn your OpenAPI specification into a beautiful TypeScript client +
+ Logo +

OpenAPI Typescript

+

✨ Turn your OpenAPI specification into a beautiful TypeScript client.

+
## About diff --git a/docs/.vitepress/config/en.ts b/docs/.vitepress/config/en.ts index 0c981de81..1d8355924 100644 --- a/docs/.vitepress/config/en.ts +++ b/docs/.vitepress/config/en.ts @@ -1,8 +1,8 @@ -import { defineConfig } from "vitepress"; +import { defineConfig } from 'vitepress'; export default defineConfig({ lang: 'en-US', - description: "Turn your OpenAPI specification into a beautiful TypeScript client", + description: 'Turn your OpenAPI specification into a beautiful TypeScript client', themeConfig: { nav: [ { text: 'Guide', link: '/introduction' }, diff --git a/docs/.vitepress/config/shared.ts b/docs/.vitepress/config/shared.ts index e6c642f98..58f85e734 100644 --- a/docs/.vitepress/config/shared.ts +++ b/docs/.vitepress/config/shared.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'vitepress'; export default defineConfig({ - title: "OpenAPI TypeScript", + title: 'OpenAPI TypeScript', lastUpdated: true, sitemap: { hostname: 'https://heyapi.vercel.app',