@gv-sh/specgen-app 0.7.1 โ†’ 0.8.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SpecGen App - Complete Platform
2
2
 
3
- [![Version](https://img.shields.io/badge/version-0.7.1-blue.svg)](https://github.com/gv-sh/specgen-app)
3
+ [![Version](https://img.shields.io/badge/version-0.8.0-blue.svg)](https://github.com/gv-sh/specgen-app)
4
4
 
5
5
  A unified deployment package for the SpecGen speculative fiction generator platform. **Optimized for port 80 deployment with low memory usage.**
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gv-sh/specgen-app",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Complete SpecGen application with server, admin, and user interfaces",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -11,14 +11,10 @@
11
11
  "dev": "chmod +x scripts/dev.sh && ./scripts/dev.sh",
12
12
  "build": "cd admin && npm run build && cd ../user && npm run build",
13
13
  "start": "cd server && npm start",
14
- "production": "chmod +x scripts/production.sh && ./scripts/production.sh",
15
14
  "deploy": "chmod +x scripts/deploy.sh && ./scripts/deploy.sh",
16
15
  "deploy:dry-run": "chmod +x scripts/deploy.sh && ./scripts/deploy.sh --dry-run",
17
16
  "test:deploy": "chmod +x scripts/deploy.sh && ./scripts/deploy.sh --dry-run",
18
17
  "make-executable": "chmod +x scripts/make-executable.sh && ./scripts/make-executable.sh",
19
- "deploy:stop": "chmod +x scripts/stop.sh && ./scripts/stop.sh",
20
- "deploy:restart": "chmod +x scripts/restart.sh && ./scripts/restart.sh",
21
- "deploy:status": "chmod +x scripts/status.sh && ./scripts/status.sh",
22
18
  "postinstall": "chmod +x bin/cli.js"
23
19
  },
24
20
  "dependencies": {
package/cleanup.sh DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Remove backup scripts
4
- echo "๐Ÿงน Removing backup script files..."
5
- rm -f scripts/*.backup
6
- echo "โœ… Cleanup complete!"
@@ -1,180 +0,0 @@
1
- #!/bin/bash
2
-
3
- # SpecGen Production Script - Low Memory, Port 80 with Cleanup
4
- set -e
5
-
6
- echo "๐Ÿš€ Starting SpecGen in production mode on port 80..."
7
- echo "๐Ÿงน Cleaning up existing processes..."
8
-
9
- # Function to check if port is available
10
- check_port() {
11
- local port=$1
12
- if lsof -Pi :$port -sTCP:LISTEN -t >/dev/null 2>&1; then
13
- return 1 # Port in use
14
- else
15
- return 0 # Port available
16
- fi
17
- }
18
-
19
- # ========================================
20
- # CLEANUP EXISTING PROCESSES
21
- # ========================================
22
-
23
- # Stop and cleanup PM2 processes
24
- echo "Stopping existing PM2 processes..."
25
- npx pm2 stop all 2>/dev/null || true
26
- npx pm2 delete all 2>/dev/null || true
27
-
28
- # Kill processes on ports we'll use
29
- echo "Freeing ports..."
30
- for port in 80 3000 3001 3002; do
31
- if ! check_port $port; then
32
- echo "Port $port is in use. Attempting to free it..."
33
- lsof -ti:$port | xargs kill -9 2>/dev/null || true
34
- sleep 1
35
- fi
36
- done
37
-
38
- # Stop nginx if it might interfere
39
- if command -v nginx &> /dev/null && systemctl is-active --quiet nginx 2>/dev/null; then
40
- echo "Nginx is running, checking for conflicts..."
41
- if nginx -T 2>/dev/null | grep -q ":80"; then
42
- echo "โš ๏ธ Nginx is configured to use port 80. You may need to reconfigure nginx."
43
- fi
44
- fi
45
-
46
- # ========================================
47
- # VERIFY SETUP
48
- # ========================================
49
-
50
- # Verify OpenAI API key
51
- if [ -f "server/.env" ]; then
52
- # In CI mode, skip API key validation
53
- if [ "$CI" = "true" ]; then
54
- echo "CI mode detected - skipping API key validation"
55
- elif grep -q "OPENAI_API_KEY=your_openai_api_key_here" server/.env; then
56
- echo "โš ๏ธ No OpenAI API key detected!"
57
- echo "Enter your OpenAI API key: "
58
- read -r OPENAI_KEY
59
-
60
- if [ -z "$OPENAI_KEY" ]; then
61
- echo "โŒ No API key provided. Cannot start in production mode."
62
- exit 1
63
- else
64
- # Update the API key in the .env file
65
- sed -i.bak "s/OPENAI_API_KEY=.*/OPENAI_API_KEY=$OPENAI_KEY/" server/.env
66
- rm -f server/.env.bak
67
- echo "โœ… API key updated in server/.env"
68
- fi
69
- fi
70
- else
71
- echo "โŒ server/.env file not found. Run 'npm run setup' first."
72
- exit 1
73
- fi
74
-
75
- # Verify directories exist
76
- for dir in server admin user; do
77
- if [ ! -d "$dir" ]; then
78
- echo "โŒ $dir directory not found. Run 'npm run setup' first."
79
- exit 1
80
- fi
81
- done
82
-
83
- # ========================================
84
- # INSTALL DEPENDENCIES
85
- # ========================================
86
-
87
- # Make sure node_modules exist in the server directory
88
- if [ ! -d "server/node_modules" ]; then
89
- echo "Installing server dependencies..."
90
- cd server
91
- # Create a .npmrc file that ignores engine requirements
92
- echo "engine-strict=false" > .npmrc
93
- npm install --no-fund --no-audit --production --maxsockets=2 --loglevel=warn
94
- cd ..
95
- fi
96
-
97
- # Set production environment
98
- export NODE_ENV=production
99
-
100
- # ========================================
101
- # BUILD INTERFACES
102
- # ========================================
103
-
104
- # Check if we need to build
105
- if [ ! -d "admin/build" ] || [ ! -d "user/build" ]; then
106
- echo "Building web interfaces (optimized mode)..."
107
-
108
- # Admin build
109
- if [ ! -d "admin/build" ]; then
110
- echo "Building admin..."
111
- cd admin
112
- echo "engine-strict=false" > .npmrc
113
- # Install only production dependencies
114
- npm install --no-fund --no-audit --production --maxsockets=2 --loglevel=warn
115
- # Set environment for smaller build
116
- export GENERATE_SOURCEMAP=false
117
- export SKIP_PREFLIGHT_CHECK=true
118
- npm run build
119
- cd ..
120
- fi
121
-
122
- # User build
123
- if [ ! -d "user/build" ]; then
124
- echo "Building user..."
125
- cd user
126
- echo "engine-strict=false" > .npmrc
127
- # Install only production dependencies
128
- npm install --no-fund --no-audit --production --maxsockets=2 --loglevel=warn
129
- # Set environment for smaller build
130
- export GENERATE_SOURCEMAP=false
131
- export SKIP_PREFLIGHT_CHECK=true
132
- npm run build
133
- cd ..
134
- fi
135
- fi
136
-
137
- # ========================================
138
- # CONFIGURE ENVIRONMENT
139
- # ========================================
140
-
141
- # Update server .env to use port 80
142
- if [ -f "server/.env" ]; then
143
- # Update or add PORT=80 to .env
144
- if grep -q "^PORT=" server/.env; then
145
- sed -i.bak "s/^PORT=.*/PORT=80/" server/.env
146
- else
147
- echo "PORT=80" >> server/.env
148
- fi
149
- rm -f server/.env.bak
150
- fi
151
-
152
- # Create production-ready .env for server
153
- cat > server/.env.production << EOF
154
- $(cat server/.env)
155
- NODE_ENV=production
156
- PORT=80
157
- EOF
158
-
159
- # Create logs directory
160
- mkdir -p logs
161
-
162
- # ========================================
163
- # START SERVER
164
- # ========================================
165
-
166
- # Final port check
167
- echo "Final check for port 80..."
168
- if ! check_port 80; then
169
- echo "Port 80 is still in use after cleanup. Force killing..."
170
- lsof -ti:80 | xargs kill -9 2>/dev/null || true
171
- sleep 2
172
- fi
173
-
174
- # Start production server
175
- echo "Starting production server on port 80..."
176
- if [ "$CI" = "true" ]; then
177
- echo "CI mode detected - skipping server start"
178
- else
179
- cd server && NODE_ENV=production PORT=80 npm start
180
- fi
@@ -1,19 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Restart SpecGen services
4
- set -e
5
-
6
- echo "Restarting SpecGen services..."
7
-
8
- # Restart PM2 processes
9
- pm2 restart specgen-server || echo "Starting server..."
10
- pm2 start ecosystem.config.js || echo "Server started"
11
-
12
- # Restart Nginx
13
- sudo systemctl restart nginx
14
-
15
- # Show status
16
- pm2 status
17
- sudo systemctl status nginx --no-pager -l
18
-
19
- echo "SpecGen restarted successfully"
package/scripts/status.sh DELETED
@@ -1,30 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Show SpecGen application status
4
- set -e
5
-
6
- echo "=== SpecGen Application Status ==="
7
-
8
- # PM2 processes
9
- echo -e "\nPM2 Processes:"
10
- pm2 list
11
-
12
- # Nginx status
13
- echo -e "\nNginx Status:"
14
- sudo systemctl status nginx --no-pager -l
15
-
16
- # Server logs (last 20 lines)
17
- echo -e "\nServer Logs (last 20 lines):"
18
- pm2 logs specgen-server --lines 20
19
-
20
- # Disk usage of app directory
21
- echo -e "\nDisk Usage:"
22
- du -sh /opt/specgen-app
23
-
24
- # Memory usage
25
- echo -e "\nMemory Usage:"
26
- free -h
27
-
28
- # Port status
29
- echo -e "\nPort Status:"
30
- sudo netstat -tlpn | grep -E ':80|:3000|:443'
package/scripts/stop.sh DELETED
@@ -1,14 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Stop SpecGen services
4
- set -e
5
-
6
- echo "Stopping SpecGen services..."
7
-
8
- # Stop PM2 processes
9
- pm2 stop specgen-server || echo "Server not running"
10
-
11
- # Stop Nginx (optional - uncomment if needed)
12
- # sudo systemctl stop nginx
13
-
14
- echo "SpecGen stopped successfully"