@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.
Files changed (63) hide show
  1. package/dist/generators/api.js +3 -4
  2. package/dist/generators/api.js.map +1 -1
  3. package/dist/generators/database.js +32 -0
  4. package/dist/generators/database.js.map +1 -0
  5. package/dist/generators/index.js +5 -0
  6. package/dist/generators/index.js.map +1 -1
  7. package/dist/generators/utils.js +2 -1
  8. package/dist/generators/utils.js.map +1 -1
  9. package/dist/index.js +9 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/templates/api/.env.example +6 -0
  12. package/dist/templates/api/README.md +25 -35
  13. package/dist/templates/api/package.json +0 -8
  14. package/dist/templates/api/src/context.ts +4 -8
  15. package/dist/templates/database/.env.example +8 -0
  16. package/dist/templates/database/README.md +93 -0
  17. package/dist/templates/database/__tests__/database.test.ts +14 -0
  18. package/dist/templates/database/jest.config.js +19 -0
  19. package/dist/templates/database/jest.setup.js +11 -0
  20. package/dist/templates/database/package.json +61 -0
  21. package/dist/templates/{api → database}/prisma/schema.prisma +1 -1
  22. package/dist/templates/database/prisma/seed.ts +28 -0
  23. package/dist/templates/database/src/client.ts +18 -0
  24. package/dist/templates/database/src/index.ts +11 -0
  25. package/dist/templates/database/src/schemas.ts +26 -0
  26. package/dist/templates/database/tsconfig.json +32 -0
  27. package/dist/templates/workspace/.devcontainer/Dockerfile +23 -0
  28. package/dist/templates/workspace/.devcontainer/README.md +0 -0
  29. package/dist/templates/workspace/.devcontainer/devcontainer.json +71 -99
  30. package/dist/templates/workspace/.devcontainer/docker-compose.yml +19 -46
  31. package/dist/templates/workspace/.devcontainer/fix-permissions.sh +0 -0
  32. package/dist/templates/workspace/.devcontainer/post-create.sh +0 -89
  33. package/dist/templates/workspace/.devcontainer/setup.sh +64 -0
  34. package/dist/templates/workspace/Dockerfile +24 -6
  35. package/dist/types/generators/database.d.ts +2 -0
  36. package/dist/types/generators/index.d.ts +1 -0
  37. package/dist/types/types.d.ts +1 -1
  38. package/package.json +8 -3
  39. package/templates/api/.env.example +6 -0
  40. package/templates/api/README.md +25 -35
  41. package/templates/api/package.json +0 -8
  42. package/templates/api/src/context.ts +4 -8
  43. package/templates/database/.env.example +8 -0
  44. package/templates/database/README.md +93 -0
  45. package/templates/database/__tests__/database.test.ts +14 -0
  46. package/templates/database/jest.config.js +19 -0
  47. package/templates/database/jest.setup.js +11 -0
  48. package/templates/database/package.json +61 -0
  49. package/templates/{api → database}/prisma/schema.prisma +1 -1
  50. package/templates/database/prisma/seed.ts +28 -0
  51. package/templates/database/src/client.ts +18 -0
  52. package/templates/database/src/index.ts +11 -0
  53. package/templates/database/src/schemas.ts +26 -0
  54. package/templates/database/tsconfig.json +32 -0
  55. package/templates/workspace/.devcontainer/Dockerfile +4 -6
  56. package/templates/workspace/.devcontainer/README.md +0 -0
  57. package/templates/workspace/.devcontainer/docker-compose.yml +13 -27
  58. package/templates/workspace/.devcontainer/fix-permissions.sh +0 -0
  59. package/templates/workspace/.devcontainer/post-create.sh +0 -0
  60. package/dist/templates/api/env.example +0 -12
  61. package/dist/templates/workspace/.env.production +0 -56
  62. package/dist/templates/workspace/scripts/docker-build.sh +0 -151
  63. package/templates/api/env.example +0 -12
