Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brave-eggs-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@proofgeist/kit": patch
---

Fix: post-install template functions not running
7 changes: 7 additions & 0 deletions cli/src/cli/add/page/index.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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,
Expand Down Expand Up @@ -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 = () => {
Expand Down
2 changes: 1 addition & 1 deletion cli/template/nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function RootLayout({
<ColorSchemeScript defaultColorScheme="auto" />
</Suspense>
</head>
<body>
<body suppressHydrationWarning>
<MantineProvider defaultColorScheme="auto" theme={theme}>
<Notifications />
<ModalsProvider>{children}</ModalsProvider>
Expand Down
16 changes: 10 additions & 6 deletions config/templates.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
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;
hint?: string;
templatePath: string;
screenshot?: string;
tags?: string[];
postIntallFn?: (args: {
projectDir: string;
pageDir: string;
dataSource?: unknown;
schemaName?: string;
}) => void | Promise<void>;
postIntallFn?: TPostInstallFn;
}

export const nextjsTemplates: Record<string, Template> = {
Expand All @@ -24,18 +23,21 @@ export const nextjsTemplates: Record<string, Template> = {
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,
},
};

Expand All @@ -50,11 +52,13 @@ export const wvTemplates: Record<string, Template> = {
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,
},
};