@idealyst/cli 1.0.27 → 1.0.29

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 (42) hide show
  1. package/dist/index.js +43 -13
  2. package/dist/types/generators/utils.d.ts +6 -1
  3. package/package.json +1 -1
  4. package/templates/api/__tests__/api.test.ts +26 -0
  5. package/templates/api/jest.config.js +23 -0
  6. package/templates/api/jest.setup.js +9 -0
  7. package/templates/api/package.json +13 -0
  8. package/templates/native/__tests__/App.test.tsx +156 -0
  9. package/templates/native/__tests__/components.test.tsx +300 -0
  10. package/templates/native/jest.config.js +21 -0
  11. package/templates/native/jest.setup.js +12 -0
  12. package/templates/native/package.json +34 -0
  13. package/templates/native/src/App-with-trpc.tsx +0 -13
  14. package/templates/shared/__tests__/shared.test.ts +39 -0
  15. package/templates/shared/jest.config.js +22 -0
  16. package/templates/shared/package.json +10 -0
  17. package/templates/web/__tests__/App.test.tsx +342 -0
  18. package/templates/web/__tests__/components.test.tsx +564 -0
  19. package/templates/web/jest.config.js +27 -0
  20. package/templates/web/jest.setup.js +24 -0
  21. package/templates/web/package.json +11 -1
  22. package/templates/web/src/App-with-trpc.tsx +0 -13
  23. package/templates/workspace/.devcontainer/devcontainer.json +150 -0
  24. package/templates/workspace/.devcontainer/post-create.sh +129 -0
  25. package/templates/workspace/.dockerignore +151 -0
  26. package/templates/workspace/.env.example +36 -0
  27. package/templates/workspace/.env.production +56 -0
  28. package/templates/workspace/DOCKER.md +385 -0
  29. package/templates/workspace/Dockerfile +100 -0
  30. package/templates/workspace/README.md +93 -0
  31. package/templates/workspace/docker/nginx/prod.conf +238 -0
  32. package/templates/workspace/docker/nginx.conf +131 -0
  33. package/templates/workspace/docker/postgres/init.sql +41 -0
  34. package/templates/workspace/docker/prometheus/prometheus.yml +52 -0
  35. package/templates/workspace/docker-compose.prod.yml +146 -0
  36. package/templates/workspace/docker-compose.yml +144 -0
  37. package/templates/workspace/jest.config.js +20 -0
  38. package/templates/workspace/package.json +11 -1
  39. package/templates/workspace/scripts/docker/db-backup.sh +230 -0
  40. package/templates/workspace/scripts/docker/deploy.sh +212 -0
  41. package/templates/workspace/scripts/test-runner.js +120 -0
  42. package/templates/workspace/setup.sh +205 -0
