From dbe9fd8ced916cb4e032b925036a42886d20fd78 Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Sat, 14 Jun 2025 11:18:45 +0200 Subject: [PATCH 1/7] fix: replace callPhpSync with callPhp for storage linking (#226) --- resources/js/electron-plugin/dist/server/php.js | 2 +- resources/js/electron-plugin/src/server/php.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/electron-plugin/dist/server/php.js b/resources/js/electron-plugin/dist/server/php.js index 4ce3ee59..0d65dc55 100644 --- a/resources/js/electron-plugin/dist/server/php.js +++ b/resources/js/electron-plugin/dist/server/php.js @@ -210,7 +210,7 @@ function serveApp(secret, apiPort, phpIniSettings) { }); if (!runningSecureBuild()) { console.log('Linking storage path...'); - callPhpSync(['artisan', 'storage:link', '--force'], phpOptions, phpIniSettings); + callPhp(['artisan', 'storage:link', '--force'], phpOptions, phpIniSettings); } if (shouldOptimize(store)) { console.log('Caching view and routes...'); diff --git a/resources/js/electron-plugin/src/server/php.ts b/resources/js/electron-plugin/src/server/php.ts index b3bd6ec3..e6301ad9 100644 --- a/resources/js/electron-plugin/src/server/php.ts +++ b/resources/js/electron-plugin/src/server/php.ts @@ -320,7 +320,7 @@ function serveApp(secret, apiPort, phpIniSettings): Promise { * (whether it's a secured bundle or not), so symlinking feels redundant */ console.log('Linking storage path...'); - callPhpSync(['artisan', 'storage:link', '--force'], phpOptions, phpIniSettings) + callPhp(['artisan', 'storage:link', '--force'], phpOptions, phpIniSettings) } // Cache the project From dc346d811bda0635109159b6c01cf69f9fe790da Mon Sep 17 00:00:00 2001 From: Gennaro Landolfi Date: Sun, 22 Jun 2025 09:43:16 +0200 Subject: [PATCH 2/7] Added file to warning message relative to the copy() call (#223) Sometimes some files are considered folders (or are hidden files) and the are unable to be copied on Windows. Showing which causes the exception to be thrown makes easy to investigate on the issue. --- src/Traits/CopiesToBuildDirectory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/CopiesToBuildDirectory.php b/src/Traits/CopiesToBuildDirectory.php index fa8334fb..f3e2f066 100644 --- a/src/Traits/CopiesToBuildDirectory.php +++ b/src/Traits/CopiesToBuildDirectory.php @@ -117,7 +117,7 @@ public function copyToBuildDirectory(): bool } } } catch (Throwable $e) { - warning('[WARNING] '.$e->getMessage()); + warning('[WARNING] '.$e->getMessage().', file: '.$item->getPathname()); } } From 5ddb8a84ada2883445d7c27a2021744c693f7f1c Mon Sep 17 00:00:00 2001 From: WINBIGFOX Date: Wed, 25 Jun 2025 11:42:19 +0200 Subject: [PATCH 3/7] fix: extend electron-updater mock to include downloadUpdate method (#225) --- .../js/electron-plugin/tests/api.test.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/resources/js/electron-plugin/tests/api.test.ts b/resources/js/electron-plugin/tests/api.test.ts index ce4959cc..3abe8b85 100644 --- a/resources/js/electron-plugin/tests/api.test.ts +++ b/resources/js/electron-plugin/tests/api.test.ts @@ -2,13 +2,18 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; import startAPIServer, { APIProcess } from "../src/server/api"; import axios from "axios"; -vi.mock('electron-updater', () => ({ - autoUpdater: { - checkForUpdates: vi.fn(), - quitAndInstall: vi.fn(), - addListener: vi.fn(), - }, -})); +vi.mock('electron-updater', () => { + return { + default: { + autoUpdater: { + checkForUpdates: vi.fn(), + quitAndInstall: vi.fn(), + addListener: vi.fn(), + downloadUpdate: vi.fn(), + }, + }, + }; +}); let apiServer: APIProcess; From f4cd36d7e7c6ca4b0acce174136337698e02805d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 10:49:17 +0100 Subject: [PATCH 4/7] build(deps): bump stefanzweifel/git-auto-commit-action from 5 to 6 (#228) Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 5 to 6. - [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases) - [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v5...v6) --- updated-dependencies: - dependency-name: stefanzweifel/git-auto-commit-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build-plugin.yml | 2 +- .github/workflows/fix-php-code-style-issues.yml | 2 +- .github/workflows/update-changelog.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-plugin.yml b/.github/workflows/build-plugin.yml index c811ab37..7d00c675 100644 --- a/.github/workflows/build-plugin.yml +++ b/.github/workflows/build-plugin.yml @@ -36,7 +36,7 @@ jobs: - name: Commit changes if: github.event_name == 'pull_request' - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v6 with: commit_message: Build plugin diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index eb79b6e0..f5e63fc4 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -37,7 +37,7 @@ jobs: - name: Commit changes if: github.event_name == 'pull_request' - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v6 with: commit_message: Fix styling diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index ec40921c..859924d6 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -24,7 +24,7 @@ jobs: release-notes: ${{ github.event.release.body }} - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v6 with: branch: main commit_message: Update CHANGELOG From 5b4b8b14c9c8bd7fa66815434c7e50b5dfbe57db Mon Sep 17 00:00:00 2001 From: WINBIGFOX Date: Wed, 25 Jun 2025 12:42:56 +0200 Subject: [PATCH 5/7] Add emoji panel API endpoints for support check and display (#224) Co-authored-by: Pete Bishop <9081809+PeteBishwhip@users.noreply.github.com> --- resources/js/electron-plugin/dist/server/api/app.js | 9 +++++++++ resources/js/electron-plugin/src/server/api/app.ts | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/resources/js/electron-plugin/dist/server/api/app.js b/resources/js/electron-plugin/dist/server/api/app.js index b43f7388..ecc48579 100644 --- a/resources/js/electron-plugin/dist/server/api/app.js +++ b/resources/js/electron-plugin/dist/server/api/app.js @@ -65,4 +65,13 @@ router.get('/open-at-login', (req, res) => { open: app.getLoginItemSettings().openAtLogin, }); }); +router.get('/is-emoji-panel-supported', (req, res) => { + res.json({ + supported: app.isEmojiPanelSupported(), + }); +}); +router.post('/show-emoji-panel', (req, res) => { + app.showEmojiPanel(); + res.sendStatus(200); +}); export default router; diff --git a/resources/js/electron-plugin/src/server/api/app.ts b/resources/js/electron-plugin/src/server/api/app.ts index 19fe1850..47d037a9 100644 --- a/resources/js/electron-plugin/src/server/api/app.ts +++ b/resources/js/electron-plugin/src/server/api/app.ts @@ -81,4 +81,15 @@ router.get('/open-at-login', (req, res) => { }); }); +router.get('/is-emoji-panel-supported', (req, res) => { + res.json({ + supported: app.isEmojiPanelSupported(), + }); +}); + +router.post('/show-emoji-panel', (req, res) => { + app.showEmojiPanel(); + res.sendStatus(200); +}); + export default router; From d9953c98c95af6ab516dd9a59f632fdf28ae1cd5 Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Fri, 27 Jun 2025 15:57:10 +0200 Subject: [PATCH 6/7] fix: symfony console deprecation notice (#227) * fix: symfony console deprecation notice * Fix styling --- src/Commands/BuildCommand.php | 5 +++++ src/Commands/BundleCommand.php | 7 +++++-- src/Commands/DevelopCommand.php | 5 +++++ src/Commands/InstallCommand.php | 7 +++++-- src/Commands/PublishCommand.php | 5 +++++ src/Commands/ResetCommand.php | 7 +++++-- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index ecfd7e91..50649647 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -15,10 +15,15 @@ use Native\Electron\Traits\OsAndArch; use Native\Electron\Traits\PatchesPackagesJson; use Native\Electron\Traits\PrunesVendorDirectory; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Process\Process as SymfonyProcess; use function Laravel\Prompts\intro; +#[AsCommand( + name: 'native:build', + description: 'Build the NativePHP application for the specified operating system and architecture.', +)] class BuildCommand extends Command { use CleansEnvFile; diff --git a/src/Commands/BundleCommand.php b/src/Commands/BundleCommand.php index a3a94065..a27d5449 100644 --- a/src/Commands/BundleCommand.php +++ b/src/Commands/BundleCommand.php @@ -17,11 +17,16 @@ use Native\Electron\Traits\LocatesPhpBinary; use Native\Electron\Traits\PatchesPackagesJson; use Native\Electron\Traits\PrunesVendorDirectory; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Finder\Finder; use ZipArchive; use function Laravel\Prompts\intro; +#[AsCommand( + name: 'native:bundle', + description: 'Bundle your application for distribution.', +)] class BundleCommand extends Command { use CleansEnvFile; @@ -35,8 +40,6 @@ class BundleCommand extends Command protected $signature = 'native:bundle {--fetch} {--clear} {--without-cleanup}'; - protected $description = 'Bundle your application for distribution.'; - private ?string $key; private string $zipPath; diff --git a/src/Commands/DevelopCommand.php b/src/Commands/DevelopCommand.php index 9a5d7f95..59385676 100644 --- a/src/Commands/DevelopCommand.php +++ b/src/Commands/DevelopCommand.php @@ -8,10 +8,15 @@ use Native\Electron\Traits\Installer; use Native\Electron\Traits\InstallsAppIcon; use Native\Electron\Traits\PatchesPackagesJson; +use Symfony\Component\Console\Attribute\AsCommand; use function Laravel\Prompts\intro; use function Laravel\Prompts\note; +#[AsCommand( + name: 'native:serve', + description: 'Start the NativePHP development server with the Electron app', +)] class DevelopCommand extends Command { use CopiesCertificateAuthority; diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index db71977c..29626b31 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -5,6 +5,7 @@ use Illuminate\Console\Command; use Native\Electron\Traits\Installer; use RuntimeException; +use Symfony\Component\Console\Attribute\AsCommand; use function Laravel\Prompts\confirm; use function Laravel\Prompts\info; @@ -12,6 +13,10 @@ use function Laravel\Prompts\note; use function Laravel\Prompts\outro; +#[AsCommand( + name: 'native:install', + description: 'Install all of the NativePHP resources', +)] class InstallCommand extends Command { use Installer; @@ -20,8 +25,6 @@ class InstallCommand extends Command {--force : Overwrite existing files by default} {--installer=npm : The package installer to use: npm, yarn or pnpm}'; - protected $description = 'Install all of the NativePHP resources'; - public function handle(): void { intro('Publishing NativePHP Service Provider...'); diff --git a/src/Commands/PublishCommand.php b/src/Commands/PublishCommand.php index a631c336..c2aef693 100644 --- a/src/Commands/PublishCommand.php +++ b/src/Commands/PublishCommand.php @@ -6,7 +6,12 @@ use Illuminate\Support\Facades\Artisan; use Native\Electron\Traits\LocatesPhpBinary; use Native\Electron\Traits\OsAndArch; +use Symfony\Component\Console\Attribute\AsCommand; +#[AsCommand( + name: 'native:publish', + description: 'Build and publish the NativePHP app for the specified operating system and architecture', +)] class PublishCommand extends Command { use LocatesPhpBinary; diff --git a/src/Commands/ResetCommand.php b/src/Commands/ResetCommand.php index ab3ffdeb..094f7f13 100644 --- a/src/Commands/ResetCommand.php +++ b/src/Commands/ResetCommand.php @@ -4,18 +4,21 @@ use Illuminate\Console\Command; use Native\Electron\Traits\PatchesPackagesJson; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Filesystem\Filesystem; use function Laravel\Prompts\intro; +#[AsCommand( + name: 'native:reset', + description: 'Clear all build and dist files', +)] class ResetCommand extends Command { use PatchesPackagesJson; protected $signature = 'native:reset {--with-app-data : Clear the app data as well}'; - protected $description = 'Clear all build and dist files'; - public function handle(): int { intro('Clearing build and dist directories...'); From 861d5ef169f38b282abc2673e92aa167b68aa844 Mon Sep 17 00:00:00 2001 From: Santos Vilanculos Date: Mon, 30 Jun 2025 08:43:39 +0200 Subject: [PATCH 7/7] fix: take into account all changed keys (#231) --- resources/js/electron-plugin/dist/server/state.js | 10 +++++----- resources/js/electron-plugin/src/server/state.ts | 12 +++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/resources/js/electron-plugin/dist/server/state.js b/resources/js/electron-plugin/dist/server/state.js index 2f9bab89..c58187a8 100644 --- a/resources/js/electron-plugin/dist/server/state.js +++ b/resources/js/electron-plugin/dist/server/state.js @@ -2,16 +2,16 @@ import Store from "electron-store"; import { notifyLaravel } from "./utils.js"; const settingsStore = new Store(); settingsStore.onDidAnyChange((newValue, oldValue) => { - const changedKey = Object.keys(newValue).find((key) => newValue[key] !== oldValue[key]); - if (changedKey) { + const changedKeys = Object.keys(newValue).filter((key) => newValue[key] !== oldValue[key]); + changedKeys.forEach((key) => { notifyLaravel("events", { event: "Native\\Laravel\\Events\\Settings\\SettingChanged", payload: { - key: changedKey, - value: newValue[changedKey] || null, + key, + value: newValue[key] || null, }, }); - } + }); }); function generateRandomString(length) { let result = ""; diff --git a/resources/js/electron-plugin/src/server/state.ts b/resources/js/electron-plugin/src/server/state.ts index 11937f53..75e2f3a7 100644 --- a/resources/js/electron-plugin/src/server/state.ts +++ b/resources/js/electron-plugin/src/server/state.ts @@ -5,19 +5,17 @@ import { notifyLaravel } from "./utils.js"; const settingsStore = new Store(); settingsStore.onDidAnyChange((newValue, oldValue) => { // Only notify of the changed key/value pair - const changedKey = Object.keys(newValue).find( - (key) => newValue[key] !== oldValue[key] - ); + const changedKeys = Object.keys(newValue).filter((key) => newValue[key] !== oldValue[key]); - if (changedKey) { + changedKeys.forEach((key) => { notifyLaravel("events", { event: "Native\\Laravel\\Events\\Settings\\SettingChanged", payload: { - key: changedKey, - value: newValue[changedKey] || null, + key, + value: newValue[key] || null, }, }); - } + }); }); interface State {