create-stackkit-app 0.4.4 → 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.
- package/README.md +1 -1
- package/dist/index.js +61 -4
- package/dist/lib/code-generator.d.ts +80 -0
- package/dist/lib/code-generator.js +541 -0
- package/dist/lib/create-project.d.ts +20 -1
- package/dist/lib/create-project.js +154 -96
- package/dist/lib/framework-utils.d.ts +22 -0
- package/dist/lib/framework-utils.js +74 -0
- package/dist/lib/utils/logger.d.ts +16 -0
- package/dist/lib/utils/logger.js +59 -0
- package/dist/lib/utils/module-discovery.d.ts +62 -0
- package/dist/lib/utils/module-discovery.js +180 -0
- package/dist/lib/utils/package-utils.js +2 -2
- package/modules/auth/authjs/files/api/auth/[...nextauth]/route.ts +6 -0
- package/modules/auth/authjs/files/lib/auth-client.ts +11 -0
- package/modules/auth/authjs/files/lib/auth.ts +36 -0
- package/modules/auth/authjs/files/schemas/prisma-schema.prisma +45 -0
- package/modules/auth/authjs/module.json +22 -0
- package/modules/auth/better-auth/files/lib/auth-client.ts +7 -0
- package/modules/auth/better-auth/files/lib/auth.ts +77 -1
- package/modules/auth/better-auth/files/lib/email-service.ts +34 -0
- package/modules/auth/better-auth/files/lib/email-templates.ts +89 -0
- package/modules/auth/better-auth/files/schemas/prisma-schema.prisma +7 -7
- package/modules/auth/better-auth/generator.json +83 -0
- package/modules/auth/better-auth/module.json +17 -34
- package/modules/database/mongoose/files/lib/db.ts +63 -0
- package/modules/database/{mongoose-mongodb → mongoose}/files/models/User.ts +0 -5
- package/modules/database/mongoose/generator.json +33 -0
- package/modules/database/mongoose/module.json +15 -0
- package/modules/database/prisma/files/lib/prisma.ts +7 -4
- package/modules/database/prisma/files/prisma/schema.prisma +1 -1
- package/modules/database/prisma/files/prisma.config.ts +2 -2
- package/modules/database/prisma/generator.json +46 -0
- package/modules/database/prisma/module.json +6 -132
- package/package.json +1 -1
- package/templates/express/.env.example +0 -1
- package/templates/express/package.json +4 -4
- package/templates/express/src/app.ts +2 -2
- package/templates/express/src/features/health/health.controller.ts +18 -0
- package/templates/express/src/features/health/health.route.ts +9 -0
- package/templates/express/src/features/health/health.service.ts +6 -0
- package/templates/express/template.json +6 -19
- package/templates/nextjs/lib/env.ts +8 -0
- package/templates/nextjs/package.json +7 -7
- package/templates/nextjs/template.json +5 -1
- package/templates/react-vite/.env.example +1 -2
- package/templates/react-vite/.prettierignore +4 -0
- package/templates/react-vite/.prettierrc +9 -0
- package/templates/react-vite/README.md +22 -0
- package/templates/react-vite/package.json +16 -16
- package/templates/react-vite/src/router.tsx +0 -12
- package/templates/react-vite/template.json +6 -14
- package/templates/react-vite/vite.config.ts +0 -6
- package/dist/lib/utils/config-utils.d.ts +0 -2
- package/dist/lib/utils/config-utils.js +0 -33
- package/dist/lib/utils/file-utils.d.ts +0 -8
- package/dist/lib/utils/file-utils.js +0 -75
- package/dist/lib/utils/module-utils.d.ts +0 -2
- package/dist/lib/utils/module-utils.js +0 -311
- package/modules/auth/clerk/files/express/auth.ts +0 -7
- package/modules/auth/clerk/files/nextjs/auth-provider.tsx +0 -5
- package/modules/auth/clerk/files/nextjs/middleware.ts +0 -9
- package/modules/auth/clerk/files/react/auth-provider.tsx +0 -15
- package/modules/auth/clerk/module.json +0 -115
- package/modules/database/mongoose-mongodb/files/lib/db.ts +0 -78
- package/modules/database/mongoose-mongodb/module.json +0 -70
- package/templates/express/src/features/auth/auth.controller.ts +0 -48
- package/templates/express/src/features/auth/auth.route.ts +0 -10
- package/templates/express/src/features/auth/auth.service.ts +0 -21
- package/templates/react-vite/src/api/services/user.service.ts +0 -18
- package/templates/react-vite/src/pages/UserProfile.tsx +0 -40
- package/templates/react-vite/src/types/user.d.ts +0 -6
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Interactive wizard helps you choose:
|
|
|
12
12
|
|
|
13
13
|
- **Framework**: Next.js, Express, or React + Vite
|
|
14
14
|
- **Database**: Prisma (PostgreSQL/MongoDB), Mongoose (MongoDB)
|
|
15
|
-
- **Authentication**: Better Auth,
|
|
15
|
+
- **Authentication**: Better Auth, Auth.js
|
|
16
16
|
- **Package manager**: pnpm, npm, or yarn
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
package/dist/index.js
CHANGED
|
@@ -2,15 +2,72 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const create_project_1 = require("./lib/create-project");
|
|
5
|
+
const logger_1 = require("./lib/utils/logger");
|
|
6
|
+
function parseArgs(args) {
|
|
7
|
+
const options = {};
|
|
8
|
+
let projectName;
|
|
9
|
+
for (let i = 0; i < args.length; i++) {
|
|
10
|
+
const arg = args[i];
|
|
11
|
+
if (arg === '--help' || arg === '-h') {
|
|
12
|
+
showHelp();
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
if (arg.startsWith('--')) {
|
|
16
|
+
const key = arg.slice(2);
|
|
17
|
+
if (args[i + 1] && !args[i + 1].startsWith('--')) {
|
|
18
|
+
options[key] = args[i + 1];
|
|
19
|
+
i++;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
options[key] = true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (arg.startsWith('-') && arg.length === 2) {
|
|
26
|
+
const key = arg.slice(1);
|
|
27
|
+
if (args[i + 1] && !args[i + 1].startsWith('-')) {
|
|
28
|
+
options[key] = args[i + 1];
|
|
29
|
+
i++;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
options[key] = true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (!projectName) {
|
|
36
|
+
projectName = arg;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return { projectName, options };
|
|
40
|
+
}
|
|
41
|
+
function showHelp() {
|
|
42
|
+
logger_1.logger.log(`
|
|
43
|
+
Create StackKit App
|
|
44
|
+
|
|
45
|
+
Usage:
|
|
46
|
+
create-stackkit-app [project-name] [options]
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
-f, --framework <framework> Framework: nextjs, express, react-vite
|
|
50
|
+
-d, --database <database> Database: prisma, mongoose, none
|
|
51
|
+
-a, --auth <auth> Auth: better-auth, authjs, none
|
|
52
|
+
-l, --language <language> Language: typescript, javascript
|
|
53
|
+
-p, --package-manager <pm> Package manager: pnpm, npm, yarn, bun
|
|
54
|
+
--skip-install Skip dependency installation
|
|
55
|
+
--no-git Skip git initialization
|
|
56
|
+
-y, --yes Use default options
|
|
57
|
+
-h, --help Show this help
|
|
58
|
+
|
|
59
|
+
Examples:
|
|
60
|
+
create-stackkit-app my-app --framework nextjs --database prisma-postgresql --auth better-auth
|
|
61
|
+
`);
|
|
62
|
+
}
|
|
5
63
|
async function main() {
|
|
6
64
|
const args = process.argv.slice(2);
|
|
7
|
-
const projectName = args
|
|
65
|
+
const { projectName, options } = parseArgs(args);
|
|
8
66
|
try {
|
|
9
|
-
await (0, create_project_1.createProject)(projectName);
|
|
67
|
+
await (0, create_project_1.createProject)(projectName, options);
|
|
10
68
|
}
|
|
11
69
|
catch (error) {
|
|
12
|
-
|
|
13
|
-
console.error("Error:", error.message);
|
|
70
|
+
logger_1.logger.error(`Error: ${error.message}`);
|
|
14
71
|
process.exit(1);
|
|
15
72
|
}
|
|
16
73
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { FrameworkConfig } from './framework-utils';
|
|
2
|
+
export interface GenerationContext {
|
|
3
|
+
framework: string;
|
|
4
|
+
database?: string;
|
|
5
|
+
auth?: string;
|
|
6
|
+
features?: string[];
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface TemplateCondition {
|
|
10
|
+
framework?: string;
|
|
11
|
+
database?: string;
|
|
12
|
+
auth?: string;
|
|
13
|
+
features?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface Operation {
|
|
16
|
+
type: 'create-file' | 'patch-file' | 'add-dependency' | 'add-script' | 'add-env' | 'run-command';
|
|
17
|
+
description?: string;
|
|
18
|
+
condition?: TemplateCondition;
|
|
19
|
+
priority?: number;
|
|
20
|
+
source?: string;
|
|
21
|
+
destination?: string;
|
|
22
|
+
content?: string;
|
|
23
|
+
file?: string;
|
|
24
|
+
operations?: PatchOperation[];
|
|
25
|
+
dependencies?: Record<string, string>;
|
|
26
|
+
devDependencies?: Record<string, string>;
|
|
27
|
+
scripts?: Record<string, string>;
|
|
28
|
+
envVars?: Record<string, string>;
|
|
29
|
+
command?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface PatchOperation {
|
|
32
|
+
type: 'add-import' | 'add-code' | 'replace-code' | 'add-to-top' | 'add-to-bottom';
|
|
33
|
+
condition?: TemplateCondition;
|
|
34
|
+
imports?: string[];
|
|
35
|
+
code?: string;
|
|
36
|
+
after?: string;
|
|
37
|
+
before?: string;
|
|
38
|
+
replace?: string;
|
|
39
|
+
content?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface GeneratorConfig {
|
|
42
|
+
name: string;
|
|
43
|
+
type: 'framework' | 'database' | 'auth';
|
|
44
|
+
priority: number;
|
|
45
|
+
operations?: Operation[];
|
|
46
|
+
dependencies?: Record<string, string>;
|
|
47
|
+
devDependencies?: Record<string, string>;
|
|
48
|
+
scripts?: Record<string, string>;
|
|
49
|
+
envVars?: Record<string, string>;
|
|
50
|
+
}
|
|
51
|
+
export declare class AdvancedCodeGenerator {
|
|
52
|
+
private generators;
|
|
53
|
+
private frameworkConfig;
|
|
54
|
+
private postInstallCommands;
|
|
55
|
+
constructor(frameworkConfig: FrameworkConfig);
|
|
56
|
+
loadGenerators(modulesPath: string): Promise<void>;
|
|
57
|
+
private evaluateCondition;
|
|
58
|
+
private processTemplate;
|
|
59
|
+
generate(selectedModules: {
|
|
60
|
+
framework: string;
|
|
61
|
+
database?: string;
|
|
62
|
+
auth?: string;
|
|
63
|
+
prismaProvider?: string;
|
|
64
|
+
}, features: string[], outputPath: string): Promise<string[]>;
|
|
65
|
+
private executeOperation;
|
|
66
|
+
private copyTemplate;
|
|
67
|
+
private processOperationTemplates;
|
|
68
|
+
private executeCreateFile;
|
|
69
|
+
private executePatchFile;
|
|
70
|
+
private executeAddDependency;
|
|
71
|
+
private executeAddScript;
|
|
72
|
+
private executeAddEnv;
|
|
73
|
+
private executeRunCommand;
|
|
74
|
+
private generatePackageJson;
|
|
75
|
+
getAvailableGenerators(): {
|
|
76
|
+
frameworks: string[];
|
|
77
|
+
databases: string[];
|
|
78
|
+
auths: string[];
|
|
79
|
+
};
|
|
80
|
+
}
|