@@ -0,0 +1,150 @@
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": true,
17
+ "source.organizeImports": true
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/node:1": {
69
+ "version": "20",
70
+ "nodeGypDependencies": true,
71
+ "installYarnUsingApt": true
72
+ },
73
+ "ghcr.io/devcontainers/features/git:1": {
74
+ "ppa": true,
75
+ "version": "latest"
76
+ },
77
+ "ghcr.io/devcontainers/features/github-cli:1": {
78
+ "version": "latest"
79
+ },
80
+ "ghcr.io/devcontainers/features/docker-in-docker:2": {
81
+ "moby": true,
82
+ "dockerDashComposeVersion": "v2"
83
+ },
84
+ "ghcr.io/devcontainers/features/common-utils:2": {
85
+ "installZsh": true,
86
+ "configureZshAsDefaultShell": true,
87
+ "installOhMyZsh": true,
88
+ "username": "devuser",
89
+ "userUid": 1001,
90
+ "userGid": 1001
91
+ }
92
+ },
93
+
94
+ // Port forwarding for development servers
95
+ "forwardPorts": [
96
+ 3000, // Web dev server
97
+ 3001, // API server
98
+ 5173, // Vite dev server
99
+ 8080, // Additional dev server
100
+ 19006, // Expo dev tools
101
+ 5432, // PostgreSQL
102
+ 6379 // Redis
103
+ ],
104
+
105
+ "portsAttributes": {
106
+ "3000": {
107
+ "label": "Web App",
108
+ "onAutoForward": "openBrowser"
109
+ },
110
+ "3001": {
111
+ "label": "API Server",
112
+ "onAutoForward": "silent"
113
+ },
114
+ "5173": {
115
+ "label": "Vite Dev Server",
116
+ "onAutoForward": "openBrowser"
117
+ },
118
+ "19006": {
119
+ "label": "Expo Dev Tools",
120
+ "onAutoForward": "openBrowser"
121
+ },
122
+ "5432": {
123
+ "label": "PostgreSQL",
124
+ "onAutoForward": "silent"
125
+ },
126
+ "6379": {
127
+ "label": "Redis",
128
+ "onAutoForward": "silent"
129
+ }
130
+ },
131
+
132
+ // Post-create commands
133
+ "postCreateCommand": "bash .devcontainer/post-create.sh",
134
+
135
+ // Development user
136
+ "remoteUser": "devuser",
137
+
138
+ // Environment variables
139
+ "remoteEnv": {
140
+ "NODE_ENV": "development",
141
+ "DATABASE_URL": "postgresql://postgres:postgres@postgres:5432/idealyst_db",
142
+ "REDIS_URL": "redis://redis:6379"
143
+ },
144
+
145
+ // Mount the workspace with proper permissions
146
+ "mounts": [
147
+ "source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached",
148
+ "source=idealyst-node-modules,target=/app/node_modules,type=volume"
149
+ ]
150
+ }
@@ -0,0 +1,129 @@
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
+ # Install dependencies if not already installed
10
+ if [ ! -d "/app/node_modules" ]; then
11
+ echo "📦 Installing dependencies..."
12
+ yarn install
13
+ fi
14
+
15
+ # Set up git configuration (if not already set)
16
+ if [ -z "$(git config --global user.name)" ]; then
17
+ echo "⚙️ Please configure git:"
18
+ echo " git config --global user.name \"Your Name\""
19
+ echo " git config --global user.email \"your.email@example.com\""
20
+ fi
21
+
22
+ # Create environment file if it doesn't exist
23
+ if [ ! -f "/app/.env" ]; then
24
+ echo "📝 Creating .env file..."
25
+ cat > /app/.env << EOF
26
+ # Database Configuration
27
+ DATABASE_URL=postgresql://postgres:postgres@postgres:5432/idealyst_db
28
+ POSTGRES_DB=idealyst_db
29
+ POSTGRES_USER=postgres
30
+ POSTGRES_PASSWORD=postgres
31
+
32
+ # Redis Configuration
33
+ REDIS_URL=redis://redis:6379
34
+
35
+ # API Configuration
36
+ API_PORT=3001
37
+ JWT_SECRET=your-jwt-secret-here
38
+
39
+ # Web Configuration
40
+ WEB_PORT=3000
41
+
42
+ # Development Configuration
43
+ NODE_ENV=development
44
+ LOG_LEVEL=debug
45
+
46
+ # Project Configuration
47
+ PROJECT_NAME={{packageName}}
48
+ EOF
49
+ fi
50
+
51
+ # Wait for database to be ready
52
+ echo "⏳ Waiting for database to be ready..."
53
+ until pg_isready -h postgres -p 5432 -U postgres; do
54
+ echo "Database is unavailable - sleeping"
55
+ sleep 1
56
+ done
57
+
58
+ echo "✅ Database is ready!"
59
+
60
+ # Run database migrations if they exist
61
+ if [ -d "/app/packages" ]; then
62
+ echo "🗄️ Setting up database..."
63
+
64
+ # Check if any package has prisma
65
+ for package_dir in /app/packages/*/; do
66
+ if [ -f "${package_dir}prisma/schema.prisma" ]; then
67
+ echo "Running Prisma setup for $(basename "$package_dir")..."
68
+ cd "$package_dir"
69
+ npx prisma generate
70
+ npx prisma db push
71
+ cd /app
72
+ fi
73
+ done
74
+ fi
75
+
76
+ # Set up git hooks if husky is present
77
+ if [ -f "/app/package.json" ] && grep -q "husky" /app/package.json; then
78
+ echo "🐕 Setting up git hooks..."
79
+ yarn husky install
80
+ fi
81
+
82
+ # Create helpful aliases
83
+ echo "⚡ Setting up helpful aliases..."
84
+ cat >> ~/.bashrc << EOF
85
+
86
+ # Idealyst Development Aliases
87
+ alias dev-web='cd /app && yarn workspace web dev'
88
+ alias dev-api='cd /app && yarn workspace api dev'
89
+ alias test-all='cd /app && yarn test'
90
+ alias build-all='cd /app && yarn build:all'
91
+ alias lint-all='cd /app && yarn lint:all'
92
+
93
+ # Docker aliases
94
+ alias dc='docker-compose'
95
+ alias dcu='docker-compose up'
96
+ alias dcd='docker-compose down'
97
+ alias dcl='docker-compose logs'
98
+
99
+ # Git aliases
100
+ alias gs='git status'
101
+ alias ga='git add'
102
+ alias gc='git commit'
103
+ alias gp='git push'
104
+ alias gl='git pull'
105
+
106
+ echo "🎉 Idealyst development environment is ready!"
107
+ echo ""
108
+ echo "Available commands:"
109
+ echo " dev-web - Start web development server"
110
+ echo " dev-api - Start API development server"
111
+ echo " test-all - Run all tests"
112
+ echo " build-all - Build all packages"
113
+ echo " lint-all - Lint all packages"
114
+ echo ""
115
+ echo "Database: postgresql://postgres:postgres@postgres:5432/idealyst_db"
116
+ echo "Redis: redis://redis:6379"
117
+ echo ""
118
+ EOF
119
+
120
+ source ~/.bashrc
121
+
122
+ echo "🎉 Development environment setup complete!"
123
+ echo ""
124
+ echo "Quick start:"
125
+ echo " 1. Run 'dev-web' to start the web development server"
126
+ echo " 2. Run 'dev-api' to start the API server"
127
+ echo " 3. Open http://localhost:3000 to view your app"
128
+ echo ""
129
+ echo "Happy coding! 🚀"
@@ -0,0 +1,151 @@
1
+ # Dockerignore file for Idealyst workspace
2
+ # Excludes files and directories from Docker build context
3
+
4
+ # Node.js
5
+ node_modules/
6
+ npm-debug.log*
7
+ yarn-debug.log*
8
+ yarn-error.log*
9
+ .pnpm-debug.log*
10
+
11
+ # Environment files (use .env.example instead)
12
+ .env
13
+ .env.local
14
+ .env.development.local
15
+ .env.test.local
16
+ .env.production.local
17
+
18
+ # Build outputs
19
+ dist/
20
+ build/
21
+ out/
22
+ .next/
23
+ coverage/
24
+
25
+ # Development tools
26
+ .vscode/
27
+ .idea/
28
+ *.swp
29
+ *.swo
30
+ *~
31
+
32
+ # OS generated files
33
+ .DS_Store
34
+ .DS_Store?
35
+ ._*
36
+ .Spotlight-V100
37
+ .Trashes
38
+ ehthumbs.db
39
+ Thumbs.db
40
+
41
+ # Git
42
+ .git/
43
+ .gitignore
44
+ .gitattributes
45
+
46
+ # Docker
47
+ Dockerfile*
48
+ docker-compose*.yml
49
+ .dockerignore
50
+
51
+ # CI/CD
52
+ .github/
53
+ .gitlab-ci.yml
54
+ .travis.yml
55
+ .circleci/
56
+
57
+ # Logs
58
+ logs/
59
+ *.log
60
+
61
+ # Runtime data
62
+ pids/
63
+ *.pid
64
+ *.seed
65
+ *.pid.lock
66
+
67
+ # Coverage directory used by tools like istanbul
68
+ coverage/
69
+ .nyc_output/
70
+
71
+ # Test files and directories
72
+ __tests__/
73
+ *.test.js
74
+ *.test.ts
75
+ *.test.tsx
76
+ *.spec.js
77
+ *.spec.ts
78
+ *.spec.tsx
79
+ test/
80
+ tests/
81
+
82
+ # Documentation
83
+ README.md
84
+ CHANGELOG.md
85
+ LICENSE
86
+ *.md
87
+
88
+ # Package manager files
89
+ package-lock.json
90
+ yarn.lock
91
+ pnpm-lock.yaml
92
+
93
+ # Development scripts
94
+ scripts/dev*
95
+ scripts/test*
96
+
97
+ # Temporary files
98
+ tmp/
99
+ temp/
100
+ .tmp/
101
+
102
+ # Editor directories and files
103
+ .vscode/
104
+ .idea/
105
+ *.suo
106
+ *.ntvs*
107
+ *.njsproj
108
+ *.sln
109
+ *.sw?
110
+
111
+ # Runtime configuration
112
+ .editorconfig
113
+ .eslintrc*
114
+ .prettierrc*
115
+ .stylelintrc*
116
+ jest.config.*
117
+ tsconfig.json
118
+ tsconfig.*.json
119
+
120
+ # Mobile development
121
+ android/
122
+ ios/
123
+ .expo/
124
+ .expo-shared/
125
+
126
+ # Backup files
127
+ *.backup
128
+ backups/
129
+
130
+ # Database files
131
+ *.db
132
+ *.sqlite
133
+ *.sqlite3
134
+
135
+ # Cache directories
136
+ .cache/
137
+ .parcel-cache/
138
+ .eslintcache
139
+
140
+ # Storybook
141
+ .storybook/
142
+ storybook-static/
143
+
144
+ # IDE files
145
+ .project
146
+ .classpath
147
+ .c9/
148
+ *.launch
149
+ .settings/
150
+ *.sublime-workspace
151
+ *.sublime-project
@@ -0,0 +1,36 @@
1
+ # Environment variables for Docker Compose
2
+ # Copy this file to .env and customize for your environment
3
+
4
+ # Project Configuration
5
+ PROJECT_NAME={{packageName}}
6
+ NODE_ENV=development
7
+
8
+ # Database Configuration
9
+ POSTGRES_DB=idealyst_db
10
+ POSTGRES_USER=postgres
11
+ POSTGRES_PASSWORD=postgres
12
+ POSTGRES_PORT=5432
13
+
14
+ # Redis Configuration
15
+ REDIS_PORT=6379
16
+
17
+ # API Configuration
18
+ API_PORT=3001
19
+ JWT_SECRET=your-jwt-secret-change-this-in-production
20
+
21
+ # Web Configuration
22
+ WEB_PORT=3000
23
+
24
+ # Monitoring Configuration (optional)
25
+ GRAFANA_PASSWORD=admin
26
+
27
+ # SSL Configuration (for production)
28
+ DOMAIN_NAME=localhost
29
+ SSL_EMAIL=admin@localhost
30
+
31
+ # Logging
32
+ LOG_LEVEL=info
33
+
34
+ # Rate Limiting
35
+ RATE_LIMIT_WINDOW_MS=900000
36
+ RATE_LIMIT_MAX_REQUESTS=100
@@ -0,0 +1,56 @@
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