@idealyst/cli 1.0.33 → 1.0.35
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/templates/api/README.md +207 -0
- package/dist/templates/api/__tests__/api.test.ts +26 -0
- package/dist/templates/api/env.example +12 -0
- package/dist/templates/api/jest.config.js +23 -0
- package/dist/templates/api/jest.setup.js +9 -0
- package/dist/templates/api/package.json +62 -0
- package/dist/templates/api/prisma/schema.prisma +21 -0
- package/dist/templates/api/src/context.ts +23 -0
- package/dist/templates/api/src/controllers/UserController.ts +102 -0
- package/dist/templates/api/src/index.ts +14 -0
- package/dist/templates/api/src/lib/controller.ts +90 -0
- package/dist/templates/api/src/lib/middleware.ts +170 -0
- package/dist/templates/api/src/middleware/auth.ts +75 -0
- package/dist/templates/api/src/middleware/common.ts +103 -0
- package/dist/templates/api/src/router/index.ts +130 -0
- package/dist/templates/api/src/server.ts +50 -0
- package/dist/templates/api/src/trpc.ts +28 -0
- package/dist/templates/api/tsconfig.json +44 -0
- package/dist/templates/native/.yarnrc.yml +19 -0
- package/dist/templates/native/App.tsx +23 -0
- package/dist/templates/native/README.md +86 -0
- package/dist/templates/native/__tests__/App.test.tsx +156 -0
- package/dist/templates/native/__tests__/components.test.tsx +300 -0
- package/dist/templates/native/app.json +5 -0
- package/dist/templates/native/babel.config.js +10 -0
- package/dist/templates/native/index.js +6 -0
- package/dist/templates/native/jest.config.js +21 -0
- package/dist/templates/native/jest.setup.js +12 -0
- package/dist/templates/native/metro.config.js +27 -0
- package/dist/templates/native/package.json +44 -0
- package/dist/templates/native/src/App-with-trpc.tsx +59 -0
- package/dist/templates/native/src/utils/trpc.ts +127 -0
- package/dist/templates/native/tsconfig.json +30 -0
- package/dist/templates/shared/README.md +109 -0
- package/dist/templates/shared/__tests__/shared.test.ts +39 -0
- package/dist/templates/shared/jest.config.js +22 -0
- package/dist/templates/shared/package.json +50 -0
- package/dist/templates/shared/rollup.config.js +43 -0
- package/dist/templates/shared/src/index.ts +1 -0
- package/dist/templates/shared/tsconfig.json +25 -0
- package/dist/templates/web/README.md +90 -0
- package/dist/templates/web/__tests__/App.test.tsx +342 -0
- package/dist/templates/web/__tests__/components.test.tsx +564 -0
- package/dist/templates/web/index.html +13 -0
- package/dist/templates/web/jest.config.js +27 -0
- package/dist/templates/web/jest.setup.js +24 -0
- package/dist/templates/web/package.json +66 -0
- package/dist/templates/web/src/App-with-trpc.tsx +67 -0
- package/dist/templates/web/src/App.tsx +15 -0
- package/dist/templates/web/src/main.tsx +25 -0
- package/dist/templates/web/src/utils/trpc.ts +93 -0
- package/dist/templates/web/tsconfig.json +27 -0
- package/dist/templates/web/vite.config.ts +69 -0
- package/dist/templates/workspace/.devcontainer/devcontainer.json +140 -0
- package/dist/templates/workspace/.devcontainer/docker-compose.yml +74 -0
- package/dist/templates/workspace/.dockerignore +151 -0
- package/dist/templates/workspace/.env.example +36 -0
- package/dist/templates/workspace/.env.production +56 -0
- package/dist/templates/workspace/.yarnrc.yml +26 -0
- package/dist/templates/workspace/DOCKER.md +0 -0
- package/dist/templates/workspace/Dockerfile +93 -0
- package/dist/templates/workspace/README.md +179 -0
- package/dist/templates/workspace/docker/nginx/prod.conf +238 -0
- package/dist/templates/workspace/docker/nginx.conf +131 -0
- package/dist/templates/workspace/docker/postgres/init.sql +41 -0
- package/dist/templates/workspace/docker/prometheus/prometheus.yml +52 -0
- package/dist/templates/workspace/docker-compose.prod.yml +146 -0
- package/dist/templates/workspace/docker-compose.yml +144 -0
- package/dist/templates/workspace/jest.config.js +20 -0
- package/dist/templates/workspace/package.json +35 -0
- package/dist/templates/workspace/scripts/docker/db-backup.sh +230 -0
- package/dist/templates/workspace/scripts/docker/deploy.sh +212 -0
- package/dist/templates/workspace/scripts/docker-build.sh +151 -0
- package/dist/templates/workspace/scripts/test-runner.js +120 -0
- package/dist/templates/workspace/setup.sh +205 -0
- package/package.json +3 -2
- package/templates/workspace/.devcontainer/Dockerfile +22 -0
- package/templates/workspace/.devcontainer/devcontainer.json +0 -140
- package/templates/workspace/.devcontainer/docker-compose.yml +13 -26
- package/templates/workspace/.devcontainer/setup.sh +64 -0
- package/templates/workspace/Dockerfile +24 -6
- /package/{templates → dist/templates}/workspace/.devcontainer/post-create.sh +0 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Quick setup script for Idealyst workspace
|
|
4
|
+
# Usage: ./setup.sh [development|production]
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
ENVIRONMENT=${1:-development}
|
|
9
|
+
PROJECT_NAME="{{packageName}}"
|
|
10
|
+
|
|
11
|
+
echo "🚀 Setting up Idealyst workspace..."
|
|
12
|
+
echo "Environment: $ENVIRONMENT"
|
|
13
|
+
echo "Project: $PROJECT_NAME"
|
|
14
|
+
echo ""
|
|
15
|
+
|
|
16
|
+
# Function to generate random password
|
|
17
|
+
generate_password() {
|
|
18
|
+
openssl rand -base64 32 | tr -d "=+/" | cut -c1-25
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Function to generate JWT secret
|
|
22
|
+
generate_jwt_secret() {
|
|
23
|
+
openssl rand -base64 64 | tr -d "=+/" | cut -c1-50
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# Function to setup development environment
|
|
27
|
+
setup_development() {
|
|
28
|
+
echo "🔧 Setting up development environment..."
|
|
29
|
+
|
|
30
|
+
if [ ! -f ".env" ]; then
|
|
31
|
+
echo "📝 Creating .env from template..."
|
|
32
|
+
cp .env.example .env
|
|
33
|
+
echo "✅ Created .env file"
|
|
34
|
+
else
|
|
35
|
+
echo "⚠️ .env file already exists, skipping..."
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
echo ""
|
|
39
|
+
echo "🐳 Starting development containers..."
|
|
40
|
+
if command -v docker-compose &> /dev/null; then
|
|
41
|
+
docker-compose up -d postgres redis
|
|
42
|
+
echo "✅ Database and Redis started"
|
|
43
|
+
|
|
44
|
+
echo "⏳ Waiting for services to be ready..."
|
|
45
|
+
sleep 10
|
|
46
|
+
|
|
47
|
+
echo "🚀 Starting development environment..."
|
|
48
|
+
echo "💡 You can now:"
|
|
49
|
+
echo " - Run 'docker-compose up -d dev' for full dev container"
|
|
50
|
+
echo " - Run 'yarn dev' for local development"
|
|
51
|
+
echo " - Open in VS Code and select 'Reopen in Container'"
|
|
52
|
+
else
|
|
53
|
+
echo "❌ Docker Compose not found. Please install Docker and Docker Compose."
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
# Function to setup production environment
|
|
59
|
+
setup_production() {
|
|
60
|
+
echo "🏭 Setting up production environment..."
|
|
61
|
+
|
|
62
|
+
if [ ! -f ".env" ]; then
|
|
63
|
+
echo "📝 Creating .env from production template..."
|
|
64
|
+
cp .env.production .env
|
|
65
|
+
|
|
66
|
+
# Generate secure passwords and secrets
|
|
67
|
+
echo "🔐 Generating secure credentials..."
|
|
68
|
+
|
|
69
|
+
DB_PASSWORD=$(generate_password)
|
|
70
|
+
JWT_SECRET=$(generate_jwt_secret)
|
|
71
|
+
SESSION_SECRET=$(generate_jwt_secret)
|
|
72
|
+
ENCRYPTION_KEY=$(openssl rand -base64 32 | cut -c1-32)
|
|
73
|
+
GRAFANA_PASSWORD=$(generate_password)
|
|
74
|
+
|
|
75
|
+
# Replace placeholders in .env file
|
|
76
|
+
sed -i "s/CHANGE_THIS_STRONG_PASSWORD/$DB_PASSWORD/g" .env
|
|
77
|
+
sed -i "s/CHANGE_THIS_VERY_STRONG_JWT_SECRET_MINIMUM_32_CHARACTERS/$JWT_SECRET/g" .env
|
|
78
|
+
sed -i "s/CHANGE_THIS_VERY_STRONG_SESSION_SECRET/$SESSION_SECRET/g" .env
|
|
79
|
+
sed -i "s/CHANGE_THIS_32_CHARACTER_ENCRYPTION_KEY/$ENCRYPTION_KEY/g" .env
|
|
80
|
+
sed -i "s/CHANGE_THIS_STRONG_PASSWORD/$GRAFANA_PASSWORD/g" .env
|
|
81
|
+
|
|
82
|
+
echo "✅ Created .env with secure credentials"
|
|
83
|
+
echo ""
|
|
84
|
+
echo "🔐 Generated Credentials (save these securely!):"
|
|
85
|
+
echo " Database Password: $DB_PASSWORD"
|
|
86
|
+
echo " JWT Secret: $JWT_SECRET"
|
|
87
|
+
echo " Grafana Password: $GRAFANA_PASSWORD"
|
|
88
|
+
echo ""
|
|
89
|
+
echo "⚠️ IMPORTANT: Edit .env to configure your domain and other settings!"
|
|
90
|
+
|
|
91
|
+
else
|
|
92
|
+
echo "⚠️ .env file already exists. Please verify production settings."
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
echo ""
|
|
96
|
+
echo "📋 Production Checklist:"
|
|
97
|
+
echo " [ ] Edit .env with your domain name"
|
|
98
|
+
echo " [ ] Configure SSL certificates"
|
|
99
|
+
echo " [ ] Set up DNS records"
|
|
100
|
+
echo " [ ] Configure firewall rules"
|
|
101
|
+
echo " [ ] Set up monitoring (optional)"
|
|
102
|
+
echo ""
|
|
103
|
+
echo "🚀 Deploy with: ./scripts/docker/deploy.sh production"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# Function to check prerequisites
|
|
107
|
+
check_prerequisites() {
|
|
108
|
+
echo "🔍 Checking prerequisites..."
|
|
109
|
+
|
|
110
|
+
# Check Docker
|
|
111
|
+
if ! command -v docker &> /dev/null; then
|
|
112
|
+
echo "❌ Docker not found. Please install Docker."
|
|
113
|
+
exit 1
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# Check Docker Compose
|
|
117
|
+
if ! command -v docker-compose &> /dev/null; then
|
|
118
|
+
echo "❌ Docker Compose not found. Please install Docker Compose."
|
|
119
|
+
exit 1
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Check if Docker is running
|
|
123
|
+
if ! docker info &> /dev/null; then
|
|
124
|
+
echo "❌ Docker is not running. Please start Docker."
|
|
125
|
+
exit 1
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
echo "✅ Prerequisites check passed"
|
|
129
|
+
echo ""
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
# Function to show post-setup instructions
|
|
133
|
+
show_instructions() {
|
|
134
|
+
echo ""
|
|
135
|
+
echo "🎉 Setup complete!"
|
|
136
|
+
echo ""
|
|
137
|
+
echo "Next steps:"
|
|
138
|
+
|
|
139
|
+
if [ "$ENVIRONMENT" = "development" ]; then
|
|
140
|
+
echo " 1. Install dependencies: yarn install"
|
|
141
|
+
echo " 2. Start development:"
|
|
142
|
+
echo " - Full container: docker-compose up -d dev"
|
|
143
|
+
echo " - VS Code: Open in Container"
|
|
144
|
+
echo " - Local: yarn dev"
|
|
145
|
+
echo " 3. Access your app:"
|
|
146
|
+
echo " - Web: http://localhost:3000"
|
|
147
|
+
echo " - API: http://localhost:3001"
|
|
148
|
+
echo " - Database: postgresql://postgres:postgres@localhost:5432/idealyst_db"
|
|
149
|
+
else
|
|
150
|
+
echo " 1. Edit .env with your production settings"
|
|
151
|
+
echo " 2. Configure SSL certificates"
|
|
152
|
+
echo " 3. Deploy: ./scripts/docker/deploy.sh production"
|
|
153
|
+
echo " 4. Set up monitoring (optional)"
|
|
154
|
+
fi
|
|
155
|
+
|
|
156
|
+
echo ""
|
|
157
|
+
echo "📚 Documentation:"
|
|
158
|
+
echo " - DOCKER.md - Complete Docker guide"
|
|
159
|
+
echo " - TESTING.md - Testing documentation"
|
|
160
|
+
echo " - README.md - General workspace info"
|
|
161
|
+
echo ""
|
|
162
|
+
echo "🆘 Need help? Check the documentation or run:"
|
|
163
|
+
echo " ./scripts/docker/deploy.sh --help"
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
# Main setup process
|
|
167
|
+
main() {
|
|
168
|
+
check_prerequisites
|
|
169
|
+
|
|
170
|
+
case $ENVIRONMENT in
|
|
171
|
+
"development"|"dev")
|
|
172
|
+
setup_development
|
|
173
|
+
;;
|
|
174
|
+
"production"|"prod")
|
|
175
|
+
setup_production
|
|
176
|
+
;;
|
|
177
|
+
*)
|
|
178
|
+
echo "❌ Invalid environment. Use 'development' or 'production'"
|
|
179
|
+
echo "Usage: $0 [development|production]"
|
|
180
|
+
exit 1
|
|
181
|
+
;;
|
|
182
|
+
esac
|
|
183
|
+
|
|
184
|
+
show_instructions
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
# Handle help
|
|
188
|
+
if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "help" ]]; then
|
|
189
|
+
echo "Idealyst Workspace Setup Script"
|
|
190
|
+
echo ""
|
|
191
|
+
echo "Usage: $0 [environment]"
|
|
192
|
+
echo ""
|
|
193
|
+
echo "Environments:"
|
|
194
|
+
echo " development (default) - Set up for local development"
|
|
195
|
+
echo " production - Set up for production deployment"
|
|
196
|
+
echo ""
|
|
197
|
+
echo "Examples:"
|
|
198
|
+
echo " $0 # Development setup"
|
|
199
|
+
echo " $0 development # Development setup"
|
|
200
|
+
echo " $0 production # Production setup"
|
|
201
|
+
echo ""
|
|
202
|
+
exit 0
|
|
203
|
+
fi
|
|
204
|
+
|
|
205
|
+
main
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"description": "CLI tool for generating Idealyst Framework projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "tsc",
|
|
21
|
+
"build": "tsc && npm run copy-templates",
|
|
22
|
+
"copy-templates": "cp -r templates dist/",
|
|
22
23
|
"test": "jest",
|
|
23
24
|
"test:integration": "jest __tests__/integration.test.ts",
|
|
24
25
|
"dev": "tsc --watch",
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
# Set working directory
|
|
13
|
+
WORKDIR /workspace
|
|
14
|
+
|
|
15
|
+
# Install global tools that might be useful
|
|
16
|
+
RUN npm install -g @expo/cli
|
|
17
|
+
|
|
18
|
+
# Set up git (will be configured in setup script)
|
|
19
|
+
RUN git config --global init.defaultBranch main
|
|
20
|
+
|
|
21
|
+
# Keep container running
|
|
22
|
+
CMD ["sleep", "infinity"]
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Idealyst Development Environment",
|
|
3
|
-
"dockerComposeFile": ["./docker-compose.yml"],
|
|
4
|
-
"service": "dev",
|
|
5
|
-
"workspaceFolder": "/app",
|
|
6
|
-
"shutdownAction": "stopCompose",
|
|
7
|
-
|
|
8
|
-
// VS Code configuration
|
|
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
|
|
86
|
-
"forwardPorts": [
|
|
87
|
-
3000, // Web dev server
|
|
88
|
-
3001, // API server
|
|
89
|
-
5173, // Vite dev server
|
|
90
|
-
8080, // Additional dev server
|
|
91
|
-
19006, // Expo dev tools
|
|
92
|
-
5432, // PostgreSQL
|
|
93
|
-
6379 // Redis
|
|
94
|
-
],
|
|
95
|
-
|
|
96
|
-
"portsAttributes": {
|
|
97
|
-
"3000": {
|
|
98
|
-
"label": "Web App",
|
|
99
|
-
"onAutoForward": "openBrowser"
|
|
100
|
-
},
|
|
101
|
-
"3001": {
|
|
102
|
-
"label": "API Server",
|
|
103
|
-
"onAutoForward": "silent"
|
|
104
|
-
},
|
|
105
|
-
"5173": {
|
|
106
|
-
"label": "Vite Dev Server",
|
|
107
|
-
"onAutoForward": "openBrowser"
|
|
108
|
-
},
|
|
109
|
-
"19006": {
|
|
110
|
-
"label": "Expo Dev Tools",
|
|
111
|
-
"onAutoForward": "openBrowser"
|
|
112
|
-
},
|
|
113
|
-
"5432": {
|
|
114
|
-
"label": "PostgreSQL",
|
|
115
|
-
"onAutoForward": "silent"
|
|
116
|
-
},
|
|
117
|
-
"6379": {
|
|
118
|
-
"label": "Redis",
|
|
119
|
-
"onAutoForward": "silent"
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
// Post-create commands
|
|
124
|
-
"postCreateCommand": "bash .devcontainer/post-create.sh",
|
|
125
|
-
|
|
126
|
-
// Development user
|
|
127
|
-
"remoteUser": "devuser",
|
|
128
|
-
|
|
129
|
-
// Environment variables
|
|
130
|
-
"remoteEnv": {
|
|
131
|
-
"NODE_ENV": "development",
|
|
132
|
-
"DATABASE_URL": "postgresql://postgres:postgres@postgres:5432/idealyst_db",
|
|
133
|
-
"REDIS_URL": "redis://redis:6379"
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
// Mount the workspace with proper permissions
|
|
137
|
-
"mounts": [
|
|
138
|
-
"source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached"
|
|
139
|
-
]
|
|
140
|
-
}
|
|
@@ -2,7 +2,7 @@ services:
|
|
|
2
2
|
# PostgreSQL Database
|
|
3
3
|
postgres:
|
|
4
4
|
image: postgres:15-alpine
|
|
5
|
-
container_name: ${PROJECT_NAME:-
|
|
5
|
+
container_name: ${PROJECT_NAME:-idealyst}-postgres
|
|
6
6
|
environment:
|
|
7
7
|
POSTGRES_DB: ${POSTGRES_DB:-idealyst_db}
|
|
8
8
|
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
|
@@ -11,40 +11,30 @@ services:
|
|
|
11
11
|
- "${POSTGRES_PORT:-5432}:5432"
|
|
12
12
|
volumes:
|
|
13
13
|
- 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
14
|
networks:
|
|
21
15
|
- idealyst-network
|
|
22
16
|
|
|
23
17
|
# Redis Cache
|
|
24
18
|
redis:
|
|
25
19
|
image: redis:7-alpine
|
|
26
|
-
container_name: ${PROJECT_NAME:-
|
|
20
|
+
container_name: ${PROJECT_NAME:-idealyst}-redis
|
|
27
21
|
ports:
|
|
28
22
|
- "${REDIS_PORT:-6379}:6379"
|
|
29
23
|
volumes:
|
|
30
24
|
- redis_data:/data
|
|
31
|
-
healthcheck:
|
|
32
|
-
test: ["CMD", "redis-cli", "ping"]
|
|
33
|
-
interval: 30s
|
|
34
|
-
timeout: 10s
|
|
35
|
-
retries: 5
|
|
36
25
|
networks:
|
|
37
26
|
- idealyst-network
|
|
38
27
|
|
|
39
28
|
# Development Service (for devcontainer)
|
|
40
|
-
|
|
29
|
+
app:
|
|
41
30
|
build:
|
|
42
31
|
context: ..
|
|
43
|
-
dockerfile: Dockerfile
|
|
44
|
-
|
|
45
|
-
container_name: ${PROJECT_NAME:-truday}-dev
|
|
32
|
+
dockerfile: .devcontainer/Dockerfile
|
|
33
|
+
container_name: ${PROJECT_NAME:-idealyst}-app
|
|
46
34
|
environment:
|
|
47
35
|
NODE_ENV: development
|
|
36
|
+
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/idealyst_db
|
|
37
|
+
REDIS_URL: redis://redis:6379
|
|
48
38
|
ports:
|
|
49
39
|
- "3000:3000" # Web dev server
|
|
50
40
|
- "3001:3001" # API dev server
|
|
@@ -52,22 +42,19 @@ services:
|
|
|
52
42
|
- "8080:8080" # Additional dev server
|
|
53
43
|
- "19006:19006" # Expo dev tools
|
|
54
44
|
volumes:
|
|
55
|
-
- ..:/
|
|
56
|
-
- /
|
|
57
|
-
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
45
|
+
- ..:/workspace
|
|
46
|
+
- node_modules:/workspace/node_modules
|
|
58
47
|
depends_on:
|
|
59
|
-
postgres
|
|
60
|
-
|
|
61
|
-
redis:
|
|
62
|
-
condition: service_healthy
|
|
48
|
+
- postgres
|
|
49
|
+
- redis
|
|
63
50
|
networks:
|
|
64
51
|
- idealyst-network
|
|
65
|
-
|
|
66
|
-
stdin_open: true
|
|
52
|
+
command: sleep infinity
|
|
67
53
|
|
|
68
54
|
volumes:
|
|
69
55
|
postgres_data:
|
|
70
56
|
redis_data:
|
|
57
|
+
node_modules:
|
|
71
58
|
|
|
72
59
|
networks:
|
|
73
60
|
idealyst-network:
|
|
@@ -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!"
|
|
@@ -66,16 +66,34 @@ CMD ["nginx", "-g", "daemon off;"]
|
|
|
66
66
|
# Development stage - for use with dev containers
|
|
67
67
|
FROM base AS dev
|
|
68
68
|
|
|
69
|
+
# Install additional tools for development
|
|
70
|
+
RUN apt-get update && apt-get install -y \
|
|
71
|
+
sudo \
|
|
72
|
+
postgresql-client \
|
|
73
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
74
|
+
|
|
75
|
+
# Create dev user with proper permissions
|
|
76
|
+
RUN groupadd --gid 1000 devuser \
|
|
77
|
+
&& useradd --uid 1000 --gid devuser --shell /bin/bash --create-home devuser \
|
|
78
|
+
&& echo 'devuser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
79
|
+
|
|
80
|
+
# Set up workspace directory with proper ownership
|
|
81
|
+
RUN mkdir -p /app && chown -R devuser:devuser /app
|
|
82
|
+
|
|
83
|
+
# Switch to dev user for remaining setup
|
|
84
|
+
USER devuser
|
|
85
|
+
WORKDIR /app
|
|
86
|
+
|
|
69
87
|
# Copy package files
|
|
70
|
-
COPY package.json yarn.lock .yarnrc.yml ./
|
|
71
|
-
COPY .yarn .yarn
|
|
88
|
+
COPY --chown=devuser:devuser package.json yarn.lock .yarnrc.yml ./
|
|
89
|
+
COPY --chown=devuser:devuser .yarn .yarn
|
|
72
90
|
|
|
73
91
|
# Create packages directory structure and copy package.json files
|
|
74
92
|
RUN mkdir -p packages/api packages/app packages/components packages/web
|
|
75
|
-
COPY packages/api/package.json ./packages/api/
|
|
76
|
-
COPY packages/app/package.json ./packages/app/
|
|
77
|
-
COPY packages/components/package.json ./packages/components/
|
|
78
|
-
COPY packages/web/package.json ./packages/web/
|
|
93
|
+
COPY --chown=devuser:devuser packages/api/package.json ./packages/api/
|
|
94
|
+
COPY --chown=devuser:devuser packages/app/package.json ./packages/app/
|
|
95
|
+
COPY --chown=devuser:devuser packages/components/package.json ./packages/components/
|
|
96
|
+
COPY --chown=devuser:devuser packages/web/package.json ./packages/web/
|
|
79
97
|
|
|
80
98
|
# Install dependencies including dev dependencies
|
|
81
99
|
RUN yarn install
|
|
File without changes
|