create-stackkit-app 0.4.5 → 0.4.6

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.
@@ -5,118 +5,10 @@
5
5
  "category": "database",
6
6
  "provider": "prisma",
7
7
  "supportedFrameworks": ["nextjs", "express"],
8
- "dependencies": {
9
- "common": {
10
- "@prisma/client": "^7.2.0",
11
- "dotenv": "^17.2.3"
12
- },
13
- "providers": {
14
- "postgresql": {
15
- "@prisma/adapter-pg": "^7.2.0",
16
- "pg": "^8.16.3"
17
- },
18
- "mongodb": {
19
- "@prisma/client": "6.19"
20
- },
21
- "mysql": {
22
- "@prisma/adapter-mariadb": "^7.2.0"
23
- },
24
- "sqlite": {
25
- "@prisma/adapter-better-sqlite3": "^7.2.0"
26
- }
27
- }
28
- },
29
- "devDependencies": {
30
- "common": {
31
- "prisma": "^7.2.0",
32
- "tsx": "^4.21.0"
33
- },
34
- "providers": {
35
- "postgresql": {
36
- "@types/pg": "^8.16.0"
37
- },
38
- "mongodb": {
39
- "prisma": "6.19"
40
- },
41
- "mysql": {},
42
- "sqlite": {
43
- "@types/better-sqlite3": "^7.6.13"
44
- }
45
- }
46
- },
47
- "envVars": {
48
- "common": [
49
- {
50
- "key": "DATABASE_URL",
51
- "value": "{{connectionString}}",
52
- "required": true
53
- }
54
- ],
55
- "providers": {
56
- "mysql": [
57
- {
58
- "key": "DATABASE_HOST",
59
- "value": "localhost",
60
- "required": true
61
- },
62
- {
63
- "key": "DATABASE_USER",
64
- "value": "",
65
- "required": true
66
- },
67
- {
68
- "key": "DATABASE_PASSWORD",
69
- "value": "",
70
- "required": true
71
- },
72
- {
73
- "key": "DATABASE_NAME",
74
- "value": "mydb",
75
- "required": true
76
- },
77
- {
78
- "key": "DATABASE_PORT",
79
- "value": "3306",
80
- "required": false
81
- }
82
- ]
83
- }
84
- },
85
- "frameworkPatches": {
86
- "express": {
87
- "tsconfig.json": {
88
- "merge": {
89
- "compilerOptions": {
90
- "baseUrl": ".",
91
- "paths": {
92
- "@/*": ["./*"]
93
- }
94
- },
95
- "include": ["src/**/*", "lib/**/*"],
96
- "exclude": ["node_modules", "dist", "lib/generated/prisma"]
97
- }
98
- }
99
- }
100
- },
101
- "patches": [
102
- {
103
- "type": "create-file",
104
- "description": "Create Prisma schema",
105
- "source": "prisma/schema.prisma",
106
- "destination": "prisma/schema.prisma"
107
- },
108
- {
109
- "type": "create-file",
110
- "description": "Create Prisma config",
111
- "source": "prisma.config.ts",
112
- "destination": "prisma.config.ts"
113
- },
114
- {
115
- "type": "create-file",
116
- "description": "{{dbDescription}}",
117
- "source": "lib/{{dbFile}}",
118
- "destination": "{{lib}}/{{dbFile}}"
119
- }
120
- ],
121
- "postInstall": ["npx prisma generate"]
8
+ "compatibility": {
9
+ "frameworks": ["nextjs", "express"],
10
+ "databases": ["prisma"],
11
+ "languages": ["typescript", "javascript"],
12
+ "packageManagers": ["npm", "yarn", "pnpm", "bun"]
13
+ }
122
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-stackkit-app",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Create a new StackKit project with modular composition",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,8 +1,12 @@
1
1
  {
2
- "name": "express-base",
2
+ "name": "express",
3
3
  "displayName": "Express.js",
4
4
  "framework": "express",
5
5
  "description": "Express.js REST API with TypeScript",
6
+ "compatibility": {
7
+ "databases": ["prisma", "mongoose"],
8
+ "auth": ["better-auth"]
9
+ },
6
10
  "files": ["src/", ".gitignore", "package.json", "tsconfig.json", ".env.example"],
7
11
  "scripts": {
8
12
  "dev": "tsx watch src/server.ts",
@@ -19,22 +23,5 @@
19
23
  "lint:fix": "eslint src --ext .js --fix",
20
24
  "start": "node src/server.js",
21
25
  "start:prod": "cross-env NODE_ENV=production node src/server.js"
22
- },
23
- "fileReplacements": [
24
- {
25
- "file": "src/server.js",
26
- "from": "import app from './app'",
27
- "to": "import app from './app.js'"
28
- },
29
- {
30
- "file": "src/app.js",
31
- "from": "import { env } from './config/env'",
32
- "to": "import { env } from './config/env.js'"
33
- },
34
- {
35
- "file": "src/app.js",
36
- "from": "import { errorHandler } from './middlewares/error.middleware'",
37
- "to": "import { errorHandler } from './middlewares/error.middleware.js'"
38
- }
39
- ]
26
+ }
40
27
  }