@@ -2,60 +2,46 @@ services:
2
2
  # PostgreSQL Database
3
3
  postgres:
4
4
  image: postgres:15-alpine
5
- container_name: ${PROJECT_NAME:-idealyst}-postgres
6
5
  environment:
7
- POSTGRES_DB: ${POSTGRES_DB:-idealyst_db}
8
- POSTGRES_USER: ${POSTGRES_USER:-postgres}
9
- POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
6
+ POSTGRES_DB: idealyst_db
7
+ POSTGRES_USER: postgres
8
+ POSTGRES_PASSWORD: postgres
10
9
  ports:
11
- - "${POSTGRES_PORT:-5432}:5432"
10
+ - "5432:5432"
12
11
  volumes:
13
12
  - postgres_data:/var/lib/postgresql/data
14
- networks:
15
- - idealyst-network
16
13
 
17
14
  # Redis Cache
18
15
  redis:
19
16
  image: redis:7-alpine
20
- container_name: ${PROJECT_NAME:-idealyst}-redis
21
17
  ports:
22
- - "${REDIS_PORT:-6379}:6379"
18
+ - "6379:6379"
23
19
  volumes:
24
20
  - redis_data:/data
25
- networks:
26
- - idealyst-network
27
21
 
28
22
  # Development Service (for devcontainer)
29
23
  app:
30
24
  build:
31
- context: ..
32
- dockerfile: .devcontainer/Dockerfile
33
- container_name: ${PROJECT_NAME:-idealyst}-app
25
+ context: .
26
+ dockerfile: Dockerfile
34
27
  environment:
35
28
  NODE_ENV: development
36
29
  DATABASE_URL: postgresql://postgres:postgres@postgres:5432/idealyst_db
37
30
  REDIS_URL: redis://redis:6379
38
31
  ports:
39
- - "3000:3000" # Web dev server
40
- - "3001:3001" # API dev server
41
- - "5173:5173" # Vite dev server
42
- - "8080:8080" # Additional dev server
43
- - "19006:19006" # Expo dev tools
32
+ - "3000:3000"
33
+ - "3001:3001"
34
+ - "5173:5173"
35
+ - "8080:8080"
36
+ - "19006:19006"
44
37
  volumes:
45
38
  - ..:/workspace
46
- - node_modules:/workspace/node_modules
39
+ - /workspace/node_modules
47
40
  depends_on:
48
41
  - postgres
49
42
  - redis
50
- networks:
51
- - idealyst-network
52
43
  command: sleep infinity
53
44
 
54
45
  volumes:
55
46
  postgres_data:
56
47
  redis_data:
