pake-cli 3.2.18 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -10
- package/dist/cli.js +128 -41
- package/package.json +2 -2
- package/src-tauri/.cargo/config.toml +11 -0
- package/src-tauri/.pake/pake.json +5 -7
- package/src-tauri/.pake/tauri.conf.json +5 -5
- package/src-tauri/.pake/tauri.macos.conf.json +3 -3
- package/src-tauri/pake.json +3 -3
- package/src-tauri/src/app/window.rs +4 -9
package/README.md
CHANGED
|
@@ -306,6 +306,15 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
306
306
|
<sub><b>GoodbyeNJN</b></sub>
|
|
307
307
|
</a>
|
|
308
308
|
</td>
|
|
309
|
+
<td align="center">
|
|
310
|
+
<a href="https://github.com/eltociear">
|
|
311
|
+
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="90;" alt="eltociear"/>
|
|
312
|
+
<br />
|
|
313
|
+
<sub><b>Ikko Eltociear Ashimine</b></sub>
|
|
314
|
+
</a>
|
|
315
|
+
</td>
|
|
316
|
+
</tr>
|
|
317
|
+
<tr>
|
|
309
318
|
<td align="center">
|
|
310
319
|
<a href="https://github.com/kittizz">
|
|
311
320
|
<img src="https://avatars.githubusercontent.com/u/62899732?v=4" width="90;" alt="kittizz"/>
|
|
@@ -313,8 +322,6 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
313
322
|
<sub><b>Kittizz</b></sub>
|
|
314
323
|
</a>
|
|
315
324
|
</td>
|
|
316
|
-
</tr>
|
|
317
|
-
<tr>
|
|
318
325
|
<td align="center">
|
|
319
326
|
<a href="https://github.com/mattbajorek">
|
|
320
327
|
<img src="https://avatars.githubusercontent.com/u/17235301?v=4" width="90;" alt="mattbajorek"/>
|
|
@@ -357,6 +364,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
357
364
|
<sub><b>Yue Yang</b></sub>
|
|
358
365
|
</a>
|
|
359
366
|
</td>
|
|
367
|
+
</tr>
|
|
368
|
+
<tr>
|
|
360
369
|
<td align="center">
|
|
361
370
|
<a href="https://github.com/lkieryan">
|
|
362
371
|
<img src="https://avatars.githubusercontent.com/u/187804088?v=4" width="90;" alt="lkieryan"/>
|
|
@@ -364,8 +373,6 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
364
373
|
<sub><b>Kieran</b></sub>
|
|
365
374
|
</a>
|
|
366
375
|
</td>
|
|
367
|
-
</tr>
|
|
368
|
-
<tr>
|
|
369
376
|
<td align="center">
|
|
370
377
|
<a href="https://github.com/exposir">
|
|
371
378
|
<img src="https://avatars.githubusercontent.com/u/33340988?v=4" width="90;" alt="exposir"/>
|
|
@@ -408,6 +415,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
408
415
|
<sub><b>Ayaka Neko</b></sub>
|
|
409
416
|
</a>
|
|
410
417
|
</td>
|
|
418
|
+
</tr>
|
|
419
|
+
<tr>
|
|
411
420
|
<td align="center">
|
|
412
421
|
<a href="https://github.com/turkyden">
|
|
413
422
|
<img src="https://avatars.githubusercontent.com/u/24560160?v=4" width="90;" alt="turkyden"/>
|
|
@@ -415,8 +424,6 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
415
424
|
<sub><b>Dengju Deng</b></sub>
|
|
416
425
|
</a>
|
|
417
426
|
</td>
|
|
418
|
-
</tr>
|
|
419
|
-
<tr>
|
|
420
427
|
<td align="center">
|
|
421
428
|
<a href="https://github.com/fvn-elmy">
|
|
422
429
|
<img src="https://avatars.githubusercontent.com/u/71275745?v=4" width="90;" alt="fvn-elmy"/>
|
|
@@ -459,6 +466,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
459
466
|
<sub><b>Milo</b></sub>
|
|
460
467
|
</a>
|
|
461
468
|
</td>
|
|
469
|
+
</tr>
|
|
470
|
+
<tr>
|
|
462
471
|
<td align="center">
|
|
463
472
|
<a href="https://github.com/princemaple">
|
|
464
473
|
<img src="https://avatars.githubusercontent.com/u/1329716?v=4" width="90;" alt="princemaple"/>
|
|
@@ -466,8 +475,6 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
466
475
|
<sub><b>Po Chen</b></sub>
|
|
467
476
|
</a>
|
|
468
477
|
</td>
|
|
469
|
-
</tr>
|
|
470
|
-
<tr>
|
|
471
478
|
<td align="center">
|
|
472
479
|
<a href="https://github.com/beautifulrem">
|
|
473
480
|
<img src="https://avatars.githubusercontent.com/u/98527099?v=4" width="90;" alt="beautifulrem"/>
|
|
@@ -510,6 +517,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
510
517
|
<sub><b>Liudonghua</b></sub>
|
|
511
518
|
</a>
|
|
512
519
|
</td>
|
|
520
|
+
</tr>
|
|
521
|
+
<tr>
|
|
513
522
|
<td align="center">
|
|
514
523
|
<a href="https://github.com/liusishan">
|
|
515
524
|
<img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>
|
|
@@ -517,8 +526,6 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
517
526
|
<sub><b>Liusishan</b></sub>
|
|
518
527
|
</a>
|
|
519
528
|
</td>
|
|
520
|
-
</tr>
|
|
521
|
-
<tr>
|
|
522
529
|
<td align="center">
|
|
523
530
|
<a href="https://github.com/piaoyidage">
|
|
524
531
|
<img src="https://avatars.githubusercontent.com/u/5135405?v=4" width="90;" alt="piaoyidage"/>
|
package/dist/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ import sharp from 'sharp';
|
|
|
22
22
|
import * as psl from 'psl';
|
|
23
23
|
|
|
24
24
|
var name = "pake-cli";
|
|
25
|
-
var version = "3.
|
|
25
|
+
var version = "3.3.1";
|
|
26
26
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
|
|
27
27
|
var engines = {
|
|
28
28
|
node: ">=18.0.0"
|
|
@@ -85,7 +85,7 @@ var dependencies = {
|
|
|
85
85
|
ora: "^8.2.0",
|
|
86
86
|
prompts: "^2.4.2",
|
|
87
87
|
psl: "^1.15.0",
|
|
88
|
-
sharp: "^0.
|
|
88
|
+
sharp: "^0.33.4",
|
|
89
89
|
"tmp-promise": "^3.0.3",
|
|
90
90
|
"update-notifier": "^7.3.1"
|
|
91
91
|
};
|
|
@@ -350,9 +350,7 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
350
350
|
}));
|
|
351
351
|
const { width, height, fullscreen, hideTitleBar, alwaysOnTop, appVersion, darkMode, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, proxyUrl, installerLanguage, hideOnClose, incognito, title, wasm, enableDragDrop, } = options;
|
|
352
352
|
const { platform } = process;
|
|
353
|
-
// Platform-specific hide_on_close behavior: macOS keeps true, others default to false
|
|
354
353
|
const platformHideOnClose = hideOnClose ?? platform === 'darwin';
|
|
355
|
-
// Set Windows parameters.
|
|
356
354
|
const tauriConfWindowOptions = {
|
|
357
355
|
width,
|
|
358
356
|
height,
|
|
@@ -373,10 +371,12 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
373
371
|
tauriConf.productName = name;
|
|
374
372
|
tauriConf.identifier = identifier;
|
|
375
373
|
tauriConf.version = appVersion;
|
|
374
|
+
if (platform === 'linux') {
|
|
375
|
+
tauriConf.mainBinaryName = `pake-${name.toLowerCase()}`;
|
|
376
|
+
}
|
|
376
377
|
if (platform == 'win32') {
|
|
377
378
|
tauriConf.bundle.windows.wix.language[0] = installerLanguage;
|
|
378
379
|
}
|
|
379
|
-
//Judge the type of URL, whether it is a file or a website.
|
|
380
380
|
const pathExists = await fsExtra.pathExists(url);
|
|
381
381
|
if (pathExists) {
|
|
382
382
|
logger.warn('✼ Your input might be a local file.');
|
|
@@ -427,8 +427,8 @@ Version=1.0
|
|
|
427
427
|
Type=Application
|
|
428
428
|
Name=${name}
|
|
429
429
|
Comment=${name}
|
|
430
|
-
Exec
|
|
431
|
-
Icon=${appNameLower}
|
|
430
|
+
Exec=pake-${appNameLower}
|
|
431
|
+
Icon=${appNameLower}_512
|
|
432
432
|
Categories=Network;WebBrowser;
|
|
433
433
|
MimeType=text/html;text/xml;application/xhtml_xml;
|
|
434
434
|
StartupNotify=true
|
|
@@ -510,7 +510,7 @@ StartupNotify=true
|
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
if (updateIconPath) {
|
|
513
|
-
tauriConf.bundle.icon = [
|
|
513
|
+
tauriConf.bundle.icon = [iconInfo.path];
|
|
514
514
|
}
|
|
515
515
|
else {
|
|
516
516
|
logger.warn(`✼ Icon will remain as default.`);
|
|
@@ -606,15 +606,13 @@ class BaseBuilder {
|
|
|
606
606
|
return process.platform === 'win32' ? 600000 : 300000;
|
|
607
607
|
}
|
|
608
608
|
getBuildTimeout() {
|
|
609
|
-
return 900000;
|
|
609
|
+
return 900000;
|
|
610
610
|
}
|
|
611
611
|
async detectPackageManager() {
|
|
612
|
-
// 使用缓存避免重复检测
|
|
613
612
|
if (BaseBuilder.packageManagerCache) {
|
|
614
613
|
return BaseBuilder.packageManagerCache;
|
|
615
614
|
}
|
|
616
615
|
const { execa } = await import('execa');
|
|
617
|
-
// 优先使用pnpm(如果可用)
|
|
618
616
|
try {
|
|
619
617
|
await execa('pnpm', ['--version'], { stdio: 'ignore' });
|
|
620
618
|
logger.info('✺ Using pnpm for package management.');
|
|
@@ -622,7 +620,6 @@ class BaseBuilder {
|
|
|
622
620
|
return 'pnpm';
|
|
623
621
|
}
|
|
624
622
|
catch {
|
|
625
|
-
// pnpm不可用,回退到npm
|
|
626
623
|
try {
|
|
627
624
|
await execa('npm', ['--version'], { stdio: 'ignore' });
|
|
628
625
|
logger.info('✺ pnpm not available, using npm for package management.');
|
|
@@ -710,9 +707,18 @@ class BaseBuilder {
|
|
|
710
707
|
const appPath = this.getBuildAppPath(npmDirectory, fileName, fileType);
|
|
711
708
|
const distPath = path.resolve(`${name}.${fileType}`);
|
|
712
709
|
await fsExtra.copy(appPath, distPath);
|
|
710
|
+
// Copy raw binary if requested
|
|
711
|
+
if (this.options.keepBinary) {
|
|
712
|
+
await this.copyRawBinary(npmDirectory, name);
|
|
713
|
+
}
|
|
713
714
|
await fsExtra.remove(appPath);
|
|
714
715
|
logger.success('✔ Build success!');
|
|
715
716
|
logger.success('✔ App installer located in', distPath);
|
|
717
|
+
// Log binary location if preserved
|
|
718
|
+
if (this.options.keepBinary) {
|
|
719
|
+
const binaryPath = this.getRawBinaryPath(name);
|
|
720
|
+
logger.success('✔ Raw binary located in', path.resolve(binaryPath));
|
|
721
|
+
}
|
|
716
722
|
}
|
|
717
723
|
getFileType(target) {
|
|
718
724
|
return target;
|
|
@@ -804,6 +810,67 @@ class BaseBuilder {
|
|
|
804
810
|
const bundleDir = fileType.toLowerCase() === 'app' ? 'macos' : fileType.toLowerCase();
|
|
805
811
|
return path.join(npmDirectory, this.getBasePath(), bundleDir, `${fileName}.${fileType}`);
|
|
806
812
|
}
|
|
813
|
+
/**
|
|
814
|
+
* Copy raw binary file to output directory
|
|
815
|
+
*/
|
|
816
|
+
async copyRawBinary(npmDirectory, appName) {
|
|
817
|
+
const binaryPath = this.getRawBinarySourcePath(npmDirectory, appName);
|
|
818
|
+
const outputPath = this.getRawBinaryPath(appName);
|
|
819
|
+
if (await fsExtra.pathExists(binaryPath)) {
|
|
820
|
+
await fsExtra.copy(binaryPath, outputPath);
|
|
821
|
+
// Make binary executable on Unix-like systems
|
|
822
|
+
if (process.platform !== 'win32') {
|
|
823
|
+
await fsExtra.chmod(outputPath, 0o755);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
else {
|
|
827
|
+
logger.warn(`✼ Raw binary not found at ${binaryPath}, skipping...`);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Get the source path of the raw binary file in the build directory
|
|
832
|
+
*/
|
|
833
|
+
getRawBinarySourcePath(npmDirectory, appName) {
|
|
834
|
+
const basePath = this.options.debug ? 'debug' : 'release';
|
|
835
|
+
const binaryName = this.getBinaryName(appName);
|
|
836
|
+
// Handle cross-platform builds
|
|
837
|
+
if (this.options.multiArch || this.hasArchSpecificTarget()) {
|
|
838
|
+
return path.join(npmDirectory, this.getArchSpecificPath(), basePath, binaryName);
|
|
839
|
+
}
|
|
840
|
+
return path.join(npmDirectory, 'src-tauri/target', basePath, binaryName);
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Get the output path for the raw binary file
|
|
844
|
+
*/
|
|
845
|
+
getRawBinaryPath(appName) {
|
|
846
|
+
const extension = process.platform === 'win32' ? '.exe' : '';
|
|
847
|
+
const suffix = process.platform === 'win32' ? '' : '-binary';
|
|
848
|
+
return `${appName}${suffix}${extension}`;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Get the binary name based on app name and platform
|
|
852
|
+
*/
|
|
853
|
+
getBinaryName(appName) {
|
|
854
|
+
const extension = process.platform === 'win32' ? '.exe' : '';
|
|
855
|
+
// Linux uses the unique binary name we set in merge.ts
|
|
856
|
+
if (process.platform === 'linux') {
|
|
857
|
+
return `pake-${appName.toLowerCase()}${extension}`;
|
|
858
|
+
}
|
|
859
|
+
// Windows and macOS use 'pake' as binary name
|
|
860
|
+
return `pake${extension}`;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Check if this build has architecture-specific target
|
|
864
|
+
*/
|
|
865
|
+
hasArchSpecificTarget() {
|
|
866
|
+
return false; // Override in subclasses if needed
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Get architecture-specific path for binary
|
|
870
|
+
*/
|
|
871
|
+
getArchSpecificPath() {
|
|
872
|
+
return 'src-tauri/target'; // Override in subclasses if needed
|
|
873
|
+
}
|
|
807
874
|
}
|
|
808
875
|
BaseBuilder.packageManagerCache = null;
|
|
809
876
|
// 架构映射配置
|
|
@@ -832,31 +899,23 @@ BaseBuilder.ARCH_DISPLAY_NAMES = {
|
|
|
832
899
|
class MacBuilder extends BaseBuilder {
|
|
833
900
|
constructor(options) {
|
|
834
901
|
super(options);
|
|
835
|
-
// Store the original targets value for architecture selection
|
|
836
|
-
// For macOS, targets can be architecture names or format names
|
|
837
|
-
// Filter out non-architecture values
|
|
838
902
|
const validArchs = ['intel', 'apple', 'universal', 'auto', 'x64', 'arm64'];
|
|
839
903
|
this.buildArch = validArchs.includes(options.targets || '')
|
|
840
904
|
? options.targets
|
|
841
905
|
: 'auto';
|
|
842
|
-
// Use DMG by default for distribution
|
|
843
|
-
// Only create app bundles for testing to avoid user interaction
|
|
844
906
|
if (process.env.PAKE_CREATE_APP === '1') {
|
|
845
907
|
this.buildFormat = 'app';
|
|
846
908
|
}
|
|
847
909
|
else {
|
|
848
910
|
this.buildFormat = 'dmg';
|
|
849
911
|
}
|
|
850
|
-
// Set targets to format for Tauri
|
|
851
912
|
this.options.targets = this.buildFormat;
|
|
852
913
|
}
|
|
853
914
|
getFileName() {
|
|
854
915
|
const { name } = this.options;
|
|
855
|
-
// For app bundles, use simple name without version/arch
|
|
856
916
|
if (this.buildFormat === 'app') {
|
|
857
917
|
return name;
|
|
858
918
|
}
|
|
859
|
-
// For DMG files, use versioned filename
|
|
860
919
|
let arch;
|
|
861
920
|
if (this.buildArch === 'universal' || this.options.multiArch) {
|
|
862
921
|
arch = 'universal';
|
|
@@ -868,7 +927,6 @@ class MacBuilder extends BaseBuilder {
|
|
|
868
927
|
arch = 'x64';
|
|
869
928
|
}
|
|
870
929
|
else {
|
|
871
|
-
// Auto-detect based on current architecture
|
|
872
930
|
arch = this.getArchDisplayName(this.resolveTargetArch(this.buildArch));
|
|
873
931
|
}
|
|
874
932
|
return `${name}_${tauriConfig.version}_${arch}`;
|
|
@@ -893,7 +951,6 @@ class MacBuilder extends BaseBuilder {
|
|
|
893
951
|
throw new Error(`Unsupported architecture: ${actualArch} for macOS`);
|
|
894
952
|
}
|
|
895
953
|
let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
|
|
896
|
-
// Add features
|
|
897
954
|
const features = this.getBuildFeatures();
|
|
898
955
|
if (features.length > 0) {
|
|
899
956
|
fullCommand += ` --features ${features.join(',')}`;
|
|
@@ -906,14 +963,20 @@ class MacBuilder extends BaseBuilder {
|
|
|
906
963
|
const target = this.getTauriTarget(actualArch, 'darwin');
|
|
907
964
|
return `src-tauri/target/${target}/${basePath}/bundle`;
|
|
908
965
|
}
|
|
966
|
+
hasArchSpecificTarget() {
|
|
967
|
+
return true;
|
|
968
|
+
}
|
|
969
|
+
getArchSpecificPath() {
|
|
970
|
+
const actualArch = this.getActualArch();
|
|
971
|
+
const target = this.getTauriTarget(actualArch, 'darwin');
|
|
972
|
+
return `src-tauri/target/${target}`;
|
|
973
|
+
}
|
|
909
974
|
}
|
|
910
975
|
|
|
911
976
|
class WinBuilder extends BaseBuilder {
|
|
912
977
|
constructor(options) {
|
|
913
978
|
super(options);
|
|
914
979
|
this.buildFormat = 'msi';
|
|
915
|
-
// For Windows, targets can be architecture names or format names
|
|
916
|
-
// Filter out non-architecture values
|
|
917
980
|
const validArchs = ['x64', 'arm64', 'auto'];
|
|
918
981
|
this.buildArch = validArchs.includes(options.targets || '')
|
|
919
982
|
? this.resolveTargetArch(options.targets)
|
|
@@ -933,7 +996,6 @@ class WinBuilder extends BaseBuilder {
|
|
|
933
996
|
throw new Error(`Unsupported architecture: ${this.buildArch} for Windows`);
|
|
934
997
|
}
|
|
935
998
|
let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
|
|
936
|
-
// Add features
|
|
937
999
|
const features = this.getBuildFeatures();
|
|
938
1000
|
if (features.length > 0) {
|
|
939
1001
|
fullCommand += ` --features ${features.join(',')}`;
|
|
@@ -945,12 +1007,18 @@ class WinBuilder extends BaseBuilder {
|
|
|
945
1007
|
const target = this.getTauriTarget(this.buildArch, 'win32');
|
|
946
1008
|
return `src-tauri/target/${target}/${basePath}/bundle/`;
|
|
947
1009
|
}
|
|
1010
|
+
hasArchSpecificTarget() {
|
|
1011
|
+
return true;
|
|
1012
|
+
}
|
|
1013
|
+
getArchSpecificPath() {
|
|
1014
|
+
const target = this.getTauriTarget(this.buildArch, 'win32');
|
|
1015
|
+
return `src-tauri/target/${target}`;
|
|
1016
|
+
}
|
|
948
1017
|
}
|
|
949
1018
|
|
|
950
1019
|
class LinuxBuilder extends BaseBuilder {
|
|
951
1020
|
constructor(options) {
|
|
952
1021
|
super(options);
|
|
953
|
-
// Parse target format and architecture
|
|
954
1022
|
const target = options.targets || 'deb';
|
|
955
1023
|
if (target.includes('-arm64')) {
|
|
956
1024
|
this.buildFormat = target.replace('-arm64', '');
|
|
@@ -960,33 +1028,32 @@ class LinuxBuilder extends BaseBuilder {
|
|
|
960
1028
|
this.buildFormat = target;
|
|
961
1029
|
this.buildArch = this.resolveTargetArch('auto');
|
|
962
1030
|
}
|
|
963
|
-
// Set targets to format for Tauri
|
|
964
1031
|
this.options.targets = this.buildFormat;
|
|
965
1032
|
}
|
|
966
1033
|
getFileName() {
|
|
967
1034
|
const { name, targets } = this.options;
|
|
968
1035
|
const version = tauriConfig.version;
|
|
969
|
-
// Determine architecture display name
|
|
970
1036
|
let arch;
|
|
971
1037
|
if (this.buildArch === 'arm64') {
|
|
972
1038
|
arch = targets === 'rpm' || targets === 'appimage' ? 'aarch64' : 'arm64';
|
|
973
1039
|
}
|
|
974
1040
|
else {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1041
|
+
if (this.buildArch === 'x64') {
|
|
1042
|
+
arch = targets === 'rpm' ? 'x86_64' : 'amd64';
|
|
1043
|
+
}
|
|
1044
|
+
else {
|
|
1045
|
+
arch = this.buildArch;
|
|
1046
|
+
if (this.buildArch === 'arm64' &&
|
|
1047
|
+
(targets === 'rpm' || targets === 'appimage')) {
|
|
1048
|
+
arch = 'aarch64';
|
|
1049
|
+
}
|
|
981
1050
|
}
|
|
982
1051
|
}
|
|
983
|
-
// The RPM format uses different separators and version number formats
|
|
984
1052
|
if (targets === 'rpm') {
|
|
985
1053
|
return `${name}-${version}-1.${arch}`;
|
|
986
1054
|
}
|
|
987
1055
|
return `${name}_${version}_${arch}`;
|
|
988
1056
|
}
|
|
989
|
-
// Customize it, considering that there are all targets.
|
|
990
1057
|
async build(url) {
|
|
991
1058
|
const targetTypes = ['deb', 'appimage', 'rpm'];
|
|
992
1059
|
for (const target of targetTypes) {
|
|
@@ -997,12 +1064,10 @@ class LinuxBuilder extends BaseBuilder {
|
|
|
997
1064
|
}
|
|
998
1065
|
getBuildCommand(packageManager = 'pnpm') {
|
|
999
1066
|
const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
|
|
1000
|
-
// Only add target if it's ARM64
|
|
1001
1067
|
const buildTarget = this.buildArch === 'arm64'
|
|
1002
1068
|
? this.getTauriTarget(this.buildArch, 'linux')
|
|
1003
1069
|
: undefined;
|
|
1004
1070
|
let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
|
|
1005
|
-
// Add features
|
|
1006
1071
|
const features = this.getBuildFeatures();
|
|
1007
1072
|
if (features.length > 0) {
|
|
1008
1073
|
fullCommand += ` --features ${features.join(',')}`;
|
|
@@ -1023,6 +1088,16 @@ class LinuxBuilder extends BaseBuilder {
|
|
|
1023
1088
|
}
|
|
1024
1089
|
return super.getFileType(target);
|
|
1025
1090
|
}
|
|
1091
|
+
hasArchSpecificTarget() {
|
|
1092
|
+
return this.buildArch === 'arm64';
|
|
1093
|
+
}
|
|
1094
|
+
getArchSpecificPath() {
|
|
1095
|
+
if (this.buildArch === 'arm64') {
|
|
1096
|
+
const target = this.getTauriTarget(this.buildArch, 'linux');
|
|
1097
|
+
return `src-tauri/target/${target}`;
|
|
1098
|
+
}
|
|
1099
|
+
return super.getArchSpecificPath();
|
|
1100
|
+
}
|
|
1026
1101
|
}
|
|
1027
1102
|
|
|
1028
1103
|
const { platform } = process;
|
|
@@ -1066,6 +1141,7 @@ const DEFAULT_PAKE_OPTIONS = {
|
|
|
1066
1141
|
incognito: false,
|
|
1067
1142
|
wasm: false,
|
|
1068
1143
|
enableDragDrop: false,
|
|
1144
|
+
keepBinary: false,
|
|
1069
1145
|
};
|
|
1070
1146
|
|
|
1071
1147
|
async function checkUpdateTips() {
|
|
@@ -1078,7 +1154,7 @@ async function checkUpdateTips() {
|
|
|
1078
1154
|
const ICON_CONFIG = {
|
|
1079
1155
|
minFileSize: 100,
|
|
1080
1156
|
downloadTimeout: 10000,
|
|
1081
|
-
supportedFormats: ['png', 'ico', 'jpeg', 'jpg', 'webp'],
|
|
1157
|
+
supportedFormats: ['png', 'ico', 'jpeg', 'jpg', 'webp', 'icns'],
|
|
1082
1158
|
whiteBackground: { r: 255, g: 255, b: 255 },
|
|
1083
1159
|
};
|
|
1084
1160
|
// API Configuration
|
|
@@ -1159,6 +1235,14 @@ async function handleIcon(options, url) {
|
|
|
1159
1235
|
if (options.icon.startsWith('http')) {
|
|
1160
1236
|
const downloadedPath = await downloadIcon(options.icon);
|
|
1161
1237
|
if (downloadedPath && options.name) {
|
|
1238
|
+
// Check if the downloaded file is already in the correct format for the platform
|
|
1239
|
+
const downloadedExt = path.extname(downloadedPath).toLowerCase();
|
|
1240
|
+
const isCorrectFormat = (IS_WIN && downloadedExt === '.ico') ||
|
|
1241
|
+
(IS_LINUX && downloadedExt === '.png') ||
|
|
1242
|
+
(!IS_WIN && !IS_LINUX && downloadedExt === '.icns'); // macOS
|
|
1243
|
+
if (isCorrectFormat) {
|
|
1244
|
+
return downloadedPath;
|
|
1245
|
+
}
|
|
1162
1246
|
// Convert downloaded icon to platform-specific format
|
|
1163
1247
|
const convertedPath = await convertIconFormat(downloadedPath, options.name);
|
|
1164
1248
|
if (convertedPath) {
|
|
@@ -1470,7 +1554,7 @@ program
|
|
|
1470
1554
|
.option('--fullscreen', 'Start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
|
|
1471
1555
|
.option('--hide-title-bar', 'For Mac, hide title bar', DEFAULT_PAKE_OPTIONS.hideTitleBar)
|
|
1472
1556
|
.option('--multi-arch', 'For Mac, both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch)
|
|
1473
|
-
.option('--inject
|
|
1557
|
+
.option('--inject <files>', 'Inject local CSS/JS files into the page', (val, previous) => {
|
|
1474
1558
|
if (!val)
|
|
1475
1559
|
return DEFAULT_PAKE_OPTIONS.inject;
|
|
1476
1560
|
// Split by comma and trim whitespace, filter out empty strings
|
|
@@ -1488,7 +1572,7 @@ program
|
|
|
1488
1572
|
.addOption(new Option('--user-agent <string>', 'Custom user agent')
|
|
1489
1573
|
.default(DEFAULT_PAKE_OPTIONS.userAgent)
|
|
1490
1574
|
.hideHelp())
|
|
1491
|
-
.addOption(new Option('--targets <string>', 'Build target
|
|
1575
|
+
.addOption(new Option('--targets <string>', 'Build target format for your system').default(DEFAULT_PAKE_OPTIONS.targets))
|
|
1492
1576
|
.addOption(new Option('--app-version <string>', 'App version, the same as package.json version')
|
|
1493
1577
|
.default(DEFAULT_PAKE_OPTIONS.appVersion)
|
|
1494
1578
|
.hideHelp())
|
|
@@ -1523,6 +1607,9 @@ program
|
|
|
1523
1607
|
.addOption(new Option('--enable-drag-drop', 'Enable drag and drop functionality')
|
|
1524
1608
|
.default(DEFAULT_PAKE_OPTIONS.enableDragDrop)
|
|
1525
1609
|
.hideHelp())
|
|
1610
|
+
.addOption(new Option('--keep-binary', 'Keep raw binary file alongside installer')
|
|
1611
|
+
.default(DEFAULT_PAKE_OPTIONS.keepBinary)
|
|
1612
|
+
.hideHelp())
|
|
1526
1613
|
.addOption(new Option('--installer-language <string>', 'Installer language')
|
|
1527
1614
|
.default(DEFAULT_PAKE_OPTIONS.installerLanguage)
|
|
1528
1615
|
.hideHelp())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pake-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"ora": "^8.2.0",
|
|
64
64
|
"prompts": "^2.4.2",
|
|
65
65
|
"psl": "^1.15.0",
|
|
66
|
-
"sharp": "^0.
|
|
66
|
+
"sharp": "^0.33.4",
|
|
67
67
|
"tmp-promise": "^3.0.3",
|
|
68
68
|
"update-notifier": "^7.3.1"
|
|
69
69
|
},
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
[source.crates-io]
|
|
2
|
+
replace-with = 'rsproxy-sparse'
|
|
3
|
+
[source.rsproxy]
|
|
4
|
+
registry = "https://rsproxy.cn/crates.io-index"
|
|
5
|
+
[source.rsproxy-sparse]
|
|
6
|
+
registry = "sparse+https://rsproxy.cn/index/"
|
|
7
|
+
[registries.rsproxy]
|
|
8
|
+
index = "https://rsproxy.cn/crates.io-index"
|
|
9
|
+
[net]
|
|
10
|
+
git-fetch-with-cli = true
|
|
11
|
+
|
|
1
12
|
[env]
|
|
2
13
|
# Fix for macOS 26 Beta compatibility issues
|
|
3
14
|
# Forces use of compatible SDK when building on macOS 26 Beta
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"windows": [
|
|
3
3
|
{
|
|
4
|
-
"url": "https://
|
|
4
|
+
"url": "https://weekly.tw93.fun",
|
|
5
5
|
"url_type": "web",
|
|
6
6
|
"hide_title_bar": false,
|
|
7
7
|
"fullscreen": false,
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
22
|
"user_agent": {
|
|
23
|
-
"macos": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/
|
|
24
|
-
"linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
25
|
-
"windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
23
|
+
"macos": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15",
|
|
24
|
+
"linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
|
|
25
|
+
"windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
|
|
26
26
|
},
|
|
27
27
|
"system_tray": {
|
|
28
28
|
"macos": false,
|
|
@@ -30,8 +30,6 @@
|
|
|
30
30
|
"windows": true
|
|
31
31
|
},
|
|
32
32
|
"system_tray_path": "png/icon_512.png",
|
|
33
|
-
"inject": [
|
|
34
|
-
"/tmp/test.css"
|
|
35
|
-
],
|
|
33
|
+
"inject": [],
|
|
36
34
|
"proxy_url": ""
|
|
37
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"productName": "
|
|
3
|
-
"identifier": "com.pake.
|
|
2
|
+
"productName": "WeeklyIconFixed",
|
|
3
|
+
"identifier": "com.pake.33f03a",
|
|
4
4
|
"version": "1.0.0",
|
|
5
5
|
"app": {
|
|
6
6
|
"withGlobalTauri": true,
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
},
|
|
14
14
|
"bundle": {
|
|
15
15
|
"icon": [
|
|
16
|
-
"
|
|
16
|
+
"icons/weeklyiconfixed.icns"
|
|
17
17
|
],
|
|
18
18
|
"active": true,
|
|
19
19
|
"targets": [
|
|
20
|
-
"
|
|
20
|
+
"app"
|
|
21
21
|
],
|
|
22
22
|
"resources": [
|
|
23
|
-
"icons/
|
|
23
|
+
"icons/weeklyiconfixed.icns"
|
|
24
24
|
]
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bundle": {
|
|
3
3
|
"icon": [
|
|
4
|
-
"
|
|
4
|
+
"icons/weeklyiconfixed.icns"
|
|
5
5
|
],
|
|
6
6
|
"active": true,
|
|
7
7
|
"targets": [
|
|
8
|
-
"
|
|
8
|
+
"app"
|
|
9
9
|
],
|
|
10
10
|
"resources": [
|
|
11
|
-
"icons/
|
|
11
|
+
"icons/weeklyiconfixed.icns"
|
|
12
12
|
]
|
|
13
13
|
}
|
|
14
14
|
}
|
package/src-tauri/pake.json
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"user_agent": {
|
|
22
|
-
"macos": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/
|
|
23
|
-
"linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
24
|
-
"windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
22
|
+
"macos": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15",
|
|
23
|
+
"linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
|
|
24
|
+
"windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
|
|
25
25
|
},
|
|
26
26
|
"system_tray": {
|
|
27
27
|
"macos": false,
|
|
@@ -40,7 +40,6 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
|
|
|
40
40
|
.always_on_top(window_config.always_on_top)
|
|
41
41
|
.incognito(window_config.incognito);
|
|
42
42
|
|
|
43
|
-
// Conditionally disable drag-drop handler
|
|
44
43
|
if !window_config.enable_drag_drop {
|
|
45
44
|
window_builder = window_builder.disable_drag_drop_handler();
|
|
46
45
|
}
|
|
@@ -52,14 +51,12 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
|
|
|
52
51
|
.initialization_script(include_str!("../inject/style.js"))
|
|
53
52
|
.initialization_script(include_str!("../inject/custom.js"));
|
|
54
53
|
|
|
55
|
-
// Configure WASM support with required headers for SharedArrayBuffer
|
|
56
54
|
if window_config.enable_wasm {
|
|
57
55
|
window_builder = window_builder
|
|
58
56
|
.additional_browser_args("--enable-features=SharedArrayBuffer")
|
|
59
57
|
.additional_browser_args("--enable-unsafe-webgpu");
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
// Configure proxy if specified
|
|
63
60
|
if !config.proxy_url.is_empty() {
|
|
64
61
|
if let Ok(proxy_url) = Url::from_str(&config.proxy_url) {
|
|
65
62
|
window_builder = window_builder.proxy_url(proxy_url);
|
|
@@ -86,10 +83,9 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
|
|
|
86
83
|
{
|
|
87
84
|
window_builder = window_builder
|
|
88
85
|
.data_directory(_data_dir)
|
|
89
|
-
.title(app.package_info().name.clone())
|
|
86
|
+
.title(app.package_info().name.clone())
|
|
87
|
+
.additional_browser_args("--disable-blink-features=AutomationControlled");
|
|
90
88
|
|
|
91
|
-
// Set theme to None for automatic system theme detection on Windows
|
|
92
|
-
// This allows the window to respond to system theme changes automatically
|
|
93
89
|
window_builder = window_builder.theme(None);
|
|
94
90
|
}
|
|
95
91
|
|
|
@@ -97,10 +93,9 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
|
|
|
97
93
|
{
|
|
98
94
|
window_builder = window_builder
|
|
99
95
|
.data_directory(_data_dir)
|
|
100
|
-
.title(app.package_info().name.clone())
|
|
96
|
+
.title(app.package_info().name.clone())
|
|
97
|
+
.additional_browser_args("--disable-blink-features=AutomationControlled");
|
|
101
98
|
|
|
102
|
-
// Set theme to None for automatic system theme detection on Linux
|
|
103
|
-
// This allows the window to respond to system theme changes automatically
|
|
104
99
|
window_builder = window_builder.theme(None);
|
|
105
100
|
}
|
|
106
101
|
|