sql-kite 1.0.5 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +29 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -285,6 +285,12 @@ lib/database/
285
285
  └── engine.local.js
286
286
  ```
287
287
 
288
+ | File | Purpose |
289
+ |---|---|
290
+ | `index.js` | Auto-switches between dev and production engines |
291
+ | `engine.dev.js` | HTTP client that queries the SQL-Kite server |
292
+ | `engine.local.js` | Local SQLite via expo-sqlite for production |
293
+
288
294
  **2) Use in your app:**
289
295
 
290
296
  ```javascript
@@ -293,6 +299,29 @@ import { runQuery } from '@/lib/database';
293
299
  const users = await runQuery("SELECT * FROM users WHERE active = ?", [1]);
294
300
  ```
295
301
 
302
+ ### How Dev/Prod Switching Works
303
+
304
+ The switching is **fully automatic** — the user does not need to manually toggle anything.
305
+
306
+ ```javascript
307
+ const isDev = typeof __DEV__ !== 'undefined' ? __DEV__ : process.env.NODE_ENV === 'development';
308
+ ```
309
+
310
+ **Detection order:**
311
+ 1. **Expo's `__DEV__` global** — automatically `true` in dev builds, `false` in production
312
+ 2. **Fallback:** `process.env.NODE_ENV === 'development'`
313
+
314
+ | Environment | Engine Used | How it works |
315
+ |---|---|---|
316
+ | Development (`isDev = true`) | `engine.dev.js` | Queries go to SQL-Kite server via HTTP |
317
+ | Production (`isDev = false`) | `engine.local.js` | Queries run locally via expo-sqlite |
318
+
319
+ ### Port Configuration (Dev Mode)
320
+
321
+ The dev engine connects to the SQL-Kite server using:
322
+ - `SQL_KITE_PORT` environment variable (if set)
323
+ - Default port `3000` (editable in the generated `engine.dev.js`)
324
+
296
325
  ### Two Workflow Modes
297
326
 
298
327
  **Development Mode:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sql-kite",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "SQL-Kite CLI — Local-first SQLite workspace with branches, migrations and snapshots.",
5
5
  "type": "module",
6
6
  "preferGlobal": true,