create-pika-minigame 2.6.4 → 2.6.7
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/package.json
CHANGED
|
@@ -22,9 +22,9 @@ export default Repack.defineRspackConfig((env) => {
|
|
|
22
22
|
output: {
|
|
23
23
|
path: `${__dirname}/build/outputs/${platform}/remotes`,
|
|
24
24
|
uniqueName: '{{PROJECT_NAME_SNAKE}}',
|
|
25
|
-
//
|
|
26
|
-
// MF_PUBLIC_PATH=https://
|
|
27
|
-
publicPath: process.env.MF_PUBLIC_PATH || '
|
|
25
|
+
// 'auto' = detect URL at runtime (works for any port)
|
|
26
|
+
// Set MF_PUBLIC_PATH for production: MF_PUBLIC_PATH=https://cdn.com/ios/
|
|
27
|
+
publicPath: process.env.MF_PUBLIC_PATH || 'auto',
|
|
28
28
|
},
|
|
29
29
|
resolve: {
|
|
30
30
|
...Repack.getResolveOptions({ enablePackageExports: true }),
|
|
@@ -66,7 +66,19 @@ fi
|
|
|
66
66
|
PROJECT_NAME=$(node -p "require('./package.json').name")
|
|
67
67
|
PROJECT_VERSION=$(node -p "require('./package.json').version")
|
|
68
68
|
|
|
69
|
+
# Determine Vercel project name:
|
|
70
|
+
# 1. If saved prod URL exists, extract project name from it (e.g., test-game-3.vercel.app -> test-game-3)
|
|
71
|
+
# 2. Otherwise, normalize package.json name for Vercel
|
|
72
|
+
if [[ -n "$VERCEL_PROD_URL" ]]; then
|
|
73
|
+
VERCEL_PROJECT_NAME=$(echo "$VERCEL_PROD_URL" | sed -E 's|https://([^.]+)\.vercel\.app.*|\1|')
|
|
74
|
+
log_info "Using existing Vercel project: $VERCEL_PROJECT_NAME"
|
|
75
|
+
else
|
|
76
|
+
# Normalize project name for Vercel (lowercase, valid chars only)
|
|
77
|
+
VERCEL_PROJECT_NAME=$(echo "$PROJECT_NAME" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9._-' '-' | sed 's/^-//;s/-$//')
|
|
78
|
+
fi
|
|
79
|
+
|
|
69
80
|
log_info "Project: $PROJECT_NAME v$PROJECT_VERSION"
|
|
81
|
+
log_info "Vercel project: $VERCEL_PROJECT_NAME"
|
|
70
82
|
|
|
71
83
|
# =============================================================================
|
|
72
84
|
# Step 1: Build for all platforms using pika-build.sh
|
|
@@ -160,9 +172,40 @@ log_success "Build complete: $BUILD_DIR"
|
|
|
160
172
|
# =============================================================================
|
|
161
173
|
log_info "Deploying to Vercel..."
|
|
162
174
|
|
|
175
|
+
# Get Vercel scope from environment or try to detect
|
|
176
|
+
VERCEL_SCOPE="${VERCEL_SCOPE:-}"
|
|
177
|
+
if [[ -z "$VERCEL_SCOPE" ]]; then
|
|
178
|
+
# Try to get scope from existing .vercel/project.json
|
|
179
|
+
if [[ -f ".vercel/project.json" ]]; then
|
|
180
|
+
VERCEL_SCOPE=$(node -e "console.log(require('./.vercel/project.json').orgId || '')" 2>/dev/null || echo "")
|
|
181
|
+
fi
|
|
182
|
+
# If still no scope, search in parent directories
|
|
183
|
+
if [[ -z "$VERCEL_SCOPE" ]]; then
|
|
184
|
+
SEARCH_DIR=$(dirname "$PWD")
|
|
185
|
+
while [[ "$SEARCH_DIR" != "/" && -z "$VERCEL_SCOPE" ]]; do
|
|
186
|
+
for proj in "$SEARCH_DIR"/*/.vercel/project.json; do
|
|
187
|
+
if [[ -f "$proj" ]]; then
|
|
188
|
+
VERCEL_SCOPE=$(node -e "console.log(require('$proj').orgId || '')" 2>/dev/null || echo "")
|
|
189
|
+
if [[ -n "$VERCEL_SCOPE" ]]; then
|
|
190
|
+
log_info "Found Vercel orgId from: $proj"
|
|
191
|
+
break
|
|
192
|
+
fi
|
|
193
|
+
fi
|
|
194
|
+
done
|
|
195
|
+
SEARCH_DIR=$(dirname "$SEARCH_DIR")
|
|
196
|
+
done
|
|
197
|
+
fi
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
SCOPE_FLAG=""
|
|
201
|
+
if [[ -n "$VERCEL_SCOPE" ]]; then
|
|
202
|
+
SCOPE_FLAG="--scope $VERCEL_SCOPE"
|
|
203
|
+
log_info "Using Vercel scope: $VERCEL_SCOPE"
|
|
204
|
+
fi
|
|
205
|
+
|
|
163
206
|
# First deploy to get the project linked and get a URL
|
|
164
207
|
log_info "Initial deployment..."
|
|
165
|
-
DEPLOY_OUTPUT=$(vercel "$BUILD_DIR" $PROD_FLAG --yes 2>&1)
|
|
208
|
+
DEPLOY_OUTPUT=$(vercel "$BUILD_DIR" $PROD_FLAG $SCOPE_FLAG --name "$VERCEL_PROJECT_NAME" --yes 2>&1)
|
|
166
209
|
|
|
167
210
|
# Extract URL more carefully - look for vercel.app deployment URLs
|
|
168
211
|
DEPLOY_URL=$(echo "$DEPLOY_OUTPUT" | grep -oE 'https://[a-zA-Z0-9._-]+\.vercel\.app' | head -1)
|
|
@@ -236,7 +279,7 @@ fi
|
|
|
236
279
|
|
|
237
280
|
# Redeploy with updated manifests
|
|
238
281
|
log_info "Redeploying with updated manifests..."
|
|
239
|
-
FINAL_OUTPUT=$(vercel "$BUILD_DIR" $PROD_FLAG --yes 2>&1)
|
|
282
|
+
FINAL_OUTPUT=$(vercel "$BUILD_DIR" $PROD_FLAG $SCOPE_FLAG --name "$VERCEL_PROJECT_NAME" --yes 2>&1)
|
|
240
283
|
FINAL_URL=$(echo "$FINAL_OUTPUT" | grep -oE 'https://[a-zA-Z0-9._-]+\.vercel\.app' | head -1)
|
|
241
284
|
|
|
242
285
|
if [[ -n "$FINAL_URL" ]]; then
|