create-pika-minigame 2.6.3 → 2.6.6

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
@@ -274,6 +274,7 @@ ${colors.reset}
274
274
  'typescript': '~5.3.0',
275
275
  'serve': '^14.2.0',
276
276
  'eslint': '^8.0.0',
277
+ 'pika-minigame-sdk': '^1.0.0',
277
278
  };
278
279
 
279
280
  // Add build and deploy scripts (use pika-build.sh for MF compatibility)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pika-minigame",
3
- "version": "2.6.3",
3
+ "version": "2.6.6",
4
4
  "description": "CLI to scaffold Pika mini-game projects (bare React Native 0.77)",
5
5
  "author": "Pika Team",
6
6
  "license": "MIT",
@@ -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
- // Set this to your CDN URL for production builds:
26
- // MF_PUBLIC_PATH=https://your-cdn.com/games/{{PROJECT_NAME_KEBAB}}/
27
- publicPath: process.env.MF_PUBLIC_PATH || 'http://localhost:9000/',
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 }),
@@ -2,8 +2,8 @@
2
2
  #
3
3
  # Pika Mini-Game Build Script
4
4
  #
5
- # Builds the mini-game using the Pika host's build environment to ensure
6
- # Module Federation compatibility.
5
+ # Builds the mini-game for Module Federation compatibility.
6
+ # Uses pika-minigame-sdk if installed, otherwise falls back to host repo.
7
7
  #
8
8
  # Usage:
9
9
  # ./scripts/pika-build.sh ios
@@ -16,28 +16,44 @@ PLATFORM=${1:-ios}
16
16
 
17
17
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
18
18
  PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
19
- PROJECT_NAME=$(node -e "console.log(require('./app.json').name)" 2>/dev/null || basename "$PROJECT_DIR" | sed 's/-/_/g')
20
-
21
- # Pika host repo - contains the correct node_modules
22
- # Change this to your robotapp location or set PIKA_HOST_DIR env var
23
- PIKA_HOST_DIR="${PIKA_HOST_DIR:-$HOME/robotapp}"
19
+ PROJECT_NAME=$(node -e "console.log(require('./package.json').name || require('./app.json').name)" 2>/dev/null || basename "$PROJECT_DIR" | sed 's/-/_/g')
20
+ SCOPE=$(echo "$PROJECT_NAME" | sed 's/-/_/g' | tr '[:upper:]' '[:lower:]')
24
21
 
25
22
  echo "🎮 Pika Mini-Game Builder"
26
23
  echo "========================="
27
- echo "Project: ${PROJECT_NAME}"
24
+ echo "Project: ${PROJECT_NAME} (scope: ${SCOPE})"
28
25
  echo "Platform: ${PLATFORM}"
29
- echo "Host dir: ${PIKA_HOST_DIR}"
30
26
  echo ""
31
27
 
28
+ # Method 1: Check for pika-minigame-sdk (preferred)
29
+ SDK_PATH="${PROJECT_DIR}/node_modules/pika-minigame-sdk"
30
+ if [ -d "$SDK_PATH" ]; then
31
+ echo "📦 Using pika-minigame-sdk"
32
+
33
+ # Set public path if MF_PUBLIC_PATH is set
34
+ PUBLIC_PATH_ARG=""
35
+ if [ -n "$MF_PUBLIC_PATH" ]; then
36
+ PUBLIC_PATH_ARG="--public-path $MF_PUBLIC_PATH"
37
+ fi
38
+
39
+ npx pika-build ${PLATFORM} ${PUBLIC_PATH_ARG}
40
+ exit 0
41
+ fi
42
+
43
+ # Method 2: Fall back to Pika host repo
44
+ PIKA_HOST_DIR="${PIKA_HOST_DIR:-$HOME/robotapp}"
45
+
46
+ echo "📁 Using host repo: ${PIKA_HOST_DIR}"
47
+
32
48
  # Verify host directory exists
33
49
  if [ ! -d "${PIKA_HOST_DIR}/node_modules/@callstack/repack" ]; then
34
- echo "❌ Error: Pika host not found at ${PIKA_HOST_DIR}"
35
50
  echo ""
36
- echo "Please either:"
37
- echo " 1. Set PIKA_HOST_DIR environment variable to your robotapp location"
38
- echo " 2. Or clone robotapp to ~/robotapp and run 'npm install'"
51
+ echo " Error: Build environment not found"
52
+ echo ""
53
+ echo "Please install pika-minigame-sdk:"
54
+ echo " npm install pika-minigame-sdk --save-dev"
39
55
  echo ""
40
- echo "Example:"
56
+ echo "Or set PIKA_HOST_DIR to your robotapp location:"
41
57
  echo " export PIKA_HOST_DIR=/path/to/robotapp"
42
58
  echo " ./scripts/pika-build.sh ios"
43
59
  exit 1
@@ -72,8 +88,8 @@ cat > "${WORKSPACE_DIR}/package.json" << EOF
72
88
  "version": "1.0.0",
73
89
  "private": true,
74
90
  "scripts": {
75
- "build:ios": "npx react-native webpack-bundle --platform ios --entry-file index.js --dev false --bundle-output build/outputs/ios/local/index.ios.bundle --assets-dest build/outputs/ios/local",
76
- "build:android": "npx react-native webpack-bundle --platform android --entry-file index.js --dev false --bundle-output build/outputs/android/local/index.android.bundle --assets-dest build/outputs/android/local"
91
+ "build:ios": "npx react-native webpack-bundle --platform ios --entry-file index.js --dev false",
92
+ "build:android": "npx react-native webpack-bundle --platform android --entry-file index.js --dev false"
77
93
  },
78
94
  "peerDependencies": {
79
95
  "react": "18.3.1",