feat(desktop): add --reset flag to clear user data for testing
- Add reset-user-data.sh script to clear ~/.super-multica/ - Add --reset CLI flag to clear localStorage on startup - Add dev:reset npm script for development testing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c0db46e200
commit
4961604f31
3 changed files with 56 additions and 1 deletions
|
|
@ -44,7 +44,7 @@ process.stderr?.on?.('error', (err: NodeJS.ErrnoException) => {
|
|||
throw err
|
||||
})
|
||||
|
||||
import { app, BrowserWindow, shell, ipcMain } from 'electron'
|
||||
import { app, BrowserWindow, shell, ipcMain, session } from 'electron'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'node:path'
|
||||
import { registerAllIpcHandlers, initializeApp, cleanupAll, setupDeviceConfirmation } from './ipc/index.js'
|
||||
|
|
@ -65,6 +65,7 @@ process.env.VITE_PUBLIC = VITE_DEV_SERVER_URL ? path.join(process.env.APP_ROOT,
|
|||
|
||||
// CLI flags
|
||||
const forceOnboarding = process.argv.includes('--force-onboarding')
|
||||
const resetUserData = process.argv.includes('--reset')
|
||||
|
||||
let win: BrowserWindow | null
|
||||
|
||||
|
|
@ -113,6 +114,15 @@ app.on('before-quit', () => {
|
|||
})
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
// Reset user data if --reset flag is passed (for development testing)
|
||||
if (resetUserData) {
|
||||
console.log('[reset] Clearing localStorage...')
|
||||
await session.defaultSession.clearStorageData({
|
||||
storages: ['localstorage']
|
||||
})
|
||||
console.log('[reset] localStorage cleared')
|
||||
}
|
||||
|
||||
// App-level IPC handlers
|
||||
ipcMain.handle('app:getFlags', () => ({ forceOnboarding }))
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"mu": "pnpm --filter @multica/cli dev",
|
||||
"dev": "pnpm --filter @multica/desktop dev",
|
||||
"dev:desktop": "pnpm --filter @multica/desktop dev",
|
||||
"dev:reset": "bash scripts/reset-user-data.sh && pnpm --filter @multica/desktop dev -- --reset",
|
||||
"dev:gateway": "pnpm --filter @multica/gateway dev",
|
||||
"dev:web": "pnpm --filter @multica/web dev",
|
||||
"dev:all": "concurrently \"pnpm dev:gateway\" \"pnpm dev:web\"",
|
||||
|
|
|
|||
44
scripts/reset-user-data.sh
Executable file
44
scripts/reset-user-data.sh
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
# Reset all user data for super-multica desktop app
|
||||
# Use this to simulate a fresh install for testing
|
||||
|
||||
set -e
|
||||
|
||||
echo "🧹 Resetting Super Multica user data..."
|
||||
|
||||
# Main data directory
|
||||
MULTICA_DATA_DIR="$HOME/.super-multica"
|
||||
if [ -d "$MULTICA_DATA_DIR" ]; then
|
||||
echo " Removing $MULTICA_DATA_DIR"
|
||||
rm -rf "$MULTICA_DATA_DIR"
|
||||
else
|
||||
echo " $MULTICA_DATA_DIR does not exist, skipping"
|
||||
fi
|
||||
|
||||
# Electron app data (macOS)
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
ELECTRON_APP_DATA="$HOME/Library/Application Support/super-multica"
|
||||
if [ -d "$ELECTRON_APP_DATA" ]; then
|
||||
echo " Removing $ELECTRON_APP_DATA"
|
||||
rm -rf "$ELECTRON_APP_DATA"
|
||||
else
|
||||
echo " $ELECTRON_APP_DATA does not exist, skipping"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Electron app data (Linux)
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
ELECTRON_APP_DATA="$HOME/.config/super-multica"
|
||||
if [ -d "$ELECTRON_APP_DATA" ]; then
|
||||
echo " Removing $ELECTRON_APP_DATA"
|
||||
rm -rf "$ELECTRON_APP_DATA"
|
||||
else
|
||||
echo " $ELECTRON_APP_DATA does not exist, skipping"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "✅ User data reset complete!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " pnpm dev # Start app (will show onboarding)"
|
||||
echo " pnpm dev:reset # Reset and start in one command"
|
||||
Loading…
Add table
Add a link
Reference in a new issue