create-pika-minigame 2.6.1 → 2.6.2

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/bin/cli.js CHANGED
@@ -291,7 +291,26 @@ ${colors.reset}
291
291
 
292
292
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
293
293
 
294
- log.step(5, 'Project created successfully!');
294
+ // Step 5: Update .gitignore for Vercel
295
+ log.step(5, 'Updating .gitignore...');
296
+ const gitignorePath = path.join(targetDir, '.gitignore');
297
+ if (fs.existsSync(gitignorePath)) {
298
+ let gitignore = fs.readFileSync(gitignorePath, 'utf8');
299
+ if (!gitignore.includes('.vercel-prod-url')) {
300
+ gitignore += `
301
+ # Vercel
302
+ .vercel
303
+ .vercel-prod-url
304
+
305
+ # Build outputs
306
+ build/
307
+ `;
308
+ fs.writeFileSync(gitignorePath, gitignore);
309
+ log.success('Updated .gitignore');
310
+ }
311
+ }
312
+
313
+ log.step(6, 'Project created successfully!');
295
314
 
296
315
  console.log(`
297
316
  ${colors.green}Success!${colors.reset} Created ${colors.bright}${pascalName}${colors.reset} at ${targetDir}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pika-minigame",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "CLI to scaffold Pika mini-game projects (bare React Native 0.77)",
5
5
  "author": "Pika Team",
6
6
  "license": "MIT",
@@ -8,17 +8,16 @@ set -e
8
8
  # Usage:
9
9
  # ./scripts/deploy-vercel.sh [--prod]
10
10
  #
11
- # Environment variables:
12
- # VERCEL_PROD_URL - Production URL (e.g., https://my-game.vercel.app)
13
- # Required for --prod to set correct publicPath
11
+ # First deploy creates a new Vercel project and saves the production URL.
12
+ # Subsequent deploys use the saved URL automatically.
13
+ #
14
+ # To reset and create a new Vercel project:
15
+ # rm -rf .vercel .vercel-prod-url && ./scripts/deploy-vercel.sh --prod
14
16
  #
15
17
  # Prerequisites:
16
18
  # - Vercel CLI: npm i -g vercel
17
19
  # - Logged in: vercel login
18
20
  #
19
- # Example:
20
- # VERCEL_PROD_URL=https://deploy-pink-mu.vercel.app ./scripts/deploy-vercel.sh --prod
21
- #
22
21
  # =============================================================================
23
22
 
24
23
  # Colors
@@ -41,16 +40,23 @@ fi
41
40
 
42
41
  # Parse arguments
43
42
  PROD_FLAG=""
43
+ PROD_URL_FILE=".vercel-prod-url"
44
+
44
45
  if [[ "$1" == "--prod" ]]; then
45
46
  PROD_FLAG="--prod"
46
47
  log_info "Deploying to PRODUCTION"
47
48
 
48
- # Check for VERCEL_PROD_URL
49
+ # Check for saved production URL (project-local)
50
+ if [[ -f "$PROD_URL_FILE" ]]; then
51
+ SAVED_PROD_URL=$(cat "$PROD_URL_FILE" | tr -d '[:space:]')
52
+ if [[ -n "$SAVED_PROD_URL" ]]; then
53
+ log_info "Using saved production URL: $SAVED_PROD_URL"
54
+ VERCEL_PROD_URL="$SAVED_PROD_URL"
55
+ fi
56
+ fi
57
+
49
58
  if [[ -z "$VERCEL_PROD_URL" ]]; then
50
- log_warn "VERCEL_PROD_URL not set. Will try to auto-detect, but may not work correctly."
51
- log_warn "For reliable deploys, set: VERCEL_PROD_URL=https://your-project.vercel.app"
52
- else
53
- log_info "Production URL: $VERCEL_PROD_URL"
59
+ log_info "No saved production URL found. Will detect after first deploy."
54
60
  fi
55
61
  else
56
62
  log_info "Deploying to PREVIEW (add --prod for production)"
@@ -168,11 +174,12 @@ fi
168
174
  # For production, use VERCEL_PROD_URL if set, otherwise try to auto-detect
169
175
  if [[ "$PROD_FLAG" == "--prod" ]]; then
170
176
  if [[ -n "$VERCEL_PROD_URL" ]]; then
171
- # Use the explicitly set production URL
177
+ # Use the saved/provided production URL
172
178
  DEPLOY_URL="$VERCEL_PROD_URL"
173
- log_info "Using provided production URL: $DEPLOY_URL"
179
+ log_info "Using production URL: $DEPLOY_URL"
174
180
  else
175
- log_info "Trying to detect production alias..."
181
+ log_info "Detecting production alias from Vercel..."
182
+
176
183
  # Try to get alias from the deployed URL
177
184
  PROD_DOMAIN=$(vercel inspect "$DEPLOY_URL" --json 2>/dev/null | node -e "
178
185
  const data = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8'));
@@ -186,8 +193,13 @@ if [[ "$PROD_FLAG" == "--prod" ]]; then
186
193
  DEPLOY_URL="https://$PROD_DOMAIN"
187
194
  log_info "Detected production alias: $DEPLOY_URL"
188
195
  else
189
- log_warn "Could not detect production alias, using deployment URL: $DEPLOY_URL"
196
+ # Use the deployment URL as-is (first deploy)
197
+ log_info "Using deployment URL as production URL: $DEPLOY_URL"
190
198
  fi
199
+
200
+ # Save for future deploys
201
+ echo "$DEPLOY_URL" > "$PROD_URL_FILE"
202
+ log_success "Saved production URL to $PROD_URL_FILE"
191
203
  fi
192
204
  fi
193
205