better-auth-studio 1.0.72 → 1.0.74-beta.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/README.md CHANGED
@@ -14,7 +14,7 @@ A sneak peek of the studio dashboard and management interface.
14
14
  <table>
15
15
  <tr>
16
16
  <td width="50%">
17
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJoDfkJ9wMTlHmhCfKGn1VSWOkq0g8sLJirp6A" alt="Better Auth Studio Preview 0" width="100%" />
17
+ <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJI57TKc4BY9GjOlTtSmoRXCZJ2D50IWsLq6vd" alt="Better Auth Studio Preview 0" width="100%" />
18
18
  </td>
19
19
  <td width="50%">
20
20
  <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJ4L7IilBo7ItO3420CBLpvnPJlA6j5zaFYZbG" alt="Better Auth Studio Preview 4" width="100%" />
@@ -227,6 +227,7 @@ pnpx better-auth-studio start [options]
227
227
  - `--host <string>` - Specify host (default: localhost)
228
228
  - `--no-open` - Don't automatically open browser
229
229
  - `--config <path>` - Path to auth config file (default: auto-detect)
230
+ - `--watch` - Watch for changes in auth config file and reload server automatically
230
231
 
231
232
  **Examples:**
232
233
  ```bash
@@ -241,33 +242,40 @@ pnpm better-auth-studio start --no-open
241
242
 
242
243
  # Use custom config file
243
244
  pnpm better-auth-studio start --config ./custom-auth.ts
245
+
246
+ # Enable watch mode for auto-reload on config changes
247
+ pnpm better-auth-studio start --watch
248
+
249
+ # Combine multiple options
250
+ pnpx better-auth-studio start --port 3001 --watch --config ./src/auth.ts
244
251
  ```
245
252
 
246
253
  ### Using `--config` Option
247
254
 
248
- The `--config` option allows you to specify a custom path to your Better Auth configuration file. This is useful when:
249
-
250
- - Your auth config file is in a non-standard location
251
- - You have multiple auth config files in your project
252
- - You're working with monorepos or nested project structures
253
- - Auto-detection fails to find your config file
254
-
255
- **How it works:**
256
- - Better Auth Studio automatically searches for config files in common locations:
257
- - `auth.ts`, `auth.js`, `auth.server.ts`, `auth.server.js`
258
- - `src/auth.ts`, `lib/auth.ts`, `server/auth.ts`, etc.
259
- - When `--config` is provided, it uses the specified path instead
260
-
261
- **Path resolution:**
262
- - **Relative paths** are resolved from the current working directory:
263
- ```bash
264
- pnpm better-auth-studio start --config ./src/lib/auth.ts
265
- pnpm better-auth-studio start --config ../shared/auth.ts
266
- ```
267
- - **Absolute paths** are used as-is:
268
- ```bash
269
- pnpm better-auth-studio start --config /path/to/project/auth.ts
270
- ```
255
+ Specify a custom path to your auth config file when it's in a non-standard location or auto-detection fails.
256
+
257
+ **Example:**
258
+ ```bash
259
+ # With relative path
260
+ pnpm better-auth-studio start --config ./src/lib/auth.ts
261
+
262
+ # With absolute path
263
+ pnpm better-auth-studio start --config /path/to/project/auth.ts
264
+ ```
265
+
266
+ **How it works:** Studio automatically searches for config files in common locations (`auth.ts`, `src/auth.ts`, `lib/auth.ts`, etc.). Use `--config` to specify a custom path when needed.
267
+
268
+ ### Using `--watch` Option
269
+
270
+ Automatically reload the server when your `auth.ts` file changes. Perfect for development when iterating on your auth configuration.
271
+
272
+ **Example:**
273
+ ```bash
274
+ # Start with watch mode enabled
275
+ pnpx better-auth-studio start --watch
276
+ ```
277
+
278
+ **How it works:** Monitors your auth config file for changes, automatically restarts the server, and updates the browser UI via WebSocket - no manual refresh needed.
271
279
 
272
280
  ### Other Commands
273
281
  ```bash
package/dist/cli.js CHANGED
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAqLhG;AAeD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAi1KR"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAqLhG;AAeD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAs1KR"}
package/dist/routes.js CHANGED
@@ -1219,10 +1219,16 @@ export function createRoutes(authConfig, configPath, geoDbPath) {
1219
1219
  }
1220
1220
  if (script) {
1221
1221
  // TODO: use more of sandbox environment to execute the script for security reasons
1222
- const result = eval(script);
1222
+ try {
1223
+ const result = eval(script);
1224
+ }
1225
+ catch (error) {
1226
+ return res
1227
+ .status(500)
1228
+ .json({ success: false, error: 'Failed to execute migration script' });
1229
+ }
1223
1230
  return res.json({
1224
1231
  success: true,
1225
- result: result,
1226
1232
  });
1227
1233
  }
1228
1234
  else {