@blu1606/create-walrus-app 2.2.0 → 2.2.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blu1606/create-walrus-app",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Interactive CLI for scaffolding Walrus applications",
5
5
  "type": "module",
6
6
  "bin": {
@@ -69,10 +69,10 @@ setup_bun() {
69
69
  setup_site_builder() {
70
70
  # Set install directory based on OS
71
71
  if [ "$OS_TYPE" = "windows" ]; then
72
- WALRUS_BIN="$USERPROFILE/bin"
72
+ WALRUS_BIN="$USERPROFILE/.walrus/bin"
73
73
  SITE_BUILDER="$WALRUS_BIN/site-builder.exe"
74
74
  else
75
- WALRUS_BIN="$HOME/bin"
75
+ WALRUS_BIN="$HOME/.walrus/bin"
76
76
  SITE_BUILDER="$WALRUS_BIN/site-builder"
77
77
  fi
78
78
 
@@ -86,25 +86,45 @@ setup_site_builder() {
86
86
  echo "📥 Downloading site-builder for $OS_TYPE..."
87
87
  mkdir -p "$WALRUS_BIN"
88
88
 
89
- # Select binary based on OS
89
+ # Select binary based on OS and architecture (following official Walrus naming)
90
90
  case "$OS_TYPE" in
91
- linux) BINARY_NAME="site-builder-linux" ;;
92
- macos) BINARY_NAME="site-builder-macos" ;;
93
- windows) BINARY_NAME="site-builder-windows.exe" ;;
91
+ linux)
92
+ case "$ARCH" in
93
+ x86_64) SYSTEM="ubuntu-x86_64" ;;
94
+ *) SYSTEM="ubuntu-x86_64-generic" ;;
95
+ esac
96
+ ;;
97
+ macos)
98
+ case "$ARCH" in
99
+ arm64) SYSTEM="macos-arm64" ;;
100
+ x86_64) SYSTEM="macos-x86_64" ;;
101
+ *) SYSTEM="macos-x86_64" ;;
102
+ esac
103
+ ;;
104
+ windows)
105
+ SYSTEM="windows-x86_64.exe"
106
+ ;;
94
107
  esac
95
108
 
96
- SYSTEM=ubuntu-x86_64
97
- curl https://storage.googleapis.com/mysten-walrus-binaries/site-builder-testnet-latest-$SYSTEM -o site-builder
98
- chmod +x site-builder
109
+ # Use official Google Cloud Storage URL (testnet)
110
+ DOWNLOAD_URL="https://storage.googleapis.com/mysten-walrus-binaries/site-builder-testnet-latest-$SYSTEM"
111
+
112
+ # Download with retry
113
+ if ! curl -fsSL -o "$SITE_BUILDER" "$DOWNLOAD_URL"; then
114
+ echo "❌ Failed to download site-builder from: $DOWNLOAD_URL"
115
+ echo " System detected: $OS_TYPE ($ARCH)"
116
+ echo " Binary variant: $SYSTEM"
117
+ exit 1
118
+ fi
99
119
 
100
120
  chmod +x "$SITE_BUILDER"
101
121
  echo "✅ site-builder installed: $SITE_BUILDER"
102
122
 
103
123
  # Add to PATH hint (won't persist after script)
104
124
  if [ "$OS_TYPE" = "windows" ]; then
105
- export PATH="$USERPROFILE/bin:$PATH"
125
+ export PATH="$USERPROFILE/.walrus/bin:$PATH"
106
126
  else
107
- export PATH="$HOME/bin:$PATH"
127
+ export PATH="$HOME/.walrus/bin:$PATH"
108
128
  fi
109
129
  }
110
130
 