@@ -1,8 +1,12 @@
1
1
  {
2
- "name": "nextjs-base",
2
+ "name": "nextjs",
3
3
  "displayName": "Next.js",
4
4
  "framework": "nextjs",
5
5
  "description": "Next.js 16 App Router with TypeScript",
6
+ "compatibility": {
7
+ "databases": ["prisma", "mongoose"],
8
+ "auth": ["better-auth", "authjs"]
9
+ },
6
10
  "files": [
7
11
  "app/",
8
12
  "public/",
@@ -1,8 +1,12 @@
1
1
  {
2
- "name": "react-vite-base",
2
+ "name": "react-vite",
3
3
  "displayName": "React (Vite)",
4
4
  "framework": "react-vite",
5
5
  "description": "Production-ready React 19 + Vite with TypeScript, Router, TanStack Query, and more",
6
+ "compatibility": {
7
+ "databases": [],
8
+ "auth": ["better-auth"]
9
+ },
6
10
  "files": [
7
11
  "src/",
8
12
  "public/",
@@ -30,17 +34,5 @@
30
34
  "lint": "eslint .",
31
35
  "lint:fix": "eslint . --fix",
32
36
  "preview": "vite preview"
33
- },
34
- "fileReplacements": [
35
- {
36
- "file": "index.html",
37
- "from": "/src/main.tsx",
38
- "to": "/src/main.jsx"
39
- },
40
- {
41
- "file": "vite.config.ts",
42
- "from": "main.tsx",
43
- "to": "main.jsx"
44
- }
45
- ]
37
+ }
46
38
  }
@@ -1,2 +0,0 @@
1
- export declare function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>): Record<string, unknown>;
2
- export declare function applyFrameworkPatches(targetDir: string, patches: Record<string, unknown>): Promise<void>;
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.deepMerge = deepMerge;
7
- exports.applyFrameworkPatches = applyFrameworkPatches;
8
- const fs_extra_1 = __importDefault(require("fs-extra"));
9
- const path_1 = require("path");
10
- function deepMerge(target, source) {
11
- const result = { ...target };
12
- for (const key in source) {
13
- if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
14
- result[key] = deepMerge(result[key] || {}, source[key]);
15
- }
16
- else {
17
- result[key] = source[key];
18
- }
19
- }
20
- return result;
21
- }
22
- async function applyFrameworkPatches(targetDir, patches) {
23
- for (const [filename, patchConfig] of Object.entries(patches)) {
24
- const filePath = (0, path_1.join)(targetDir, filename);
25
- if (await fs_extra_1.default.pathExists(filePath)) {
26
- if (patchConfig && typeof patchConfig === "object" && "merge" in patchConfig) {
27
- const fileContent = await fs_extra_1.default.readJson(filePath);
28
- const merged = deepMerge(fileContent, patchConfig.merge);
29
- await fs_extra_1.default.writeJson(filePath, merged, { spaces: 2 });
30
- }
31
- else if (patchConfig && typeof patchConfig === "object" && "replace" in patchConfig) {
32
- let fileContent = await fs_extra_1.default.readFile(filePath, "utf-8");
33
- const replaceConfig = patchConfig;
34
- for (const [oldStr, newStr] of Object.entries(replaceConfig.replace)) {
35
- fileContent = fileContent.replace(new RegExp(oldStr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), newStr);
36
- }
37
- await fs_extra_1.default.writeFile(filePath, fileContent);
38
- }
39
- else if (patchConfig &&
40
- typeof patchConfig === "object" &&
41
- ("operations" in patchConfig ||
42
- ("type" in patchConfig && patchConfig.type === "patch-file"))) {
43
- let fileContent = await fs_extra_1.default.readFile(filePath, "utf-8");
44
- const operations = patchConfig.operations;
45
- for (const operation of operations) {
46
- if (operation && typeof operation === "object" && "type" in operation) {
47
- const op = operation;
48
- if (op.type === "add-import" && "imports" in op && Array.isArray(op.imports)) {
49
- const imports = op.imports;
50
- // Add imports at the top after existing imports
51
- const importLines = imports.join("\n");
52
- // Find the last import statement
53
- const lines = fileContent.split("\n");
54
- let lastImportIndex = -1;
55
- for (let i = 0; i < lines.length; i++) {
56
- if (lines[i].trim().startsWith("import")) {
57
- lastImportIndex = i;
58
- }
59
- else if (lines[i].trim() !== "" && !lines[i].trim().startsWith("//")) {
60
- break;
61
- }
62
- }
63
- if (lastImportIndex >= 0) {
64
- lines.splice(lastImportIndex + 1, 0, "", importLines);
65
- fileContent = lines.join("\n");
66
- }
67
- }
68
- else if (op.type === "add-code" && "after" in op && "code" in op) {
69
- const after = op.after;
70
- const code = op.code;
71
- const afterIndex = fileContent.indexOf(after);
72
- if (afterIndex >= 0) {
73
- const insertPos = afterIndex + after.length;
74
- fileContent = fileContent.slice(0, insertPos) + code + fileContent.slice(insertPos);
75
- }
76
- }
77
- else if (op.type === "replace" && "oldString" in op && "newString" in op) {
78
- const oldString = op.oldString;
79
- const newString = op.newString;
80
- fileContent = fileContent.replace(oldString, newString);
81
- }
82
- }
83
- }
84
- await fs_extra_1.default.writeFile(filePath, fileContent);
85
- }
86
- }
87
- }
88
- }
@@ -1,8 +0,0 @@
1
- export interface PackageJsonConfig {
2
- dependencies?: Record<string, string>;
3
- devDependencies?: Record<string, string>;
4
- scripts?: Record<string, string>;
5
- }
6
- export declare function copyBaseFramework(templatesDir: string, targetDir: string, framework: string): Promise<void>;
7
- export declare function mergePackageJson(targetDir: string, config: PackageJsonConfig): Promise<void>;
8
- export declare function mergeEnvFile(targetDir: string, envVars: Record<string, string>): Promise<void>;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.copyBaseFramework = copyBaseFramework;
7
- exports.mergePackageJson = mergePackageJson;
8
- exports.mergeEnvFile = mergeEnvFile;
9
- const fs_extra_1 = __importDefault(require("fs-extra"));
10
- const path_1 = __importDefault(require("path"));
11
- async function copyBaseFramework(templatesDir, targetDir, framework) {
12
- const baseDir = path_1.default.join(templatesDir, framework);
13
- if (!(await fs_extra_1.default.pathExists(baseDir))) {
14
- throw new Error(`Base template not found for framework: ${framework}\n` + `Expected at: ${baseDir}`);
15
- }
16
- await fs_extra_1.default.copy(baseDir, targetDir, {
17
- filter: (src) => {
18
- const basename = path_1.default.basename(src);
19
- return !["template.json", "config.json", "node_modules", ".git"].includes(basename);
20
- },
21
- });
22
- }
23
- async function mergePackageJson(targetDir, config) {
24
- const pkgPath = path_1.default.join(targetDir, "package.json");
25
- if (!(await fs_extra_1.default.pathExists(pkgPath))) {
26
- return;
27
- }
28
- const pkg = await fs_extra_1.default.readJson(pkgPath);
29
- if (config.dependencies) {
30
- pkg.dependencies = { ...pkg.dependencies, ...config.dependencies };
31
- }
32
- if (config.devDependencies) {
33
- pkg.devDependencies = { ...pkg.devDependencies, ...config.devDependencies };
34
- }
35
- if (config.scripts) {
36
- pkg.scripts = { ...pkg.scripts, ...config.scripts };
37
- }
38
- await fs_extra_1.default.writeJson(pkgPath, pkg, { spaces: 2 });
39
- }
40
- async function mergeEnvFile(targetDir, envVars) {
41
- if (Object.keys(envVars).length === 0) {
42
- return;
43
- }
44
- const envExamplePath = path_1.default.join(targetDir, ".env.example");
45
- const envPath = path_1.default.join(targetDir, ".env");
46
- const envContent = Object.entries(envVars)
47
- .map(([key, value]) => `${key}="${value}"`)
48
- .join("\n") + "\n";
49
- // Update .env.example
50
- if (await fs_extra_1.default.pathExists(envExamplePath)) {
51
- const existing = await fs_extra_1.default.readFile(envExamplePath, "utf-8");
52
- const existingKeys = existing.split("\n").map((line) => line.split("=")[0]);
53
- const newVars = Object.keys(envVars).filter((key) => !existingKeys.includes(key));
54
- if (newVars.length > 0) {
55
- const newContent = newVars.map((key) => `${key}="${envVars[key]}"`).join("\n");
56
- await fs_extra_1.default.appendFile(envExamplePath, "\n" + newContent + "\n");
57
- }
58
- }
59
- else {
60
- await fs_extra_1.default.writeFile(envExamplePath, envContent);
61
- }
62
- // Update .env (create if doesn't exist, or append new vars if it does)
63
- if (await fs_extra_1.default.pathExists(envPath)) {
64
- const existing = await fs_extra_1.default.readFile(envPath, "utf-8");
65
- const existingKeys = existing.split("\n").map((line) => line.split("=")[0]);
66
- const newVars = Object.keys(envVars).filter((key) => !existingKeys.includes(key));
67
- if (newVars.length > 0) {
68
- const newContent = newVars.map((key) => `${key}="${envVars[key]}"`).join("\n");
69
- await fs_extra_1.default.appendFile(envPath, "\n" + newContent + "\n");
70
- }
71
- }
72
- else {
73
- await fs_extra_1.default.writeFile(envPath, envContent);
74
- }
75
- }
@@ -1,2 +0,0 @@
1
- export declare function mergeDatabaseConfig(templatesDir: string, targetDir: string, database: string, framework: string, dbProvider?: string): Promise<string[]>;
2
- export declare function mergeAuthConfig(templatesDir: string, targetDir: string, framework: string, auth: string, database?: string, dbProvider?: string): Promise<void>;