From 96906179be88809f3c0d30f2ae8dcf73fa429433 Mon Sep 17 00:00:00 2001 From: Leilukin Date: Fri, 9 May 2025 12:10:21 +0800 Subject: [PATCH] Reorganise package.json scripts --- .github/workflows/hostinger.yml | 2 +- README.md | 6 +----- package.json | 9 +++++---- src/pages/search.vto | 4 ++-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/hostinger.yml b/.github/workflows/hostinger.yml index 41a16e04..ed20e9e0 100644 --- a/.github/workflows/hostinger.yml +++ b/.github/workflows/hostinger.yml @@ -22,7 +22,7 @@ jobs: run: bun install - name: Build - run: bun run build-pagefind + run: bun run build - name: SSH Deploy to Hostinger uses: easingthemes/ssh-deploy@main diff --git a/README.md b/README.md index d8d83aa9..4965fb23 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,6 @@ It is recommended to use [Bun](https://bun.sh) as the JavaScript runtime for thi ``` 1. Run the project: ``` - bun start-pagefind + bun start ``` 1. Open http://localhost:1414/ in your web browser. - -The `bun start-pagefind` command runs both Eleventy to build the website and [Pagefind](https://pagefind.app/) to create the website's search index, then serves the website project output in a live server. - -After the website's search index has been created and updated, when you want to run the project again, you can run the `bun start` command, then open `http://localhost:8080` in your web browser to view the website project output in a live server. diff --git a/package.json b/package.json index 01a30c07..10e9496d 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,11 @@ "url": "https://git.32bit.cafe/Leilukin/leilukin-site" }, "scripts": { - "start": "bunx @11ty/eleventy --serve --quiet", - "build": "bunx @11ty/eleventy", - "start-pagefind": "bunx @11ty/eleventy --quiet && bunx -y pagefind --site _site --serve", - "build-pagefind": "bunx @11ty/eleventy --quiet && bunx -y pagefind --site _site" + "build-11ty": "bunx @11ty/eleventy", + "start-11ty": "bunx @11ty/eleventy --serve --quiet", + "create-search-index": "bunx -y pagefind --site _site", + "build": "bun build-11ty --quiet && bun create-search-index", + "start": "bun run build --serve" }, "type": "module", "devDependencies": { diff --git a/src/pages/search.vto b/src/pages/search.vto index 00504bb8..18f2d4e8 100644 --- a/src/pages/search.vto +++ b/src/pages/search.vto @@ -3,10 +3,10 @@ title: Search eleventyComputed: desc: Search {{ sitemeta.siteName }}. --- +

Looking for something on my website? If you have JavaScript enabled, you can use the search field below, which is powered by the static search library Pagefind. Your search query will not be recorded anywhere.

+ - -

Looking for something on my website? If you have JavaScript enabled, you can use the search field below, which is powered by the static search library Pagefind. Your search query will not be recorded anywhere.