@idealyst/cli 1.0.31 → 1.0.33

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAC1B,8CAAqD;AAErD,8CAA4H;AAE5H,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,qDAAqD,CAAC;KAClE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,uBAAuB,CAAC;KAChC,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,2CAA2C,CAAC;KACxE,MAAM,CAAC,6BAA6B,EAAE,kBAAkB,EAAE,GAAG,CAAC;KAC9D,MAAM,CAAC,2BAA2B,EAAE,uDAAuD,CAAC;KAC5F,MAAM,CAAC,aAAa,EAAE,8DAA8D,CAAC;KACrF,MAAM,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;KACxD,MAAM,CAAC,KAAK,EAAE,WAA+B,EAAE,OAM/C,EAAE,EAAE;IACH,IAAI,CAAC;QACH,0CAA0C;QAC1C,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,MAAM,IAAA,4BAAoB,GAAE,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,iCAAiC;YACjC,MAAM,EAAE,mBAAmB,EAAE,GAAG,wDAAa,oBAAoB,GAAC,CAAC;YACnE,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;gBACpD,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC,CA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AE,KAAK,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@idealyst/cli",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "CLI tool for generating Idealyst Framework projects",
5
- "type": "module",
6
5
  "main": "dist/index.js",
7
6
  "bin": {
8
7
  "idealyst": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Idealyst Development Environment",
3
- "dockerComposeFile": ["../docker-compose.yml"],
3
+ "dockerComposeFile": ["./docker-compose.yml"],
4
4
  "service": "dev",
5
5
  "workspaceFolder": "/app",
6
6
  "shutdownAction": "stopCompose",
@@ -13,8 +13,8 @@
13
13
  "typescript.preferences.includePackageJsonAutoImports": "auto",
14
14
  "editor.formatOnSave": true,
15
15
  "editor.codeActionsOnSave": {
16
- "source.fixAll.eslint": true,
17
- "source.organizeImports": true
16
+ "source.fixAll.eslint": "explicit",
17
+ "source.organizeImports": "explicit"
18
18
  },
19
19
  "files.watcherExclude": {
20
20
  "**/node_modules/**": true,
@@ -65,11 +65,6 @@
65
65
 
66
66
  // Development container features
67
67
  "features": {
68
- "ghcr.io/devcontainers/features/node:1": {
69
- "version": "20",
70
- "nodeGypDependencies": true,
71
- "installYarnUsingApt": true
72
- },
73
68
  "ghcr.io/devcontainers/features/git:1": {
74
69
  "ppa": true,
75
70
  "version": "latest"
@@ -77,10 +72,6 @@
77
72
  "ghcr.io/devcontainers/features/github-cli:1": {
78
73
  "version": "latest"
79
74
  },
80
- "ghcr.io/devcontainers/features/docker-in-docker:2": {
81
- "moby": true,
82
- "dockerDashComposeVersion": "v2"
83
- },
84
75
  "ghcr.io/devcontainers/features/common-utils:2": {
85
76
  "installZsh": true,
86
77
  "configureZshAsDefaultShell": true,
@@ -144,7 +135,6 @@
144
135
 
145
136
  // Mount the workspace with proper permissions
146
137
  "mounts": [
147
- "source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached",
148
- "source=idealyst-node-modules,target=/app/node_modules,type=volume"
138
+ "source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached"
149
139
  ]
150
140
  }
@@ -0,0 +1,74 @@
1
+ services:
2
+ # PostgreSQL Database
3
+ postgres:
4
+ image: postgres:15-alpine
5
+ container_name: ${PROJECT_NAME:-truday}-postgres
6
+ environment:
7
+ POSTGRES_DB: ${POSTGRES_DB:-idealyst_db}
8
+ POSTGRES_USER: ${POSTGRES_USER:-postgres}
9
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
10
+ ports:
11
+ - "${POSTGRES_PORT:-5432}:5432"
12
+ volumes:
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
+ networks:
21
+ - idealyst-network
22
+
23
+ # Redis Cache
24
+ redis:
25
+ image: redis:7-alpine
26
+ container_name: ${PROJECT_NAME:-truday}-redis
27
+ ports:
28
+ - "${REDIS_PORT:-6379}:6379"
29
+ volumes:
30
+ - 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
+
39
+ # Development Service (for devcontainer)
40
+ dev:
41
+ build:
42
+ context: ..
43
+ dockerfile: Dockerfile
44
+ target: dev
45
+ container_name: ${PROJECT_NAME:-truday}-dev
46
+ environment:
47
+ NODE_ENV: development
48
+ ports:
49
+ - "3000:3000" # Web dev server
50
+ - "3001:3001" # API dev server
51
+ - "5173:5173" # Vite dev server
52
+ - "8080:8080" # Additional dev server
53
+ - "19006:19006" # Expo dev tools
54
+ volumes:
55
+ - ..:/app
56
+ - /app/node_modules
57
+ - /var/run/docker.sock:/var/run/docker.sock:ro
58
+ depends_on:
59
+ postgres:
60
+ condition: service_healthy
61
+ redis:
62
+ condition: service_healthy
63
+ networks:
64
+ - idealyst-network
65
+ tty: true
66
+ stdin_open: true
67
+
68
+ volumes:
69
+ postgres_data:
70
+ redis_data:
71
+
72
+ networks:
73
+ idealyst-network:
74
+ driver: bridge
@@ -86,47 +86,4 @@ fi
86
86
  echo "⚡ Setting up helpful aliases..."
87
87
  cat >> ~/.bashrc << EOF
88
88
 
89
- # Idealyst Development Aliases
90
- alias dev-web='cd /app && yarn workspace web dev'
91
- alias dev-api='cd /app && yarn workspace api dev'
92
- alias test-all='cd /app && yarn test'
93
- alias build-all='cd /app && yarn build:all'
94
- alias lint-all='cd /app && yarn lint:all'
95
-
96
- # Docker aliases
97
- alias dc='docker-compose'
98
- alias dcu='docker-compose up'
99
- alias dcd='docker-compose down'
100
- alias dcl='docker-compose logs'
101
-
102
- # Git aliases
103
- alias gs='git status'
104
- alias ga='git add'
105
- alias gc='git commit'
106
- alias gp='git push'
107
- alias gl='git pull'
108
-
109
- echo "🎉 Idealyst development environment is ready!"
110
- echo ""
111
- echo "Available commands:"
112
- echo " dev-web - Start web development server"
113
- echo " dev-api - Start API development server"
114
- echo " test-all - Run all tests"
115
- echo " build-all - Build all packages"
116
- echo " lint-all - Lint all packages"
117
- echo ""
118
- echo "Database: postgresql://postgres:postgres@postgres:5432/idealyst_db"
119
- echo "Redis: redis://redis:6379"
120
- echo ""
121
- EOF
122
-
123
- source ~/.bashrc
124
-
125
- echo "🎉 Development environment setup complete!"
126
- echo ""
127
- echo "Quick start:"
128
- echo " 1. Run 'dev-web' to start the web development server"
129
- echo " 2. Run 'dev-api' to start the API server"
130
- echo " 3. Open http://localhost:3000 to view your app"
131
- echo ""
132
- echo "Happy coding! 🚀"
89
+ source ~/.bashrc
@@ -1,398 +0,0 @@
1
- # Docker Configuration Guide
2
-
3
- This workspace includes comprehensive Docker support for development, staging, and production environments.
4
-
5
- ## Quick Start
6
-
7
- ### Development Environment
8
- ```bash
9
- # Copy environment file
10
- cp .env.example .env
11
-
12
- # Start development environment
13
- ./scripts/docker/deploy.sh development
14
-
15
- # Or use Docker Compose directly
16
- docker-compose up -d dev
17
- ```
18
-
19
- ### Production Deployment
20
- ```bash
21
- # Copy and configure production environment
22
- cp .env.production .env
23
- # Edit .env with your production settings
24
-
25
- # Deploy to production
26
- ./scripts/docker/deploy.sh production
27
- ```
28
-
29
- ## Architecture
30
-
31
- ### Services Overview
32
- - **postgres**: PostgreSQL database with initialization scripts
33
- - **redis**: Redis cache for sessions and caching
34
- - **api**: Backend API service
35
- - **web**: Frontend web application
36
- - **nginx**: Reverse proxy and load balancer (production)
37
- - **dev**: Development container with all tools
38
- - **test**: Test runner container
39
-
40
- ### Development vs Production
41
-
42
- #### Development
43
- - Single container with all development tools
44
- - File watching and hot reload
45
- - Debug logging enabled
46
- - Development database
47
-
48
- #### Production
49
- - Multi-container architecture
50
- - Optimized builds
51
- - Load balancing with Nginx
52
- - Health checks and monitoring
53
- - Secure configurations
54
-
55
- ## File Structure
56
-
57
- ```
58
- workspace/
59
- ├── Dockerfile # Multi-stage Dockerfile
60
- ├── docker-compose.yml # Main compose configuration
61
- ├── docker-compose.prod.yml # Production overrides
62
- ├── .dockerignore # Build context exclusions
63
- ├── .env.example # Development environment template
64
- ├── .env.production # Production environment template
65
- ├── .devcontainer/ # VS Code dev container config
66
- │ ├── devcontainer.json
67
- │ └── post-create.sh
68
- ├── docker/ # Docker configuration files
69
- │ ├── nginx.conf # Development nginx config
70
- │ ├── nginx/
71
- │ │ └── prod.conf # Production nginx config
72
- │ ├── postgres/
73
- │ │ └── init.sql # Database initialization
74
- │ └── prometheus/
75
- │ └── prometheus.yml # Monitoring configuration
76
- └── scripts/docker/ # Management scripts
77
- ├── deploy.sh # Deployment script
78
- └── db-backup.sh # Database backup/restore
79
- ```
80
-
81
- ## Environment Configuration
82
-
83
- ### Required Environment Variables
84
-
85
- ```bash
86
- # Project
87
- PROJECT_NAME=your-project-name
88
-
89
- # Database
90
- POSTGRES_DB=your_database
91
- POSTGRES_USER=your_user
92
- POSTGRES_PASSWORD=strong_password
93
-
94
- # API
95
- JWT_SECRET=very_strong_jwt_secret
96
- API_PORT=3001
97
-
98
- # Web
99
- WEB_PORT=80
100
- ```
101
-
102
- ### Security Considerations
103
-
104
- For production, ensure you:
105
- 1. Change all default passwords
106
- 2. Use strong, unique secrets
107
- 3. Configure SSL certificates
108
- 4. Set up proper firewall rules
109
- 5. Enable monitoring and logging
110
-
111
- ## Development Container
112
-
113
- ### VS Code Integration
114
-
115
- The workspace includes a complete VS Code dev container configuration:
116
-
117
- 1. **Open in VS Code**: Use "Reopen in Container" when prompted
118
- 2. **Automatic Setup**: Dependencies and tools are installed automatically
119
- 3. **Database**: PostgreSQL and Redis are available immediately
120
- 4. **Port Forwarding**: All development ports are automatically forwarded
121
-
122
- ### Features Included
123
- - Node.js 20 with Yarn
124
- - TypeScript and development tools
125
- - Git and GitHub CLI
126
- - Docker-in-Docker support
127
- - VS Code extensions for React, TypeScript, and more
128
-
129
- ### Manual Setup
130
- ```bash
131
- # Start dev container
132
- docker-compose up -d dev
133
-
134
- # Access the container
135
- docker-compose exec dev bash
136
-
137
- # Install dependencies (if not already done)
138
- yarn install
139
-
140
- # Start development servers
141
- yarn dev
142
- ```
143
-
144
- ## Deployment Scripts
145
-
146
- ### Deploy Script (`./scripts/docker/deploy.sh`)
147
-
148
- ```bash
149
- # Development
150
- ./scripts/docker/deploy.sh development
151
-
152
- # Production
153
- ./scripts/docker/deploy.sh production
154
-
155
- # View status
156
- ./scripts/docker/deploy.sh status
157
-
158
- # View logs
159
- ./scripts/docker/deploy.sh logs
160
-
161
- # Stop all services
162
- ./scripts/docker/deploy.sh stop
163
-
164
- # Clean up everything
165
- ./scripts/docker/deploy.sh clean
166
- ```
167
-
168
- ### Database Management (`./scripts/docker/db-backup.sh`)
169
-
170
- ```bash
171
- # Create backup
172
- ./scripts/docker/db-backup.sh backup
173
-
174
- # Restore backup
175
- ./scripts/docker/db-backup.sh restore backups/backup-file.sql
176
-
177
- # List backups
178
- ./scripts/docker/db-backup.sh list
179
-
180
- # Clean old backups
181
- ./scripts/docker/db-backup.sh clean 30
182
-
183
- # Show database info
184
- ./scripts/docker/db-backup.sh info
185
- ```
186
-
187
- ## Production Deployment
188
-
189
- ### Prerequisites
190
- 1. Docker and Docker Compose installed
191
- 2. Domain name configured
192
- 3. SSL certificates (Let's Encrypt recommended)
193
- 4. Environment variables configured
194
-
195
- ### Steps
196
- 1. **Prepare Environment**
197
- ```bash
198
- cp .env.production .env
199
- # Edit .env with your settings
200
- ```
201
-
202
- 2. **Deploy**
203
- ```bash
204
- ./scripts/docker/deploy.sh production
205
- ```
206
-
207
- 3. **Configure SSL** (if using Let's Encrypt)
208
- ```bash
209
- # Install certbot
210
- docker run -it --rm \
211
- -v /etc/letsencrypt:/etc/letsencrypt \
212
- -v /var/lib/letsencrypt:/var/lib/letsencrypt \
213
- certbot/certbot certonly --standalone \
214
- -d yourdomain.com
215
-
216
- # Copy certificates
217
- mkdir -p docker/nginx/ssl
218
- cp /etc/letsencrypt/live/yourdomain.com/fullchain.pem docker/nginx/ssl/cert.pem
219
- cp /etc/letsencrypt/live/yourdomain.com/privkey.pem docker/nginx/ssl/key.pem
220
- ```
221
-
222
- 4. **Restart with SSL**
223
- ```bash
224
- docker-compose -f docker-compose.yml -f docker-compose.prod.yml restart nginx
225
- ```
226
-
227
- ### Scaling Services
228
-
229
- ```bash
230
- # Scale API service
231
- docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --scale api=3
232
-
233
- # Scale web service
234
- docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --scale web=2
235
- ```
236
-
237
- ## Monitoring and Logging
238
-
239
- ### Built-in Monitoring (Optional)
240
- - **Prometheus**: Metrics collection (http://localhost:9090)
241
- - **Grafana**: Visualization dashboard (http://localhost:3002)
242
-
243
- ```bash
244
- # Start with monitoring
245
- docker-compose --profile monitoring -f docker-compose.yml -f docker-compose.prod.yml up -d
246
- ```
247
-
248
- ### Log Management
249
- ```bash
250
- # View logs for all services
251
- docker-compose logs -f
252
-
253
- # View logs for specific service
254
- docker-compose logs -f api
255
-
256
- # Export logs
257
- docker-compose logs --no-color > application.log
258
- ```
259
-
260
- ### Health Checks
261
- All services include health checks:
262
- - API: `/health` endpoint
263
- - Web: HTTP status check
264
- - Database: `pg_isready` check
265
- - Redis: `redis-cli ping` check
266
-
267
- ## Troubleshooting
268
-
269
- ### Common Issues
270
-
271
- 1. **Port Conflicts**
272
- ```bash
273
- # Check what's using the port
274
- lsof -i :3000
275
-
276
- # Change port in .env file
277
- WEB_PORT=3001
278
- ```
279
-
280
- 2. **Database Connection Issues**
281
- ```bash
282
- # Check database logs
283
- docker-compose logs postgres
284
-
285
- # Test connection
286
- docker-compose exec postgres psql -U postgres -d idealyst_db
287
- ```
288
-
289
- 3. **Build Failures**
290
- ```bash
291
- # Clean build cache
292
- docker system prune -a
293
-
294
- # Rebuild without cache
295
- docker-compose build --no-cache
296
- ```
297
-
298
- 4. **Yarn Lockfile Issues**
299
- If you see "The lockfile would have been created by this install, which is explicitly forbidden":
300
- ```bash
301
- # Create lockfile first
302
- yarn install
303
-
304
- # Then build Docker
305
- docker-compose build
306
-
307
- # Alternative: Use development mode (handles missing lockfile)
308
- docker-compose up dev
309
- ```
310
-
311
- 5. **Permission Issues**
312
- ```bash
313
- # Fix file permissions
314
- sudo chown -R $USER:$USER .
315
-
316
- # Reset container permissions
317
- docker-compose down
318
- docker-compose up -d
319
- ```
320
-
321
- ### Debugging
322
-
323
- ```bash
324
- # Access running container
325
- docker-compose exec api bash
326
- docker-compose exec web sh
327
-
328
- # Run commands in container
329
- docker-compose exec api yarn test
330
- docker-compose exec api npm run migrate
331
-
332
- # Check service status
333
- docker-compose ps
334
- docker-compose top
335
- ```
336
-
337
- ## Performance Optimization
338
-
339
- ### Production Optimizations
340
- - Multi-stage builds reduce image size
341
- - Nginx caching for static assets
342
- - Gzip compression enabled
343
- - Connection pooling for database
344
- - Health checks for reliability
345
-
346
- ### Development Optimizations
347
- - Volume mounts for hot reload
348
- - Development dependencies included
349
- - Debug logging enabled
350
- - File watching optimized
351
-
352
- ## Security Best Practices
353
-
354
- 1. **Never commit `.env` files**
355
- 2. **Use strong, unique passwords**
356
- 3. **Rotate secrets regularly**
357
- 4. **Enable SSL in production**
358
- 5. **Configure firewalls properly**
359
- 6. **Regular security updates**
360
- 7. **Monitor logs for suspicious activity**
361
-
362
- ## Backup and Recovery
363
-
364
- ### Automated Backups
365
- ```bash
366
- # Setup cron job for daily backups
367
- 0 2 * * * /path/to/workspace/scripts/docker/db-backup.sh backup
368
- 0 3 * * 0 /path/to/workspace/scripts/docker/db-backup.sh clean 30
369
- ```
370
-
371
- ### Disaster Recovery
372
- 1. **Data Backup**: Regular database and file backups
373
- 2. **Image Registry**: Push images to Docker registry
374
- 3. **Configuration Backup**: Version control all configs
375
- 4. **Documentation**: Keep deployment notes updated
376
-
377
- ## Updates and Maintenance
378
-
379
- ### Updating Services
380
- ```bash
381
- # Pull latest images
382
- docker-compose pull
383
-
384
- # Rebuild and restart
385
- docker-compose up -d --build
386
-
387
- # Clean old images
388
- docker image prune
389
- ```
390
-
391
- ### Database Migrations
392
- ```bash
393
- # Run migrations
394
- docker-compose exec api yarn migrate
395
-
396
- # Rollback if needed
397
- docker-compose exec api yarn migrate:rollback
398
- ```
@@ -2,8 +2,11 @@
2
2
  # Supports web apps, API services, and can be used for staging/production
3
3
 
4
4
  # Base stage with Node.js and build tools
5
- FROM node:20-alpine AS base
6
- RUN apk add --no-cache libc6-compat git
5
+ FROM node:20-bullseye-slim AS base
6
+ RUN apt-get update && apt-get install -y \
7
+ libc6-dev \
8
+ git \
9
+ && rm -rf /var/lib/apt/lists/*
7
10
  WORKDIR /app
8
11
 
9
12
  # Enable corepack for yarn
@@ -62,20 +65,6 @@ CMD ["nginx", "-g", "daemon off;"]
62
65
 
63
66
  # Development stage - for use with dev containers
64
67
  FROM base AS dev
65
- RUN apk add --no-cache \
66
- docker \
67
- docker-compose \
68
- bash \
69
- zsh \
70
- fish \
71
- git \
72
- curl \
73
- wget \
74
- vim \
75
- nano
76
-
77
- # Install global development tools
78
- RUN npm install -g @types/node typescript ts-node nodemon
79
68
 
80
69
  # Copy package files
81
70
  COPY package.json yarn.lock .yarnrc.yml ./
@@ -91,17 +80,6 @@ COPY packages/web/package.json ./packages/web/
91
80
  # Install dependencies including dev dependencies
92
81
  RUN yarn install
93
82
 
94
- # Create non-root user for development
95
- RUN addgroup --system --gid 1001 devuser
96
- RUN adduser --system --uid 1001 --ingroup devuser devuser
97
- RUN chown -R devuser:devuser /app
98
-
99
- USER devuser
100
-
101
- # Set up shell
102
- RUN echo 'alias ll="ls -la"' >> ~/.bashrc
103
- RUN echo 'alias la="ls -la"' >> ~/.bashrc
104
-
105
83
  EXPOSE 3000 3001 5173 8080 19006
106
84
 
107
85
  CMD ["tail", "-f", "/dev/null"]