diff --git a/app/main/store.ts b/app/main/store.ts index f64efdc..3df522f 100644 --- a/app/main/store.ts +++ b/app/main/store.ts @@ -1,47 +1,58 @@ import fs from 'node:fs'; import path from 'node:path'; -import Database from 'better-sqlite3'; - import type { CharacterSheet, SystemDefinition } from '../shared/types.ts'; import { validateSystemDefinition } from '../shared/systemValidate.ts'; +type Meta = { + systems: Record; + characters: Record; +}; + export class AppStore { - private readonly db: Database.Database; + private readonly rootDir: string; + private readonly dbPath: string; + private data: Meta = { systems: {}, characters: {} }; constructor(dbPath: string) { - fs.mkdirSync(path.dirname(dbPath), { recursive: true }); - this.db = new Database(dbPath); - this.db.exec(` - CREATE TABLE IF NOT EXISTS systems ( - id TEXT PRIMARY KEY, - revision INTEGER NOT NULL, - schema_version INTEGER NOT NULL, - name TEXT NOT NULL, - json TEXT NOT NULL, - updated_at TEXT NOT NULL - ); - CREATE TABLE IF NOT EXISTS characters ( - id TEXT PRIMARY KEY, - system_id TEXT NOT NULL, - name TEXT NOT NULL, - json TEXT NOT NULL, - updated_at TEXT NOT NULL - ); - `); + // dbPath historically pointed at *.sqlite — keep parent dir, use store.json + this.rootDir = path.dirname(dbPath); + this.dbPath = path.join(this.rootDir, 'store.json'); + fs.mkdirSync(this.rootDir, { recursive: true }); + this.load(); + } + + private load(): void { + try { + const raw = fs.readFileSync(this.dbPath, 'utf8'); + const parsed = JSON.parse(raw) as Meta; + this.data = { + systems: parsed.systems ?? {}, + characters: parsed.characters ?? {}, + }; + } catch { + this.data = { systems: {}, characters: {} }; + this.persist(); + } + } + + private persist(): void { + fs.writeFileSync(this.dbPath, JSON.stringify(this.data, null, 2), 'utf8'); } listSystems(): Array<{ id: string; name: string; revision: number; schemaVersion: number }> { - return this.db - .prepare('SELECT id, name, revision, schema_version AS schemaVersion FROM systems ORDER BY name') - .all() as Array<{ id: string; name: string; revision: number; schemaVersion: number }>; + return Object.values(this.data.systems) + .map((s) => ({ + id: s.id, + name: s.name, + revision: s.revision, + schemaVersion: s.schemaVersion, + })) + .sort((a, b) => a.name.localeCompare(b.name)); } getSystem(id: string): SystemDefinition | null { - const row = this.db.prepare('SELECT json FROM systems WHERE id = ?').get(id) as - | { json: string } - | undefined; - return row ? (JSON.parse(row.json) as SystemDefinition) : null; + return this.data.systems[id] ?? null; } upsertSystem(system: SystemDefinition): SystemDefinition { @@ -49,89 +60,47 @@ export class AppStore { if (!check.ok) { throw new Error(check.errors.map((e) => e.message).join('; ')); } - const existing = this.getSystem(system.id); + const existing = this.data.systems[system.id]; const next: SystemDefinition = { ...system, revision: existing ? existing.revision + 1 : system.revision || 1, }; - const now = new Date().toISOString(); - this.db - .prepare( - `INSERT INTO systems (id, revision, schema_version, name, json, updated_at) - VALUES (@id, @revision, @schemaVersion, @name, @json, @updatedAt) - ON CONFLICT(id) DO UPDATE SET - revision=excluded.revision, - schema_version=excluded.schema_version, - name=excluded.name, - json=excluded.json, - updated_at=excluded.updated_at`, - ) - .run({ - id: next.id, - revision: next.revision, - schemaVersion: next.schemaVersion, - name: next.name, - json: JSON.stringify(next), - updatedAt: now, - }); + this.data.systems[next.id] = next; + this.persist(); return next; } deleteSystem(id: string): void { - const tx = this.db.transaction(() => { - this.db.prepare('DELETE FROM characters WHERE system_id = ?').run(id); - this.db.prepare('DELETE FROM systems WHERE id = ?').run(id); - }); - tx(); + delete this.data.systems[id]; + for (const [cid, ch] of Object.entries(this.data.characters)) { + if (ch.systemId === id) delete this.data.characters[cid]; + } + this.persist(); } listCharacters(systemId?: string): Array<{ id: string; name: string; systemId: string }> { - if (systemId) { - return this.db - .prepare( - 'SELECT id, name, system_id AS systemId FROM characters WHERE system_id = ? ORDER BY name', - ) - .all(systemId) as Array<{ id: string; name: string; systemId: string }>; - } - return this.db - .prepare('SELECT id, name, system_id AS systemId FROM characters ORDER BY name') - .all() as Array<{ id: string; name: string; systemId: string }>; + return Object.values(this.data.characters) + .filter((c) => (systemId ? c.systemId === systemId : true)) + .map((c) => ({ id: c.id, name: c.name, systemId: c.systemId })) + .sort((a, b) => a.name.localeCompare(b.name)); } getCharacter(id: string): CharacterSheet | null { - const row = this.db.prepare('SELECT json FROM characters WHERE id = ?').get(id) as - | { json: string } - | undefined; - return row ? (JSON.parse(row.json) as CharacterSheet) : null; + return this.data.characters[id] ?? null; } upsertCharacter(character: CharacterSheet): CharacterSheet { - const now = new Date().toISOString(); - this.db - .prepare( - `INSERT INTO characters (id, system_id, name, json, updated_at) - VALUES (@id, @systemId, @name, @json, @updatedAt) - ON CONFLICT(id) DO UPDATE SET - system_id=excluded.system_id, - name=excluded.name, - json=excluded.json, - updated_at=excluded.updated_at`, - ) - .run({ - id: character.id, - systemId: character.systemId, - name: character.name, - json: JSON.stringify(character), - updatedAt: now, - }); + this.data.characters[character.id] = character; + this.persist(); return character; } deleteCharacter(id: string): void { - this.db.prepare('DELETE FROM characters WHERE id = ?').run(id); + delete this.data.characters[id]; + this.persist(); } close(): void { - this.db.close(); + this.persist(); } } diff --git a/docs/adr/001-core.md b/docs/adr/001-core.md index 93bc199..15a4ca0 100644 --- a/docs/adr/001-core.md +++ b/docs/adr/001-core.md @@ -2,38 +2,20 @@ ## Decision -Electron + React + TypeScript + Vite; SQLite with JSON documents for systems/characters; portable `app/shared` contract for future TTRPG Player + mobile. +Electron + React + TypeScript + Vite; JSON file store (`userData/store.json`) for systems/characters; portable `app/shared` contract for future TTRPG Player + mobile. ## Rationale -Matches TTRPG Player packaging targets; offline-first; no Postgres. +Offline-first; avoids native module rebuild (better-sqlite3) requiring Visual Studio on Windows. # ADR-002: Formula DSL -## Decision - -Custom minimal expression language (`floor`, `ceil`, `round`, `min`, `max`, `clamp`, arithmetic, `attr.*` / `skill.*` / `resource.*` / `derived.*`). - -## Rationale - -Same evaluator can be copied into the player; explicit rounding; no heavy CEL/JSONata dependency. +Custom minimal expression language with explicit rounding; portable to the player. # ADR-003: Schema freeze via snapshotHash -## Decision - -Player binds store `snapshotHash` (content-addressed) rather than inline full schema per character. - -## Rationale - -Implements freeze-on-bind without bloating `players.json`. +Player binds store `snapshotHash` rather than inline full schema per character. # ADR-004: Spells from dnd.su -## Decision - -Provide an import pipeline for PHB-labelled spells from dnd.su at product owner request, with README/IP disclaimer. Prefer SRD stubs in default presets. - -## Rationale - -Owner requested PHB coverage; redistribution risk acknowledged. +Import pipeline for PHB-labelled spells at product owner request, with IP disclaimer. Default presets ship SRD stubs. diff --git a/package-lock.json b/package-lock.json index 5107bff..e879128 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,14 +11,12 @@ "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/utilities": "^3.2.2", - "better-sqlite3": "^11.10.0", "react": "^19.2.5", "react-dom": "^19.2.5", "reactflow": "^11.11.4" }, "devDependencies": { "@playwright/test": "^1.62.0", - "@types/better-sqlite3": "^7.6.13", "@types/node": "^25.6.0", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", @@ -1368,16 +1366,6 @@ "node": ">=10" } }, - "node_modules/@types/better-sqlite3": { - "version": "7.6.13", - "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.13.tgz", - "integrity": "sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/cacheable-request": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", @@ -2077,6 +2065,7 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, "funding": [ { "type": "github", @@ -2093,37 +2082,6 @@ ], "license": "MIT" }, - "node_modules/better-sqlite3": { - "version": "11.10.0", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.10.0.tgz", - "integrity": "sha512-EwhOpyXiOEL/lKzHz9AW1msWFNzGc/z+LzeB3/jnFJpxu+th2yqvzsSWas1v9jgs9+xiXJcD5A8CJxAG2TaghQ==", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "bindings": "^1.5.0", - "prebuild-install": "^7.1.1" - } - }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "license": "MIT", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "license": "MIT", - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -2153,30 +2111,6 @@ "node": "20 || >=22" } }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -2619,6 +2553,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, "license": "MIT", "dependencies": { "mimic-response": "^3.1.0" @@ -2630,15 +2565,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/defer-to-connect": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", @@ -2701,6 +2627,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=8" @@ -3036,6 +2963,7 @@ "version": "1.4.5", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, "license": "MIT", "dependencies": { "once": "^1.4.0" @@ -3184,15 +3112,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "license": "(MIT OR WTFPL)", - "engines": { - "node": ">=6" - } - }, "node_modules/exponential-backoff": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz", @@ -3242,12 +3161,6 @@ } } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "license": "MIT" - }, "node_modules/filelist": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.6.tgz", @@ -3305,12 +3218,6 @@ "node": ">= 6" } }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "license": "MIT" - }, "node_modules/fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -3423,12 +3330,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", - "license": "MIT" - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -3693,26 +3594,6 @@ "node": ">= 14" } }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -3729,12 +3610,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true, "license": "ISC" }, "node_modules/is-fullwidth-code-point": { @@ -4248,6 +4124,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -4276,6 +4153,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4318,12 +4196,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "license": "MIT" - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -4350,12 +4222,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/napi-build-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", - "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", - "license": "MIT" - }, "node_modules/node-abi": { "version": "4.35.0", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-4.35.0.tgz", @@ -4501,6 +4367,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -4721,45 +4588,6 @@ "node": "^12.20.0 || >=14" } }, - "node_modules/prebuild-install": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", - "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", - "deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.", - "license": "MIT", - "dependencies": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^2.0.0", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/prebuild-install/node_modules/node-abi": { - "version": "3.96.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.96.0.tgz", - "integrity": "sha512-rebQ/lz7i0EkoLzUVSrKRzA69zMkwLp95kKMWoMDkkM00Suxz0D7zEQPwRml5fQum24mj7bPvmlgLAmu2JCiYg==", - "license": "MIT", - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/proc-log": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", @@ -4817,6 +4645,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "dev": true, "license": "MIT", "dependencies": { "end-of-stream": "^1.1.0", @@ -4856,21 +4685,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, "node_modules/react": { "version": "19.3.0", "resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz", @@ -4923,20 +4737,6 @@ "read-binary-file-arch": "cli.js" } }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -5073,26 +4873,6 @@ "@rolldown/binding-win32-x64-msvc": "1.2.8" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/sanitize-filename": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.4.tgz", @@ -5123,6 +4903,7 @@ "version": "7.8.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -5186,51 +4967,6 @@ "dev": true, "license": "ISC" }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/simple-get": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "node_modules/simple-update-notifier": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", @@ -5293,15 +5029,6 @@ "node": ">= 6" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -5330,15 +5057,6 @@ "node": ">=8" } }, - "node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/sumchecker": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", @@ -5382,40 +5100,6 @@ "node": ">=18" } }, - "node_modules/tar-fs": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.5.tgz", - "integrity": "sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw==", - "license": "MIT", - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "node_modules/tar-fs/node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "license": "ISC" - }, - "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "license": "MIT", - "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/tar/node_modules/yallist": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", @@ -5544,18 +5228,6 @@ "fsevents": "~2.3.3" } }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, "node_modules/type-fest": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", @@ -5661,6 +5333,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, "license": "MIT" }, "node_modules/vite": { @@ -5793,6 +5466,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, "license": "ISC" }, "node_modules/xmlbuilder": { diff --git a/package.json b/package.json index 6a2d767..ba755e7 100644 --- a/package.json +++ b/package.json @@ -21,14 +21,12 @@ "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/utilities": "^3.2.2", - "better-sqlite3": "^11.10.0", "react": "^19.2.5", "react-dom": "^19.2.5", "reactflow": "^11.11.4" }, "devDependencies": { "@playwright/test": "^1.62.0", - "@types/better-sqlite3": "^7.6.13", "@types/node": "^25.6.0", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", @@ -60,19 +58,47 @@ "asar": true, "mac": { "target": [ - { "target": "dmg", "arch": ["x64", "arm64"] }, - { "target": "zip", "arch": ["x64", "arm64"] } + { + "target": "dmg", + "arch": [ + "x64", + "arm64" + ] + }, + { + "target": "zip", + "arch": [ + "x64", + "arm64" + ] + } ] }, "win": { "target": [ - { "target": "nsis", "arch": ["x64"] }, - { "target": "zip", "arch": ["x64"] } + { + "target": "nsis", + "arch": [ + "x64" + ] + }, + { + "target": "zip", + "arch": [ + "x64" + ] + } ] }, "linux": { "target": [ - { "target": "AppImage", "arch": ["x64", "arm64"] } + { + "target": "AppImage", + "arch": [ + "x64", + "arm64" + ] + } ], "category": "Game" }, diff --git a/scripts/build.mjs b/scripts/build.mjs index 004bf1d..e43cf35 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -12,9 +12,9 @@ await build({ platform: 'node', format: 'cjs', outfile: path.join(root, 'dist/main/index.cjs'), - external: ['electron', 'better-sqlite3'], - sourcemap: true, -}); + external: ['electron'], + sourcemap: true, + }); await build({ entryPoints: [path.join(root, 'app/preload/index.ts')], diff --git a/scripts/dev.mjs b/scripts/dev.mjs index 9dcc9a0..da42f49 100644 --- a/scripts/dev.mjs +++ b/scripts/dev.mjs @@ -14,7 +14,7 @@ async function buildMain() { platform: 'node', format: 'cjs', outfile: path.join(root, 'dist/main/index.cjs'), - external: ['electron', 'better-sqlite3'], + external: ['electron'], sourcemap: true, }); await build({