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
21 changes: 21 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"mode": "pre",
"tag": "beta",
"initialVersions": {
"demo": "0.1.0",
"@proofkit/docs": "0.0.2",
"@proofkit/better-auth": "0.3.0",
"@proofkit/cli": "1.1.8",
"create-proofkit": "0.1.0",
"@proofkit/fmdapi": "5.0.2",
"fmodata": "0.0.0",
"@proofkit/registry": "1.0.0",
"tmp": "0.0.0",
"@proofkit/typegen": "1.0.10",
"@proofkit/webviewer": "3.0.6"
},
"changesets": [
"swift-swans-rush",
"ui-default-shadcn"
]
}
4 changes: 3 additions & 1 deletion .changeset/ui-default-shadcn.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
"@proofkit/cli": minor
---

CLI defaults to shadcn/ui for new projects. Legacy Mantine templates are still available via a hidden `--ui mantine` flag during `init`. The selected UI is persisted in `proofkit.json` as `ui`. Existing projects using Mantine are auto-detected and remain fully supported. For shadcn-based projects, adding new pages or auth via `proofkit add` is temporarily disabled while we work on a new component system.
CLI defaults to shadcn/ui for new projects. Legacy Mantine templates are still available via a hidden `--ui mantine` flag during `init`. The selected UI is persisted in `proofkit.json` as `ui`. Existing projects using Mantine are auto-detected and remain fully supported. For shadcn-based projects, adding new pages or auth via `proofkit add` requires passing the name of the component you want to add, such as `proofkit add table/basic`. Interactive selection of templates will come back soon!

This release also deprecates the `mantine` UI templates. In the next major release of the CLI, the `mantine` UI templates will no longer be supported for new projects.
2 changes: 1 addition & 1 deletion .cursor/plans/static-registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ app.get("/index.json", async (c) => {
// Serves the data for a single component
// The :style param is part of the shadcn spec, we'll include it for compatibility
app.get("/:style/:name.json", async (c) => {
const { name } = c.req.param();
const { name } = c.req.param();
try {
const component = await getStaticComponent(name);
if (!component) {
Expand Down
19 changes: 9 additions & 10 deletions apps/docs/src/app/r/[[...name]]/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
getComponentMeta,
getRegistryIndex,
getStaticComponent,
getStaticComponentForShadcn,
} from "@proofkit/registry";
import { createMiddleware } from "hono/factory";
import type { TemplateMetadata } from "@proofkit/registry";
Expand Down Expand Up @@ -53,10 +54,14 @@ app.get("/*", componentMeta("/r"), async (c) => {
const path = c.get("path");
const requestUrl = new URL(c.req.url);

const meta = c.get("meta");
if (meta.type === "static") {
try {
const data = await getStaticComponent(path);
const routeNameRaw = c.req.query("routeName")
? decodeURIComponent(c.req.query("routeName")!)
: undefined;
// remove leading slash if present
const routeName = routeNameRaw ? routeNameRaw.replace(/^\/+/, "") : undefined;

try {
const data = await getStaticComponentForShadcn(path, {routeName});

return c.json({
...data,
Expand All @@ -68,12 +73,6 @@ app.get("/*", componentMeta("/r"), async (c) => {
console.error(error);
return c.json({ error: "Component not found." }, { status: 404 });
}
} else {
return c.json(
{ error: "Dynamic components are not supported yet." },
{ status: 501 },
);
}
});

export default app;
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@proofkit/cli",
"version": "1.1.8",
"version": "1.2.0-beta.0",
"description": "Create web application with the ProofKit stack",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -73,6 +73,7 @@
"fs-extra": "^11.3.0",
"glob": "^11.0.1",
"gradient-string": "^2.0.2",
"handlebars": "^4.7.8",
"jiti": "^1.21.7",
"jsonc-parser": "^3.3.1",
"open": "^10.1.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/cli/add/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ export const makeAddAuthCommand = () => {

.action(async () => {
const settings = getSettings();
if (settings.ui === "shadcn") {
throw new Error("Shadcn projects should add auth using the template registry");
}
if (settings.auth.type !== "none") {
throw new Error("Auth already exists");
}
Expand Down
9 changes: 5 additions & 4 deletions packages/cli/src/cli/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ export const runAdd = async (
name: string | undefined,
options?: { noInstall?: boolean }
) => {

if (name === "tanstack-query") {
return await runAddTanstackQueryCommand();
} else if (name !== undefined) {
// an arbitrary name was provided, so we'll try to install from the registry
return await installFromRegistry(name);
}
ensureProofKitProject({ commandName: "add" });

ensureProofKitProject({ commandName: "add" });
const settings = getSettings();



const addType = abortIfCancel(
await p.select({
message: "What do you want to add to your project?",
Expand All @@ -54,7 +55,7 @@ export const runAdd = async (
},
]
: []),
...(settings.auth.type === "none" && settings.appType === "browser"
...(settings.ui === "shadcn" ? [] : settings.auth.type === "none" && settings.appType === "browser"
? [{ label: "Auth", value: "auth" }]
: []),
],
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/cli/add/page/post-install/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export const postInstallTable: TPostInstallFn = async ({
dataSourceName: dataSource.name,
});

const { auth } = getSettings();
const settings = getSettings();
if (settings.ui === "shadcn") {
return;
}
const auth = settings.auth;

const substitutions = {
__SOURCE_NAME__: dataSource.name,
Expand Down
52 changes: 25 additions & 27 deletions packages/cli/src/cli/add/registry/getOptions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

import { registryFetch } from "./http.js";
import fs from "fs-extra";
import fg from "fast-glob"
import path from "path";
import fg from "fast-glob";
import fs from "fs-extra";

import { state } from "~/state.js";
import { registryFetch } from "./http.js";

export async function getMetaFromRegistry(name: string) {
const result = await registryFetch("@get/meta/:name", {
Expand All @@ -22,32 +22,30 @@ const PROJECT_SHARED_IGNORE = [
"public",
"dist",
"build",
]
];

export async function getProjectInfo() {
const cwd = state.projectDir || process.cwd();
const [configFiles, isSrcDir] = await Promise.all([
fg.glob(
"**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*",
{
cwd,
deep: 3,
ignore: PROJECT_SHARED_IGNORE,
}
),
fs.pathExists(path.resolve(cwd, "src"))
])


const isUsingAppDir = await fs.pathExists(
path.resolve(cwd, `${isSrcDir ? "src/" : ""}app`)
)

fg.glob(
"**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*",
{
cwd,
deep: 3,
ignore: PROJECT_SHARED_IGNORE,
}
),
fs.pathExists(path.resolve(cwd, "src")),
]);

const isUsingAppDir = await fs.pathExists(
path.resolve(cwd, `${isSrcDir ? "src/" : ""}app`)
);

// Next.js.
if (configFiles.find((file) => file.startsWith("next.config."))?.length) {
return isUsingAppDir ? "next-app" : "next-pages";
}

// Next.js.
if (configFiles.find((file) => file.startsWith("next.config."))?.length) {
return isUsingAppDir ? "next-app" : "next-pages"
return "manual";
}

return "manual"
}
Loading
Loading