From 948a8217b75407c5decc91669c25314ffb00f467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Buben=C3=ADk?= Date: Mon, 18 Mar 2024 07:10:39 +0100 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=92=84=20style:=20Prettier=20formatti?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .badges.json | 2 +- .github/workflows/release.yml | 8 ++++---- CHANGELOG.md | 22 +++++++++------------- README.md | 10 +++++----- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/.badges.json b/.badges.json index 64e66fb..af42536 100644 --- a/.badges.json +++ b/.badges.json @@ -31,4 +31,4 @@ "status": "MIT" } ] -} \ No newline at end of file +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 17a1ecd..6665154 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ permissions: jobs: ci: name: CI Init - runs-on: [ self-hosted, Linux ] + runs-on: [self-hosted, Linux] outputs: action: ${{ steps.init.outputs.action }} steps: @@ -23,7 +23,7 @@ jobs: name: Prepare Release PR needs: ci if: needs.ci.outputs.action == 'prepare' - runs-on: [ self-hosted, Linux ] + runs-on: [self-hosted, Linux] steps: - uses: localazy/release/prepare@v2 with: @@ -35,7 +35,7 @@ jobs: name: Publish Release needs: ci if: needs.ci.outputs.action == 'publish' - runs-on: [ self-hosted, Linux ] + runs-on: [self-hosted, Linux] steps: - uses: localazy/release/publish@v2 with: @@ -47,7 +47,7 @@ jobs: deploy-docs: name: Deploy Docs needs: publish - runs-on: [ self-hosted, Linux ] + runs-on: [self-hosted, Linux] env: NODE_OPTIONS: --max_old_space_size=8192 steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 316dffb..4c146b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,26 +1,22 @@ # 1.5.0 (2024-03-18) - - ### ✨ Features -* Add package version to the CdnClient class ([1a90771](https://github.com/localazy/cdn-client/commit/1a90771)) - +- Add package version to the CdnClient class ([1a90771](https://github.com/localazy/cdn-client/commit/1a90771)) ### 📚 Documentation -* Update README.md and add badges ([1fd6ac2](https://github.com/localazy/cdn-client/commit/1fd6ac2)) - +- Update README.md and add badges ([1fd6ac2](https://github.com/localazy/cdn-client/commit/1fd6ac2)) ### 🧰 Other Commits -* Add prettier ([91d4c12](https://github.com/localazy/cdn-client/commit/91d4c12)) -* Delete unused type ([7a9c488](https://github.com/localazy/cdn-client/commit/7a9c488)) -* Reformat with prettier ([8aa5725](https://github.com/localazy/cdn-client/commit/8aa5725)) -* Remove fetch polyfill ([5d60c36](https://github.com/localazy/cdn-client/commit/5d60c36)) -* Split CSS file into theme and custom styles, update hero claim ([ccd264a](https://github.com/localazy/cdn-client/commit/ccd264a)) -* Update deps ([80342a8](https://github.com/localazy/cdn-client/commit/80342a8)) -* Update terser plugin ([bd953d9](https://github.com/localazy/cdn-client/commit/bd953d9)) +- Add prettier ([91d4c12](https://github.com/localazy/cdn-client/commit/91d4c12)) +- Delete unused type ([7a9c488](https://github.com/localazy/cdn-client/commit/7a9c488)) +- Reformat with prettier ([8aa5725](https://github.com/localazy/cdn-client/commit/8aa5725)) +- Remove fetch polyfill ([5d60c36](https://github.com/localazy/cdn-client/commit/5d60c36)) +- Split CSS file into theme and custom styles, update hero claim ([ccd264a](https://github.com/localazy/cdn-client/commit/ccd264a)) +- Update deps ([80342a8](https://github.com/localazy/cdn-client/commit/80342a8)) +- Update terser plugin ([bd953d9](https://github.com/localazy/cdn-client/commit/bd953d9)) ## 1.4.1 (2024-03-15) diff --git a/README.md b/README.md index 5d95a9c..3face74 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,16 @@ const result = await cdn.fetch({ const result = { en: { cdn_info: 'With the CDN you can deliver the translation files instantly', - cdn_testing: 'We\'re testing the CDN', + cdn_testing: "We're testing the CDN", hello_localazy: 'Hello Localazy!', - using_javascript: 'In this project we decided to use JavaScript' + using_javascript: 'In this project we decided to use JavaScript', }, de: { cdn_info: 'Mit dem CDN können Sie die Übersetzungsdateien sofort liefern', cdn_testing: 'Wir testen das CDN', hello_localazy: 'Hallo Localazy!', - using_javascript: 'In diesem Projekt haben wir uns für JavaScript entschieden' - } + using_javascript: 'In diesem Projekt haben wir uns für JavaScript entschieden', + }, }; ``` @@ -77,7 +77,7 @@ For more information, visit [Installation](https://localazy.github.io/cdn-client Check out all npm packages from Localazy: | Package | Description | -|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------| +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ | | [@localazy/cli](https://www.npmjs.com/package/@localazy/cli) | Localazy CLI tool for app and software localization and translation. | | [@localazy/api-client](https://www.npmjs.com/package/@localazy/api-client) | Node.js module that allows you to easily interact with the Localazy API. | | [@localazy/cdn-client](https://www.npmjs.com/package/@localazy/cdn-client) | Node.js module that allows you to easily interact with the Localazy CDN. | From dd2beb9e295e7af127947229f2cf2cd8092b2306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Buben=C3=ADk?= Date: Mon, 18 Mar 2024 10:40:05 +0100 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=93=9A=20docs:=20Update=20vitepress?= =?UTF-8?q?=20theme,=20change=20hero,=20add=20headers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vitepress/config.mts | 124 -------- docs/.vitepress/config.ts | 39 +++ docs/.vitepress/config/en/head.ts | 58 ++++ docs/.vitepress/config/en/nav.ts | 23 ++ docs/.vitepress/config/en/sidebar.ts | 45 +++ docs/.vitepress/config/markdown.ts | 23 ++ .../theme/components/FooterLinks.vue | 2 +- docs/.vitepress/theme/styles.css | 1 + docs/.vitepress/theme/vitepress-theme.css | 16 ++ docs/get-started/introduction.md | 2 +- docs/get-started/metafile.md | 4 +- docs/index.md | 9 +- docs/package.json | 1 + .../how-it-works.svg} | 0 .../public/{ => assets}/metafile-url-copy.png | Bin docs/public/{ => assets}/metafile-url.png | Bin docs/public/hero.svg | 264 ------------------ docs/public/localazy-logo-white-large.svg | 16 -- docs/public/localazy-logo-white.svg | 40 --- docs/public/theme/apple-touch-icon.png | Bin 0 -> 6279 bytes docs/public/theme/hero-dark.svg | 244 ++++++++++++++++ docs/public/theme/hero-light.svg | 244 ++++++++++++++++ docs/public/theme/localazy-cdn-client-og.png | Bin 0 -> 174691 bytes docs/public/theme/localazy-logo-white.svg | 16 ++ docs/public/theme/localazy-logo.svg | 4 + docs/public/{ => theme}/ts.svg | 0 26 files changed, 724 insertions(+), 451 deletions(-) delete mode 100644 docs/.vitepress/config.mts create mode 100644 docs/.vitepress/config.ts create mode 100644 docs/.vitepress/config/en/head.ts create mode 100644 docs/.vitepress/config/en/nav.ts create mode 100644 docs/.vitepress/config/en/sidebar.ts create mode 100644 docs/.vitepress/config/markdown.ts rename docs/public/{localazy-cdn-client.svg => assets/how-it-works.svg} (100%) rename docs/public/{ => assets}/metafile-url-copy.png (100%) rename docs/public/{ => assets}/metafile-url.png (100%) delete mode 100644 docs/public/hero.svg delete mode 100644 docs/public/localazy-logo-white-large.svg delete mode 100644 docs/public/localazy-logo-white.svg create mode 100644 docs/public/theme/apple-touch-icon.png create mode 100644 docs/public/theme/hero-dark.svg create mode 100644 docs/public/theme/hero-light.svg create mode 100644 docs/public/theme/localazy-cdn-client-og.png create mode 100644 docs/public/theme/localazy-logo-white.svg create mode 100644 docs/public/theme/localazy-logo.svg rename docs/public/{ => theme}/ts.svg (100%) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts deleted file mode 100644 index 8964d52..0000000 --- a/docs/.vitepress/config.mts +++ /dev/null @@ -1,124 +0,0 @@ -import { defineConfig } from 'vitepress'; -import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'; -import { npmCommandsMarkdownPlugin } from 'vitepress-plugin-npm-commands'; -import { renderSandbox } from 'vitepress-plugin-sandpack'; -import container from 'markdown-it-container'; -import { version } from '../../package.json'; - -export default defineConfig({ - title: 'CDN Client', - description: 'Localazy CDN Client Documentation', - head: [ - ['link', { rel: 'icon', href: '/cdn-client/favicon.ico' }], - [ - 'link', - { - rel: 'stylesheet', - href: 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap', - }, - ], - ], - base: '/cdn-client/', - - markdown: { - lineNumbers: true, - config(md) { - md.use(tabsMarkdownPlugin); - md.use(npmCommandsMarkdownPlugin); - md.use(container, 'loc-sandbox', { - render(tokens, idx) { - return renderSandbox(tokens, idx, 'loc-sandbox'); - }, - }); - }, - // https://shiki.style - theme: { - light: 'github-light', - dark: 'github-dark', - }, - }, - - themeConfig: { - logo: { src: 'https://localazy.com/directus9/assets/89c7bdc9-387c-4267-9632-64afcddb8e5a', width: 24, height: 24 }, - - nav: nav(), - - sidebar: [ - { - text: 'Get Started', - items: [ - { text: 'Introduction', link: '/get-started/introduction' }, - { text: 'Installation', link: '/get-started/installation' }, - { text: 'Metafile', link: '/get-started/metafile' }, - ], - }, - { - text: 'Usage', - items: [ - { - text: 'Get Locales', - link: '/usage/get-locales', - }, - { - text: 'Get Content', - link: '/usage/get-content', - items: [ - { text: 'Selecting Data', link: '/usage/get-content#selecting-data' }, - { text: 'Single File', link: '/usage/get-content#single-file' }, - { text: 'Multiple Files', link: '/usage/get-content#multiple-files' }, - ], - }, - ], - }, - { - text: 'Sandbox', - items: [{ text: 'Live Demo', link: '/sandbox/live-demo' }], - }, - { - text: 'Examples', - items: [{ text: 'i18next', link: '/examples/i18next' }], - }, - { - text: 'Reference', - items: [ - { text: 'Client API', link: '/reference/client-api' }, - { text: 'Types', link: '/reference/types' }, - ], - }, - ], - - search: { - provider: 'local', - }, - - socialLinks: [ - { icon: 'npm', link: 'https://www.npmjs.com/package/@localazy/cdn-client' }, - { icon: 'github', link: 'https://github.com/localazy/cdn-client' }, - ], - - externalLinkIcon: true, - }, -}); - -function nav() { - return [ - { - text: 'Get Started', - link: '/get-started/introduction', - activeMatch: '/get-started/', - }, - { - text: version, - items: [ - { - text: 'Releases', - link: 'https://github.com/localazy/cdn-client/releases', - }, - { - text: 'Changelog', - link: 'https://github.com/localazy/cdn-client/blob/main/CHANGELOG.md', - }, - ], - }, - ]; -} diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts new file mode 100644 index 0000000..cad614e --- /dev/null +++ b/docs/.vitepress/config.ts @@ -0,0 +1,39 @@ +import { defineConfig } from 'vitepress'; +import { markdown } from './config/markdown'; +import { head } from './config/en/head'; +import { nav } from './config/en/nav'; +import { sidebar } from './config/en/sidebar'; + +export default defineConfig({ + title: 'CDN Client', + titleTemplate: 'Localazy CDN Client', + description: 'Localazy CDN Client Documentation', + + lang: 'en-US', + base: '/cdn-client/', + head: head(), + lastUpdated: true, + markdown: markdown(), + + sitemap: { + hostname: 'https://localazy.github.io/cdn-client/', + }, + + themeConfig: { + logo: { + src: '/theme/localazy-logo.svg', + width: 24, + height: 24, + }, + nav: nav(), + sidebar: sidebar(), + socialLinks: [ + { icon: 'npm', link: 'https://www.npmjs.com/package/@localazy/cdn-client' }, + { icon: 'github', link: 'https://github.com/localazy/cdn-client' }, + ], + search: { + provider: 'local', + }, + externalLinkIcon: true, + }, +}); diff --git a/docs/.vitepress/config/en/head.ts b/docs/.vitepress/config/en/head.ts new file mode 100644 index 0000000..37b59f4 --- /dev/null +++ b/docs/.vitepress/config/en/head.ts @@ -0,0 +1,58 @@ +import { HeadConfig } from 'vitepress'; + +export const head = (): HeadConfig[] => [ + // Favicon + ['link', { rel: 'icon', href: '/cdn-client/favicon.ico', sizes: '32x32' }], + ['link', { rel: 'icon', href: '/cdn-client/theme/localazy-logo.svg', type: 'image/svg+xml' }], + ['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/cdn-client/theme/apple-touch-icon.png' }], + + // Fonts + [ + 'link', + { + rel: 'stylesheet', + href: 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap', + }, + ], + + // Open Graph protocol + ['meta', { name: 'theme-color', content: '#066fef' }], + ['meta', { property: 'og:type', content: 'website' }], + ['meta', { property: 'og:locale', content: 'en' }], + ['meta', { property: 'og:title', content: 'Localazy CDN Client | Documentation' }], + ['meta', { property: 'og:site_name', content: 'Localazy CDN Client' }], + [ + 'meta', + { + property: 'og:description', + content: 'Node.js module that allows you to easily interact with the Localazy CDN.', + }, + ], + [ + 'meta', + { + property: 'og:image', + content: 'https://localazy.github.io/cdn-client/cdn-client/theme/localazy-cdn-client-og.png', + }, + ], + ['meta', { property: 'og:url', content: 'https://localazy.github.io/cdn-client/' }], + + // Twitter card + ['meta', { property: 'twitter:card', content: 'summary_large_image' }], + ['meta', { property: 'twitter:url', content: 'https://localazy.github.io/cdn-client/' }], + ['meta', { property: 'twitter:title', content: 'Localazy CDN Client | Documentation' }], + [ + 'meta', + { + property: 'twitter:description', + content: 'Node.js module that allows you to easily interact with the Localazy CDN.', + }, + ], + [ + 'meta', + { + property: 'twitter:image', + content: 'https://localazy.github.io/cdn-client/cdn-client/theme/localazy-cdn-client-og.png', + }, + ], +]; diff --git a/docs/.vitepress/config/en/nav.ts b/docs/.vitepress/config/en/nav.ts new file mode 100644 index 0000000..aee1b94 --- /dev/null +++ b/docs/.vitepress/config/en/nav.ts @@ -0,0 +1,23 @@ +import { DefaultTheme } from 'vitepress/theme'; +import { version } from '../../../../package.json'; + +export const nav = (): DefaultTheme.NavItem[] => [ + { + text: 'Get Started', + link: '/get-started/introduction', + activeMatch: '/get-started/', + }, + { + text: version, + items: [ + { + text: 'Releases', + link: 'https://github.com/localazy/cdn-client/releases', + }, + { + text: 'Changelog', + link: 'https://github.com/localazy/cdn-client/blob/main/CHANGELOG.md', + }, + ], + }, +]; diff --git a/docs/.vitepress/config/en/sidebar.ts b/docs/.vitepress/config/en/sidebar.ts new file mode 100644 index 0000000..6afa698 --- /dev/null +++ b/docs/.vitepress/config/en/sidebar.ts @@ -0,0 +1,45 @@ +import type { DefaultTheme } from 'vitepress/theme'; + +export const sidebar = (): DefaultTheme.Sidebar => [ + { + text: 'Get Started', + items: [ + { text: 'Introduction', link: '/get-started/introduction' }, + { text: 'Installation', link: '/get-started/installation' }, + { text: 'Metafile', link: '/get-started/metafile' }, + ], + }, + { + text: 'Usage', + items: [ + { + text: 'Get Locales', + link: '/usage/get-locales', + }, + { + text: 'Get Content', + link: '/usage/get-content', + items: [ + { text: 'Selecting Data', link: '/usage/get-content#selecting-data' }, + { text: 'Single File', link: '/usage/get-content#single-file' }, + { text: 'Multiple Files', link: '/usage/get-content#multiple-files' }, + ], + }, + ], + }, + { + text: 'Sandbox', + items: [{ text: 'Live Demo', link: '/sandbox/live-demo' }], + }, + { + text: 'Examples', + items: [{ text: 'i18next', link: '/examples/i18next' }], + }, + { + text: 'Reference', + items: [ + { text: 'Client API', link: '/reference/client-api' }, + { text: 'Types', link: '/reference/types' }, + ], + }, +]; diff --git a/docs/.vitepress/config/markdown.ts b/docs/.vitepress/config/markdown.ts new file mode 100644 index 0000000..1e0d709 --- /dev/null +++ b/docs/.vitepress/config/markdown.ts @@ -0,0 +1,23 @@ +import { MarkdownOptions } from 'vitepress'; +import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'; +import { npmCommandsMarkdownPlugin } from 'vitepress-plugin-npm-commands'; +import { renderSandbox } from 'vitepress-plugin-sandpack'; +import container from 'markdown-it-container'; + +export const markdown = (): MarkdownOptions => ({ + lineNumbers: true, + config(md): void { + md.use(tabsMarkdownPlugin); + md.use(npmCommandsMarkdownPlugin); + md.use(container, 'loc-sandbox', { + render(tokens, idx) { + return renderSandbox(tokens, idx, 'loc-sandbox'); + }, + }); + }, + // https://shiki.style + theme: { + light: 'github-light', + dark: 'github-dark', + }, +}); diff --git a/docs/.vitepress/theme/components/FooterLinks.vue b/docs/.vitepress/theme/components/FooterLinks.vue index 3d08578..da6581d 100644 --- a/docs/.vitepress/theme/components/FooterLinks.vue +++ b/docs/.vitepress/theme/components/FooterLinks.vue @@ -7,7 +7,7 @@