sketchboard-app 1.0.3 → 1.0.5

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 (3) hide show
  1. package/README.md +144 -23
  2. package/bin/uninstall.js +97 -0
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -1,46 +1,167 @@
1
- # SketchBoard
1
+ <div align="center">
2
2
 
3
- A local-first whiteboard app. Run instantly with no setup required.
3
+ ```
4
+ ╔═══════════════════════════════════════════════════════╗
5
+ ║ ║
6
+ ║ ✏ S K E T C H B O A R D ║
7
+ ║ ║
8
+ ║ Draw · Save · Share · Collaborate ║
9
+ ║ ║
10
+ ╚═══════════════════════════════════════════════════════╝
11
+ ```
12
+
13
+ **A local-first whiteboard that lives on your machine.**
14
+ No account. No cloud. No setup. Just draw.
15
+
16
+ [![npm version](https://img.shields.io/npm/v/sketchboard-app?style=flat-square&color=0ea5e9&label=npm)](https://www.npmjs.com/package/sketchboard-app)
17
+ [![npm downloads](https://img.shields.io/npm/dt/sketchboard-app?style=flat-square&color=6366f1&label=installs)](https://www.npmjs.com/package/sketchboard-app)
18
+ [![License: MIT](https://img.shields.io/badge/License-MIT-22c55e?style=flat-square)](LICENSE)
19
+ [![Node.js](https://img.shields.io/badge/Node.js-18%2B-f97316?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
20
+
21
+ </div>
22
+
23
+ ---
24
+
25
+ ## Install & Run
4
26
 
5
- ## Quick Start
27
+ ### Run instantly (no install needed)
6
28
 
7
29
  ```bash
8
30
  npx sketchboard-app
9
31
  ```
10
32
 
11
- That's it. Your browser will open automatically at `http://localhost:4321`.
33
+ Your browser opens automatically at **http://localhost:4321**.
34
+
35
+ ---
36
+
37
+ ### Install globally (launch from anywhere, zero wait)
38
+
39
+ ```bash
40
+ npm install -g sketchboard-app
41
+ ```
42
+
43
+ Then just type:
44
+
45
+ ```bash
46
+ sketchboard
47
+ ```
48
+
49
+ ---
50
+
51
+ ### Uninstall
52
+
53
+ ```bash
54
+ npm uninstall -g sketchboard-app
55
+ ```
56
+
57
+ ---
12
58
 
13
59
  ## Features
14
60
 
15
- - **Zero setup** — no database, no config, no accounts needed
16
- - **Local-first** — all data stored on your machine in `~/.sketchboard`
17
- - **Offline capable** — works without internet once loaded
18
- - **Collaboration** — share drawings with others on the same network
19
- - **Export** — save your work as PNG, SVG, or JSON
61
+ - **Zero config** — one command, instant whiteboard
62
+ - **Saves to your machine** — drawings stored as JSON files in `~/.sketchboard/`
63
+ - **My Drawings sidebar** — browse, rename, load, and delete all your drawings
64
+ - **Ctrl+S** — save with unsaved-changes indicator in the toolbar
65
+ - **Share links** — generate a public read-only link for any drawing
66
+ - **Live collaboration** — real-time multi-user sessions over socket.io
67
+ - **Full export** — PNG, SVG, clipboard, or `.excalidraw` file
68
+ - **Light & dark theme** — auto-synced across the entire UI
69
+ - **Offline-capable** — works without internet once loaded
70
+ - **Cross-platform** — Windows, macOS, Linux
20
71
 
21
- ## Data Storage
72
+ ---
22
73
 
23
- All drawings are saved locally at:
74
+ ## Usage
24
75
 
25
- | OS | Path |
26
- |---|---|
27
- | Windows | `C:\Users\<you>\.sketchboard` |
28
- | macOS | `/Users/<you>/.sketchboard` |
29
- | Linux | `/home/<you>/.sketchboard` |
76
+ ```
77
+ ╔═══════════════════════════════════════╗
78
+ ║ SketchBoard ║
79
+ ╠═══════════════════════════════════════╣
80
+ ║ URL : http://localhost:4321 ║
81
+ ║ Data : ~/.sketchboard ║
82
+ ╚═══════════════════════════════════════╝
83
+ ```
30
84
 
31
- ## Configuration
85
+ ### Custom port
32
86
 
33
- | Env Variable | Default | Description |
34
- |---|---|---|
35
- | `PORT` | `4321` | Server port |
36
- | `SKETCHBOARD_DATA` | `~/.sketchboard` | Data directory |
87
+ ```bash
88
+ PORT=8888 npx sketchboard-app
89
+ # or with global install:
90
+ PORT=8888 sketchboard
91
+ ```
37
92
 
38
- Example:
93
+ ### Custom data directory
39
94
 
40
95
  ```bash
41
- PORT=5678 npx sketchboard-app
96
+ SKETCHBOARD_DATA=/path/to/my/drawings npx sketchboard-app
42
97
  ```
43
98
 
99
+ ### Environment variables
100
+
101
+ | Variable | Default | Description |
102
+ |---|---|---|
103
+ | `PORT` | `4321` | Port the server listens on |
104
+ | `SKETCHBOARD_DATA` | `~/.sketchboard` | Where drawings are stored |
105
+
106
+ ---
107
+
108
+ ## Where your data lives
109
+
110
+ ```
111
+ ~/.sketchboard/
112
+ drawings/
113
+ <uuid>.json ← one file per drawing (permanent)
114
+ library.json ← your saved shape library
115
+ collab/ ← live collaboration room scenes
116
+ collab-files/ ← collaboration image files
117
+ ```
118
+
119
+ | OS | Path |
120
+ |---|---|
121
+ | Windows | `C:\Users\<you>\.sketchboard\` |
122
+ | macOS | `/Users/<you>/.sketchboard/` |
123
+ | Linux | `/home/<you>/.sketchboard/` |
124
+
125
+ Plain JSON files — easy to back up, move, or sync with any tool.
126
+
127
+ ---
128
+
129
+ ## Keyboard shortcuts
130
+
131
+ | Shortcut | Action |
132
+ |---|---|
133
+ | `Ctrl+S` / `Cmd+S` | Save current drawing |
134
+ | `Ctrl+Z` | Undo |
135
+ | `Ctrl+Shift+Z` | Redo |
136
+ | `V` | Selection tool |
137
+ | `R` | Rectangle |
138
+ | `E` | Ellipse |
139
+ | `A` | Arrow |
140
+ | `T` | Text |
141
+ | `P` | Pencil / freehand |
142
+ | `Delete` | Delete selected |
143
+
144
+ ---
145
+
146
+ ## Troubleshooting
147
+
148
+ | Problem | Fix |
149
+ |---|---|
150
+ | Port 4321 already in use | `PORT=5678 npx sketchboard-app` |
151
+ | Browser does not open | Manually visit `http://localhost:4321` |
152
+ | Old version cached by npx | `npx --yes sketchboard-app@latest` |
153
+ | `EACCES` error on Linux/Mac | `sudo npm install -g sketchboard-app` |
154
+ | Drawings not saving | Check `~/.sketchboard/drawings/` is writable |
155
+
156
+ ---
157
+
158
+ ## Credits
159
+
160
+ Built on top of **[Excalidraw](https://github.com/excalidraw/excalidraw)** — the excellent open-source hand-drawn whiteboard (MIT licensed).
161
+ SketchBoard adds local persistence, drawing management, and the npm package layer.
162
+
163
+ ---
164
+
44
165
  ## License
45
166
 
46
167
  MIT
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const readline = require("readline");
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const os = require("os");
9
+
10
+ const DATA_DIR = process.env.SKETCHBOARD_DATA || path.join(os.homedir(), ".sketchboard");
11
+ const exists = fs.existsSync(DATA_DIR);
12
+
13
+ // Non-interactive environment (CI/pipe) — skip prompt, keep data
14
+ if (!process.stdin.isTTY) {
15
+ process.exit(0);
16
+ }
17
+
18
+ // ── Count saved drawings ──────────────────────────────────────────────────────
19
+ let drawingCount = 0;
20
+ try {
21
+ const drawingsDir = path.join(DATA_DIR, "drawings");
22
+ if (fs.existsSync(drawingsDir)) {
23
+ drawingCount = fs.readdirSync(drawingsDir).filter((f) => f.endsWith(".json")).length;
24
+ }
25
+ } catch { /* ignore */ }
26
+
27
+ // ── Banner ────────────────────────────────────────────────────────────────────
28
+ const shortPath = DATA_DIR.length > 46 ? "..." + DATA_DIR.slice(-43) : DATA_DIR;
29
+
30
+ console.log(`
31
+ ╔════════════════════════════════════════════════════╗
32
+ ║ SketchBoard Uninstaller ║
33
+ ╠════════════════════════════════════════════════════╣`);
34
+
35
+ if (exists && drawingCount > 0) {
36
+ console.log(` ║ ║
37
+ ║ You have ${String(drawingCount).padEnd(3)} saved drawing(s) at: ║
38
+ ║ ${shortPath.padEnd(50)} ║
39
+ ║ ║`);
40
+ } else if (exists) {
41
+ console.log(` ║ ║
42
+ ║ Data folder exists (no drawings saved yet): ║
43
+ ║ ${shortPath.padEnd(50)} ║
44
+ ║ ║`);
45
+ } else {
46
+ console.log(` ║ ║
47
+ ║ No data folder found — nothing to delete. ║
48
+ ║ ║`);
49
+ }
50
+
51
+ console.log(` ╚════════════════════════════════════════════════════╝
52
+ `);
53
+
54
+ console.log(" How would you like to uninstall?\n");
55
+ console.log(" [1] Soft uninstall — remove the app, keep your drawings (default)");
56
+ console.log(" [2] Full uninstall — remove the app AND delete all drawings\n");
57
+
58
+ // ── Prompt ────────────────────────────────────────────────────────────────────
59
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
60
+
61
+ // Safety timeout — if no answer in 30s, default to soft uninstall
62
+ const timeout = setTimeout(() => {
63
+ rl.close();
64
+ console.log("\n (Timed out — defaulting to soft uninstall. Your drawings are safe.)\n");
65
+ process.exit(0);
66
+ }, 30_000);
67
+
68
+ rl.question(" Your choice (1 or 2, press Enter for 1): ", (answer) => {
69
+ clearTimeout(timeout);
70
+ rl.close();
71
+
72
+ const choice = answer.trim();
73
+
74
+ if (choice === "2") {
75
+ console.log();
76
+ if (exists) {
77
+ try {
78
+ fs.rmSync(DATA_DIR, { recursive: true, force: true });
79
+ console.log(` ✓ Deleted ${DATA_DIR}`);
80
+ if (drawingCount > 0) {
81
+ console.log(` ✓ ${drawingCount} drawing(s) removed`);
82
+ }
83
+ } catch (err) {
84
+ console.error(` ✗ Could not delete ${DATA_DIR}: ${err.message}`);
85
+ console.error(" You can delete it manually in File Explorer.\n");
86
+ }
87
+ } else {
88
+ console.log(" (No data folder found — nothing to delete)");
89
+ }
90
+ console.log("\n Proceeding with full uninstall...\n");
91
+ } else {
92
+ console.log("\n Your drawings are safe.");
93
+ console.log(" Proceeding with soft uninstall...\n");
94
+ }
95
+
96
+ process.exit(0);
97
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sketchboard-app",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "SketchBoard — local-first whiteboard app. Run with: npx sketchboard-app",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -15,7 +15,8 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "start": "NODE_ENV=production node server.js",
18
- "dev": "nodemon server.js"
18
+ "dev": "nodemon server.js",
19
+ "preuninstall": "node bin/uninstall.js"
19
20
  },
20
21
  "dependencies": {
21
22
  "compression": "^1.7.4",