pake-cli 3.2.17 → 3.3.0
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 +15 -7
- package/dist/cli.js +135 -46
- package/package.json +6 -5
- package/src-tauri/.cargo/config.toml +11 -0
- package/src-tauri/.pake/pake.json +10 -8
- package/src-tauri/.pake/tauri.conf.json +5 -5
- package/src-tauri/.pake/tauri.macos.conf.json +3 -3
- package/src-tauri/Cargo.lock +267 -362
- package/src-tauri/Cargo.toml +6 -6
- package/src-tauri/pake.json +6 -4
- package/src-tauri/src/app/config.rs +1 -0
- package/src-tauri/src/app/window.rs +11 -10
- package/src-tauri/src/lib.rs +11 -2
package/README.md
CHANGED
|
@@ -199,9 +199,10 @@ pnpm run build
|
|
|
199
199
|
|
|
200
200
|
## Documentation
|
|
201
201
|
|
|
202
|
-
- **[CLI Usage](docs/cli-usage.md)**
|
|
203
|
-
- **[Advanced Usage](docs/advanced-usage.md)**
|
|
204
|
-
- **[GitHub Actions](docs/github-actions-usage.md)**
|
|
202
|
+
- **[CLI Usage](docs/cli-usage.md)** | [中文](docs/cli-usage_CN.md) - Command-line interface reference
|
|
203
|
+
- **[Advanced Usage](docs/advanced-usage.md)** | [中文](docs/advanced-usage_CN.md) - Customization and advanced features
|
|
204
|
+
- **[GitHub Actions](docs/github-actions-usage.md)** | [中文](docs/github-actions-usage_CN.md) - Build apps online
|
|
205
|
+
- **[Pake Action](docs/pake-action.md)** - Use Pake as GitHub Action in your projects
|
|
205
206
|
- **[Contributing](CONTRIBUTING.md)** - How to contribute to development
|
|
206
207
|
|
|
207
208
|
## Developers
|
|
@@ -444,6 +445,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
444
445
|
<sub><b>Jiaqi Gu</b></sub>
|
|
445
446
|
</a>
|
|
446
447
|
</td>
|
|
448
|
+
<td align="center">
|
|
449
|
+
<a href="https://github.com/Jason6987">
|
|
450
|
+
<img src="https://avatars.githubusercontent.com/u/140222795?v=4" width="90;" alt="Jason6987"/>
|
|
451
|
+
<br />
|
|
452
|
+
<sub><b>Luminall</b></sub>
|
|
453
|
+
</a>
|
|
454
|
+
</td>
|
|
447
455
|
<td align="center">
|
|
448
456
|
<a href="https://github.com/Milo123459">
|
|
449
457
|
<img src="https://avatars.githubusercontent.com/u/50248166?v=4" width="90;" alt="Milo123459"/>
|
|
@@ -458,6 +466,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
458
466
|
<sub><b>Po Chen</b></sub>
|
|
459
467
|
</a>
|
|
460
468
|
</td>
|
|
469
|
+
</tr>
|
|
470
|
+
<tr>
|
|
461
471
|
<td align="center">
|
|
462
472
|
<a href="https://github.com/beautifulrem">
|
|
463
473
|
<img src="https://avatars.githubusercontent.com/u/98527099?v=4" width="90;" alt="beautifulrem"/>
|
|
@@ -465,8 +475,6 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
465
475
|
<sub><b>Xie Ruiqi</b></sub>
|
|
466
476
|
</a>
|
|
467
477
|
</td>
|
|
468
|
-
</tr>
|
|
469
|
-
<tr>
|
|
470
478
|
<td align="center">
|
|
471
479
|
<a href="https://github.com/bocanhcam">
|
|
472
480
|
<img src="https://avatars.githubusercontent.com/u/35592955?v=4" width="90;" alt="bocanhcam"/>
|
|
@@ -509,6 +517,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
509
517
|
<sub><b>Liusishan</b></sub>
|
|
510
518
|
</a>
|
|
511
519
|
</td>
|
|
520
|
+
</tr>
|
|
521
|
+
<tr>
|
|
512
522
|
<td align="center">
|
|
513
523
|
<a href="https://github.com/piaoyidage">
|
|
514
524
|
<img src="https://avatars.githubusercontent.com/u/5135405?v=4" width="90;" alt="piaoyidage"/>
|
|
@@ -516,8 +526,6 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
516
526
|
<sub><b>Ranger</b></sub>
|
|
517
527
|
</a>
|
|
518
528
|
</td>
|
|
519
|
-
</tr>
|
|
520
|
-
<tr>
|
|
521
529
|
<td align="center">
|
|
522
530
|
<a href="https://github.com/hetz">
|
|
523
531
|
<img src="https://avatars.githubusercontent.com/u/820141?v=4" width="90;" alt="hetz"/>
|
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.0";
|
|
26
26
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
|
|
27
27
|
var engines = {
|
|
28
28
|
node: ">=18.0.0"
|
|
@@ -65,6 +65,7 @@ var scripts = {
|
|
|
65
65
|
test: "pnpm run cli:build && cross-env PAKE_CREATE_APP=1 node tests/index.js",
|
|
66
66
|
format: "prettier --write . --ignore-unknown && find tests -name '*.js' -exec sed -i '' 's/[[:space:]]*$//' {} \\; && cd src-tauri && cargo fmt --verbose",
|
|
67
67
|
"format:check": "prettier --check . --ignore-unknown",
|
|
68
|
+
update: "pnpm update --verbose && cd src-tauri && cargo update",
|
|
68
69
|
prepublishOnly: "pnpm run cli:build"
|
|
69
70
|
};
|
|
70
71
|
var type = "module";
|
|
@@ -72,10 +73,10 @@ var exports = "./dist/cli.js";
|
|
|
72
73
|
var license = "MIT";
|
|
73
74
|
var dependencies = {
|
|
74
75
|
"@tauri-apps/api": "^2.8.0",
|
|
75
|
-
"@tauri-apps/cli": "^2.8.
|
|
76
|
+
"@tauri-apps/cli": "^2.8.3",
|
|
76
77
|
axios: "^1.11.0",
|
|
77
78
|
chalk: "^5.6.0",
|
|
78
|
-
commander: "^
|
|
79
|
+
commander: "^12.1.0",
|
|
79
80
|
execa: "^9.6.0",
|
|
80
81
|
"file-type": "^18.7.0",
|
|
81
82
|
"fs-extra": "^11.3.1",
|
|
@@ -84,7 +85,7 @@ var dependencies = {
|
|
|
84
85
|
ora: "^8.2.0",
|
|
85
86
|
prompts: "^2.4.2",
|
|
86
87
|
psl: "^1.15.0",
|
|
87
|
-
sharp: "^0.
|
|
88
|
+
sharp: "^0.34.3",
|
|
88
89
|
"tmp-promise": "^3.0.3",
|
|
89
90
|
"update-notifier": "^7.3.1"
|
|
90
91
|
};
|
|
@@ -103,7 +104,7 @@ var devDependencies = {
|
|
|
103
104
|
"app-root-path": "^3.1.0",
|
|
104
105
|
"cross-env": "^7.0.3",
|
|
105
106
|
prettier: "^3.6.2",
|
|
106
|
-
rollup: "^4.
|
|
107
|
+
rollup: "^4.49.0",
|
|
107
108
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
108
109
|
tslib: "^2.8.1",
|
|
109
110
|
typescript: "^5.9.2"
|
|
@@ -347,9 +348,9 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
347
348
|
await fsExtra.copy(sourcePath, destPath);
|
|
348
349
|
}
|
|
349
350
|
}));
|
|
350
|
-
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, } = options;
|
|
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;
|
|
351
352
|
const { platform } = process;
|
|
352
|
-
|
|
353
|
+
const platformHideOnClose = hideOnClose ?? platform === 'darwin';
|
|
353
354
|
const tauriConfWindowOptions = {
|
|
354
355
|
width,
|
|
355
356
|
height,
|
|
@@ -360,19 +361,22 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
360
361
|
always_on_top: alwaysOnTop,
|
|
361
362
|
dark_mode: darkMode,
|
|
362
363
|
disabled_web_shortcuts: disabledWebShortcuts,
|
|
363
|
-
hide_on_close:
|
|
364
|
+
hide_on_close: platformHideOnClose,
|
|
364
365
|
incognito: incognito,
|
|
365
366
|
title: title || null,
|
|
366
367
|
enable_wasm: wasm,
|
|
368
|
+
enable_drag_drop: enableDragDrop,
|
|
367
369
|
};
|
|
368
370
|
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
|
369
371
|
tauriConf.productName = name;
|
|
370
372
|
tauriConf.identifier = identifier;
|
|
371
373
|
tauriConf.version = appVersion;
|
|
374
|
+
if (platform === 'linux') {
|
|
375
|
+
tauriConf.mainBinaryName = `pake-${name.toLowerCase()}`;
|
|
376
|
+
}
|
|
372
377
|
if (platform == 'win32') {
|
|
373
378
|
tauriConf.bundle.windows.wix.language[0] = installerLanguage;
|
|
374
379
|
}
|
|
375
|
-
//Judge the type of URL, whether it is a file or a website.
|
|
376
380
|
const pathExists = await fsExtra.pathExists(url);
|
|
377
381
|
if (pathExists) {
|
|
378
382
|
logger.warn('✼ Your input might be a local file.');
|
|
@@ -423,8 +427,8 @@ Version=1.0
|
|
|
423
427
|
Type=Application
|
|
424
428
|
Name=${name}
|
|
425
429
|
Comment=${name}
|
|
426
|
-
Exec
|
|
427
|
-
Icon=${appNameLower}
|
|
430
|
+
Exec=pake-${appNameLower}
|
|
431
|
+
Icon=${appNameLower}_512
|
|
428
432
|
Categories=Network;WebBrowser;
|
|
429
433
|
MimeType=text/html;text/xml;application/xhtml_xml;
|
|
430
434
|
StartupNotify=true
|
|
@@ -506,7 +510,7 @@ StartupNotify=true
|
|
|
506
510
|
}
|
|
507
511
|
}
|
|
508
512
|
if (updateIconPath) {
|
|
509
|
-
tauriConf.bundle.icon = [
|
|
513
|
+
tauriConf.bundle.icon = [iconInfo.path];
|
|
510
514
|
}
|
|
511
515
|
else {
|
|
512
516
|
logger.warn(`✼ Icon will remain as default.`);
|
|
@@ -544,11 +548,13 @@ StartupNotify=true
|
|
|
544
548
|
const injectFilePath = path.join(npmDirectory, `src-tauri/src/inject/custom.js`);
|
|
545
549
|
// inject js or css files
|
|
546
550
|
if (inject?.length > 0) {
|
|
547
|
-
|
|
551
|
+
// Ensure inject is an array before calling .every()
|
|
552
|
+
const injectArray = Array.isArray(inject) ? inject : [inject];
|
|
553
|
+
if (!injectArray.every((item) => item.endsWith('.css') || item.endsWith('.js'))) {
|
|
548
554
|
logger.error('The injected file must be in either CSS or JS format.');
|
|
549
555
|
return;
|
|
550
556
|
}
|
|
551
|
-
const files =
|
|
557
|
+
const files = injectArray.map((filepath) => path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath));
|
|
552
558
|
tauriConf.pake.inject = files;
|
|
553
559
|
await combineFiles(files, injectFilePath);
|
|
554
560
|
}
|
|
@@ -600,15 +606,13 @@ class BaseBuilder {
|
|
|
600
606
|
return process.platform === 'win32' ? 600000 : 300000;
|
|
601
607
|
}
|
|
602
608
|
getBuildTimeout() {
|
|
603
|
-
return 900000;
|
|
609
|
+
return 900000;
|
|
604
610
|
}
|
|
605
611
|
async detectPackageManager() {
|
|
606
|
-
// 使用缓存避免重复检测
|
|
607
612
|
if (BaseBuilder.packageManagerCache) {
|
|
608
613
|
return BaseBuilder.packageManagerCache;
|
|
609
614
|
}
|
|
610
615
|
const { execa } = await import('execa');
|
|
611
|
-
// 优先使用pnpm(如果可用)
|
|
612
616
|
try {
|
|
613
617
|
await execa('pnpm', ['--version'], { stdio: 'ignore' });
|
|
614
618
|
logger.info('✺ Using pnpm for package management.');
|
|
@@ -616,7 +620,6 @@ class BaseBuilder {
|
|
|
616
620
|
return 'pnpm';
|
|
617
621
|
}
|
|
618
622
|
catch {
|
|
619
|
-
// pnpm不可用,回退到npm
|
|
620
623
|
try {
|
|
621
624
|
await execa('npm', ['--version'], { stdio: 'ignore' });
|
|
622
625
|
logger.info('✺ pnpm not available, using npm for package management.');
|
|
@@ -704,9 +707,18 @@ class BaseBuilder {
|
|
|
704
707
|
const appPath = this.getBuildAppPath(npmDirectory, fileName, fileType);
|
|
705
708
|
const distPath = path.resolve(`${name}.${fileType}`);
|
|
706
709
|
await fsExtra.copy(appPath, distPath);
|
|
710
|
+
// Copy raw binary if requested
|
|
711
|
+
if (this.options.keepBinary) {
|
|
712
|
+
await this.copyRawBinary(npmDirectory, name);
|
|
713
|
+
}
|
|
707
714
|
await fsExtra.remove(appPath);
|
|
708
715
|
logger.success('✔ Build success!');
|
|
709
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
|
+
}
|
|
710
722
|
}
|
|
711
723
|
getFileType(target) {
|
|
712
724
|
return target;
|
|
@@ -798,6 +810,67 @@ class BaseBuilder {
|
|
|
798
810
|
const bundleDir = fileType.toLowerCase() === 'app' ? 'macos' : fileType.toLowerCase();
|
|
799
811
|
return path.join(npmDirectory, this.getBasePath(), bundleDir, `${fileName}.${fileType}`);
|
|
800
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
|
+
}
|
|
801
874
|
}
|
|
802
875
|
BaseBuilder.packageManagerCache = null;
|
|
803
876
|
// 架构映射配置
|
|
@@ -826,31 +899,23 @@ BaseBuilder.ARCH_DISPLAY_NAMES = {
|
|
|
826
899
|
class MacBuilder extends BaseBuilder {
|
|
827
900
|
constructor(options) {
|
|
828
901
|
super(options);
|
|
829
|
-
// Store the original targets value for architecture selection
|
|
830
|
-
// For macOS, targets can be architecture names or format names
|
|
831
|
-
// Filter out non-architecture values
|
|
832
902
|
const validArchs = ['intel', 'apple', 'universal', 'auto', 'x64', 'arm64'];
|
|
833
903
|
this.buildArch = validArchs.includes(options.targets || '')
|
|
834
904
|
? options.targets
|
|
835
905
|
: 'auto';
|
|
836
|
-
// Use DMG by default for distribution
|
|
837
|
-
// Only create app bundles for testing to avoid user interaction
|
|
838
906
|
if (process.env.PAKE_CREATE_APP === '1') {
|
|
839
907
|
this.buildFormat = 'app';
|
|
840
908
|
}
|
|
841
909
|
else {
|
|
842
910
|
this.buildFormat = 'dmg';
|
|
843
911
|
}
|
|
844
|
-
// Set targets to format for Tauri
|
|
845
912
|
this.options.targets = this.buildFormat;
|
|
846
913
|
}
|
|
847
914
|
getFileName() {
|
|
848
915
|
const { name } = this.options;
|
|
849
|
-
// For app bundles, use simple name without version/arch
|
|
850
916
|
if (this.buildFormat === 'app') {
|
|
851
917
|
return name;
|
|
852
918
|
}
|
|
853
|
-
// For DMG files, use versioned filename
|
|
854
919
|
let arch;
|
|
855
920
|
if (this.buildArch === 'universal' || this.options.multiArch) {
|
|
856
921
|
arch = 'universal';
|
|
@@ -862,7 +927,6 @@ class MacBuilder extends BaseBuilder {
|
|
|
862
927
|
arch = 'x64';
|
|
863
928
|
}
|
|
864
929
|
else {
|
|
865
|
-
// Auto-detect based on current architecture
|
|
866
930
|
arch = this.getArchDisplayName(this.resolveTargetArch(this.buildArch));
|
|
867
931
|
}
|
|
868
932
|
return `${name}_${tauriConfig.version}_${arch}`;
|
|
@@ -887,7 +951,6 @@ class MacBuilder extends BaseBuilder {
|
|
|
887
951
|
throw new Error(`Unsupported architecture: ${actualArch} for macOS`);
|
|
888
952
|
}
|
|
889
953
|
let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
|
|
890
|
-
// Add features
|
|
891
954
|
const features = this.getBuildFeatures();
|
|
892
955
|
if (features.length > 0) {
|
|
893
956
|
fullCommand += ` --features ${features.join(',')}`;
|
|
@@ -900,14 +963,20 @@ class MacBuilder extends BaseBuilder {
|
|
|
900
963
|
const target = this.getTauriTarget(actualArch, 'darwin');
|
|
901
964
|
return `src-tauri/target/${target}/${basePath}/bundle`;
|
|
902
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
|
+
}
|
|
903
974
|
}
|
|
904
975
|
|
|
905
976
|
class WinBuilder extends BaseBuilder {
|
|
906
977
|
constructor(options) {
|
|
907
978
|
super(options);
|
|
908
979
|
this.buildFormat = 'msi';
|
|
909
|
-
// For Windows, targets can be architecture names or format names
|
|
910
|
-
// Filter out non-architecture values
|
|
911
980
|
const validArchs = ['x64', 'arm64', 'auto'];
|
|
912
981
|
this.buildArch = validArchs.includes(options.targets || '')
|
|
913
982
|
? this.resolveTargetArch(options.targets)
|
|
@@ -927,7 +996,6 @@ class WinBuilder extends BaseBuilder {
|
|
|
927
996
|
throw new Error(`Unsupported architecture: ${this.buildArch} for Windows`);
|
|
928
997
|
}
|
|
929
998
|
let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
|
|
930
|
-
// Add features
|
|
931
999
|
const features = this.getBuildFeatures();
|
|
932
1000
|
if (features.length > 0) {
|
|
933
1001
|
fullCommand += ` --features ${features.join(',')}`;
|
|
@@ -939,12 +1007,18 @@ class WinBuilder extends BaseBuilder {
|
|
|
939
1007
|
const target = this.getTauriTarget(this.buildArch, 'win32');
|
|
940
1008
|
return `src-tauri/target/${target}/${basePath}/bundle/`;
|
|
941
1009
|
}
|
|
1010
|
+
hasArchSpecificTarget() {
|
|
1011
|
+
return true;
|
|
1012
|
+
}
|
|
1013
|
+
getArchSpecificPath() {
|
|
1014
|
+
const target = this.getTauriTarget(this.buildArch, 'win32');
|
|
1015
|
+
return `src-tauri/target/${target}`;
|
|
1016
|
+
}
|
|
942
1017
|
}
|
|
943
1018
|
|
|
944
1019
|
class LinuxBuilder extends BaseBuilder {
|
|
945
1020
|
constructor(options) {
|
|
946
1021
|
super(options);
|
|
947
|
-
// Parse target format and architecture
|
|
948
1022
|
const target = options.targets || 'deb';
|
|
949
1023
|
if (target.includes('-arm64')) {
|
|
950
1024
|
this.buildFormat = target.replace('-arm64', '');
|
|
@@ -954,33 +1028,32 @@ class LinuxBuilder extends BaseBuilder {
|
|
|
954
1028
|
this.buildFormat = target;
|
|
955
1029
|
this.buildArch = this.resolveTargetArch('auto');
|
|
956
1030
|
}
|
|
957
|
-
// Set targets to format for Tauri
|
|
958
1031
|
this.options.targets = this.buildFormat;
|
|
959
1032
|
}
|
|
960
1033
|
getFileName() {
|
|
961
1034
|
const { name, targets } = this.options;
|
|
962
1035
|
const version = tauriConfig.version;
|
|
963
|
-
// Determine architecture display name
|
|
964
1036
|
let arch;
|
|
965
1037
|
if (this.buildArch === 'arm64') {
|
|
966
1038
|
arch = targets === 'rpm' || targets === 'appimage' ? 'aarch64' : 'arm64';
|
|
967
1039
|
}
|
|
968
1040
|
else {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
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
|
+
}
|
|
975
1050
|
}
|
|
976
1051
|
}
|
|
977
|
-
// The RPM format uses different separators and version number formats
|
|
978
1052
|
if (targets === 'rpm') {
|
|
979
1053
|
return `${name}-${version}-1.${arch}`;
|
|
980
1054
|
}
|
|
981
1055
|
return `${name}_${version}_${arch}`;
|
|
982
1056
|
}
|
|
983
|
-
// Customize it, considering that there are all targets.
|
|
984
1057
|
async build(url) {
|
|
985
1058
|
const targetTypes = ['deb', 'appimage', 'rpm'];
|
|
986
1059
|
for (const target of targetTypes) {
|
|
@@ -991,12 +1064,10 @@ class LinuxBuilder extends BaseBuilder {
|
|
|
991
1064
|
}
|
|
992
1065
|
getBuildCommand(packageManager = 'pnpm') {
|
|
993
1066
|
const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
|
|
994
|
-
// Only add target if it's ARM64
|
|
995
1067
|
const buildTarget = this.buildArch === 'arm64'
|
|
996
1068
|
? this.getTauriTarget(this.buildArch, 'linux')
|
|
997
1069
|
: undefined;
|
|
998
1070
|
let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
|
|
999
|
-
// Add features
|
|
1000
1071
|
const features = this.getBuildFeatures();
|
|
1001
1072
|
if (features.length > 0) {
|
|
1002
1073
|
fullCommand += ` --features ${features.join(',')}`;
|
|
@@ -1017,6 +1088,16 @@ class LinuxBuilder extends BaseBuilder {
|
|
|
1017
1088
|
}
|
|
1018
1089
|
return super.getFileType(target);
|
|
1019
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
|
+
}
|
|
1020
1101
|
}
|
|
1021
1102
|
|
|
1022
1103
|
const { platform } = process;
|
|
@@ -1056,9 +1137,11 @@ const DEFAULT_PAKE_OPTIONS = {
|
|
|
1056
1137
|
debug: false,
|
|
1057
1138
|
inject: [],
|
|
1058
1139
|
installerLanguage: 'en-US',
|
|
1059
|
-
hideOnClose: true,
|
|
1140
|
+
hideOnClose: undefined, // Platform-specific: true for macOS, false for others
|
|
1060
1141
|
incognito: false,
|
|
1061
1142
|
wasm: false,
|
|
1143
|
+
enableDragDrop: false,
|
|
1144
|
+
keepBinary: false,
|
|
1062
1145
|
};
|
|
1063
1146
|
|
|
1064
1147
|
async function checkUpdateTips() {
|
|
@@ -1503,7 +1586,7 @@ program
|
|
|
1503
1586
|
.addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon')
|
|
1504
1587
|
.default(DEFAULT_PAKE_OPTIONS.systemTrayIcon)
|
|
1505
1588
|
.hideHelp())
|
|
1506
|
-
.addOption(new Option('--hide-on-close', 'Hide window on close instead of exiting')
|
|
1589
|
+
.addOption(new Option('--hide-on-close', 'Hide window on close instead of exiting (default: true for macOS, false for others)')
|
|
1507
1590
|
.default(DEFAULT_PAKE_OPTIONS.hideOnClose)
|
|
1508
1591
|
.hideHelp())
|
|
1509
1592
|
.addOption(new Option('--title <string>', 'Window title').hideHelp())
|
|
@@ -1513,6 +1596,12 @@ program
|
|
|
1513
1596
|
.addOption(new Option('--wasm', 'Enable WebAssembly support (Flutter Web, etc.)')
|
|
1514
1597
|
.default(DEFAULT_PAKE_OPTIONS.wasm)
|
|
1515
1598
|
.hideHelp())
|
|
1599
|
+
.addOption(new Option('--enable-drag-drop', 'Enable drag and drop functionality')
|
|
1600
|
+
.default(DEFAULT_PAKE_OPTIONS.enableDragDrop)
|
|
1601
|
+
.hideHelp())
|
|
1602
|
+
.addOption(new Option('--keep-binary', 'Keep raw binary file alongside installer')
|
|
1603
|
+
.default(DEFAULT_PAKE_OPTIONS.keepBinary)
|
|
1604
|
+
.hideHelp())
|
|
1516
1605
|
.addOption(new Option('--installer-language <string>', 'Installer language')
|
|
1517
1606
|
.default(DEFAULT_PAKE_OPTIONS.installerLanguage)
|
|
1518
1607
|
.hideHelp())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pake-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"test": "pnpm run cli:build && cross-env PAKE_CREATE_APP=1 node tests/index.js",
|
|
44
44
|
"format": "prettier --write . --ignore-unknown && find tests -name '*.js' -exec sed -i '' 's/[[:space:]]*$//' {} \\; && cd src-tauri && cargo fmt --verbose",
|
|
45
45
|
"format:check": "prettier --check . --ignore-unknown",
|
|
46
|
+
"update": "pnpm update --verbose && cd src-tauri && cargo update",
|
|
46
47
|
"prepublishOnly": "pnpm run cli:build"
|
|
47
48
|
},
|
|
48
49
|
"type": "module",
|
|
@@ -50,10 +51,10 @@
|
|
|
50
51
|
"license": "MIT",
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"@tauri-apps/api": "^2.8.0",
|
|
53
|
-
"@tauri-apps/cli": "^2.8.
|
|
54
|
+
"@tauri-apps/cli": "^2.8.3",
|
|
54
55
|
"axios": "^1.11.0",
|
|
55
56
|
"chalk": "^5.6.0",
|
|
56
|
-
"commander": "^
|
|
57
|
+
"commander": "^12.1.0",
|
|
57
58
|
"execa": "^9.6.0",
|
|
58
59
|
"file-type": "^18.7.0",
|
|
59
60
|
"fs-extra": "^11.3.1",
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
"ora": "^8.2.0",
|
|
63
64
|
"prompts": "^2.4.2",
|
|
64
65
|
"psl": "^1.15.0",
|
|
65
|
-
"sharp": "^0.
|
|
66
|
+
"sharp": "^0.34.3",
|
|
66
67
|
"tmp-promise": "^3.0.3",
|
|
67
68
|
"update-notifier": "^7.3.1"
|
|
68
69
|
},
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
"app-root-path": "^3.1.0",
|
|
82
83
|
"cross-env": "^7.0.3",
|
|
83
84
|
"prettier": "^3.6.2",
|
|
84
|
-
"rollup": "^4.
|
|
85
|
+
"rollup": "^4.49.0",
|
|
85
86
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
86
87
|
"tslib": "^2.8.1",
|
|
87
88
|
"typescript": "^5.9.2"
|
|
@@ -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,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"windows": [
|
|
3
3
|
{
|
|
4
|
-
"url": "https://
|
|
4
|
+
"url": "https://web-serial-example.netlify.app/",
|
|
5
5
|
"url_type": "web",
|
|
6
|
-
"hide_title_bar":
|
|
6
|
+
"hide_title_bar": false,
|
|
7
7
|
"fullscreen": false,
|
|
8
8
|
"width": 1200,
|
|
9
|
-
"height":
|
|
9
|
+
"height": 780,
|
|
10
10
|
"resizable": true,
|
|
11
11
|
"always_on_top": false,
|
|
12
12
|
"dark_mode": false,
|
|
@@ -14,14 +14,16 @@
|
|
|
14
14
|
"disabled_web_shortcuts": false,
|
|
15
15
|
"hide_on_close": true,
|
|
16
16
|
"incognito": false,
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"enable_wasm": false,
|
|
18
|
+
"enable_drag_drop": false,
|
|
19
|
+
"enable_serial": true,
|
|
20
|
+
"title": null
|
|
19
21
|
}
|
|
20
22
|
],
|
|
21
23
|
"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/
|
|
24
|
+
"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",
|
|
25
|
+
"linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
|
|
26
|
+
"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
27
|
},
|
|
26
28
|
"system_tray": {
|
|
27
29
|
"macos": false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"productName": "
|
|
3
|
-
"identifier": "com.pake.
|
|
2
|
+
"productName": "SerialTerminal",
|
|
3
|
+
"identifier": "com.pake.76e98c",
|
|
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/serialterminal.icns"
|
|
17
17
|
],
|
|
18
18
|
"active": true,
|
|
19
19
|
"targets": [
|
|
20
|
-
"
|
|
20
|
+
"dmg"
|
|
21
21
|
],
|
|
22
22
|
"resources": [
|
|
23
|
-
"icons/
|
|
23
|
+
"icons/serialterminal.icns"
|
|
24
24
|
]
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bundle": {
|
|
3
3
|
"icon": [
|
|
4
|
-
"
|
|
4
|
+
"icons/serialterminal.icns"
|
|
5
5
|
],
|
|
6
6
|
"active": true,
|
|
7
7
|
"targets": [
|
|
8
|
-
"
|
|
8
|
+
"dmg"
|
|
9
9
|
],
|
|
10
10
|
"resources": [
|
|
11
|
-
"icons/
|
|
11
|
+
"icons/serialterminal.icns"
|
|
12
12
|
]
|
|
13
13
|
}
|
|
14
14
|
}
|