Skip to content

Commit

Permalink
Merge pull request #68 from tanerijun/main
Browse files Browse the repository at this point in the history
chore: internal improvements
  • Loading branch information
shishkin authored Jan 23, 2024
2 parents 3057b04 + 6e794da commit 98ea5b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/astro-pagefind/src/components/Search.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Props {
readonly uiOptions?: Record<string, any>;
}
const { id, className, query, uiOptions = {} } = Astro.props as Props;
const { id, className, query, uiOptions = {} } = Astro.props;
const bundlePath = `${import.meta.env.BASE_URL}pagefind/`;
---

Expand Down
17 changes: 9 additions & 8 deletions packages/astro-pagefind/src/pagefind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default function pagefind(): AstroIntegration {
return {
name: "pagefind",
hooks: {
"astro:config:setup": ({ config }) => {
"astro:config:setup": ({ config, logger }) => {
if (config.output === "server") {
console.warn(
logger.warn(
"Output type `server` does not produce static *.html pages in its output and thus will not work with astro-pagefind integration.",
);
return;
Expand All @@ -26,10 +26,10 @@ export default function pagefind(): AstroIntegration {
outDir = fileURLToPath(config.outDir);
}
},
"astro:server:setup": ({ server }) => {
"astro:server:setup": ({ server, logger }) => {
if (!outDir) {
console.warn(
"astro-pagefind could reliably determine the output directory. Search assets will not be served.",
logger.warn(
"astro-pagefind couldn't reliably determine the output directory. Search assets will not be served.",
);
return;
}
Expand All @@ -46,13 +46,14 @@ export default function pagefind(): AstroIntegration {
}
});
},
"astro:build:done": () => {
"astro:build:done": ({ logger }) => {
if (!outDir) {
console.warn(
"astro-pagefind could reliably determine the output directory. Search index will not be built.",
logger.warn(
"astro-pagefind couldn't reliably determine the output directory. Search index will not be built.",
);
return;
}

const cmd = `npx pagefind --site "${outDir}"`;
execSync(cmd, {
stdio: [process.stdin, process.stdout, process.stderr],
Expand Down

0 comments on commit 98ea5b7

Please sign in to comment.