sql-kite 1.0.4 → 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 +70 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,13 +10,17 @@
10
10
 
11
11
  <p align="center">
12
12
  <strong>Version-controlled SQLite for local development.</strong>
13
- </p>init
13
+ </p>
14
14
 
15
15
  <p align="center">
16
16
  Branch your database. Inspect every change. Recover instantly.<br/>
17
17
  <b>No cloud • No accounts • No telemetry</b>
18
18
  </p>
19
19
 
20
+ <p align="center">
21
+ <code>npm install -g sql-kite</code>
22
+ </p>
23
+
20
24
  ---
21
25
 
22
26
  <p align="center">
@@ -140,22 +144,6 @@ A clean local interface for:
140
144
 
141
145
  ---
142
146
 
143
- ## Screenshots
144
-
145
- ### SQL Editor
146
-
147
- Execute queries, save templates, and export results with full SQL syntax highlighting.
148
-
149
- ![SQL Editor](../../screenshots/sql-editor.png)
150
-
151
- ### Database Schema Viewer
152
-
153
- Browse tables, inspect columns, constraints, indexes, and relationships in a clean interface.
154
-
155
- ![Database Schema](../../screenshots/database-schema.png)
156
-
157
- ---
158
-
159
147
  ## Zero-Cloud Architecture
160
148
 
161
149
  SQL Kite runs **entirely on your machine**.
@@ -179,22 +167,54 @@ SQL Kite runs **entirely on your machine**.
179
167
  * Node.js 18+
180
168
  * npm
181
169
 
182
- ### Install Globally (Recommended)
170
+ ### Option 1: Global Installation (Recommended)
183
171
 
184
- Install SQL Kite globally to use it from anywhere:
172
+ Install globally to use `sql-kite` commands from anywhere:
185
173
 
186
174
  ```bash
187
175
  npm install -g sql-kite
188
176
  ```
189
177
 
190
- After installation, you can use `sql-kite` commands directly:
178
+ **Usage after global installation:**
191
179
 
192
180
  ```bash
193
181
  sql-kite new my-db
194
182
  sql-kite start my-db
183
+ sql-kite list
184
+ ```
185
+
186
+ ### Option 2: Local Installation
187
+
188
+ Install locally in your project:
189
+
190
+ ```bash
191
+ npm install sql-kite
192
+ ```
193
+
194
+ **Usage after local installation:**
195
+
196
+ Add this script to your `package.json`:
197
+
198
+ ```json
199
+ {
200
+ "scripts": {
201
+ "sql-kite": "sql-kite"
202
+ }
203
+ }
204
+ ```
205
+
206
+ Then run:
207
+
208
+ ```bash
209
+ npm run sql-kite new my-db
210
+ npm run sql-kite start my-db
211
+ npm run sql-kite list
212
+ npm run sql-kite import ./database.db
195
213
  ```
196
214
 
197
- > **Note:** Use global installation (`-g` flag) for CLI tools. After installing globally, run commands directly as `sql-kite <command>`, not `npm run sql-kite <command>`.
215
+ ---
216
+
217
+ > **Recommendation:** Use global installation for CLI tools to avoid typing `npm run` every time.
198
218
 
199
219
  ---
200
220
 
@@ -265,6 +285,12 @@ lib/database/
265
285
  └── engine.local.js
266
286
  ```
267
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
+
268
294
  **2) Use in your app:**
269
295
 
270
296
  ```javascript
@@ -273,6 +299,29 @@ import { runQuery } from '@/lib/database';
273
299
  const users = await runQuery("SELECT * FROM users WHERE active = ?", [1]);
274
300
  ```
275
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
+
276
325
  ### Two Workflow Modes
277
326
 
278
327
  **Development Mode:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sql-kite",
3
- "version": "1.0.4",
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,