-
-
Notifications
You must be signed in to change notification settings - Fork 44
Feature Added Database (SQLite) and Code History with Undo/Redo #162
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
Merged
saeedvaziry
merged 16 commits into
tweakphp:main
from
ILDaviz:features/add-sqlite-migration-history
Sep 27, 2025
Merged
Feature Added Database (SQLite) and Code History with Undo/Redo #162
saeedvaziry
merged 16 commits into
tweakphp:main
from
ILDaviz:features/add-sqlite-migration-history
Sep 27, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… and dependency management" This reverts commit 511f737.
luanfreitasdev
approved these changes
Sep 17, 2025
…ew editor theme, and update dependencies for v0.10.0 release
Member
|
I've tested on macOS and Windows, and it works fine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request introduces a persistent database into the application and implements one of the most important features for user experience: change history with Undo/Redo.
To achieve this, SQLite has been integrated via the better-sqlite3 package, chosen for its excellent performance and solid integration with the Node.js/Electron environment. The introduction of the database lays the foundation for future features that require data persistence.
The main changes included in this PR are:
Database Integration with SQLite (better-sqlite3) The better-sqlite3 dependency has been added to provide a robust, fast, local SQL database. All database interaction logic is handled in Electron's main process to ensure security and performance. The build process has been updated to correctly handle this native dependency across all platforms (macOS, Windows, Linux).
Migration System: A basic migration logic has been added to manage the evolution of the database schema in a controlled and versioned manner. On application startup, the migration script checks the user's database state and applies any necessary changes, ensuring the schema is always up-to-date with the latest required version.
Code History with Undo/Redo: A complete history of code changes has been implemented for each tab, offering users a safety net during editing. The history is non-destructive and uses a pointer-based system to navigate between past and future code states. It saves not only the code content but also the exact cursor position for a faithful restoration of the editing state. It supports standard keyboard shortcuts: Ctrl/Cmd+Z for Undo and Ctrl/Cmd+Y (or Ctrl/Cmd+Shift+Z) for Redo. To optimize performance, a new state is added only if the code has actually changed, avoiding unnecessary duplicates.
Related Improvements to the Build Process
To properly support the native better-sqlite3 dependency across all platforms, the build and Continuous Integration process has been significantly improved. These changes are intended to resolve the previous cross-platform build failures: The build scripts (package.json, build.js) have been refactored to follow electron-builder best practices. The GitHub Actions workflow (.github/workflows/build.yml) has been updated to use npm ci and OS-specific caches, resolving previous build failures and ensuring maximum reliability. Builds for macOS, Windows, and Linux are now stable, reliable, and fully automated.
How to Test
Pull this branch.
Let me know if you have any questions or feedback!