57
- node_modules:
58
-
59
- networks:
60
- idealyst-network:
61
- driver: bridge
@@ -1,12 +0,0 @@
1
- # Database
2
- DATABASE_URL="file:./dev.db"
3
-
4
- # Server
5
- PORT=3000
6
- NODE_ENV=development
7
-
8
- # CORS
9
- CORS_ORIGIN="http://localhost:3000"
10
-
11
- # Optional: Database for production (uncomment and configure as needed)
12
- # DATABASE_URL="postgresql://username:password@localhost:5432/{{projectName}}"
@@ -1,56 +0,0 @@
1
- # Production Environment Variables
2
- # Copy this file to .env for production deployment
3
-
4
- # Project Configuration
5
- PROJECT_NAME={{packageName}}
6
- NODE_ENV=production
7
-
8
- # Database Configuration (use strong passwords!)
9
- POSTGRES_DB={{packageName}}_production
10
- POSTGRES_USER={{packageName}}_user
11
- POSTGRES_PASSWORD=CHANGE_THIS_STRONG_PASSWORD
12
- POSTGRES_PORT=5432
13
-
14
- # Redis Configuration
15
- REDIS_PORT=6379
16
-
17
- # API Configuration
18
- API_PORT=3001
19
- JWT_SECRET=CHANGE_THIS_VERY_STRONG_JWT_SECRET_MINIMUM_32_CHARACTERS
20
-
21
- # Web Configuration
22
- WEB_PORT=80
23
-
24
- # SSL/Domain Configuration
25
- DOMAIN_NAME=yourdomain.com
26
- SSL_EMAIL=admin@yourdomain.com
27
-
28
- # Monitoring
29
- GRAFANA_PASSWORD=CHANGE_THIS_STRONG_PASSWORD
30
-
31
- # Logging
32
- LOG_LEVEL=warn
33
-
34
- # Rate Limiting (more restrictive for production)
35
- RATE_LIMIT_WINDOW_MS=900000
36
- RATE_LIMIT_MAX_REQUESTS=50
37
-
38
- # Security Settings
39
- SESSION_SECRET=CHANGE_THIS_VERY_STRONG_SESSION_SECRET
40
- ENCRYPTION_KEY=CHANGE_THIS_32_CHARACTER_ENCRYPTION_KEY
41
-
42
- # External Services (configure as needed)
43
- # SMTP_HOST=smtp.yourdomain.com
44
- # SMTP_PORT=587
45
- # SMTP_USER=noreply@yourdomain.com
46
- # SMTP_PASS=smtp_password
47
-
48
- # AWS/Cloud Storage (if using)
49
- # AWS_ACCESS_KEY_ID=your_access_key
50
- # AWS_SECRET_ACCESS_KEY=your_secret_key
51
- # AWS_REGION=us-east-1
52
- # S3_BUCKET=your-bucket-name
53
-
54
- # Analytics/Monitoring
55
- # SENTRY_DSN=your_sentry_dsn
56
- # GOOGLE_ANALYTICS_ID=your_ga_id
@@ -1,151 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Docker build helper script for Idealyst workspace
4
- # Handles common issues like missing yarn.lock files
5
-
6
- set -e
7
-
8
- # Colors for output
9
- RED='\033[0;31m'
10
- GREEN='\033[0;32m'
11
- YELLOW='\033[1;33m'
12
- BLUE='\033[0;34m'
13
- NC='\033[0m' # No Color
14
-
15
- echo -e "${BLUE}🐳 Idealyst Docker Build Helper${NC}"
16
- echo ""
17
-
18
- # Check if yarn.lock exists
19
- if [ ! -f "yarn.lock" ]; then
20
- echo -e "${YELLOW}⚠️ yarn.lock not found${NC}"
21
- echo "This can cause Docker build failures with 'immutable' installs."
22
- echo ""
23
- read -p "Would you like to generate yarn.lock now? (y/N): " -n 1 -r
24
- echo ""
25
-
26
- if [[ $REPLY =~ ^[Yy]$ ]]; then
27
- echo -e "${BLUE}📦 Installing dependencies to generate yarn.lock...${NC}"
28
- yarn install
29
- echo -e "${GREEN}✅ yarn.lock generated${NC}"
30
- else
31
- echo -e "${YELLOW}⚠️ Continuing without yarn.lock (may cause build issues)${NC}"
32
- fi
33
- echo ""
34
- fi
35
-
36
- # Check if .env exists
37
- if [ ! -f ".env" ]; then
38
- echo -e "${YELLOW}⚠️ .env file not found${NC}"
39
- if [ -f ".env.example" ]; then
40
- read -p "Would you like to copy .env.example to .env? (y/N): " -n 1 -r
41
- echo ""
42
- if [[ $REPLY =~ ^[Yy]$ ]]; then
43
- cp .env.example .env
44
- echo -e "${GREEN}✅ .env file created from .env.example${NC}"
45
- echo -e "${YELLOW}📝 Please review and update .env with your settings${NC}"
46
- fi
47
- else
48
- echo -e "${YELLOW}📝 Please create a .env file with your configuration${NC}"
49
- fi
50
- echo ""
51
- fi
52
-
53
- # Determine what to build
54
- if [ $# -eq 0 ]; then
55
- echo "What would you like to do?"
56
- echo "1) Build and start development environment"
57
- echo "2) Build and start production services"
58
- echo "3) Build specific service"
59
- echo "4) Just build (no start)"
60
- echo ""
61
- read -p "Choice (1-4): " -n 1 -r
62
- echo ""
63
-
64
- case $REPLY in
65
- 1)
66
- echo -e "${BLUE}🚀 Building and starting development environment...${NC}"
67
- docker-compose build dev
68
- docker-compose up -d postgres redis
69
- docker-compose up dev
70
- ;;
71
- 2)
72
- echo -e "${BLUE}🚀 Building and starting production services...${NC}"
73
- docker-compose build
74
- docker-compose up -d
75
- ;;
76
- 3)
77
- echo "Available services: api, web, dev, postgres, redis"
78
- read -p "Service name: " service
79
- echo -e "${BLUE}🚀 Building ${service}...${NC}"
80
- docker-compose build $service
81
- ;;
82
- 4)
83
- echo -e "${BLUE}🏗️ Building all services...${NC}"
84
- docker-compose build
85
- ;;
86
- *)
87
- echo -e "${RED}❌ Invalid choice${NC}"
88
- exit 1
89
- ;;
90
- esac
91
- else
92
- # Handle command line arguments
93
- case "$1" in
94
- "dev")
95
- echo -e "${BLUE}🚀 Building and starting development environment...${NC}"
96
- docker-compose build dev
97
- docker-compose up -d postgres redis
98
- docker-compose up dev
99
- ;;
100
- "prod"|"production")
101
- echo -e "${BLUE}🚀 Building and starting production services...${NC}"
102
- docker-compose build
103
- docker-compose up -d
104
- ;;
105
- "build")
106
- if [ -n "$2" ]; then
107
- echo -e "${BLUE}🏗️ Building ${2}...${NC}"
108
- docker-compose build $2
109
- else
110
- echo -e "${BLUE}🏗️ Building all services...${NC}"
111
- docker-compose build
112
- fi
113
- ;;
114
- "help"|"-h"|"--help")
115
- echo "Usage: $0 [command] [service]"
116
- echo ""
117
- echo "Commands:"
118
- echo " dev Build and start development environment"
119
- echo " prod Build and start production services"
120
- echo " build [svc] Build all services or specific service"
121
- echo " help Show this help"
122
- echo ""
123
- echo "Services: api, web, dev, postgres, redis"
124
- ;;
125
- *)
126
- echo -e "${RED}❌ Unknown command: $1${NC}"
127
- echo "Use '$0 help' for usage information"
128
- exit 1
129
- ;;
130
- esac
131
- fi
132
-
133
- echo ""
134
- echo -e "${GREEN}🎉 Done!${NC}"
135
-
136
- # Show helpful information
137
- if docker-compose ps | grep -q "Up"; then
138
- echo ""
139
- echo -e "${BLUE}📋 Running services:${NC}"
140
- docker-compose ps
141
- echo ""
142
- echo -e "${BLUE}🔗 Access your application:${NC}"
143
- echo "• Web: http://localhost:3000"
144
- echo "• API: http://localhost:3001"
145
- echo "• Vite Dev: http://localhost:5173"
146
- echo ""
147
- echo -e "${BLUE}💡 Useful commands:${NC}"
148
- echo "• View logs: docker-compose logs -f"
149
- echo "• Stop services: docker-compose down"
150
- echo "• Access dev container: docker-compose exec dev bash"
151
- fi
@@ -1,12 +0,0 @@
1
- # Database
2
- DATABASE_URL="file:./dev.db"
3
-
4
- # Server
5
- PORT=3000
6
- NODE_ENV=development
7
-
8
- # CORS
9
- CORS_ORIGIN="http://localhost:3000"
10
-
11
- # Optional: Database for production (uncomment and configure as needed)
12
- # DATABASE_URL="postgresql://username:password@localhost:5432/{{projectName}}"