From 51c4b4e23a684d83ded20c9a3a2e72cd3130aaf4 Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Tue, 13 Aug 2024 14:29:46 +0200 Subject: [PATCH] Add plausible.io with partytown --- astro.config.mjs | 157 +++++++++++++++++++++++------------------------ package.json | 1 + pnpm-lock.yaml | 18 ++++++ 3 files changed, 96 insertions(+), 80 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 1901776..13f7423 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,9 +1,10 @@ import { defineConfig } from "astro/config"; import starlight from "@astrojs/starlight"; - import tailwind from "@astrojs/tailwind"; import starlightLinksValidatorPlugin from "starlight-links-validator"; +import partytown from "@astrojs/partytown"; + // https://astro.build/config export default defineConfig({ site: "https://swiftide.rs", @@ -11,86 +12,82 @@ export default defineConfig({ service: { entrypoint: "astro/assets/services/sharp", config: { - limitInputPixels: false, - }, - }, + limitInputPixels: false + } + } }, prefetch: { - prefetchAll: true, + prefetchAll: true }, - integrations: [ - starlight({ - title: "swiftide", - description: - "Blazing fast data pipelines for Retrieval Augmented Generation written in Rust", - editLink: { - baseUrl: "https://github.com/bosun-ai/swiftide-website/edit/master", - }, - tableOfContents: { - minHeadingLevel: 2, - }, - customCss: [ - // Fontsource files for to regular and semi-bold font weights. - "@fontsource/fira-code/400.css", - "@fontsource/fira-code/600.css", - "./src/styles/custom.css", - "./src/tailwind.css", - ], - favicon: "favicon32.png", - plugins: [starlightLinksValidatorPlugin()], - logo: { - src: "./src/assets/logo.png", - }, - social: { - github: "https://github.com/bosun-ai/swiftide", - linkedin: "https://www.linkedin.com/company/bosun-ai/", + integrations: [starlight({ + title: "swiftide", + // + head: [{ + tag: "script", + attrs: { + defer: true, + type: "text/partytown", + "data-domain": "swiftide.rs", + src: "https://plausible.io/js/script.js" + } + }], + description: "Blazing fast data pipelines for Retrieval Augmented Generation written in Rust", + editLink: { + baseUrl: "https://github.com/bosun-ai/swiftide-website/edit/master" + }, + tableOfContents: { + minHeadingLevel: 2 + }, + customCss: [ + // Fontsource files for to regular and semi-bold font weights. + "@fontsource/fira-code/400.css", "@fontsource/fira-code/600.css", "./src/styles/custom.css", "./src/tailwind.css"], + favicon: "favicon32.png", + plugins: [starlightLinksValidatorPlugin()], + logo: { + src: "./src/assets/logo.png" + }, + social: { + github: "https://github.com/bosun-ai/swiftide", + linkedin: "https://www.linkedin.com/company/bosun-ai/" + }, + sidebar: [{ + label: "What is swiftide?", + link: "/what-is-swiftide/" + }, { + label: "Getting Started", + autogenerate: { + directory: "getting-started" + } + }, { + label: "Concepts", + autogenerate: { + directory: "concepts" + } + }, { + label: "In depth", + autogenerate: { + directory: "in-depth" + } + }, { + label: "Tutorials", + autogenerate: { + directory: "tutorials" + } + }, { + label: "Reference", + link: "https://docs.rs/swiftide/latest/swiftide/", + badge: { + variant: "note", + text: "docs.rs" }, - sidebar: [ - { - label: "What is swiftide?", - link: "/what-is-swiftide/", - }, - { - label: "Getting Started", - autogenerate: { - directory: "getting-started", - }, - }, - { - label: "Concepts", - autogenerate: { - directory: "concepts", - }, - }, - { - label: "In depth", - autogenerate: { - directory: "in-depth", - }, - }, - { - label: "Tutorials", - autogenerate: { - directory: "tutorials", - }, - }, - - { - label: "Reference", - link: "https://docs.rs/swiftide/latest/swiftide/", - badge: { - variant: "note", - text: "docs.rs", - }, - - attrs: { target: "_blank" }, - }, - { - label: "Troubleshooting", - link: "/troubleshooting/", - }, - ], - }), - tailwind({ applyBaseStyles: false }), - ], -}); + attrs: { + target: "_blank" + } + }, { + label: "Troubleshooting", + link: "/troubleshooting/" + }] + }), tailwind({ + applyBaseStyles: false + }), partytown()] +}); \ No newline at end of file diff --git a/package.json b/package.json index 7c297ca..6a89bcb 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@astrojs/check": "^0.7.0", + "@astrojs/partytown": "^2.1.1", "@astrojs/starlight": "^0.24.4", "@astrojs/starlight-tailwind": "^2.0.3", "@astrojs/tailwind": "^5.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cfe92e6..bcbd5d4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@astrojs/check': specifier: ^0.7.0 version: 0.7.0(typescript@5.5.2) + '@astrojs/partytown': + specifier: ^2.1.1 + version: 2.1.1 '@astrojs/starlight': specifier: ^0.24.4 version: 0.24.4(astro@4.11.0(typescript@5.5.2)) @@ -88,6 +91,9 @@ packages: peerDependencies: astro: ^4.8.0 + '@astrojs/partytown@2.1.1': + resolution: {integrity: sha512-KvecQuGGgrDrdTjC5awmtoQXqJFinChfeizKBJyr7F5EGQPx62xq8SIWkcXamLr5xZyNw0lryKeLtIzbxRH/zw==} + '@astrojs/prism@3.1.0': resolution: {integrity: sha512-Z9IYjuXSArkAUx3N6xj6+Bnvx8OdUSHA8YoOgyepp3+zJmtVYJIl/I18GozdJVW1p5u/CNpl3Km7/gwTJK85cw==} engines: {node: ^18.17.1 || ^20.3.0 || >=21.0.0} @@ -224,6 +230,11 @@ packages: resolution: {integrity: sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==} engines: {node: '>=6.9.0'} + '@builder.io/partytown@0.10.2': + resolution: {integrity: sha512-A9U+4PREWcS+CCYzKGIPovtGB/PBgnH/8oQyCE6Nr9drDJk6cMPpLQIEajpGPmG9tYF7N3FkRvhXm/AS9+0iKg==} + engines: {node: '>=18.0.0'} + hasBin: true + '@ctrl/tinycolor@4.1.0': resolution: {integrity: sha512-WyOx8cJQ+FQus4Mm4uPIZA64gbk3Wxh0so5Lcii0aJifqwoVOlfFtorjLE0Hen4OYyHZMXDWqMmaQemBhgxFRQ==} engines: {node: '>=14'} @@ -2734,6 +2745,11 @@ snapshots: transitivePeerDependencies: - supports-color + '@astrojs/partytown@2.1.1': + dependencies: + '@builder.io/partytown': 0.10.2 + mrmime: 2.0.0 + '@astrojs/prism@3.1.0': dependencies: prismjs: 1.29.0 @@ -2953,6 +2969,8 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 + '@builder.io/partytown@0.10.2': {} + '@ctrl/tinycolor@4.1.0': {} '@emmetio/abbreviation@2.3.3':