Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/nativephp-internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
'vendor/nativephp/desktop/resources',
'vendor/nativephp/desktop/vendor',
'vendor/nativephp/php-bin',
'nativephp',

// Also deleted in PrunesVendorDirectory after fresh composer install
'vendor/bin',
Expand Down
8 changes: 4 additions & 4 deletions resources/electron/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions resources/electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NativePHP",
"version": "1.0.0",
"name": "nativephp",
"version": "v2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To maintain the version numbering, should this be 2.0.0?

Suggested change
"version": "v2",
"version": "2.0.0",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these values are patched on an native:run & native:build. So this is basically only for the very first time native:install runs in a fresh project.

You're right it should be 2.0.1. But since v1 this was never updated and was always out of sync with the real version. Since it's only shown one time i figured this was fine and we can forget about it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scratch that, it's displayed after initial install too. My bad, It only updates in the cli if you also run npm update.

However I think it's fine still. I'm not keen on updating a single file on every new version

"description": "A NativePHP Electron application",
"main": "./out/main/index.js",
"author": "NativePHP",
Expand Down
14 changes: 14 additions & 0 deletions src/Builder/Concerns/CopiesToBuildDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function copyToBuildDirectory(): bool
}

$this->keepRequiredDirectories();
$this->keepLivewireDispatcher();

return true;
}
Expand All @@ -106,4 +107,17 @@ private function keepRequiredDirectories()
$filesystem->dumpFile("{$buildPath}/storage/app/public/_native.json", '{}');
$filesystem->dumpFile("{$buildPath}/storage/logs/_native.json", '{}');
}

private function keepLivewireDispatcher()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion, but to avoid a method for every file, perhaps this could be named keepRequiredFiles(), similar to keepRequiredDirectories() above and could accept an array of files to keep (also opens up a potential for config to allow users to specify others)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion I agree with you there. That's what I did at first. My perspective changed a bit; this moving piece should not even exist in the first place. So I took it out into it's own method so I can rip it out more easily later on.

I hope to update the copying logic a so I can simply add this file using the glob patterns (exclude_list) instead. But I thought that change is a bit too risky to do as a patch right now.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with good testing it's safe to do. But if this is a quick patch-release to resolve blocking issues now, I'm okay with it.

I definitely think this should be revisited and it sounds like you have a plan to do so. All good from me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 100% I want to revisit this. This is a bit of a thorn in my eye, but should fix the issue reliably for people asap.

{
// This is a bit leaky, since we only need this for electron, not potential other drivers
// We'll find a better place for it when we add more drivers.
$dispatcherPath = 'vendor/nativephp/desktop/resources/electron/electron-plugin/src/preload/livewire-dispatcher.js';
$filesystem = new Filesystem;

$filesystem->copy(
$this->sourcePath($dispatcherPath),
$this->buildPath("app/{$dispatcherPath}")
);
}
}