sql-kite 1.0.5 → 1.0.7

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 +39 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -164,8 +164,16 @@ SQL Kite runs **entirely on your machine**.
164
164
 
165
165
  ### Requirements
166
166
 
167
- * Node.js 18+
168
- * npm
167
+ * **Node.js 18** (LTS recommended)
168
+ * **npm**
169
+
170
+ > **Important:** SQL Kite uses [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3), a native C++ module. Node.js 20+ may have compatibility issues with the current version. **Node.js 18 LTS is recommended** for the best experience.
171
+
172
+ **Windows users:** If installation fails, you may need native build tools:
173
+ 1. Re-run the Node.js installer and check **"Automatically install the necessary tools"**
174
+ 2. Or run `C:\Program Files\nodejs\install_tools.bat` to install Python and Visual Studio Build Tools
175
+
176
+ > **No special characters or spaces in your project path** — `node-gyp` may not handle them correctly.
169
177
 
170
178
  ### Option 1: Global Installation (Recommended)
171
179
 
@@ -285,6 +293,12 @@ lib/database/
285
293
  └── engine.local.js
286
294
  ```
287
295
 
296
+ | File | Purpose |
297
+ |---|---|
298
+ | `index.js` | Auto-switches between dev and production engines |
299
+ | `engine.dev.js` | HTTP client that queries the SQL-Kite server |
300
+ | `engine.local.js` | Local SQLite via expo-sqlite for production |
301
+
288
302
  **2) Use in your app:**
289
303
 
290
304
  ```javascript
@@ -293,6 +307,29 @@ import { runQuery } from '@/lib/database';
293
307
  const users = await runQuery("SELECT * FROM users WHERE active = ?", [1]);
294
308
  ```
295
309
 
310
+ ### How Dev/Prod Switching Works
311
+
312
+ The switching is **fully automatic** — the user does not need to manually toggle anything.
313
+
314
+ ```javascript
315
+ const isDev = typeof __DEV__ !== 'undefined' ? __DEV__ : process.env.NODE_ENV === 'development';
316
+ ```
317
+
318
+ **Detection order:**
319
+ 1. **Expo's `__DEV__` global** — automatically `true` in dev builds, `false` in production
320
+ 2. **Fallback:** `process.env.NODE_ENV === 'development'`
321
+
322
+ | Environment | Engine Used | How it works |
323
+ |---|---|---|
324
+ | Development (`isDev = true`) | `engine.dev.js` | Queries go to SQL-Kite server via HTTP |
325
+ | Production (`isDev = false`) | `engine.local.js` | Queries run locally via expo-sqlite |
326
+
327
+ ### Port Configuration (Dev Mode)
328
+
329
+ The dev engine connects to the SQL-Kite server using:
330
+ - `SQL_KITE_PORT` environment variable (if set)
331
+ - Default port `3000` (editable in the generated `engine.dev.js`)
332
+
296
333
  ### Two Workflow Modes
297
334
 
298
335
  **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.7",
4
4
  "description": "SQL-Kite CLI — Local-first SQLite workspace with branches, migrations and snapshots.",
5
5
  "type": "module",
6
6
  "preferGlobal": true,
@@ -31,7 +31,7 @@
31
31
  "developer-tools"
32
32
  ],
33
33
  "engines": {
34
- "node": ">=18"
34
+ "node": ">=18 <=20"
35
35
  },
36
36
  "files": [
37
37
  "bin/",