From 1c1d54bdc3666b4d4fc174cdc918448456e53e9c Mon Sep 17 00:00:00 2001 From: George Cushen Date: Wed, 31 Dec 2025 00:19:19 +0000 Subject: [PATCH] build: include Pagefind in package.json for local builds --- scripts/view-starter-dev.sh | 8 ++++---- templates/academic-cv/.github/workflows/deploy.yml | 2 +- templates/academic-cv/netlify.toml | 6 +++--- templates/academic-cv/package.json | 4 +++- templates/blog/.github/workflows/deploy.yml | 2 +- templates/blog/netlify.toml | 6 +++--- templates/blog/package.json | 4 +++- templates/documentation/.github/workflows/deploy.yml | 2 +- templates/documentation/netlify.toml | 6 +++--- templates/documentation/package.json | 4 +++- templates/landing-page/.github/workflows/deploy.yml | 2 +- templates/landing-page/netlify.toml | 6 +++--- templates/landing-page/package.json | 4 +++- templates/link-in-bio/.github/workflows/deploy.yml | 2 +- templates/link-in-bio/netlify.toml | 6 +++--- templates/link-in-bio/package.json | 4 +++- templates/resume/.github/workflows/deploy.yml | 2 +- templates/resume/netlify.toml | 6 +++--- templates/resume/package.json | 4 +++- 19 files changed, 46 insertions(+), 34 deletions(-) diff --git a/scripts/view-starter-dev.sh b/scripts/view-starter-dev.sh index f9237ff4..753fd4a5 100755 --- a/scripts/view-starter-dev.sh +++ b/scripts/view-starter-dev.sh @@ -56,9 +56,9 @@ done # Run Hugo from the site dir so Tailwind CLI is discoverable cd "templates/$STARTER" -# Ensure Tailwind CLI exists in starter (required for Hugo css.TailwindCSS) -if [ -f "package.json" ] && [ ! -x "node_modules/.bin/tailwindcss" ]; then - echo "📦 Installing Tailwind CLI in starter directory for Hugo..." +# Ensure Tailwind CLI and Pagefind exist in starter (required for Hugo css.TailwindCSS and search indexing) +if [ -f "package.json" ] && { [ ! -x "node_modules/.bin/tailwindcss" ] || [ ! -x "node_modules/.bin/pagefind" ]; }; then + echo "📦 Installing starter dependencies for Hugo..." if command -v pnpm >/dev/null 2>&1; then pnpm install else @@ -86,7 +86,7 @@ github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-decap-cms -> ../../../ if [ "$PAGEFIND" = true ]; then hugo if command -v pnpm >/dev/null 2>&1; then - pnpm dlx pagefind --site "public" --output-subdir ../static/pagefind + pnpm exec pagefind --site "public" --output-subdir ../static/pagefind else npm_config_yes=true npx pagefind --site "public" --output-subdir ../static/pagefind fi diff --git a/templates/academic-cv/.github/workflows/deploy.yml b/templates/academic-cv/.github/workflows/deploy.yml index afb7fe96..fc593765 100644 --- a/templates/academic-cv/.github/workflows/deploy.yml +++ b/templates/academic-cv/.github/workflows/deploy.yml @@ -98,7 +98,7 @@ jobs: run: | # Check if site uses Pagefind search if [ -f "package.json" ] && grep -q "pagefind" package.json; then - pnpm dlx pagefind --source "public" || npx pagefind --source "public" + pnpm run pagefind || npx pagefind --site "public" fi - name: Upload artifact diff --git a/templates/academic-cv/netlify.toml b/templates/academic-cv/netlify.toml index 852945cf..34cb655a 100644 --- a/templates/academic-cv/netlify.toml +++ b/templates/academic-cv/netlify.toml @@ -14,7 +14,7 @@ hugo --gc --minify -b $URL --logLevel debug --printI18nWarnings --printPathWarnings echo "=== Running Pagefind indexing ===" - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose echo "=== Build completed successfully ===" """ @@ -40,7 +40,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [context.branch-deploy] @@ -50,7 +50,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [[plugins]] diff --git a/templates/academic-cv/package.json b/templates/academic-cv/package.json index cecc8b29..4094bc30 100644 --- a/templates/academic-cv/package.json +++ b/templates/academic-cv/package.json @@ -6,11 +6,13 @@ "description": "Academic CV starter template for Hugo Blox with Tailwind CSS v4", "scripts": { "dev": "hugo server --disableFastRender", - "build": "hugo --minify" + "build": "hugo --minify && pnpm run pagefind", + "pagefind": "pagefind --site public" }, "dependencies": { "@tailwindcss/cli": "^4.1.12", "@tailwindcss/typography": "^0.5.10", + "pagefind": "^1.4.0", "preact": "^10.27.2", "tailwindcss": "^4.1.12" } diff --git a/templates/blog/.github/workflows/deploy.yml b/templates/blog/.github/workflows/deploy.yml index afb7fe96..fc593765 100644 --- a/templates/blog/.github/workflows/deploy.yml +++ b/templates/blog/.github/workflows/deploy.yml @@ -98,7 +98,7 @@ jobs: run: | # Check if site uses Pagefind search if [ -f "package.json" ] && grep -q "pagefind" package.json; then - pnpm dlx pagefind --source "public" || npx pagefind --source "public" + pnpm run pagefind || npx pagefind --site "public" fi - name: Upload artifact diff --git a/templates/blog/netlify.toml b/templates/blog/netlify.toml index 852945cf..34cb655a 100644 --- a/templates/blog/netlify.toml +++ b/templates/blog/netlify.toml @@ -14,7 +14,7 @@ hugo --gc --minify -b $URL --logLevel debug --printI18nWarnings --printPathWarnings echo "=== Running Pagefind indexing ===" - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose echo "=== Build completed successfully ===" """ @@ -40,7 +40,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [context.branch-deploy] @@ -50,7 +50,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [[plugins]] diff --git a/templates/blog/package.json b/templates/blog/package.json index 5067328a..5efd91c2 100644 --- a/templates/blog/package.json +++ b/templates/blog/package.json @@ -6,11 +6,13 @@ "description": "Blog starter template for Hugo Blox with Tailwind CSS v4", "scripts": { "dev": "hugo server --disableFastRender", - "build": "hugo --minify" + "build": "hugo --minify && pnpm run pagefind", + "pagefind": "pagefind --site public" }, "dependencies": { "@tailwindcss/cli": "^4.1.12", "@tailwindcss/typography": "^0.5.10", + "pagefind": "^1.4.0", "preact": "^10.27.2", "tailwindcss": "^4.1.12" } diff --git a/templates/documentation/.github/workflows/deploy.yml b/templates/documentation/.github/workflows/deploy.yml index afb7fe96..fc593765 100644 --- a/templates/documentation/.github/workflows/deploy.yml +++ b/templates/documentation/.github/workflows/deploy.yml @@ -98,7 +98,7 @@ jobs: run: | # Check if site uses Pagefind search if [ -f "package.json" ] && grep -q "pagefind" package.json; then - pnpm dlx pagefind --source "public" || npx pagefind --source "public" + pnpm run pagefind || npx pagefind --site "public" fi - name: Upload artifact diff --git a/templates/documentation/netlify.toml b/templates/documentation/netlify.toml index 852945cf..34cb655a 100644 --- a/templates/documentation/netlify.toml +++ b/templates/documentation/netlify.toml @@ -14,7 +14,7 @@ hugo --gc --minify -b $URL --logLevel debug --printI18nWarnings --printPathWarnings echo "=== Running Pagefind indexing ===" - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose echo "=== Build completed successfully ===" """ @@ -40,7 +40,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [context.branch-deploy] @@ -50,7 +50,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [[plugins]] diff --git a/templates/documentation/package.json b/templates/documentation/package.json index 7334727f..58dfec94 100644 --- a/templates/documentation/package.json +++ b/templates/documentation/package.json @@ -6,11 +6,13 @@ "description": "Documentation starter template for Hugo Blox with Tailwind CSS v4", "scripts": { "dev": "hugo server --disableFastRender", - "build": "hugo --minify" + "build": "hugo --minify && pnpm run pagefind", + "pagefind": "pagefind --site public" }, "dependencies": { "@tailwindcss/cli": "^4.1.12", "@tailwindcss/typography": "^0.5.10", + "pagefind": "^1.4.0", "preact": "^10.27.2", "tailwindcss": "^4.1.12" } diff --git a/templates/landing-page/.github/workflows/deploy.yml b/templates/landing-page/.github/workflows/deploy.yml index afb7fe96..fc593765 100644 --- a/templates/landing-page/.github/workflows/deploy.yml +++ b/templates/landing-page/.github/workflows/deploy.yml @@ -98,7 +98,7 @@ jobs: run: | # Check if site uses Pagefind search if [ -f "package.json" ] && grep -q "pagefind" package.json; then - pnpm dlx pagefind --source "public" || npx pagefind --source "public" + pnpm run pagefind || npx pagefind --site "public" fi - name: Upload artifact diff --git a/templates/landing-page/netlify.toml b/templates/landing-page/netlify.toml index 852945cf..34cb655a 100644 --- a/templates/landing-page/netlify.toml +++ b/templates/landing-page/netlify.toml @@ -14,7 +14,7 @@ hugo --gc --minify -b $URL --logLevel debug --printI18nWarnings --printPathWarnings echo "=== Running Pagefind indexing ===" - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose echo "=== Build completed successfully ===" """ @@ -40,7 +40,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [context.branch-deploy] @@ -50,7 +50,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [[plugins]] diff --git a/templates/landing-page/package.json b/templates/landing-page/package.json index bd292835..cac26ef8 100644 --- a/templates/landing-page/package.json +++ b/templates/landing-page/package.json @@ -6,11 +6,13 @@ "description": "Landing page starter template for Hugo Blox with Tailwind CSS v4", "scripts": { "dev": "hugo server --disableFastRender", - "build": "hugo --minify" + "build": "hugo --minify && pnpm run pagefind", + "pagefind": "pagefind --site public" }, "dependencies": { "@tailwindcss/cli": "^4.1.12", "@tailwindcss/typography": "^0.5.10", + "pagefind": "^1.4.0", "preact": "^10.27.2", "tailwindcss": "^4.1.12" } diff --git a/templates/link-in-bio/.github/workflows/deploy.yml b/templates/link-in-bio/.github/workflows/deploy.yml index afb7fe96..fc593765 100644 --- a/templates/link-in-bio/.github/workflows/deploy.yml +++ b/templates/link-in-bio/.github/workflows/deploy.yml @@ -98,7 +98,7 @@ jobs: run: | # Check if site uses Pagefind search if [ -f "package.json" ] && grep -q "pagefind" package.json; then - pnpm dlx pagefind --source "public" || npx pagefind --source "public" + pnpm run pagefind || npx pagefind --site "public" fi - name: Upload artifact diff --git a/templates/link-in-bio/netlify.toml b/templates/link-in-bio/netlify.toml index 852945cf..34cb655a 100644 --- a/templates/link-in-bio/netlify.toml +++ b/templates/link-in-bio/netlify.toml @@ -14,7 +14,7 @@ hugo --gc --minify -b $URL --logLevel debug --printI18nWarnings --printPathWarnings echo "=== Running Pagefind indexing ===" - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose echo "=== Build completed successfully ===" """ @@ -40,7 +40,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [context.branch-deploy] @@ -50,7 +50,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [[plugins]] diff --git a/templates/link-in-bio/package.json b/templates/link-in-bio/package.json index 5cfb5c2b..895a3191 100644 --- a/templates/link-in-bio/package.json +++ b/templates/link-in-bio/package.json @@ -6,11 +6,13 @@ "description": "Link-in-bio starter template for Hugo Blox with Tailwind CSS v4", "scripts": { "dev": "hugo server --disableFastRender", - "build": "hugo --minify" + "build": "hugo --minify && pnpm run pagefind", + "pagefind": "pagefind --site public" }, "dependencies": { "@tailwindcss/cli": "^4.1.12", "@tailwindcss/typography": "^0.5.10", + "pagefind": "^1.4.0", "preact": "^10.27.2", "tailwindcss": "^4.1.12" } diff --git a/templates/resume/.github/workflows/deploy.yml b/templates/resume/.github/workflows/deploy.yml index afb7fe96..fc593765 100644 --- a/templates/resume/.github/workflows/deploy.yml +++ b/templates/resume/.github/workflows/deploy.yml @@ -98,7 +98,7 @@ jobs: run: | # Check if site uses Pagefind search if [ -f "package.json" ] && grep -q "pagefind" package.json; then - pnpm dlx pagefind --source "public" || npx pagefind --source "public" + pnpm run pagefind || npx pagefind --site "public" fi - name: Upload artifact diff --git a/templates/resume/netlify.toml b/templates/resume/netlify.toml index 852945cf..34cb655a 100644 --- a/templates/resume/netlify.toml +++ b/templates/resume/netlify.toml @@ -14,7 +14,7 @@ hugo --gc --minify -b $URL --logLevel debug --printI18nWarnings --printPathWarnings echo "=== Running Pagefind indexing ===" - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose echo "=== Build completed successfully ===" """ @@ -40,7 +40,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [context.branch-deploy] @@ -50,7 +50,7 @@ echo "Deploy URL: $DEPLOY_PRIME_URL" pnpm install --verbose --no-frozen-lockfile hugo --gc --minify -b $DEPLOY_PRIME_URL --logLevel debug --printI18nWarnings --printPathWarnings - pnpm dlx pagefind --source 'public' --verbose + pnpm run pagefind -- --verbose """ [[plugins]] diff --git a/templates/resume/package.json b/templates/resume/package.json index 69dd89e2..2607cf8e 100644 --- a/templates/resume/package.json +++ b/templates/resume/package.json @@ -6,11 +6,13 @@ "description": "Resume starter template for Hugo Blox with Tailwind CSS v4", "scripts": { "dev": "hugo server --disableFastRender", - "build": "hugo --minify" + "build": "hugo --minify && pnpm run pagefind", + "pagefind": "pagefind --site public" }, "dependencies": { "@tailwindcss/cli": "^4.1.12", "@tailwindcss/typography": "^0.5.10", + "pagefind": "^1.4.0", "preact": "^10.27.2", "tailwindcss": "^4.1.12" }