-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headless mode in Node.js #29
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This pull request adds support for headless mode in Node.js by introducing Node-specific database implementations and modifying initialization and file-system operations for both browser and Node environments. Key changes include:
- Addition of Node.js implementations for database services (stats and project databases) using sqlite.
- Adjustments in initialization logic across files (headless.ts, ndn.ts, main.ts) to accommodate environment-specific behaviors.
- Updates to file system and synchronization operations (opfs.ts, svs-provider.ts) to improve compatibility and consistency across platforms.
Reviewed Changes
File | Description |
---|---|
src/services/database/stats_node.ts | Introduces Node.js stats database implementation via sqlite |
src/node/headless.ts | Implements headless mode initialization for Node.js |
src/services/database/proj_db_node.ts | Provides Node.js project database functionality |
src/services/database/stats_browser.ts | Implements browser-based stats storage using Dexie |
src/services/database/proj_db_browser.ts | Implements browser-based project database using Dexie |
src/services/database/stats.ts | Defines the StatsDb interface |
src/services/database/proj_db.ts | Defines the ProjDb interface and schema types |
src/main.ts | Updates service initialization to use global _o configuration |
src/services/ndn.ts | Adjusts wasm instantiation logic to differentiate Node and browser environments |
src/services/opfs.ts | Updates file system handling by replacing instance checks with kind checks |
ndn/cmd/main.go | Adds Node app detection for Go application |
src/services/svs-provider.ts | Updates SVS provider logic to use ProjDb and batch persist updates with compaction |
ndn/app/app.go | Refactors app creation for clarity between Node and browser environments |
src/components/home/JoinWorkspaceModal.vue | Updates workspace join logic to use global stats service |
src/components/home/CreateWorkspaceModal.vue | Updates workspace creation logic to use global stats service |
src/components/files/BlobView.vue | Adjusts syncFs API usage to reflect new parameter structure |
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
src/services/ndn.ts:138
- Ensure that import.meta.dirname is defined in the Node environment; if not, consider using __dirname for better compatibility.
const buffer = fs.readFileSync(import.meta.dirname + '/main.wasm');
src/components/files/BlobView.vue:77
- [nitpick] Verify that the updated syncFs API (accepting an object) is correctly reflected in its type definitions and used consistently across the codebase.
const path = await proj.syncFs({ path: props.path });
src/services/svs-provider.ts:406
- [nitpick] Consider logging a warning when awarenessStyles is undefined to aid in debugging, instead of silently returning.
if (!awarenessStyles) return;
No description provided.