Skip to content

Commit 2c23495

Browse files
authored
Patch app name during development (#96)
1 parent 6ddc505 commit 2c23495

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

resources/js/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "NativePHP",
33
"version": "1.0.0",
4-
"description": "An Electron application with Vue",
4+
"description": "A NativePHP Electron application",
55
"main": "./out/main/index.js",
6-
"author": "beyondco.de",
7-
"homepage": "https://beyondco.de",
6+
"author": "NativePHP",
7+
"homepage": "https://nativephp.com",
88
"scripts": {
99
"format": "prettier --write .",
1010
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",

src/Commands/DevelopCommand.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function handle(): void
3434
$this->patchPlist();
3535
}
3636

37+
$this->patchPackageJson();
38+
3739
$this->runDeveloper(installer: $this->option('installer'), skip_queue: $this->option('no-queue'));
3840
}
3941

@@ -54,4 +56,14 @@ protected function patchPlist(): void
5456

5557
file_put_contents(__DIR__.'/../../resources/js/node_modules/electron/dist/Electron.app/Contents/Info.plist', $pList);
5658
}
59+
60+
protected function patchPackageJson(): void
61+
{
62+
$packageJsonPath = __DIR__.'/../../resources/js/package.json';
63+
$packageJson = json_decode(file_get_contents($packageJsonPath), true);
64+
65+
$packageJson['name'] = config('app.name');
66+
67+
file_put_contents($packageJsonPath, json_encode($packageJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
68+
}
5769
}

0 commit comments

Comments
 (0)