Skip to content

Commit 76e4601

Browse files
committed
Fix minify command
1 parent 66128c0 commit 76e4601

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

resources/js/electron-builder.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ if (isBuilding) {
5050
console.log('=====================');
5151

5252
try {
53-
removeSync(join(__dirname, 'resources', 'app'));
53+
const appPath = join(__dirname, 'resources', 'app');
54+
55+
removeSync(appPath);
5456

5557
// As we can't copy into a subdirectory of ourself we need to copy to a temp directory
5658
let tmpDir = mkdtempSync(join(os.tmpdir(), 'nativephp'));
@@ -87,16 +89,16 @@ if (isBuilding) {
8789
}
8890
});
8991

90-
copySync(tmpDir, join(__dirname, 'resources', 'app'));
92+
copySync(tmpDir, appPath);
9193

9294
// Electron build removes empty folders, so we have to create dummy files
9395
// dotfiles unfortunately don't work.
94-
writeJsonSync(join(__dirname, 'resources', 'app', 'storage', 'framework', 'cache', '_native.json'), {})
95-
writeJsonSync(join(__dirname, 'resources', 'app', 'storage', 'framework', 'sessions', '_native.json'), {})
96-
writeJsonSync(join(__dirname, 'resources', 'app', 'storage', 'framework', 'testing', '_native.json'), {})
97-
writeJsonSync(join(__dirname, 'resources', 'app', 'storage', 'framework', 'views', '_native.json'), {})
98-
writeJsonSync(join(__dirname, 'resources', 'app', 'storage', 'app', 'public', '_native.json'), {})
99-
writeJsonSync(join(__dirname, 'resources', 'app', 'storage', 'logs', '_native.json'), {})
96+
writeJsonSync(join(appPath, 'storage', 'framework', 'cache', '_native.json'), {})
97+
writeJsonSync(join(appPath, 'storage', 'framework', 'sessions', '_native.json'), {})
98+
writeJsonSync(join(appPath, 'storage', 'framework', 'testing', '_native.json'), {})
99+
writeJsonSync(join(appPath, 'storage', 'framework', 'views', '_native.json'), {})
100+
writeJsonSync(join(appPath, 'storage', 'app', 'public', '_native.json'), {})
101+
writeJsonSync(join(appPath, 'storage', 'logs', '_native.json'), {})
100102

101103
removeSync(tmpDir);
102104

@@ -106,7 +108,9 @@ if (isBuilding) {
106108
console.log('=====================');
107109

108110
// We'll use the default PHP binary here, as we can cross-compile for all platforms
109-
execSync(`php ${join(__dirname, 'resources', 'app', 'artisan')} native:minify ${join(__dirname, 'resources', 'app')}`);
111+
const phpBinary = join(process.env.APP_PATH, 'vendor', 'nativephp', 'electron', 'resources', 'js', 'resources', 'php', 'php');
112+
const artisanPath = join(appPath, 'artisan');
113+
execSync(`${phpBinary} ${artisanPath} native:minify ${appPath}`);
110114
} catch (e) {
111115
console.error('=====================');
112116
console.error('Error copying app to resources');

0 commit comments

Comments
 (0)