Skip to content

Commit dd25ada

Browse files
committed
build: add svelte integration
1 parent 69106e2 commit dd25ada

File tree

8 files changed

+89
-6
lines changed

8 files changed

+89
-6
lines changed

.prettierrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"printWidth": 100,
44
"experimentalTernaries": true,
55
"astroAllowShorthand": true,
6-
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
7-
"overrides": [{ "files": "*.astro", "options": { "parser": "astro" } }]
6+
"plugins": ["prettier-plugin-astro", "prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
7+
"overrides": [
8+
{ "files": "*.astro", "options": { "parser": "astro" } },
9+
{ "files": "*.svelte", "options": { "parser": "svelte" } }
10+
]
811
}

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
"requiredtype",
118118
"returntypetype",
119119
"rollup",
120+
"runed",
120121
"scandir",
121122
"scibona",
122123
"semrush",

astro.config.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import alpinejs from "@astrojs/alpinejs";
22
import node from "@astrojs/node";
3+
import svelte from "@astrojs/svelte";
34
import vercel from "@astrojs/vercel/serverless";
45
import tailwindcss from "@tailwindcss/vite";
56
import { defineConfig } from "astro/config";
@@ -20,9 +21,14 @@ export default defineConfig({
2021
includeFiles: ["/bun1/bun"],
2122
})
2223
: node({ mode: "standalone" }),
23-
integrations: [alpinejs({ entrypoint: "/src/scripts/alpine" })],
24+
integrations: [alpinejs({ entrypoint: "/src/scripts/alpine" }), svelte()],
2425
vite: {
25-
plugins: [tailwindcss(), Icons({ compiler: "astro" }), visualizer()],
26+
plugins: [
27+
tailwindcss(),
28+
Icons({ compiler: "svelte" }),
29+
Icons({ compiler: "astro" }),
30+
visualizer(),
31+
],
2632
define: {
2733
_GIT_COMMIT: JSON.stringify(execSync("git rev-parse HEAD").toString().trim()),
2834
},

bun.lock

Lines changed: 47 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"private": true,
66
"scripts": {
77
"dev": "astro dev",
8-
"check": "astro check",
9-
"build": "bun --revision && astro check && astro build",
8+
"check": "astro check && svelte-check --no-tsconfig",
9+
"build": "bun --revision && bun run check && astro build",
1010
"preview": "astro preview",
1111
"astro": "astro",
1212
"lint": "prettier --check .",
@@ -19,6 +19,7 @@
1919
"dependencies": {
2020
"@astrojs/alpinejs": "^0.4.8",
2121
"@astrojs/node": "^9.2.1",
22+
"@astrojs/svelte": "^7.0.13",
2223
"@aws-sdk/client-s3": "^3.812.0",
2324
"@braintree/sanitize-url": "^7.1.1",
2425
"@jsdocs-io/extractor": "^1.0.0",
@@ -36,7 +37,9 @@
3637
"new-github-issue-url": "^1.1.0",
3738
"pathe": "^2.0.3",
3839
"read-pkg": "^9.0.1",
40+
"runed": "^0.28.0",
3941
"shiki": "^3.4.2",
42+
"svelte": "^5.32.1",
4043
"trim-newlines": "^5.0.0",
4144
"url-join": "^5.0.0",
4245
"validate-npm-package-name": "^6.0.0",
@@ -62,9 +65,11 @@
6265
"daisyui": "^5.0.35",
6366
"prettier": "^3.5.3",
6467
"prettier-plugin-astro": "^0.14.1",
68+
"prettier-plugin-svelte": "^3.4.0",
6569
"prettier-plugin-tailwindcss": "^0.6.11",
6670
"rollup-plugin-visualizer": "^5.14.0",
6771
"shiki-codegen": "^3.4.2",
72+
"svelte-check": "^4.2.1",
6873
"tailwindcss": "^4.1.7",
6974
"tempy": "^3.1.0",
7075
"typescript": "^5.8.3",

src/components/Test.svelte

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script>
2+
let { msg = "bar" } = $props();
3+
let count = $state(0);
4+
5+
function increment() {
6+
count += 1;
7+
}
8+
</script>
9+
10+
<button onclick={increment} class="btn btn-primary font-bold">
11+
Clicked {msg}
12+
{count}
13+
{count === 1 ? "time" : "times"}
14+
</button>

src/pages/index.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import Test from "../components/Test.svelte";
23
import BaseLayout from "../layouts/BaseLayout.astro";
34
45
const title = "jsDocs.io";
@@ -7,6 +8,7 @@ const description =
78
---
89

910
<BaseLayout {title} {description}>
11+
<Test msg={"foo"} client:load />
1012
<p>Logo and name</p>
1113
<p>Automatically generated documentation for typed npm packages.</p>
1214
<p>How to use</p>

svelte.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { vitePreprocess } from "@astrojs/svelte";
2+
3+
export default {
4+
preprocess: vitePreprocess(),
5+
};

0 commit comments

Comments
 (0)