create-kofi-stack 1.2.9 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +53 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import pc4 from "picocolors";
|
|
6
6
|
import gradient from "gradient-string";
|
|
7
|
+
import { createRequire } from "module";
|
|
7
8
|
|
|
8
9
|
// src/prompts/index.ts
|
|
9
10
|
import * as p5 from "@clack/prompts";
|
|
@@ -866,7 +867,7 @@ async function generatePackageJson(config, appDir) {
|
|
|
866
867
|
if (config.integrations.monitoring === "sentry") {
|
|
867
868
|
dependencies["@sentry/nextjs"] = "^10.0.0";
|
|
868
869
|
}
|
|
869
|
-
const
|
|
870
|
+
const packageJson2 = {
|
|
870
871
|
name: isMonorepo ? "@repo/web" : config.name,
|
|
871
872
|
version: "0.1.0",
|
|
872
873
|
private: true,
|
|
@@ -887,7 +888,7 @@ async function generatePackageJson(config, appDir) {
|
|
|
887
888
|
dependencies,
|
|
888
889
|
devDependencies
|
|
889
890
|
};
|
|
890
|
-
await writeJSON(path3.join(appDir, "package.json"),
|
|
891
|
+
await writeJSON(path3.join(appDir, "package.json"), packageJson2);
|
|
891
892
|
}
|
|
892
893
|
async function generateNextConfig(config, appDir) {
|
|
893
894
|
const isMonorepo = config.structure === "monorepo";
|
|
@@ -1837,16 +1838,14 @@ export default {
|
|
|
1837
1838
|
await writeFile(path6.join(convexDir, "auth.config.ts"), content);
|
|
1838
1839
|
}
|
|
1839
1840
|
async function generateSchema(config, convexDir) {
|
|
1840
|
-
let content = `import {
|
|
1841
|
-
import { defineSchema, defineTable } from 'convex/server'
|
|
1841
|
+
let content = `import { defineSchema, defineTable } from 'convex/server'
|
|
1842
1842
|
import { v } from 'convex/values'
|
|
1843
1843
|
|
|
1844
1844
|
export default defineSchema({
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
// Custom user extensions
|
|
1845
|
+
// Custom user extensions (links to Better Auth's internal user table)
|
|
1848
1846
|
userProfiles: defineTable({
|
|
1849
|
-
|
|
1847
|
+
// Reference to the user ID from Better Auth's internal tables
|
|
1848
|
+
userId: v.string(),
|
|
1850
1849
|
displayName: v.optional(v.string()),
|
|
1851
1850
|
avatarUrl: v.optional(v.string()),
|
|
1852
1851
|
createdAt: v.number(),
|
|
@@ -1859,13 +1858,13 @@ export default defineSchema({
|
|
|
1859
1858
|
organizations: defineTable({
|
|
1860
1859
|
name: v.string(),
|
|
1861
1860
|
slug: v.string(),
|
|
1862
|
-
ownerId: v.
|
|
1861
|
+
ownerId: v.string(), // User ID from Better Auth
|
|
1863
1862
|
createdAt: v.number(),
|
|
1864
1863
|
}).index('by_slug', ['slug']),
|
|
1865
1864
|
|
|
1866
1865
|
organizationMembers: defineTable({
|
|
1867
1866
|
organizationId: v.id('organizations'),
|
|
1868
|
-
userId: v.
|
|
1867
|
+
userId: v.string(), // User ID from Better Auth
|
|
1869
1868
|
role: v.union(v.literal('owner'), v.literal('admin'), v.literal('member')),
|
|
1870
1869
|
joinedAt: v.number(),
|
|
1871
1870
|
})
|
|
@@ -1929,7 +1928,7 @@ async function generateUsers(convexDir) {
|
|
|
1929
1928
|
import { v } from 'convex/values'
|
|
1930
1929
|
|
|
1931
1930
|
export const getUserProfile = query({
|
|
1932
|
-
args: { userId: v.
|
|
1931
|
+
args: { userId: v.string() },
|
|
1933
1932
|
handler: async (ctx, args) => {
|
|
1934
1933
|
return await ctx.db
|
|
1935
1934
|
.query('userProfiles')
|
|
@@ -1940,7 +1939,7 @@ export const getUserProfile = query({
|
|
|
1940
1939
|
|
|
1941
1940
|
export const createUserProfile = mutation({
|
|
1942
1941
|
args: {
|
|
1943
|
-
userId: v.
|
|
1942
|
+
userId: v.string(),
|
|
1944
1943
|
displayName: v.optional(v.string()),
|
|
1945
1944
|
avatarUrl: v.optional(v.string()),
|
|
1946
1945
|
},
|
|
@@ -1958,7 +1957,7 @@ export const createUserProfile = mutation({
|
|
|
1958
1957
|
|
|
1959
1958
|
export const updateUserProfile = mutation({
|
|
1960
1959
|
args: {
|
|
1961
|
-
userId: v.
|
|
1960
|
+
userId: v.string(),
|
|
1962
1961
|
displayName: v.optional(v.string()),
|
|
1963
1962
|
avatarUrl: v.optional(v.string()),
|
|
1964
1963
|
},
|
|
@@ -1983,7 +1982,7 @@ export const updateUserProfile = mutation({
|
|
|
1983
1982
|
await writeFile(path6.join(convexDir, "users.ts"), content);
|
|
1984
1983
|
}
|
|
1985
1984
|
async function generateConvexPackageJson(convexDir) {
|
|
1986
|
-
const
|
|
1985
|
+
const packageJson2 = {
|
|
1987
1986
|
name: "@repo/backend",
|
|
1988
1987
|
version: "0.1.0",
|
|
1989
1988
|
private: true,
|
|
@@ -1998,7 +1997,7 @@ async function generateConvexPackageJson(convexDir) {
|
|
|
1998
1997
|
}
|
|
1999
1998
|
};
|
|
2000
1999
|
const backendDir = path6.dirname(convexDir);
|
|
2001
|
-
await writeJSON(path6.join(backendDir, "package.json"),
|
|
2000
|
+
await writeJSON(path6.join(backendDir, "package.json"), packageJson2);
|
|
2002
2001
|
}
|
|
2003
2002
|
async function generateConvexTsConfig(convexDir) {
|
|
2004
2003
|
const tsConfig = {
|
|
@@ -2946,7 +2945,7 @@ async function generateTurborepo(config, targetDir) {
|
|
|
2946
2945
|
await generateSharedConfigs(targetDir);
|
|
2947
2946
|
}
|
|
2948
2947
|
async function generateRootPackageJson(config, targetDir) {
|
|
2949
|
-
const
|
|
2948
|
+
const packageJson2 = {
|
|
2950
2949
|
name: config.name,
|
|
2951
2950
|
version: "0.1.0",
|
|
2952
2951
|
private: true,
|
|
@@ -2973,7 +2972,7 @@ async function generateRootPackageJson(config, targetDir) {
|
|
|
2973
2972
|
"*.{json,md}": ["biome format --write"]
|
|
2974
2973
|
}
|
|
2975
2974
|
};
|
|
2976
|
-
await writeJSON(path14.join(targetDir, "package.json"),
|
|
2975
|
+
await writeJSON(path14.join(targetDir, "package.json"), packageJson2);
|
|
2977
2976
|
}
|
|
2978
2977
|
async function generateTurboJson(targetDir) {
|
|
2979
2978
|
const turboJson = {
|
|
@@ -3136,7 +3135,7 @@ async function generateUIPackage(config, targetDir) {
|
|
|
3136
3135
|
const uiDir = path14.join(targetDir, "packages/ui");
|
|
3137
3136
|
await ensureDir(path14.join(uiDir, "src/components/ui"));
|
|
3138
3137
|
await ensureDir(path14.join(uiDir, "src/lib"));
|
|
3139
|
-
const
|
|
3138
|
+
const packageJson2 = {
|
|
3140
3139
|
name: "@repo/ui",
|
|
3141
3140
|
version: "0.1.0",
|
|
3142
3141
|
private: true,
|
|
@@ -3171,7 +3170,7 @@ async function generateUIPackage(config, targetDir) {
|
|
|
3171
3170
|
react: "^19.0.0"
|
|
3172
3171
|
}
|
|
3173
3172
|
};
|
|
3174
|
-
await writeJSON(path14.join(uiDir, "package.json"),
|
|
3173
|
+
await writeJSON(path14.join(uiDir, "package.json"), packageJson2);
|
|
3175
3174
|
const tsConfig = {
|
|
3176
3175
|
extends: "@repo/config-typescript/base.json",
|
|
3177
3176
|
compilerOptions: {
|
|
@@ -3241,7 +3240,7 @@ async function generatePayload(config, marketingDir) {
|
|
|
3241
3240
|
await generatePayloadEnv(marketingDir);
|
|
3242
3241
|
}
|
|
3243
3242
|
async function generatePayloadPackageJson(marketingDir) {
|
|
3244
|
-
const
|
|
3243
|
+
const packageJson2 = {
|
|
3245
3244
|
name: "@repo/marketing",
|
|
3246
3245
|
version: "0.1.0",
|
|
3247
3246
|
private: true,
|
|
@@ -3279,7 +3278,7 @@ async function generatePayloadPackageJson(marketingDir) {
|
|
|
3279
3278
|
tsx: "^4.0.0"
|
|
3280
3279
|
}
|
|
3281
3280
|
};
|
|
3282
|
-
await writeJSON(path15.join(marketingDir, "package.json"),
|
|
3281
|
+
await writeJSON(path15.join(marketingDir, "package.json"), packageJson2);
|
|
3283
3282
|
}
|
|
3284
3283
|
async function generatePayloadConfig(config, marketingDir) {
|
|
3285
3284
|
const content = `import path from 'path'
|
|
@@ -4221,7 +4220,7 @@ async function generateFumadocs(config, docsDir) {
|
|
|
4221
4220
|
await generateFumadocsContent(config, docsDir);
|
|
4222
4221
|
}
|
|
4223
4222
|
async function generateFumadocsPackageJson(docsDir) {
|
|
4224
|
-
const
|
|
4223
|
+
const packageJson2 = {
|
|
4225
4224
|
name: "@repo/docs",
|
|
4226
4225
|
version: "0.1.0",
|
|
4227
4226
|
private: true,
|
|
@@ -4254,7 +4253,7 @@ async function generateFumadocsPackageJson(docsDir) {
|
|
|
4254
4253
|
typescript: "^5.0.0"
|
|
4255
4254
|
}
|
|
4256
4255
|
};
|
|
4257
|
-
await writeJSON(path16.join(docsDir, "package.json"),
|
|
4256
|
+
await writeJSON(path16.join(docsDir, "package.json"), packageJson2);
|
|
4258
4257
|
}
|
|
4259
4258
|
async function generateFumadocsNextConfig(docsDir) {
|
|
4260
4259
|
const content = `import { createMDX } from 'fumadocs-mdx/next'
|
|
@@ -4303,7 +4302,7 @@ export const source = loader({
|
|
|
4303
4302
|
await writeFile(path16.join(docsDir, "src/lib/source.ts"), content);
|
|
4304
4303
|
}
|
|
4305
4304
|
async function generateFumadocsAppFiles(config, docsDir) {
|
|
4306
|
-
const layoutContent = `import { RootProvider } from 'fumadocs-ui/
|
|
4305
|
+
const layoutContent = `import { RootProvider } from 'fumadocs-ui/provider/next'
|
|
4307
4306
|
import { Inter } from 'next/font/google'
|
|
4308
4307
|
import type { Metadata } from 'next'
|
|
4309
4308
|
import type { ReactNode } from 'react'
|
|
@@ -4799,7 +4798,7 @@ async function generateDesignSystemApp(config, targetDir) {
|
|
|
4799
4798
|
await generateUtils(appDir);
|
|
4800
4799
|
}
|
|
4801
4800
|
async function generatePackageJson2(config, appDir) {
|
|
4802
|
-
const
|
|
4801
|
+
const packageJson2 = {
|
|
4803
4802
|
name: "@repo/design-system",
|
|
4804
4803
|
version: "0.1.0",
|
|
4805
4804
|
private: true,
|
|
@@ -4834,7 +4833,7 @@ async function generatePackageJson2(config, appDir) {
|
|
|
4834
4833
|
typescript: "^5.0.0"
|
|
4835
4834
|
}
|
|
4836
4835
|
};
|
|
4837
|
-
await writeJSON(path17.join(appDir, "package.json"),
|
|
4836
|
+
await writeJSON(path17.join(appDir, "package.json"), packageJson2);
|
|
4838
4837
|
}
|
|
4839
4838
|
async function generateTsConfig2(appDir) {
|
|
4840
4839
|
const tsConfig = {
|
|
@@ -7042,7 +7041,7 @@ async function generateNextjsMarketing(config, marketingDir) {
|
|
|
7042
7041
|
await ensureDir(path19.join(marketingDir, "src/app"));
|
|
7043
7042
|
await ensureDir(path19.join(marketingDir, "src/components"));
|
|
7044
7043
|
await ensureDir(path19.join(marketingDir, "public"));
|
|
7045
|
-
const
|
|
7044
|
+
const packageJson2 = {
|
|
7046
7045
|
name: "@repo/marketing",
|
|
7047
7046
|
version: "0.1.0",
|
|
7048
7047
|
private: true,
|
|
@@ -7073,7 +7072,7 @@ async function generateNextjsMarketing(config, marketingDir) {
|
|
|
7073
7072
|
};
|
|
7074
7073
|
await writeFile(
|
|
7075
7074
|
path19.join(marketingDir, "package.json"),
|
|
7076
|
-
JSON.stringify(
|
|
7075
|
+
JSON.stringify(packageJson2, null, 2)
|
|
7077
7076
|
);
|
|
7078
7077
|
const homePageContent = `export default function HomePage() {
|
|
7079
7078
|
return (
|
|
@@ -7213,6 +7212,8 @@ function displaySuccessMessage(config) {
|
|
|
7213
7212
|
}
|
|
7214
7213
|
|
|
7215
7214
|
// src/index.ts
|
|
7215
|
+
var require2 = createRequire(import.meta.url);
|
|
7216
|
+
var packageJson = require2("../package.json");
|
|
7216
7217
|
var BANNER = `
|
|
7217
7218
|
\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557
|
|
7218
7219
|
\u2588\u2588\u2551 \u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u255D
|
|
@@ -7231,7 +7232,7 @@ function printBanner() {
|
|
|
7231
7232
|
var program = new Command();
|
|
7232
7233
|
program.name("create-kofi-stack").description(
|
|
7233
7234
|
"Scaffold opinionated full-stack projects with Next.js, Convex, Better-Auth, and more"
|
|
7234
|
-
).version(
|
|
7235
|
+
).version(packageJson.version).argument("[project-name]", "Name of the project").option("--monorepo", "Use monorepo structure with Turborepo").option("--single", "Use single app structure").option(
|
|
7235
7236
|
"--marketing <type>",
|
|
7236
7237
|
"Marketing site type: payload, nextjs, none"
|
|
7237
7238
|
).option("--docs", "Include documentation site (Fumadocs)").option("--no-docs", "Exclude documentation site").option(
|
|
@@ -7266,4 +7267,27 @@ program.name("create-kofi-stack").description(
|
|
|
7266
7267
|
process.exit(1);
|
|
7267
7268
|
}
|
|
7268
7269
|
});
|
|
7270
|
+
program.command("update").description("Update create-kofi-stack to the latest version").action(async () => {
|
|
7271
|
+
const { execa: execa3 } = await import("execa");
|
|
7272
|
+
console.log(pc4.cyan("Checking for updates...\n"));
|
|
7273
|
+
try {
|
|
7274
|
+
const { stdout: latestVersion } = await execa3("npm", ["view", "create-kofi-stack", "version"]);
|
|
7275
|
+
const currentVersion = packageJson.version;
|
|
7276
|
+
if (latestVersion.trim() === currentVersion) {
|
|
7277
|
+
console.log(pc4.green(`\u2713 You're already on the latest version (${currentVersion})`));
|
|
7278
|
+
return;
|
|
7279
|
+
}
|
|
7280
|
+
console.log(pc4.dim(`Current version: ${currentVersion}`));
|
|
7281
|
+
console.log(pc4.dim(`Latest version: ${latestVersion.trim()}
|
|
7282
|
+
`));
|
|
7283
|
+
console.log(pc4.cyan("Updating...\n"));
|
|
7284
|
+
await execa3("npm", ["install", "-g", "create-kofi-stack@latest"], { stdio: "inherit" });
|
|
7285
|
+
console.log(pc4.green(`
|
|
7286
|
+
\u2713 Successfully updated to v${latestVersion.trim()}`));
|
|
7287
|
+
} catch (error) {
|
|
7288
|
+
console.error(pc4.red("Failed to update. Try running manually:"));
|
|
7289
|
+
console.log(pc4.dim(" npm install -g create-kofi-stack@latest"));
|
|
7290
|
+
process.exit(1);
|
|
7291
|
+
}
|
|
7292
|
+
});
|
|
7269
7293
|
program.parse();
|