diff --git a/.changeset/brave-eggs-reflect.md b/.changeset/brave-eggs-reflect.md
new file mode 100644
index 00000000..97245f42
--- /dev/null
+++ b/.changeset/brave-eggs-reflect.md
@@ -0,0 +1,5 @@
+---
+"@proofgeist/kit": patch
+---
+
+Fix: post-install template functions not running
diff --git a/cli/src/cli/add/page/index.ts b/cli/src/cli/add/page/index.ts
index 6f0a2a91..cd4cc680 100644
--- a/cli/src/cli/add/page/index.ts
+++ b/cli/src/cli/add/page/index.ts
@@ -1,6 +1,7 @@
import path from "path";
import * as p from "@clack/prompts";
import { nextjsTemplates, wvTemplates } from "@config/templates.js";
+import chalk from "chalk";
import { Command } from "commander";
import { capitalize } from "es-toolkit";
import fs from "fs-extra";
@@ -10,6 +11,7 @@ import { getExistingSchemas } from "~/generators/fmdapi.js";
import { addRouteToNav } from "~/generators/route.js";
import { ciOption, debugOption } from "~/globalOptions.js";
import { initProgramState, state } from "~/state.js";
+import { getUserPkgManager } from "~/utils/getUserPkgManager.js";
import {
getSettings,
mergeSettings,
@@ -178,6 +180,11 @@ export const runAddPageAction = async (opts?: {
}
spinner.stop("Added page!");
+ const pkgManager = getUserPkgManager();
+
+ console.log(
+ `\n${chalk.green("Next steps:")}\nTo preview this page, restart your dev server using the ${chalk.cyan(`${pkgManager} dev`)} command\n`
+ );
};
export const makeAddPageCommand = () => {
diff --git a/cli/template/nextjs/src/app/layout.tsx b/cli/template/nextjs/src/app/layout.tsx
index 05435627..2b4efe54 100644
--- a/cli/template/nextjs/src/app/layout.tsx
+++ b/cli/template/nextjs/src/app/layout.tsx
@@ -28,7 +28,7 @@ export default function RootLayout({
-
+
{children}
diff --git a/config/templates.ts b/config/templates.ts
index 391bf498..e11f36f6 100644
--- a/config/templates.ts
+++ b/config/templates.ts
@@ -1,3 +1,7 @@
+import { postInstallTable } from "../cli/src/cli/add/page/post-install/table.js";
+import { postInstallTableInfinite } from "../cli/src/cli/add/page/post-install/table-infinite.js";
+import type { TPostInstallFn } from "../cli/src/cli/add/page/types.js";
+
export interface Template {
requireData: boolean;
label: string;
@@ -5,12 +9,7 @@ export interface Template {
templatePath: string;
screenshot?: string;
tags?: string[];
- postIntallFn?: (args: {
- projectDir: string;
- pageDir: string;
- dataSource?: unknown;
- schemaName?: string;
- }) => void | Promise;
+ postIntallFn?: TPostInstallFn;
}
export const nextjsTemplates: Record = {
@@ -24,18 +23,21 @@ export const nextjsTemplates: Record = {
label: "Basic Table",
hint: "Use to load and show multiple records",
templatePath: "nextjs/table",
+ postIntallFn: postInstallTable,
},
tableEdit: {
requireData: true,
label: "Basic Table (editable)",
hint: "Use to load and show multiple records with inline edit functionality",
templatePath: "nextjs/table-edit",
+ postIntallFn: postInstallTable,
},
tableInfinite: {
requireData: true,
label: "Infinite Table",
hint: "Automatically load more records when the user scrolls to the bottom",
templatePath: "nextjs/table-infinite",
+ postIntallFn: postInstallTableInfinite,
},
};
@@ -50,11 +52,13 @@ export const wvTemplates: Record = {
label: "Basic Table",
hint: "Use to load and show multiple records",
templatePath: "vite-wv/table",
+ postIntallFn: postInstallTable,
},
tableEdit: {
requireData: true,
label: "Basic Table (editable)",
hint: "Use to load and show multiple records with inline edit functionality",
templatePath: "vite-wv/table-edit",
+ postIntallFn: postInstallTable,
},
};