@@ -113,9 +133,9 @@ setup_site_builder() {
113
133
  # ============================================================================
114
134
  setup_portal() {
115
135
  if [ "$OS_TYPE" = "windows" ]; then
116
- PORTAL_DIR="$USERPROFILE/portal"
136
+ PORTAL_DIR="$USERPROFILE/.walrus/portal"
117
137
  else
118
- PORTAL_DIR="$HOME/portal"
138
+ PORTAL_DIR="$HOME/.walrus/portal"
119
139
  fi
120
140
 
121
141
  if [ -d "$PORTAL_DIR" ]; then
@@ -137,6 +157,12 @@ setup_portal() {
137
157
  echo "✅ Portal cloned to: $PORTAL_DIR"
138
158
  fi
139
159
 
160
+ # Navigate to portal subdirectory if it exists (some repos have portal/ subfolder)
161
+ if [ -d "portal" ] && [ -f "portal/package.json" ]; then
162
+ cd portal
163
+ echo "📍 Using portal subdirectory"
164
+ fi
165
+
140
166
  # Setup .env if not exists
141
167
  if [ ! -f ".env" ]; then
142
168
  if [ -f ".env.example" ]; then
@@ -164,14 +190,17 @@ EOF
164
190
  echo "✅ .env already configured"
165
191
  fi
166
192
 
167
- # Install portal dependencies
168
- echo "📦 Installing portal dependencies..."
169
- if ! bun install --silent; then
170
- echo "❌ Bun install failed"
171
- exit 1
193
+ # Install portal dependencies (if package.json exists)
194
+ if [ -f "package.json" ]; then
195
+ echo "📦 Installing portal dependencies..."
196
+ if ! bun install --silent; then
197
+ echo "❌ Bun install failed"
198
+ exit 1
199
+ fi
200
+ echo "✅ Portal dependencies installed"
201
+ else
202
+ echo "⚠️ No package.json found, skipping dependency installation"
172
203
  fi
173
-
174
- echo "✅ Portal dependencies installed"
175
204
  }
176
205
 
177
206
  # ============================================================================
@@ -189,7 +218,9 @@ add_project_scripts() {
189
218
  echo "📝 Adding Walrus deploy scripts to package.json..."
190
219
 
191
220
  # Use Node.js to safely modify package.json (guaranteed to exist in Node projects)
192
- node -e "
221
+ # Use NODE_CMD to handle both Unix and Windows (node.exe in Git Bash)
222
+ NODE_CMD=$(command -v node || command -v node.exe)
223
+ "$NODE_CMD" -e "
193
224
  const fs = require('fs');
194
225
  const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
195
226
 
@@ -202,15 +233,15 @@ add_project_scripts() {
202
233
 
203
234
  if (!pkg.scripts['deploy:walrus']) {
204
235
  const siteBuilderPath = process.platform === 'win32'
205
- ? '%USERPROFILE%/bin/site-builder.exe'
206
- : '~/bin/site-builder';
236
+ ? '%USERPROFILE%/.walrus/bin/site-builder.exe'
237
+ : '~/.walrus/bin/site-builder';
207
238
  pkg.scripts['deploy:walrus'] = siteBuilderPath + ' --context=testnet deploy ./dist --epochs 10';
208
239
  }
209
240
 
210
241
  if (!pkg.scripts['walrus:portal']) {
211
242
  const portalPath = process.platform === 'win32'
212
- ? 'cd %USERPROFILE%/portal'
213
- : 'cd ~/portal';
243
+ ? 'cd %USERPROFILE%/.walrus/portal'
244
+ : 'cd ~/.walrus/portal';
214
245
  pkg.scripts['walrus:portal'] = portalPath + ' && bun run server';
215
246
  }
216
247
 
@@ -241,7 +272,8 @@ main() {
241
272
  exit 1
242
273
  fi
243
274
 
244
- if ! command -v node &>/dev/null; then
275
+ # Check for Node.js - Windows-compatible
276
+ if ! command -v node &>/dev/null && ! command -v node.exe &>/dev/null; then
245
277
  echo "❌ Node.js not found. Install: https://nodejs.org"
246
278
  exit 1
247
279
  fi
@@ -86,18 +86,34 @@ setup_site_builder() {
86
86
  echo "📥 Downloading site-builder for $OS_TYPE..."
87
87
  mkdir -p "$WALRUS_BIN"
88
88
 
89
- # Select binary based on OS
89
+ # Select binary based on OS and architecture (following official Walrus naming)
90
90
  case "$OS_TYPE" in
91
- linux) BINARY_NAME="site-builder-linux" ;;
92
- macos) BINARY_NAME="site-builder-macos" ;;
93
- windows) BINARY_NAME="site-builder-windows.exe" ;;
91
+ linux)
92
+ case "$ARCH" in
93
+ x86_64) SYSTEM="ubuntu-x86_64" ;;
94
+ *) SYSTEM="ubuntu-x86_64-generic" ;;
95
+ esac
96
+ ;;
97
+ macos)
98
+ case "$ARCH" in
99
+ arm64) SYSTEM="macos-arm64" ;;
100
+ x86_64) SYSTEM="macos-x86_64" ;;
101
+ *) SYSTEM="macos-x86_64" ;;
102
+ esac
103
+ ;;
104
+ windows)
105
+ SYSTEM="windows-x86_64.exe"
106
+ ;;
94
107
  esac
