stackkit-cli 0.3.1 → 0.4.0
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 +19 -17
- package/dist/commands/add.d.ts +0 -1
- package/dist/commands/add.js +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +0 -1
- package/dist/commands/list.d.ts +0 -1
- package/dist/commands/list.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/utils/code-inject.d.ts +0 -1
- package/dist/utils/code-inject.js +0 -1
- package/dist/utils/detect.d.ts +0 -1
- package/dist/utils/detect.js +0 -1
- package/dist/utils/env-editor.d.ts +0 -1
- package/dist/utils/env-editor.js +0 -1
- package/dist/utils/files.d.ts +0 -1
- package/dist/utils/files.js +0 -1
- package/dist/utils/json-editor.d.ts +0 -1
- package/dist/utils/json-editor.js +0 -1
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +3 -2
- package/dist/utils/package-manager.d.ts +0 -1
- package/dist/utils/package-manager.js +0 -1
- package/modules/auth/better-auth-nextjs/files/api/auth/[...all]/route.ts +3 -1
- package/modules/auth/better-auth-nextjs/files/lib/auth.ts +19 -11
- package/modules/auth/better-auth-nextjs/module.json +7 -4
- package/modules/auth/clerk-express/files/lib/auth.ts +7 -0
- package/modules/auth/clerk-express/module.json +19 -0
- package/modules/auth/clerk-nextjs/files/lib/auth-provider.tsx +5 -0
- package/modules/auth/clerk-nextjs/files/middleware.ts +9 -0
- package/modules/auth/clerk-nextjs/module.json +27 -0
- package/modules/auth/clerk-react/files/lib/auth-provider.tsx +15 -0
- package/modules/auth/clerk-react/module.json +18 -0
- package/modules/database/drizzle-postgresql/files/drizzle.config.ts +10 -0
- package/modules/database/drizzle-postgresql/files/lib/db.ts +7 -0
- package/modules/database/drizzle-postgresql/files/lib/schema.ts +8 -0
- package/modules/database/drizzle-postgresql/module.json +34 -0
- package/modules/database/mongoose-mongodb/files/lib/db.ts +40 -0
- package/modules/database/mongoose-mongodb/module.json +17 -0
- package/package.json +4 -3
- package/templates/bases/nextjs-base/README.md +36 -0
- package/templates/bases/nextjs-base/app/favicon.ico +0 -0
- package/templates/bases/nextjs-base/app/globals.css +26 -3
- package/templates/bases/nextjs-base/app/layout.tsx +21 -6
- package/templates/bases/nextjs-base/app/page.tsx +61 -4
- package/templates/bases/nextjs-base/eslint.config.mjs +18 -0
- package/templates/bases/nextjs-base/next.config.ts +4 -2
- package/templates/bases/nextjs-base/package-lock.json +6538 -0
- package/templates/bases/nextjs-base/package.json +12 -10
- package/templates/bases/nextjs-base/postcss.config.mjs +7 -0
- package/templates/bases/nextjs-base/public/file.svg +1 -0
- package/templates/bases/nextjs-base/public/globe.svg +1 -0
- package/templates/bases/nextjs-base/public/next.svg +1 -0
- package/templates/bases/nextjs-base/public/vercel.svg +1 -0
- package/templates/bases/nextjs-base/public/window.svg +1 -0
- package/templates/bases/nextjs-base/template.json +12 -1
- package/templates/bases/nextjs-base/tsconfig.json +9 -2
- package/templates/bases/react-vite-base/index.html +13 -0
- package/templates/bases/react-vite-base/package.json +27 -0
- package/templates/bases/react-vite-base/src/App.css +14 -0
- package/templates/bases/react-vite-base/src/App.tsx +23 -0
- package/templates/bases/react-vite-base/src/index.css +68 -0
- package/templates/bases/react-vite-base/src/main.tsx +10 -0
- package/templates/bases/react-vite-base/src/vite-env.d.ts +1 -0
- package/templates/bases/react-vite-base/template.json +5 -0
- package/templates/bases/react-vite-base/tsconfig.json +21 -0
- package/templates/bases/react-vite-base/vite.config.ts +7 -0
- package/dist/commands/add.d.ts.map +0 -1
- package/dist/commands/add.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/utils/code-inject.d.ts.map +0 -1
- package/dist/utils/code-inject.js.map +0 -1
- package/dist/utils/detect.d.ts.map +0 -1
- package/dist/utils/detect.js.map +0 -1
- package/dist/utils/env-editor.d.ts.map +0 -1
- package/dist/utils/env-editor.js.map +0 -1
- package/dist/utils/files.d.ts.map +0 -1
- package/dist/utils/files.js.map +0 -1
- package/dist/utils/json-editor.d.ts.map +0 -1
- package/dist/utils/json-editor.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js.map +0 -1
- package/templates/auth/authjs-express/config.json +0 -20
- package/templates/auth/authjs-express/files/lib/auth.ts +0 -43
- package/templates/auth/authjs-express/files/routes/auth.ts +0 -12
- package/templates/auth/authjs-express/lib/auth.ts +0 -43
- package/templates/auth/authjs-express/module.json +0 -39
- package/templates/auth/authjs-express/routes/auth.ts +0 -12
- package/templates/auth/authjs-nextjs/app/api/auth/[...nextauth]/route.ts +0 -3
- package/templates/auth/authjs-nextjs/config.json +0 -19
- package/templates/auth/authjs-nextjs/files/api/auth/[...nextauth]/route.ts +0 -3
- package/templates/auth/authjs-nextjs/files/lib/auth.ts +0 -45
- package/templates/auth/authjs-nextjs/lib/auth.ts +0 -45
- package/templates/auth/authjs-nextjs/module.json +0 -38
- package/templates/auth/better-auth-express/config.json +0 -18
- package/templates/auth/better-auth-express/src/lib/auth.ts +0 -12
- package/templates/auth/better-auth-express/src/routes/auth.ts +0 -10
- package/templates/auth/better-auth-nextjs/app/api/auth/[...all]/route.ts +0 -4
- package/templates/auth/better-auth-nextjs/config.json +0 -18
- package/templates/auth/better-auth-nextjs/lib/auth.ts +0 -14
- package/templates/auth/better-auth-react/config.json +0 -15
- package/templates/auth/better-auth-react/files/lib/auth-client.ts +0 -9
- package/templates/auth/better-auth-react/lib/auth-client.ts +0 -9
- package/templates/auth/better-auth-react/module.json +0 -26
- package/templates/auth/nextauth/app/api/auth/[...nextauth]/route.ts +0 -3
- package/templates/auth/nextauth/config.json +0 -18
- package/templates/auth/nextauth/lib/auth.ts +0 -31
- package/templates/bases/nextjs-base/.eslintrc.json +0 -3
- package/templates/databases/prisma-mongodb/config.json +0 -21
- package/templates/databases/prisma-mongodb/lib/db.ts +0 -13
- package/templates/databases/prisma-mongodb/prisma/schema.prisma +0 -16
- package/templates/databases/prisma-postgresql/config.json +0 -22
- package/templates/databases/prisma-postgresql/lib/db.ts +0 -13
- package/templates/databases/prisma-postgresql/prisma/schema.prisma +0 -16
package/README.md
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
# stackkit-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Add modules to existing projects.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
5
|
+
## Usage
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
#
|
|
11
|
-
|
|
8
|
+
# Add authentication
|
|
9
|
+
npx stackkit-cli add auth
|
|
10
|
+
|
|
11
|
+
# Add database
|
|
12
|
+
npx stackkit-cli add database --provider prisma-postgresql
|
|
12
13
|
|
|
13
|
-
#
|
|
14
|
-
npx stackkit-cli
|
|
14
|
+
# List available modules
|
|
15
|
+
npx stackkit-cli list
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## Commands
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
- `add <module>` - Add module to your project
|
|
21
|
+
- `list` - List available modules
|
|
22
|
+
- `init` - Create new project (same as create-stackkit-app)
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
npx stackkit-cli list
|
|
24
|
+
## Development
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
```bash
|
|
27
|
+
pnpm install
|
|
28
|
+
pnpm build
|
|
29
|
+
npx . add auth
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
See [main README](../../README.md) for full documentation.
|
|
31
33
|
|
|
32
34
|
### `init [project-name]`
|
|
33
35
|
|
package/dist/commands/add.d.ts
CHANGED
package/dist/commands/add.js
CHANGED
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/init.js
CHANGED
package/dist/commands/list.d.ts
CHANGED
package/dist/commands/list.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const program = new commander_1.Command();
|
|
|
13
13
|
program
|
|
14
14
|
.name('stackkit')
|
|
15
15
|
.description('Production-ready project generator and module CLI')
|
|
16
|
-
.version('0.3.
|
|
16
|
+
.version('0.3.2');
|
|
17
17
|
// Init command
|
|
18
18
|
program
|
|
19
19
|
.command('init [project-name]')
|
|
@@ -47,4 +47,3 @@ program.on('command:*', () => {
|
|
|
47
47
|
process.exit(1);
|
|
48
48
|
});
|
|
49
49
|
program.parse();
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -12,4 +12,3 @@ export declare function injectCode(filePath: string, injection: CodeInjection, p
|
|
|
12
12
|
}): Promise<void>;
|
|
13
13
|
export declare function removeInjection(content: string, id: string): string;
|
|
14
14
|
export declare function hasInjection(content: string, id: string): boolean;
|
|
15
|
-
//# sourceMappingURL=code-inject.d.ts.map
|
package/dist/utils/detect.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ import { ProjectInfo } from '../types';
|
|
|
2
2
|
export declare function detectProjectInfo(targetDir: string): Promise<ProjectInfo>;
|
|
3
3
|
export declare function getRouterBasePath(projectInfo: ProjectInfo): string;
|
|
4
4
|
export declare function getLibPath(projectInfo: ProjectInfo): string;
|
|
5
|
-
//# sourceMappingURL=detect.d.ts.map
|
package/dist/utils/detect.js
CHANGED
package/dist/utils/env-editor.js
CHANGED
package/dist/utils/files.d.ts
CHANGED
|
@@ -4,4 +4,3 @@ export declare function createFile(targetPath: string, content: string, options?
|
|
|
4
4
|
}): Promise<void>;
|
|
5
5
|
export declare function readFile(filePath: string): Promise<string>;
|
|
6
6
|
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
7
|
-
//# sourceMappingURL=files.d.ts.map
|
package/dist/utils/files.js
CHANGED
package/dist/utils/logger.d.ts
CHANGED
package/dist/utils/logger.js
CHANGED
|
@@ -7,7 +7,9 @@ exports.logger = exports.Logger = void 0;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const ora_1 = __importDefault(require("ora"));
|
|
9
9
|
class Logger {
|
|
10
|
-
|
|
10
|
+
constructor() {
|
|
11
|
+
this.spinner = null;
|
|
12
|
+
}
|
|
11
13
|
info(message) {
|
|
12
14
|
console.log(chalk_1.default.blue('ℹ'), message);
|
|
13
15
|
}
|
|
@@ -55,4 +57,3 @@ class Logger {
|
|
|
55
57
|
}
|
|
56
58
|
exports.Logger = Logger;
|
|
57
59
|
exports.logger = new Logger();
|
|
58
|
-
//# sourceMappingURL=logger.js.map
|
|
@@ -3,4 +3,3 @@ export declare function detectPackageManager(cwd: string): Promise<PackageManage
|
|
|
3
3
|
export declare function installDependencies(cwd: string, pm: PackageManager, dev?: boolean): Promise<void>;
|
|
4
4
|
export declare function addDependencies(cwd: string, pm: PackageManager, packages: string[], dev?: boolean): Promise<void>;
|
|
5
5
|
export declare function initGit(cwd: string): Promise<void>;
|
|
6
|
-
//# sourceMappingURL=package-manager.d.ts.map
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
+
import { prismaAdapter } from '@better-auth/prisma';
|
|
1
2
|
import { betterAuth } from 'better-auth';
|
|
3
|
+
import { prisma } from './db';
|
|
2
4
|
|
|
3
5
|
export const auth = betterAuth({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// Add your authentication providers here
|
|
8
|
-
// Example: email/password, OAuth (Google, GitHub, etc.)
|
|
6
|
+
database: prismaAdapter(prisma, {
|
|
7
|
+
provider: 'postgresql', // Change to 'mongodb' if using MongoDB
|
|
8
|
+
}),
|
|
9
9
|
emailAndPassword: {
|
|
10
10
|
enabled: true,
|
|
11
11
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
socialProviders: {
|
|
13
|
+
// Uncomment to add OAuth providers
|
|
14
|
+
// google: {
|
|
15
|
+
// clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
16
|
+
// clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
17
|
+
// },
|
|
18
|
+
// github: {
|
|
19
|
+
// clientId: process.env.GITHUB_CLIENT_ID!,
|
|
20
|
+
// clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
21
|
+
// },
|
|
22
|
+
},
|
|
18
23
|
});
|
|
24
|
+
|
|
25
|
+
export type Session = typeof auth.$Infer.Session;
|
|
26
|
+
export type User = typeof auth.$Infer.User;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth",
|
|
3
3
|
"displayName": "Better Auth (Next.js)",
|
|
4
|
-
"description": "Modern authentication with Better Auth for Next.js",
|
|
4
|
+
"description": "Modern authentication with Better Auth for Next.js App Router",
|
|
5
5
|
"category": "auth",
|
|
6
|
+
"provider": "better-auth",
|
|
6
7
|
"supportedFrameworks": ["nextjs"],
|
|
8
|
+
"compatibleDatabases": ["prisma-postgresql", "prisma-mongodb"],
|
|
7
9
|
"dependencies": {
|
|
8
|
-
"better-auth": "^1.
|
|
10
|
+
"better-auth": "^1.1.4",
|
|
11
|
+
"@better-auth/prisma": "^1.1.4"
|
|
9
12
|
},
|
|
10
13
|
"envVars": [
|
|
11
14
|
{
|
|
@@ -30,8 +33,8 @@
|
|
|
30
33
|
},
|
|
31
34
|
{
|
|
32
35
|
"type": "create-file",
|
|
33
|
-
"description": "Create Better Auth API route",
|
|
34
|
-
"source": "api/auth/[...all]/route.ts",
|
|
36
|
+
"description": "Create Better Auth API route handler",
|
|
37
|
+
"source": "app/api/auth/[...all]/route.ts",
|
|
35
38
|
"destination": "{{router}}/api/auth/[...all]/route.ts"
|
|
36
39
|
}
|
|
37
40
|
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "clerk-express",
|
|
3
|
+
"description": "Clerk Authentication for Express.js",
|
|
4
|
+
"category": "auth",
|
|
5
|
+
"framework": "express",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@clerk/express": "^1.4.5"
|
|
8
|
+
},
|
|
9
|
+
"env": {
|
|
10
|
+
"CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here",
|
|
11
|
+
"CLERK_SECRET_KEY": "sk_test_your_key_here"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
{
|
|
15
|
+
"source": "files/lib/auth.ts",
|
|
16
|
+
"destination": "lib/auth.ts"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "clerk-nextjs",
|
|
3
|
+
"description": "Clerk Authentication for Next.js",
|
|
4
|
+
"category": "auth",
|
|
5
|
+
"framework": "nextjs",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@clerk/nextjs": "^6.10.2"
|
|
8
|
+
},
|
|
9
|
+
"env": {
|
|
10
|
+
"NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here",
|
|
11
|
+
"CLERK_SECRET_KEY": "sk_test_your_key_here",
|
|
12
|
+
"NEXT_PUBLIC_CLERK_SIGN_IN_URL": "/sign-in",
|
|
13
|
+
"NEXT_PUBLIC_CLERK_SIGN_UP_URL": "/sign-up",
|
|
14
|
+
"NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL": "/",
|
|
15
|
+
"NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL": "/"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"source": "files/lib/auth-provider.tsx",
|
|
20
|
+
"destination": "lib/auth-provider.tsx"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"source": "files/middleware.ts",
|
|
24
|
+
"destination": "middleware.ts"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ClerkProvider } from '@clerk/clerk-react';
|
|
2
|
+
|
|
3
|
+
const publishableKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
|
|
4
|
+
|
|
5
|
+
if (!publishableKey) {
|
|
6
|
+
throw new Error('Missing Publishable Key');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function AuthProvider({ children }: { children: React.ReactNode }) {
|
|
10
|
+
return (
|
|
11
|
+
<ClerkProvider publishableKey={publishableKey} afterSignOutUrl="/">
|
|
12
|
+
{children}
|
|
13
|
+
</ClerkProvider>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "clerk-react",
|
|
3
|
+
"description": "Clerk Authentication for React",
|
|
4
|
+
"category": "auth",
|
|
5
|
+
"framework": "react-vite",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@clerk/clerk-react": "^5.19.2"
|
|
8
|
+
},
|
|
9
|
+
"env": {
|
|
10
|
+
"VITE_CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"source": "files/lib/auth-provider.tsx",
|
|
15
|
+
"destination": "lib/auth-provider.tsx"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
|
|
2
|
+
|
|
3
|
+
export const users = pgTable('users', {
|
|
4
|
+
id: serial('id').primaryKey(),
|
|
5
|
+
name: text('name').notNull(),
|
|
6
|
+
email: text('email').notNull().unique(),
|
|
7
|
+
createdAt: timestamp('created_at').defaultNow(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "drizzle-postgresql",
|
|
3
|
+
"description": "Drizzle ORM with PostgreSQL",
|
|
4
|
+
"category": "database",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"drizzle-orm": "^0.36.4",
|
|
7
|
+
"postgres": "^3.4.5"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"drizzle-kit": "^0.28.1"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"db:generate": "drizzle-kit generate",
|
|
14
|
+
"db:migrate": "drizzle-kit migrate",
|
|
15
|
+
"db:studio": "drizzle-kit studio"
|
|
16
|
+
},
|
|
17
|
+
"env": {
|
|
18
|
+
"DATABASE_URL": "postgresql://postgres:password@localhost:5432/myapp"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
{
|
|
22
|
+
"source": "files/lib/db.ts",
|
|
23
|
+
"destination": "lib/db.ts"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"source": "files/lib/schema.ts",
|
|
27
|
+
"destination": "lib/schema.ts"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"source": "files/drizzle.config.ts",
|
|
31
|
+
"destination": "drizzle.config.ts"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/myapp';
|
|
4
|
+
|
|
5
|
+
if (!MONGODB_URI) {
|
|
6
|
+
throw new Error('Please define the MONGODB_URI environment variable');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let cached = global.mongoose;
|
|
10
|
+
|
|
11
|
+
if (!cached) {
|
|
12
|
+
cached = global.mongoose = { conn: null, promise: null };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function connectDB() {
|
|
16
|
+
if (cached.conn) {
|
|
17
|
+
return cached.conn;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!cached.promise) {
|
|
21
|
+
const opts = {
|
|
22
|
+
bufferCommands: false,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
cached.promise = mongoose.connect(MONGODB_URI, opts).then((mongoose) => {
|
|
26
|
+
return mongoose;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
cached.conn = await cached.promise;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
cached.promise = null;
|
|
34
|
+
throw e;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return cached.conn;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default connectDB;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mongoose-mongodb",
|
|
3
|
+
"description": "Mongoose ODM for MongoDB",
|
|
4
|
+
"category": "database",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"mongoose": "^8.8.4"
|
|
7
|
+
},
|
|
8
|
+
"env": {
|
|
9
|
+
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
{
|
|
13
|
+
"source": "files/lib/db.ts",
|
|
14
|
+
"destination": "lib/db.ts"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stackkit-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "CLI for StackKit - Production-ready project generator and module system",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "tsc --watch",
|
|
21
|
-
"build": "
|
|
21
|
+
"build": "npm run clean && tsc && npm run copy-assets",
|
|
22
|
+
"copy-assets": "cp -r ../../templates . && cp -r ../../modules .",
|
|
22
23
|
"clean": "rm -rf dist templates modules",
|
|
23
24
|
"typecheck": "tsc --noEmit",
|
|
24
25
|
"lint": "eslint src --ext .ts",
|
|
@@ -55,4 +56,4 @@
|
|
|
55
56
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
56
57
|
"typescript": "^5.3.3"
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First, run the development server:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# or
|
|
10
|
+
yarn dev
|
|
11
|
+
# or
|
|
12
|
+
pnpm dev
|
|
13
|
+
# or
|
|
14
|
+
bun dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
18
|
+
|
|
19
|
+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
|
20
|
+
|
|
21
|
+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
|
22
|
+
|
|
23
|
+
## Learn More
|
|
24
|
+
|
|
25
|
+
To learn more about Next.js, take a look at the following resources:
|
|
26
|
+
|
|
27
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
28
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
29
|
+
|
|
30
|
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
|
31
|
+
|
|
32
|
+
## Deploy on Vercel
|
|
33
|
+
|
|
34
|
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
35
|
+
|
|
36
|
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
|
Binary file
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--background: #ffffff;
|
|
5
|
+
--foreground: #171717;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@theme inline {
|
|
9
|
+
--color-background: var(--background);
|
|
10
|
+
--color-foreground: var(--foreground);
|
|
11
|
+
--font-sans: var(--font-geist-sans);
|
|
12
|
+
--font-mono: var(--font-geist-mono);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media (prefers-color-scheme: dark) {
|
|
16
|
+
:root {
|
|
17
|
+
--background: #0a0a0a;
|
|
18
|
+
--foreground: #ededed;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body {
|
|
23
|
+
background: var(--background);
|
|
24
|
+
color: var(--foreground);
|
|
25
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
26
|
+
}
|