@idealyst/cli 1.0.36 → 1.0.38
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/generators/api.js +3 -4
- package/dist/generators/api.js.map +1 -1
- package/dist/generators/database.js +32 -0
- package/dist/generators/database.js.map +1 -0
- package/dist/generators/index.js +5 -0
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/utils.js +2 -1
- package/dist/generators/utils.js.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/templates/api/.env.example +6 -0
- package/dist/templates/api/README.md +25 -35
- package/dist/templates/api/package.json +0 -8
- package/dist/templates/api/src/context.ts +4 -8
- package/dist/templates/database/.env.example +8 -0
- package/dist/templates/database/README.md +93 -0
- package/dist/templates/database/__tests__/database.test.ts +14 -0
- package/dist/templates/database/jest.config.js +19 -0
- package/dist/templates/database/jest.setup.js +11 -0
- package/dist/templates/database/package.json +61 -0
- package/dist/templates/{api → database}/prisma/schema.prisma +1 -1
- package/dist/templates/database/prisma/seed.ts +28 -0
- package/dist/templates/database/src/client.ts +18 -0
- package/dist/templates/database/src/index.ts +11 -0
- package/dist/templates/database/src/schemas.ts +26 -0
- package/dist/templates/database/tsconfig.json +32 -0
- package/dist/templates/workspace/.devcontainer/Dockerfile +23 -0
- package/dist/templates/workspace/.devcontainer/README.md +0 -0
- package/dist/templates/workspace/.devcontainer/devcontainer.json +71 -99
- package/dist/templates/workspace/.devcontainer/docker-compose.yml +19 -46
- package/dist/templates/workspace/.devcontainer/fix-permissions.sh +0 -0
- package/dist/templates/workspace/.devcontainer/post-create.sh +0 -89
- package/dist/templates/workspace/.devcontainer/setup.sh +64 -0
- package/dist/templates/workspace/Dockerfile +24 -6
- package/dist/types/generators/database.d.ts +2 -0
- package/dist/types/generators/index.d.ts +1 -0
- package/dist/types/types.d.ts +1 -1
- package/package.json +8 -3
- package/templates/api/.env.example +6 -0
- package/templates/api/README.md +25 -35
- package/templates/api/package.json +0 -8
- package/templates/api/src/context.ts +4 -8
- package/templates/database/.env.example +8 -0
- package/templates/database/README.md +93 -0
- package/templates/database/__tests__/database.test.ts +14 -0
- package/templates/database/jest.config.js +19 -0
- package/templates/database/jest.setup.js +11 -0
- package/templates/database/package.json +61 -0
- package/templates/{api → database}/prisma/schema.prisma +1 -1
- package/templates/database/prisma/seed.ts +28 -0
- package/templates/database/src/client.ts +18 -0
- package/templates/database/src/index.ts +11 -0
- package/templates/database/src/schemas.ts +26 -0
- package/templates/database/tsconfig.json +32 -0
- package/templates/workspace/.devcontainer/Dockerfile +4 -6
- package/templates/workspace/.devcontainer/README.md +0 -0
- package/templates/workspace/.devcontainer/docker-compose.yml +13 -27
- package/templates/workspace/.devcontainer/fix-permissions.sh +0 -0
- package/templates/workspace/.devcontainer/post-create.sh +0 -0
- package/dist/templates/api/env.example +0 -12
- package/dist/templates/workspace/.env.production +0 -56
- package/dist/templates/workspace/scripts/docker-build.sh +0 -151
- package/templates/api/env.example +0 -12
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"version": "{{version}}",
|
|
4
|
+
"description": "{{description}}",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"types": "./dist/client.d.ts",
|
|
15
|
+
"import": "./dist/client.js"
|
|
16
|
+
},
|
|
17
|
+
"./schemas": {
|
|
18
|
+
"types": "./dist/schemas.d.ts",
|
|
19
|
+
"import": "./dist/schemas.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"test": "jest",
|
|
25
|
+
"test:watch": "jest --watch",
|
|
26
|
+
"test:coverage": "jest --coverage",
|
|
27
|
+
"db:generate": "prisma generate",
|
|
28
|
+
"db:push": "prisma db push",
|
|
29
|
+
"db:studio": "prisma studio",
|
|
30
|
+
"db:migrate": "prisma migrate dev",
|
|
31
|
+
"db:reset": "prisma migrate reset",
|
|
32
|
+
"db:seed": "tsx prisma/seed.ts",
|
|
33
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
34
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
35
|
+
"type-check": "tsc --noEmit",
|
|
36
|
+
"dev": "tsx watch src/index.ts"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@prisma/client": "^5.7.1",
|
|
40
|
+
"zod": "^3.22.4"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/jest": "^29.5.12",
|
|
44
|
+
"@types/node": "^20.10.4",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
|
46
|
+
"@typescript-eslint/parser": "^6.13.1",
|
|
47
|
+
"dotenv": "^16.3.1",
|
|
48
|
+
"eslint": "^8.54.0",
|
|
49
|
+
"jest": "^29.7.0",
|
|
50
|
+
"prisma": "^5.7.1",
|
|
51
|
+
"ts-jest": "^29.1.2",
|
|
52
|
+
"tsx": "^4.6.2",
|
|
53
|
+
"typescript": "^5.3.3"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"database",
|
|
57
|
+
"prisma",
|
|
58
|
+
"typescript",
|
|
59
|
+
"orm"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PrismaClient } from '@prisma/client';
|
|
2
|
+
|
|
3
|
+
const prisma = new PrismaClient();
|
|
4
|
+
|
|
5
|
+
async function main() {
|
|
6
|
+
console.log('🌱 Seeding database...');
|
|
7
|
+
|
|
8
|
+
// Add your seed data here
|
|
9
|
+
// Example:
|
|
10
|
+
// const user = await prisma.user.create({
|
|
11
|
+
// data: {
|
|
12
|
+
// email: 'admin@example.com',
|
|
13
|
+
// name: 'Admin User',
|
|
14
|
+
// },
|
|
15
|
+
// });
|
|
16
|
+
// console.log('Created user:', user);
|
|
17
|
+
|
|
18
|
+
console.log('✅ Database seeded successfully!');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
main()
|
|
22
|
+
.catch((e) => {
|
|
23
|
+
console.error('❌ Error seeding database:', e);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
})
|
|
26
|
+
.finally(async () => {
|
|
27
|
+
await prisma.$disconnect();
|
|
28
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PrismaClient } from '@prisma/client';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
// Prevent multiple instances of Prisma Client in development
|
|
5
|
+
var __globalPrisma: PrismaClient | undefined;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const prisma =
|
|
9
|
+
globalThis.__globalPrisma ??
|
|
10
|
+
new PrismaClient({
|
|
11
|
+
log: ['query', 'error', 'warn'],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
15
|
+
globalThis.__globalPrisma = prisma;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default prisma;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Export Prisma client
|
|
2
|
+
export { PrismaClient } from '@prisma/client';
|
|
3
|
+
|
|
4
|
+
// Export database client instance
|
|
5
|
+
export { default as db } from './client';
|
|
6
|
+
|
|
7
|
+
// Export Zod schemas
|
|
8
|
+
export * from './schemas';
|
|
9
|
+
|
|
10
|
+
// Export types from Prisma
|
|
11
|
+
export type * from '@prisma/client';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// Add your Zod schemas here to match your Prisma models
|
|
4
|
+
// Example:
|
|
5
|
+
// export const UserSchema = z.object({
|
|
6
|
+
// id: z.string().cuid(),
|
|
7
|
+
// email: z.string().email(),
|
|
8
|
+
// name: z.string().optional(),
|
|
9
|
+
// createdAt: z.date(),
|
|
10
|
+
// updatedAt: z.date(),
|
|
11
|
+
// });
|
|
12
|
+
|
|
13
|
+
// export const CreateUserSchema = UserSchema.omit({
|
|
14
|
+
// id: true,
|
|
15
|
+
// createdAt: true,
|
|
16
|
+
// updatedAt: true,
|
|
17
|
+
// });
|
|
18
|
+
|
|
19
|
+
// export const UpdateUserSchema = CreateUserSchema.partial();
|
|
20
|
+
|
|
21
|
+
// Export all your schemas
|
|
22
|
+
export const schemas = {
|
|
23
|
+
// user: UserSchema,
|
|
24
|
+
// createUser: CreateUserSchema,
|
|
25
|
+
// updateUser: UpdateUserSchema,
|
|
26
|
+
} as const;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": ["ES2020"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"allowSyntheticDefaultImports": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"outDir": "./dist",
|
|
16
|
+
"rootDir": "./src",
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"allowJs": false,
|
|
19
|
+
"noUncheckedIndexedAccess": true,
|
|
20
|
+
"experimentalDecorators": true,
|
|
21
|
+
"emitDecoratorMetadata": true
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"src/**/*",
|
|
25
|
+
"prisma/**/*"
|
|
26
|
+
],
|
|
27
|
+
"exclude": [
|
|
28
|
+
"node_modules",
|
|
29
|
+
"dist",
|
|
30
|
+
"__tests__"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
FROM node:20-bullseye
|
|
2
|
+
|
|
3
|
+
# Install additional tools
|
|
4
|
+
RUN apt-get update && apt-get install -y \
|
|
5
|
+
git \
|
|
6
|
+
postgresql-client \
|
|
7
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
8
|
+
|
|
9
|
+
# Enable corepack for yarn
|
|
10
|
+
RUN corepack enable
|
|
11
|
+
|
|
12
|
+
# Install global tools that might be useful
|
|
13
|
+
RUN npm install -g @expo/cli
|
|
14
|
+
|
|
15
|
+
# Set up git (will be configured in setup script)
|
|
16
|
+
RUN git config --global init.defaultBranch main
|
|
17
|
+
|
|
18
|
+
# Create workspace directory
|
|
19
|
+
RUN mkdir -p /workspace
|
|
20
|
+
WORKDIR /workspace
|
|
21
|
+
|
|
22
|
+
# Keep container running
|
|
23
|
+
CMD ["sleep", "infinity"]
|
|
File without changes
|
|
@@ -1,88 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "Idealyst Development
|
|
3
|
-
"dockerComposeFile":
|
|
4
|
-
"service": "
|
|
5
|
-
"workspaceFolder": "/
|
|
6
|
-
"shutdownAction": "stopCompose",
|
|
2
|
+
"name": "Idealyst Development",
|
|
3
|
+
"dockerComposeFile": "docker-compose.yml",
|
|
4
|
+
"service": "app",
|
|
5
|
+
"workspaceFolder": "/workspace",
|
|
7
6
|
|
|
8
|
-
//
|
|
9
|
-
"customizations": {
|
|
10
|
-
"vscode": {
|
|
11
|
-
"settings": {
|
|
12
|
-
"terminal.integrated.shell.linux": "/bin/bash",
|
|
13
|
-
"typescript.preferences.includePackageJsonAutoImports": "auto",
|
|
14
|
-
"editor.formatOnSave": true,
|
|
15
|
-
"editor.codeActionsOnSave": {
|
|
16
|
-
"source.fixAll.eslint": "explicit",
|
|
17
|
-
"source.organizeImports": "explicit"
|
|
18
|
-
},
|
|
19
|
-
"files.watcherExclude": {
|
|
20
|
-
"**/node_modules/**": true,
|
|
21
|
-
"**/.git/**": true,
|
|
22
|
-
"**/dist/**": true,
|
|
23
|
-
"**/coverage/**": true
|
|
24
|
-
},
|
|
25
|
-
"search.exclude": {
|
|
26
|
-
"**/node_modules": true,
|
|
27
|
-
"**/dist": true,
|
|
28
|
-
"**/coverage": true,
|
|
29
|
-
"**/.yarn": true
|
|
30
|
-
},
|
|
31
|
-
"typescript.preferences.importModuleSpecifier": "relative",
|
|
32
|
-
"jest.jestCommandLine": "yarn test",
|
|
33
|
-
"jest.autoRun": "off"
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
// Extensions to install
|
|
37
|
-
"extensions": [
|
|
38
|
-
"ms-vscode.vscode-typescript-next",
|
|
39
|
-
"bradlc.vscode-tailwindcss",
|
|
40
|
-
"esbenp.prettier-vscode",
|
|
41
|
-
"dbaeumer.vscode-eslint",
|
|
42
|
-
"ms-vscode.vscode-json",
|
|
43
|
-
"ms-vscode.test-adapter-converter",
|
|
44
|
-
"orta.vscode-jest",
|
|
45
|
-
"ms-vscode.vscode-npm-script",
|
|
46
|
-
"christian-kohler.path-intellisense",
|
|
47
|
-
"formulahendry.auto-rename-tag",
|
|
48
|
-
"bradlc.vscode-tailwindcss",
|
|
49
|
-
"ms-vscode.vscode-docker",
|
|
50
|
-
"ms-azuretools.vscode-docker",
|
|
51
|
-
"redhat.vscode-yaml",
|
|
52
|
-
"ms-vscode.vscode-markdown",
|
|
53
|
-
"yzhang.markdown-all-in-one",
|
|
54
|
-
"davidanson.vscode-markdownlint",
|
|
55
|
-
"ms-vscode.vscode-git-graph",
|
|
56
|
-
"eamodio.gitlens",
|
|
57
|
-
"github.vscode-pull-request-github",
|
|
58
|
-
"github.copilot",
|
|
59
|
-
"github.copilot-chat",
|
|
60
|
-
"ms-vscode.vscode-react-native",
|
|
61
|
-
"msjsdiag.vscode-react-native"
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
// Development container features
|
|
67
|
-
"features": {
|
|
68
|
-
"ghcr.io/devcontainers/features/git:1": {
|
|
69
|
-
"ppa": true,
|
|
70
|
-
"version": "latest"
|
|
71
|
-
},
|
|
72
|
-
"ghcr.io/devcontainers/features/github-cli:1": {
|
|
73
|
-
"version": "latest"
|
|
74
|
-
},
|
|
75
|
-
"ghcr.io/devcontainers/features/common-utils:2": {
|
|
76
|
-
"installZsh": true,
|
|
77
|
-
"configureZshAsDefaultShell": true,
|
|
78
|
-
"installOhMyZsh": true,
|
|
79
|
-
"username": "devuser",
|
|
80
|
-
"userUid": 1001,
|
|
81
|
-
"userGid": 1001
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
// Port forwarding for development servers
|
|
7
|
+
// Forward ports
|
|
86
8
|
"forwardPorts": [
|
|
87
9
|
3000, // Web dev server
|
|
88
10
|
3001, // API server
|
|
@@ -93,6 +15,7 @@
|
|
|
93
15
|
6379 // Redis
|
|
94
16
|
],
|
|
95
17
|
|
|
18
|
+
// Port attributes
|
|
96
19
|
"portsAttributes": {
|
|
97
20
|
"3000": {
|
|
98
21
|
"label": "Web App",
|
|
@@ -100,41 +23,90 @@
|
|
|
100
23
|
},
|
|
101
24
|
"3001": {
|
|
102
25
|
"label": "API Server",
|
|
103
|
-
"onAutoForward": "
|
|
26
|
+
"onAutoForward": "notify"
|
|
104
27
|
},
|
|
105
28
|
"5173": {
|
|
106
29
|
"label": "Vite Dev Server",
|
|
107
30
|
"onAutoForward": "openBrowser"
|
|
108
31
|
},
|
|
32
|
+
"8080": {
|
|
33
|
+
"label": "Additional Dev Server",
|
|
34
|
+
"onAutoForward": "notify"
|
|
35
|
+
},
|
|
109
36
|
"19006": {
|
|
110
37
|
"label": "Expo Dev Tools",
|
|
111
38
|
"onAutoForward": "openBrowser"
|
|
112
39
|
},
|
|
113
40
|
"5432": {
|
|
114
|
-
"label": "PostgreSQL",
|
|
41
|
+
"label": "PostgreSQL Database",
|
|
115
42
|
"onAutoForward": "silent"
|
|
116
43
|
},
|
|
117
44
|
"6379": {
|
|
118
|
-
"label": "Redis",
|
|
45
|
+
"label": "Redis Cache",
|
|
119
46
|
"onAutoForward": "silent"
|
|
120
47
|
}
|
|
121
48
|
},
|
|
122
49
|
|
|
123
|
-
//
|
|
124
|
-
"
|
|
50
|
+
// VS Code customizations
|
|
51
|
+
"customizations": {
|
|
52
|
+
"vscode": {
|
|
53
|
+
"extensions": [
|
|
54
|
+
// React Native/React development
|
|
55
|
+
"ms-vscode.vscode-react-native",
|
|
56
|
+
"msjsdiag.vscode-react-native",
|
|
57
|
+
|
|
58
|
+
// TypeScript/JavaScript
|
|
59
|
+
"ms-vscode.vscode-typescript-next",
|
|
60
|
+
"dbaeumer.vscode-eslint",
|
|
61
|
+
"esbenp.prettier-vscode",
|
|
62
|
+
"bradlc.vscode-tailwindcss",
|
|
63
|
+
|
|
64
|
+
// General development
|
|
65
|
+
"ms-vscode.vscode-json",
|
|
66
|
+
"redhat.vscode-yaml",
|
|
67
|
+
"ms-vscode.vscode-docker",
|
|
68
|
+
"ms-vscode.vscode-markdown",
|
|
69
|
+
"christian-kohler.path-intellisense",
|
|
70
|
+
"formulahendry.auto-rename-tag",
|
|
125
71
|
|
|
126
|
-
|
|
127
|
-
|
|
72
|
+
// Testing
|
|
73
|
+
"orta.vscode-jest",
|
|
74
|
+
"ms-vscode.test-adapter-converter",
|
|
128
75
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
76
|
+
// Git
|
|
77
|
+
"mhutchie.git-graph",
|
|
78
|
+
"eamodio.gitlens",
|
|
79
|
+
"github.vscode-pull-request-github",
|
|
80
|
+
"github.copilot",
|
|
81
|
+
"github.copilot-chat"
|
|
82
|
+
],
|
|
83
|
+
"settings": {
|
|
84
|
+
"terminal.integrated.defaultProfile.linux": "bash",
|
|
85
|
+
"typescript.preferences.includePackageJsonAutoImports": "auto",
|
|
86
|
+
"editor.formatOnSave": true,
|
|
87
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
88
|
+
"editor.codeActionsOnSave": {
|
|
89
|
+
"source.fixAll.eslint": "explicit",
|
|
90
|
+
"source.organizeImports": "explicit"
|
|
91
|
+
},
|
|
92
|
+
"files.watcherExclude": {
|
|
93
|
+
"**/node_modules/**": true,
|
|
94
|
+
"**/.git/**": true,
|
|
95
|
+
"**/dist/**": true,
|
|
96
|
+
"**/coverage/**": true
|
|
97
|
+
},
|
|
98
|
+
"search.exclude": {
|
|
99
|
+
"**/node_modules": true,
|
|
100
|
+
"**/dist": true,
|
|
101
|
+
"**/coverage": true,
|
|
102
|
+
"**/.yarn": true
|
|
103
|
+
},
|
|
104
|
+
"jest.jestCommandLine": "yarn test",
|
|
105
|
+
"jest.autoRun": "off"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
134
108
|
},
|
|
135
109
|
|
|
136
|
-
//
|
|
137
|
-
"
|
|
138
|
-
"source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached"
|
|
139
|
-
]
|
|
110
|
+
// Post-create command to set up the development environment
|
|
111
|
+
"postCreateCommand": "bash .devcontainer/setup.sh"
|
|
140
112
|
}
|
|
@@ -2,73 +2,46 @@ services:
|
|
|
2
2
|
# PostgreSQL Database
|
|
3
3
|
postgres:
|
|
4
4
|
image: postgres:15-alpine
|
|
5
|
-
container_name: ${PROJECT_NAME:-truday}-postgres
|
|
6
5
|
environment:
|
|
7
|
-
POSTGRES_DB:
|
|
8
|
-
POSTGRES_USER:
|
|
9
|
-
POSTGRES_PASSWORD:
|
|
6
|
+
POSTGRES_DB: idealyst_db
|
|
7
|
+
POSTGRES_USER: postgres
|
|
8
|
+
POSTGRES_PASSWORD: postgres
|
|
10
9
|
ports:
|
|
11
|
-
- "
|
|
10
|
+
- "5432:5432"
|
|
12
11
|
volumes:
|
|
13
12
|
- postgres_data:/var/lib/postgresql/data
|
|
14
|
-
- ../docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
15
|
-
healthcheck:
|
|
16
|
-
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
|
|
17
|
-
interval: 30s
|
|
18
|
-
timeout: 10s
|
|
19
|
-
retries: 5
|
|
20
|
-
networks:
|
|
21
|
-
- idealyst-network
|
|
22
13
|
|
|
23
14
|
# Redis Cache
|
|
24
15
|
redis:
|
|
25
16
|
image: redis:7-alpine
|
|
26
|
-
container_name: ${PROJECT_NAME:-truday}-redis
|
|
27
17
|
ports:
|
|
28
|
-
- "
|
|
18
|
+
- "6379:6379"
|
|
29
19
|
volumes:
|
|
30
20
|
- redis_data:/data
|
|
31
|
-
healthcheck:
|
|
32
|
-
test: ["CMD", "redis-cli", "ping"]
|
|
33
|
-
interval: 30s
|
|
34
|
-
timeout: 10s
|
|
35
|
-
retries: 5
|
|
36
|
-
networks:
|
|
37
|
-
- idealyst-network
|
|
38
21
|
|
|
39
22
|
# Development Service (for devcontainer)
|
|
40
|
-
|
|
23
|
+
app:
|
|
41
24
|
build:
|
|
42
|
-
context:
|
|
25
|
+
context: .
|
|
43
26
|
dockerfile: Dockerfile
|
|
44
|
-
target: dev
|
|
45
|
-
container_name: ${PROJECT_NAME:-truday}-dev
|
|
46
27
|
environment:
|
|
47
28
|
NODE_ENV: development
|
|
29
|
+
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/idealyst_db
|
|
30
|
+
REDIS_URL: redis://redis:6379
|
|
48
31
|
ports:
|
|
49
|
-
- "3000:3000"
|
|
50
|
-
- "3001:3001"
|
|
51
|
-
- "5173:5173"
|
|
52
|
-
- "8080:8080"
|
|
53
|
-
- "19006:19006"
|
|
32
|
+
- "3000:3000"
|
|
33
|
+
- "3001:3001"
|
|
34
|
+
- "5173:5173"
|
|
35
|
+
- "8080:8080"
|
|
36
|
+
- "19006:19006"
|
|
54
37
|
volumes:
|
|
55
|
-
- ..:/
|
|
56
|
-
- /
|
|
57
|
-
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
38
|
+
- ..:/workspace
|
|
39
|
+
- /workspace/node_modules
|
|
58
40
|
depends_on:
|
|
59
|
-
postgres
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
condition: service_healthy
|
|
63
|
-
networks:
|
|
64
|
-
- idealyst-network
|
|
65
|
-
tty: true
|
|
66
|
-
stdin_open: true
|
|
41
|
+
- postgres
|
|
42
|
+
- redis
|
|
43
|
+
command: sleep infinity
|
|
67
44
|
|
|
68
45
|
volumes:
|
|
69
46
|
postgres_data:
|
|
70
47
|
redis_data:
|
|
71
|
-
|
|
72
|
-
networks:
|
|
73
|
-
idealyst-network:
|
|
74
|
-
driver: bridge
|
|
File without changes
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Post-create script for Idealyst dev container
|
|
4
|
-
echo "🚀 Setting up Idealyst development environment..."
|
|
5
|
-
|
|
6
|
-
# Set proper permissions
|
|
7
|
-
sudo chown -R devuser:devuser /app
|
|
8
|
-
|
|
9
|
-
# Make scripts executable
|
|
10
|
-
chmod +x /app/scripts/*.sh
|
|
11
|
-
|
|
12
|
-
# Install dependencies if not already installed
|
|
13
|
-
if [ ! -d "/app/node_modules" ]; then
|
|
14
|
-
echo "📦 Installing dependencies..."
|
|
15
|
-
yarn install
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
# Set up git configuration (if not already set)
|
|
19
|
-
if [ -z "$(git config --global user.name)" ]; then
|
|
20
|
-
echo "⚙️ Please configure git:"
|
|
21
|
-
echo " git config --global user.name \"Your Name\""
|
|
22
|
-
echo " git config --global user.email \"your.email@example.com\""
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
# Create environment file if it doesn't exist
|
|
26
|
-
if [ ! -f "/app/.env" ]; then
|
|
27
|
-
echo "📝 Creating .env file..."
|
|
28
|
-
cat > /app/.env << EOF
|
|
29
|
-
# Database Configuration
|
|
30
|
-
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/idealyst_db
|
|
31
|
-
POSTGRES_DB=idealyst_db
|
|
32
|
-
POSTGRES_USER=postgres
|
|
33
|
-
POSTGRES_PASSWORD=postgres
|
|
34
|
-
|
|
35
|
-
# Redis Configuration
|
|
36
|
-
REDIS_URL=redis://redis:6379
|
|
37
|
-
|
|
38
|
-
# API Configuration
|
|
39
|
-
API_PORT=3001
|
|
40
|
-
JWT_SECRET=your-jwt-secret-here
|
|
41
|
-
|
|
42
|
-
# Web Configuration
|
|
43
|
-
WEB_PORT=3000
|
|
44
|
-
|
|
45
|
-
# Development Configuration
|
|
46
|
-
NODE_ENV=development
|
|
47
|
-
LOG_LEVEL=debug
|
|
48
|
-
|
|
49
|
-
# Project Configuration
|
|
50
|
-
PROJECT_NAME={{packageName}}
|
|
51
|
-
EOF
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
# Wait for database to be ready
|
|
55
|
-
echo "⏳ Waiting for database to be ready..."
|
|
56
|
-
until pg_isready -h postgres -p 5432 -U postgres; do
|
|
57
|
-
echo "Database is unavailable - sleeping"
|
|
58
|
-
sleep 1
|
|
59
|
-
done
|
|
60
|
-
|
|
61
|
-
echo "✅ Database is ready!"
|
|
62
|
-
|
|
63
|
-
# Run database migrations if they exist
|
|
64
|
-
if [ -d "/app/packages" ]; then
|
|
65
|
-
echo "🗄️ Setting up database..."
|
|
66
|
-
|
|
67
|
-
# Check if any package has prisma
|
|
68
|
-
for package_dir in /app/packages/*/; do
|
|
69
|
-
if [ -f "${package_dir}prisma/schema.prisma" ]; then
|
|
70
|
-
echo "Running Prisma setup for $(basename "$package_dir")..."
|
|
71
|
-
cd "$package_dir"
|
|
72
|
-
npx prisma generate
|
|
73
|
-
npx prisma db push
|
|
74
|
-
cd /app
|
|
75
|
-
fi
|
|
76
|
-
done
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
# Set up git hooks if husky is present
|
|
80
|
-
if [ -f "/app/package.json" ] && grep -q "husky" /app/package.json; then
|
|
81
|
-
echo "🐕 Setting up git hooks..."
|
|
82
|
-
yarn husky install
|
|
83
|
-
fi
|
|
84
|
-
|
|
85
|
-
# Create helpful aliases
|
|
86
|
-
echo "⚡ Setting up helpful aliases..."
|
|
87
|
-
cat >> ~/.bashrc << EOF
|
|
88
|
-
|
|
89
|
-
source ~/.bashrc
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
echo "🚀 Setting up Idealyst development environment..."
|
|
4
|
+
|
|
5
|
+
# Install dependencies
|
|
6
|
+
echo "📦 Installing dependencies..."
|
|
7
|
+
yarn install
|
|
8
|
+
|
|
9
|
+
# Create environment file if it doesn't exist
|
|
10
|
+
if [ ! -f ".env" ]; then
|
|
11
|
+
echo "📝 Creating .env file..."
|
|
12
|
+
cat > .env << EOF
|
|
13
|
+
# Database Configuration
|
|
14
|
+
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/idealyst_db
|
|
15
|
+
POSTGRES_DB=idealyst_db
|
|
16
|
+
POSTGRES_USER=postgres
|
|
17
|
+
POSTGRES_PASSWORD=postgres
|
|
18
|
+
|
|
19
|
+
# Redis Configuration
|
|
20
|
+
REDIS_URL=redis://redis:6379
|
|
21
|
+
|
|
22
|
+
# API Configuration
|
|
23
|
+
API_PORT=3001
|
|
24
|
+
JWT_SECRET=your-jwt-secret-here
|
|
25
|
+
|
|
26
|
+
# Web Configuration
|
|
27
|
+
WEB_PORT=3000
|
|
28
|
+
|
|
29
|
+
# Development Configuration
|
|
30
|
+
NODE_ENV=development
|
|
31
|
+
LOG_LEVEL=debug
|
|
32
|
+
|
|
33
|
+
# Project Configuration
|
|
34
|
+
PROJECT_NAME={{packageName}}
|
|
35
|
+
EOF
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Wait for database to be ready
|
|
39
|
+
echo "⏳ Waiting for database to be ready..."
|
|
40
|
+
until pg_isready -h postgres -p 5432 -U postgres; do
|
|
41
|
+
echo "Database is unavailable - sleeping"
|
|
42
|
+
sleep 1
|
|
43
|
+
done
|
|
44
|
+
|
|
45
|
+
echo "✅ Database is ready!"
|
|
46
|
+
|
|
47
|
+
# Run database migrations if they exist
|
|
48
|
+
if [ -d "packages" ]; then
|
|
49
|
+
echo "🗄️ Setting up database..."
|
|
50
|
+
|
|
51
|
+
# Check if any package has prisma
|
|
52
|
+
for package_dir in packages/*/; do
|
|
53
|
+
if [ -f "${package_dir}prisma/schema.prisma" ]; then
|
|
54
|
+
echo "Running Prisma setup for $(basename "$package_dir")..."
|
|
55
|
+
cd "$package_dir"
|
|
56
|
+
npx prisma generate
|
|
57
|
+
npx prisma db push
|
|
58
|
+
cd /workspace
|
|
59
|
+
fi
|
|
60
|
+
done
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
echo "✅ Development environment is ready!"
|
|
64
|
+
echo "🎉 You can now start developing your Idealyst application!"
|