Skip to content

Commit f741381

Browse files
committed
improve local experience
1 parent 92b488a commit f741381

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
DOCS_VERSIONS=(
4+
1.x
5+
2.x
6+
3.x
7+
)
8+
9+
for v in "${DOCS_VERSIONS[@]}"; do
10+
if [ -d "filament/$v" ]; then
11+
echo "Pulling latest documentation updates for $v..."
12+
(cd filament/$v && git pull)
13+
else
14+
echo "Cloning $v..."
15+
git clone --single-branch --branch "$v" [email protected]:filamentphp/filament.git "filament/$v"
16+
fi;
17+
done
18+
19+
ln -sf ../../../filament filament/4.x

docs/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
"checkout": "bin/checkout-latest-filament",
88
"sync": "node sync.mjs",
99
"dev": "astro dev",
10+
"dev:checkout-4.x": "bin/checkout-local-filament-4.x",
11+
"dev:generate-4.x": "npm run dev:checkout-4.x && npm run sync && npm run build && npm run publicize-assets",
1012
"start": "astro dev",
1113
"build": "astro build",
12-
"publicize-assets": "rm -rf ../public/docs && cp -R dist ../public/docs && rm ../public/docs/index.html && rm -rf ../public/docs/1.x && rm -rf ../public/docs/2.x && rm -rf ../public/docs/3.x && rm -rf ../public/docs/4.x && rm -rf ./preserved-dist && cp -R dist ./preserved-dist",
14+
"publicize-assets": "rm -rf ../public/docs && cp -R dist ../public/docs && rm ../public/docs/index.html && rm -rf ../public/docs/1.x && rm -rf ../public/docs/2.x && rm -rf ../public/docs/3.x && rm -rf ../public/docs/4.x && rm -rf ./preserved-dist && cp -R dist ./preserved-dist && mkdir -p ../public/docs/3.x && cp -R filament/3.x/docs-assets/screenshots/images ../public/docs/3.x/images && mkdir -p ../public/docs/4.x && cp -R filament/4.x/docs-assets/screenshots/images ../public/docs/4.x/images",
1315
"generate": "npm run checkout && npm run sync && npm run build && npm run publicize-assets",
14-
"generate-dev": "npm run sync && npm run build && npm run publicize-assets",
1516
"preview": "astro preview",
1617
"astro": "astro"
1718
},

docs/src/components/AutoScreenshot.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ const dimensions = probe.sync(image);
1313

1414
<div style={`aspect-ratio: ${dimensions.width} / ${dimensions.height}`} class="rounded-xl ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
1515
<img
16-
src={`https://github.com/filamentphp/filament/blob/${version}/docs-assets/screenshots/images/light/${name}.jpg?raw=true`}
16+
src={`/docs/${version}/images/light/${name}.jpg`}
1717
alt={alt}
1818
loading="lazy"
1919
decoding="async"
2020
class="rounded-xl dark:hidden"
2121
/>
2222

2323
<img
24-
src={`https://github.com/filamentphp/filament/blob/${version}/docs-assets/screenshots/images/dark/${name}.jpg?raw=true`}
24+
src={`/docs/${version}/images/dark/${name}.jpg`}
2525
alt={alt}
2626
loading="lazy"
2727
decoding="async"

docs/sync.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ versions.forEach((version) => {
131131
.sort(function (a, b) {
132132
return packagesOrder.indexOf(a) - packagesOrder.indexOf(b)
133133
})
134+
.filter((name) => name !== '.DS_Store')
134135

135136
packages.forEach((packageName) => {
136137
if (

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"dev": "vite",
55
"build": "vite build",
66
"prettier": "npx prettier --write .",
7-
"generate-docs": "cd docs && npm run generate && cd ../"
7+
"build:docs": "cd docs && npm run generate && cd ../",
8+
"dev:4.x-docs": "cd docs && npm run dev:generate-4.x && cd ../"
89
},
910
"devDependencies": {
1011
"@docsearch/js": "^3.5.2",

0 commit comments

Comments
 (0)