95
108
 
96
- DOWNLOAD_URL="https://github.com/MystenLabs/walrus-sites/releases/latest/download/$BINARY_NAME"
109
+ # Use official Google Cloud Storage URL (testnet)
110
+ DOWNLOAD_URL="https://storage.googleapis.com/mysten-walrus-binaries/site-builder-testnet-latest-$SYSTEM"
97
111
 
98
112
  # Download with retry
99
113
  if ! curl -fsSL -o "$SITE_BUILDER" "$DOWNLOAD_URL"; then
100
114
  echo "❌ Failed to download site-builder from: $DOWNLOAD_URL"
115
+ echo " System detected: $OS_TYPE ($ARCH)"
116
+ echo " Binary variant: $SYSTEM"
101
117
  exit 1
102
118
  fi
103
119
 
@@ -141,6 +157,12 @@ setup_portal() {
141
157
  echo "✅ Portal cloned to: $PORTAL_DIR"
142
158
  fi
143
159
 
160
+ # Navigate to portal subdirectory (the actual portal app is in portal/ folder)
161
+ if [ -d "portal" ]; then
162
+ cd portal
163
+ echo "📍 Using portal subdirectory"
164
+ fi
165
+
144
166
  # Setup .env if not exists
145
167
  if [ ! -f ".env" ]; then
146
168
  if [ -f ".env.example" ]; then
@@ -161,21 +183,24 @@ EOF
161
183
 
162
184
  echo ""
163
185
  echo "⚠️ ACTION REQUIRED:"
164
- echo " Edit $PORTAL_DIR/.env"
186
+ echo " Edit $PORTAL_DIR/portal/.env (or $PORTAL_DIR/.env)"
165
187
  echo " Add your SUI_PRIVATE_KEY=0x..."
166
188
  echo ""
167
189
  else
168
190
  echo "✅ .env already configured"
169
191
  fi
170
192
 
171
- # Install portal dependencies
172
- echo "📦 Installing portal dependencies..."
173
- if ! bun install --silent; then
174
- echo "❌ Bun install failed"
175
- exit 1
193
+ # Install portal dependencies (if package.json exists)
194
+ if [ -f "package.json" ]; then
195
+ echo "📦 Installing portal dependencies..."
196
+ if ! bun install --silent; then
197
+ echo "❌ Bun install failed"
198
+ exit 1
199
+ fi
200
+ echo "✅ Portal dependencies installed"
201
+ else
202
+ echo "⚠️ No package.json found, skipping dependency installation"
176
203
  fi
177
-
178
- echo "✅ Portal dependencies installed"
179
204
  }
180
205
 
181
206
  # ============================================================================
@@ -193,7 +218,9 @@ add_project_scripts() {
193
218
  echo "📝 Adding Walrus deploy scripts to package.json..."
194
219
 
195
220
  # Use Node.js to safely modify package.json (guaranteed to exist in Node projects)
196
- node -e "
221
+ # Use NODE_CMD to handle both Unix and Windows (node.exe in Git Bash)
222
+ NODE_CMD=$(command -v node || command -v node.exe)
223
+ "$NODE_CMD" -e "
197
224
  const fs = require('fs');
198
225
  const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
199
226
 
@@ -245,7 +272,8 @@ main() {
245
272
  exit 1
246
273
  fi
247
274
 
248
- if ! command -v node &>/dev/null; then
275
+ # Check for Node.js - Windows-compatible
276
+ if ! command -v node &>/dev/null && ! command -v node.exe &>/dev/null; then
249
277
  echo "❌ Node.js not found. Install: https://nodejs.org"
250
278
  exit 1
251
279
  fi
@@ -86,18 +86,34 @@ setup_site_builder() {
86
86
  echo "📥 Downloading site-builder for $OS_TYPE..."
87
87
  mkdir -p "$WALRUS_BIN"
88
88
 
89
- # Select binary based on OS
89
+ # Select binary based on OS and architecture (following official Walrus naming)
90
90
  case "$OS_TYPE" in
91
- linux) BINARY_NAME="site-builder-linux" ;;
92
- macos) BINARY_NAME="site-builder-macos" ;;
93
- windows) BINARY_NAME="site-builder-windows.exe" ;;
91
+ linux)
92
+ case "$ARCH" in
93
+ x86_64) SYSTEM="ubuntu-x86_64" ;;
94
+ *) SYSTEM="ubuntu-x86_64-generic" ;;
95
+ esac
96
+ ;;
97
+ macos)
98
+ case "$ARCH" in
99
+ arm64) SYSTEM="macos-arm64" ;;
100
+ x86_64) SYSTEM="macos-x86_64" ;;
101
+ *) SYSTEM="macos-x86_64" ;;
102
+ esac
103
+ ;;
104
+ windows)
105
+ SYSTEM="windows-x86_64.exe"
106
+ ;;
94
107
  esac
95
108
 
96
- DOWNLOAD_URL="https://github.com/MystenLabs/walrus-sites/releases/latest/download/$BINARY_NAME"
109
+ # Use official Google Cloud Storage URL (testnet)
110
+ DOWNLOAD_URL="https://storage.googleapis.com/mysten-walrus-binaries/site-builder-testnet-latest-$SYSTEM"
97
111
 
98
112
  # Download with retry
99
113
  if ! curl -fsSL -o "$SITE_BUILDER" "$DOWNLOAD_URL"; then
100
114
  echo "❌ Failed to download site-builder from: $DOWNLOAD_URL"
115
+ echo " System detected: $OS_TYPE ($ARCH)"
116
+ echo " Binary variant: $SYSTEM"
101
117
  exit 1
102
118
  fi
103
119
 
@@ -141,6 +157,12 @@ setup_portal() {
141
157
  echo "✅ Portal cloned to: $PORTAL_DIR"
142
158
  fi
143
159
 
160
+ # Navigate to portal subdirectory (the actual portal app is in portal/ folder)
161
+ if [ -d "portal" ]; then
162
+ cd portal
163
+ echo "📍 Using portal subdirectory"
164
+ fi
165
+
144
166
  # Setup .env if not exists
145
167
  if [ ! -f ".env" ]; then
146
168
  if [ -f ".env.example" ]; then
@@ -161,21 +183,24 @@ EOF
161
183
 
162
184
  echo ""
163
185
  echo "⚠️ ACTION REQUIRED:"
164
- echo " Edit $PORTAL_DIR/.env"
186
+ echo " Edit $PORTAL_DIR/portal/.env (or $PORTAL_DIR/.env)"
165
187
  echo " Add your SUI_PRIVATE_KEY=0x..."
166
188
  echo ""
167
189
  else
168
190
  echo "✅ .env already configured"
169
191
  fi
170
192
 
171
- # Install portal dependencies
172
- echo "📦 Installing portal dependencies..."
173
- if ! bun install --silent; then
174
- echo "❌ Bun install failed"
175
- exit 1
193
+ # Install portal dependencies (if package.json exists)
194
+ if [ -f "package.json" ]; then
195
+ echo "📦 Installing portal dependencies..."
196
+ if ! bun install --silent; then
197
+ echo "❌ Bun install failed"
198
+ exit 1
199
+ fi
200
+ echo "✅ Portal dependencies installed"
201
+ else
202
+ echo "⚠️ No package.json found, skipping dependency installation"
176
203
  fi
177
-
178
- echo "✅ Portal dependencies installed"
179
204
  }
180
205
 
181
206
  # ============================================================================
@@ -193,7 +218,9 @@ add_project_scripts() {
193
218
  echo "📝 Adding Walrus deploy scripts to package.json..."
194
219
 
195
220
  # Use Node.js to safely modify package.json (guaranteed to exist in Node projects)
196
- node -e "
221
+ # Use NODE_CMD to handle both Unix and Windows (node.exe in Git Bash)
222
+ NODE_CMD=$(command -v node || command -v node.exe)
223
+ "$NODE_CMD" -e "
197
224
  const fs = require('fs');
198
225
  const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
199
226
 
@@ -245,7 +272,8 @@ main() {
245
272
  exit 1
246
273
  fi
247
274
 
248
- if ! command -v node &>/dev/null; then
275
+ # Check for Node.js - Windows-compatible
276
+ if ! command -v node &>/dev/null && ! command -v node.exe &>/dev/null; then
249
277
  echo "❌ Node.js not found. Install: https://nodejs.org"
250
278
  exit 1
251
279
  fi