pake-cli 3.2.16 → 3.2.17

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/dist/cli.js CHANGED
@@ -22,11 +22,12 @@ import sharp from 'sharp';
22
22
  import * as psl from 'psl';
23
23
 
24
24
  var name = "pake-cli";
25
- var version = "3.2.16";
25
+ var version = "3.2.17";
26
26
  var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
27
27
  var engines = {
28
- node: ">=16.0.0"
28
+ node: ">=18.0.0"
29
29
  };
30
+ var packageManager = "pnpm@10.15.0";
30
31
  var bin = {
31
32
  pake: "./dist/cli.js"
32
33
  };
@@ -51,19 +52,20 @@ var files = [
51
52
  "src-tauri"
52
53
  ];
53
54
  var scripts = {
54
- start: "npm run dev",
55
- dev: "npm run tauri dev",
56
- build: "npm run tauri build --",
57
- "build:debug": "npm run tauri build -- --debug",
58
- "build:mac": "npm run tauri build -- --target universal-apple-darwin",
55
+ start: "pnpm run dev",
56
+ dev: "pnpm run tauri dev",
57
+ build: "tauri build",
58
+ "build:debug": "tauri build --debug",
59
+ "build:mac": "tauri build --target universal-apple-darwin",
59
60
  "build:config": "chmod +x scripts/configure-tauri.mjs && node scripts/configure-tauri.mjs",
60
61
  analyze: "cd src-tauri && cargo bloat --release --crates",
61
62
  tauri: "tauri",
62
63
  cli: "cross-env NODE_ENV=development rollup -c -w",
63
64
  "cli:build": "cross-env NODE_ENV=production rollup -c",
64
- test: "npm run cli:build && cross-env PAKE_CREATE_APP=1 node tests/index.js",
65
+ test: "pnpm run cli:build && cross-env PAKE_CREATE_APP=1 node tests/index.js",
65
66
  format: "prettier --write . --ignore-unknown && find tests -name '*.js' -exec sed -i '' 's/[[:space:]]*$//' {} \\; && cd src-tauri && cargo fmt --verbose",
66
- prepublishOnly: "npm run cli:build"
67
+ "format:check": "prettier --check . --ignore-unknown",
68
+ prepublishOnly: "pnpm run cli:build"
67
69
  };
68
70
  var type = "module";
69
71
  var exports = "./dist/cli.js";
@@ -111,6 +113,7 @@ var packageJson = {
111
113
  version: version,
112
114
  description: description,
113
115
  engines: engines,
116
+ packageManager: packageManager,
114
117
  bin: bin,
115
118
  repository: repository,
116
119
  author: author,
@@ -344,7 +347,7 @@ async function mergeConfig(url, options, tauriConf) {
344
347
  await fsExtra.copy(sourcePath, destPath);
345
348
  }
346
349
  }));
347
- const { width, height, fullscreen, hideTitleBar, alwaysOnTop, appVersion, darkMode, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, proxyUrl, installerLanguage, hideOnClose, incognito, title, } = options;
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;
348
351
  const { platform } = process;
349
352
  // Set Windows parameters.
350
353
  const tauriConfWindowOptions = {
@@ -360,6 +363,7 @@ async function mergeConfig(url, options, tauriConf) {
360
363
  hide_on_close: hideOnClose,
361
364
  incognito: incognito,
362
365
  title: title || null,
366
+ enable_wasm: wasm,
363
367
  };
364
368
  Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
365
369
  tauriConf.productName = name;
@@ -553,6 +557,15 @@ StartupNotify=true
553
557
  await fsExtra.writeFile(injectFilePath, '');
554
558
  }
555
559
  tauriConf.pake.proxy_url = proxyUrl || '';
560
+ // Configure WASM support with required HTTP headers
561
+ if (wasm) {
562
+ tauriConf.app.security = {
563
+ headers: {
564
+ 'Cross-Origin-Opener-Policy': 'same-origin',
565
+ 'Cross-Origin-Embedder-Policy': 'require-corp',
566
+ },
567
+ };
568
+ }
556
569
  // Save config file.
557
570
  const platformConfigPaths = {
558
571
  win32: 'tauri.windows.conf.json',
@@ -589,6 +602,32 @@ class BaseBuilder {
589
602
  getBuildTimeout() {
590
603
  return 900000; // 15 minutes for all builds
591
604
  }
605
+ async detectPackageManager() {
606
+ // 使用缓存避免重复检测
607
+ if (BaseBuilder.packageManagerCache) {
608
+ return BaseBuilder.packageManagerCache;
609
+ }
610
+ const { execa } = await import('execa');
611
+ // 优先使用pnpm(如果可用)
612
+ try {
613
+ await execa('pnpm', ['--version'], { stdio: 'ignore' });
614
+ logger.info('✺ Using pnpm for package management.');
615
+ BaseBuilder.packageManagerCache = 'pnpm';
616
+ return 'pnpm';
617
+ }
618
+ catch {
619
+ // pnpm不可用,回退到npm
620
+ try {
621
+ await execa('npm', ['--version'], { stdio: 'ignore' });
622
+ logger.info('✺ pnpm not available, using npm for package management.');
623
+ BaseBuilder.packageManagerCache = 'npm';
624
+ return 'npm';
625
+ }
626
+ catch {
627
+ throw new Error('Neither pnpm nor npm is available. Please install a package manager.');
628
+ }
629
+ }
630
+ }
592
631
  async prepare() {
593
632
  const tauriSrcPath = path.join(npmDirectory, 'src-tauri');
594
633
  const tauriTargetPath = path.join(tauriSrcPath, 'target');
@@ -616,22 +655,23 @@ class BaseBuilder {
616
655
  const rustProjectDir = path.join(tauriSrcPath, '.cargo');
617
656
  const projectConf = path.join(rustProjectDir, 'config.toml');
618
657
  await fsExtra.ensureDir(rustProjectDir);
619
- // 统一使用npm,简单可靠
620
- const packageManager = 'npm';
658
+ // 智能检测可用的包管理器
659
+ const packageManager = await this.detectPackageManager();
621
660
  const registryOption = isChina
622
661
  ? ' --registry=https://registry.npmmirror.com'
623
662
  : '';
624
- const legacyPeerDeps = ' --legacy-peer-deps'; // 解决dependency conflicts
663
+ // 根据包管理器类型设置依赖冲突解决选项
664
+ const peerDepsOption = packageManager === 'npm' ? ' --legacy-peer-deps' : '';
625
665
  const timeout = this.getInstallTimeout();
626
666
  const buildEnv = this.getBuildEnvironment();
627
667
  if (isChina) {
628
- logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
668
+ logger.info(`✺ Located in China, using ${packageManager}/rsProxy CN mirror.`);
629
669
  const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
630
670
  await fsExtra.copy(projectCnConf, projectConf);
631
- await shellExec(`cd "${npmDirectory}" && ${packageManager} install${registryOption}${legacyPeerDeps} --silent`, timeout, buildEnv);
671
+ await shellExec(`cd "${npmDirectory}" && ${packageManager} install${registryOption}${peerDepsOption} --silent`, timeout, buildEnv);
632
672
  }
633
673
  else {
634
- await shellExec(`cd "${npmDirectory}" && ${packageManager} install${legacyPeerDeps} --silent`, timeout, buildEnv);
674
+ await shellExec(`cd "${npmDirectory}" && ${packageManager} install${peerDepsOption} --silent`, timeout, buildEnv);
635
675
  }
636
676
  spinner.succeed(chalk.green('Package installed!'));
637
677
  if (!tauriTargetPathExists) {
@@ -647,15 +687,17 @@ class BaseBuilder {
647
687
  async buildAndCopy(url, target) {
648
688
  const { name } = this.options;
649
689
  await mergeConfig(url, this.options, tauriConfig);
690
+ // Detect available package manager
691
+ const packageManager = await this.detectPackageManager();
650
692
  // Build app
651
693
  const buildSpinner = getSpinner('Building app...');
652
- // Let spinner run for a moment so user can see it, then stop before npm command
694
+ // Let spinner run for a moment so user can see it, then stop before package manager command
653
695
  await new Promise((resolve) => setTimeout(resolve, 500));
654
696
  buildSpinner.stop();
655
697
  // Show static message to keep the status visible
656
698
  logger.warn('✸ Building app...');
657
699
  const buildEnv = this.getBuildEnvironment();
658
- await shellExec(`cd "${npmDirectory}" && ${this.getBuildCommand()}`, this.getBuildTimeout(), buildEnv);
700
+ await shellExec(`cd "${npmDirectory}" && ${this.getBuildCommand(packageManager)}`, this.getBuildTimeout(), buildEnv);
659
701
  // Copy app
660
702
  const fileName = this.getFileName();
661
703
  const fileType = this.getFileType(target);
@@ -669,18 +711,48 @@ class BaseBuilder {
669
711
  getFileType(target) {
670
712
  return target;
671
713
  }
672
- getBuildCommand() {
714
+ /**
715
+ * 解析目标架构
716
+ */
717
+ resolveTargetArch(requestedArch) {
718
+ if (requestedArch === 'auto' || !requestedArch) {
719
+ return process.arch;
720
+ }
721
+ return requestedArch;
722
+ }
723
+ /**
724
+ * 获取Tauri构建目标
725
+ */
726
+ getTauriTarget(arch, platform = process.platform) {
727
+ const platformMappings = BaseBuilder.ARCH_MAPPINGS[platform];
728
+ if (!platformMappings)
729
+ return null;
730
+ return platformMappings[arch] || null;
731
+ }
732
+ /**
733
+ * 获取架构显示名称(用于文件名)
734
+ */
735
+ getArchDisplayName(arch) {
736
+ return BaseBuilder.ARCH_DISPLAY_NAMES[arch] || arch;
737
+ }
738
+ /**
739
+ * 构建基础构建命令
740
+ */
741
+ buildBaseCommand(packageManager, configPath, target) {
673
742
  const baseCommand = this.options.debug
674
- ? 'npm run build:debug'
675
- : 'npm run build';
676
- // Use temporary config directory to avoid modifying source files
677
- const configPath = path.join(npmDirectory, 'src-tauri', '.pake', 'tauri.conf.json');
678
- let fullCommand = `${baseCommand} -- -c "${configPath}"`;
679
- // For macOS, use app bundles by default unless DMG is explicitly requested
680
- if (IS_MAC && this.options.targets === 'app') {
681
- fullCommand += ' --bundles app';
743
+ ? `${packageManager} run build:debug`
744
+ : `${packageManager} run build`;
745
+ const argSeparator = packageManager === 'npm' ? ' --' : '';
746
+ let fullCommand = `${baseCommand}${argSeparator} -c "${configPath}"`;
747
+ if (target) {
748
+ fullCommand += ` --target ${target}`;
682
749
  }
683
- // Add features
750
+ return fullCommand;
751
+ }
752
+ /**
753
+ * 获取构建特性列表
754
+ */
755
+ getBuildFeatures() {
684
756
  const features = ['cli-build'];
685
757
  // Add macos-proxy feature for modern macOS (Darwin 23+ = macOS 14+)
686
758
  if (IS_MAC) {
@@ -689,6 +761,18 @@ class BaseBuilder {
689
761
  features.push('macos-proxy');
690
762
  }
691
763
  }
764
+ return features;
765
+ }
766
+ getBuildCommand(packageManager = 'pnpm') {
767
+ // Use temporary config directory to avoid modifying source files
768
+ const configPath = path.join(npmDirectory, 'src-tauri', '.pake', 'tauri.conf.json');
769
+ let fullCommand = this.buildBaseCommand(packageManager, configPath);
770
+ // For macOS, use app bundles by default unless DMG is explicitly requested
771
+ if (IS_MAC && this.options.targets === 'app') {
772
+ fullCommand += ' --bundles app';
773
+ }
774
+ // Add features
775
+ const features = this.getBuildFeatures();
692
776
  if (features.length > 0) {
693
777
  fullCommand += ` --features ${features.join(',')}`;
694
778
  }
@@ -715,12 +799,40 @@ class BaseBuilder {
715
799
  return path.join(npmDirectory, this.getBasePath(), bundleDir, `${fileName}.${fileType}`);
716
800
  }
717
801
  }
802
+ BaseBuilder.packageManagerCache = null;
803
+ // 架构映射配置
804
+ BaseBuilder.ARCH_MAPPINGS = {
805
+ darwin: {
806
+ arm64: 'aarch64-apple-darwin',
807
+ x64: 'x86_64-apple-darwin',
808
+ universal: 'universal-apple-darwin',
809
+ },
810
+ win32: {
811
+ arm64: 'aarch64-pc-windows-msvc',
812
+ x64: 'x86_64-pc-windows-msvc',
813
+ },
814
+ linux: {
815
+ arm64: 'aarch64-unknown-linux-gnu',
816
+ x64: 'x86_64-unknown-linux-gnu',
817
+ },
818
+ };
819
+ // 架构名称映射(用于文件名生成)
820
+ BaseBuilder.ARCH_DISPLAY_NAMES = {
821
+ arm64: 'aarch64',
822
+ x64: 'x64',
823
+ universal: 'universal',
824
+ };
718
825
 
719
826
  class MacBuilder extends BaseBuilder {
720
827
  constructor(options) {
721
828
  super(options);
722
829
  // Store the original targets value for architecture selection
723
- this.buildArch = options.targets || 'auto';
830
+ // For macOS, targets can be architecture names or format names
831
+ // Filter out non-architecture values
832
+ const validArchs = ['intel', 'apple', 'universal', 'auto', 'x64', 'arm64'];
833
+ this.buildArch = validArchs.includes(options.targets || '')
834
+ ? options.targets
835
+ : 'auto';
724
836
  // Use DMG by default for distribution
725
837
  // Only create app bundles for testing to avoid user interaction
726
838
  if (process.env.PAKE_CREATE_APP === '1') {
@@ -751,83 +863,42 @@ class MacBuilder extends BaseBuilder {
751
863
  }
752
864
  else {
753
865
  // Auto-detect based on current architecture
754
- arch = process.arch === 'arm64' ? 'aarch64' : process.arch;
866
+ arch = this.getArchDisplayName(this.resolveTargetArch(this.buildArch));
755
867
  }
756
868
  return `${name}_${tauriConfig.version}_${arch}`;
757
869
  }
758
- getBuildCommand() {
759
- // Determine if we need universal build
760
- const needsUniversal = this.buildArch === 'universal' || this.options.multiArch;
761
- if (needsUniversal) {
762
- const baseCommand = this.options.debug
763
- ? 'npm run tauri build -- --debug'
764
- : 'npm run tauri build --';
765
- // Use temporary config directory to avoid modifying source files
766
- const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
767
- let fullCommand = `${baseCommand} --target universal-apple-darwin -c "${configPath}"`;
768
- // Add features
769
- const features = ['cli-build'];
770
- // Add macos-proxy feature for modern macOS (Darwin 23+ = macOS 14+)
771
- const macOSVersion = this.getMacOSMajorVersion();
772
- if (macOSVersion >= 23) {
773
- features.push('macos-proxy');
774
- }
775
- if (features.length > 0) {
776
- fullCommand += ` --features ${features.join(',')}`;
777
- }
778
- return fullCommand;
870
+ getActualArch() {
871
+ if (this.buildArch === 'universal' || this.options.multiArch) {
872
+ return 'universal';
779
873
  }
780
874
  else if (this.buildArch === 'apple') {
781
- // Build for Apple Silicon only
782
- const baseCommand = this.options.debug
783
- ? 'npm run tauri build -- --debug'
784
- : 'npm run tauri build --';
785
- const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
786
- let fullCommand = `${baseCommand} --target aarch64-apple-darwin -c "${configPath}"`;
787
- // Add features
788
- const features = ['cli-build'];
789
- const macOSVersion = this.getMacOSMajorVersion();
790
- if (macOSVersion >= 23) {
791
- features.push('macos-proxy');
792
- }
793
- if (features.length > 0) {
794
- fullCommand += ` --features ${features.join(',')}`;
795
- }
796
- return fullCommand;
875
+ return 'arm64';
797
876
  }
798
877
  else if (this.buildArch === 'intel') {
799
- // Build for Intel only
800
- const baseCommand = this.options.debug
801
- ? 'npm run tauri build -- --debug'
802
- : 'npm run tauri build --';
803
- const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
804
- let fullCommand = `${baseCommand} --target x86_64-apple-darwin -c "${configPath}"`;
805
- // Add features
806
- const features = ['cli-build'];
807
- const macOSVersion = this.getMacOSMajorVersion();
808
- if (macOSVersion >= 23) {
809
- features.push('macos-proxy');
810
- }
811
- if (features.length > 0) {
812
- fullCommand += ` --features ${features.join(',')}`;
813
- }
814
- return fullCommand;
878
+ return 'x64';
815
879
  }
816
- return super.getBuildCommand();
880
+ return this.resolveTargetArch(this.buildArch);
817
881
  }
818
- getBasePath() {
819
- const needsUniversal = this.buildArch === 'universal' || this.options.multiArch;
820
- const basePath = this.options.debug ? 'debug' : 'release';
821
- if (needsUniversal) {
822
- return `src-tauri/target/universal-apple-darwin/${basePath}/bundle`;
823
- }
824
- else if (this.buildArch === 'apple') {
825
- return `src-tauri/target/aarch64-apple-darwin/${basePath}/bundle`;
882
+ getBuildCommand(packageManager = 'pnpm') {
883
+ const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
884
+ const actualArch = this.getActualArch();
885
+ const buildTarget = this.getTauriTarget(actualArch, 'darwin');
886
+ if (!buildTarget) {
887
+ throw new Error(`Unsupported architecture: ${actualArch} for macOS`);
826
888
  }
827
- else if (this.buildArch === 'intel') {
828
- return `src-tauri/target/x86_64-apple-darwin/${basePath}/bundle`;
889
+ let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
890
+ // Add features
891
+ const features = this.getBuildFeatures();
892
+ if (features.length > 0) {
893
+ fullCommand += ` --features ${features.join(',')}`;
829
894
  }
830
- return super.getBasePath();
895
+ return fullCommand;
896
+ }
897
+ getBasePath() {
898
+ const basePath = this.options.debug ? 'debug' : 'release';
899
+ const actualArch = this.getActualArch();
900
+ const target = this.getTauriTarget(actualArch, 'darwin');
901
+ return `src-tauri/target/${target}/${basePath}/bundle`;
831
902
  }
832
903
  }
833
904
 
@@ -835,57 +906,29 @@ class WinBuilder extends BaseBuilder {
835
906
  constructor(options) {
836
907
  super(options);
837
908
  this.buildFormat = 'msi';
838
- // Store the original targets value for architecture selection
839
- this.buildArch = options.targets || 'auto';
840
- // Set targets to msi format for Tauri
909
+ // For Windows, targets can be architecture names or format names
910
+ // Filter out non-architecture values
911
+ const validArchs = ['x64', 'arm64', 'auto'];
912
+ this.buildArch = validArchs.includes(options.targets || '')
913
+ ? this.resolveTargetArch(options.targets)
914
+ : this.resolveTargetArch('auto');
841
915
  this.options.targets = this.buildFormat;
842
916
  }
843
917
  getFileName() {
844
918
  const { name } = this.options;
845
919
  const language = tauriConfig.bundle.windows.wix.language[0];
846
- // Determine architecture name based on explicit targets option or auto-detect
847
- let targetArch;
848
- if (this.buildArch === 'arm64') {
849
- targetArch = 'aarch64';
850
- }
851
- else if (this.buildArch === 'x64') {
852
- targetArch = 'x64';
853
- }
854
- else {
855
- // Auto-detect based on current architecture if no explicit target
856
- const archMap = {
857
- x64: 'x64',
858
- arm64: 'aarch64',
859
- };
860
- targetArch = archMap[process.arch] || process.arch;
861
- }
920
+ const targetArch = this.getArchDisplayName(this.buildArch);
862
921
  return `${name}_${tauriConfig.version}_${targetArch}_${language}`;
863
922
  }
864
- getBuildCommand() {
865
- const baseCommand = this.options.debug
866
- ? 'npm run build:debug'
867
- : 'npm run build';
868
- // Use temporary config directory to avoid modifying source files
923
+ getBuildCommand(packageManager = 'pnpm') {
869
924
  const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
870
- let fullCommand = `${baseCommand} -- -c "${configPath}"`;
871
- // Determine build target based on explicit targets option or auto-detect
872
- let buildTarget;
873
- if (this.buildArch === 'arm64') {
874
- buildTarget = 'aarch64-pc-windows-msvc';
925
+ const buildTarget = this.getTauriTarget(this.buildArch, 'win32');
926
+ if (!buildTarget) {
927
+ throw new Error(`Unsupported architecture: ${this.buildArch} for Windows`);
875
928
  }
876
- else if (this.buildArch === 'x64') {
877
- buildTarget = 'x86_64-pc-windows-msvc';
878
- }
879
- else {
880
- // Auto-detect based on current architecture if no explicit target
881
- buildTarget =
882
- process.arch === 'arm64'
883
- ? 'aarch64-pc-windows-msvc'
884
- : 'x86_64-pc-windows-msvc';
885
- }
886
- fullCommand += ` --target ${buildTarget}`;
929
+ let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
887
930
  // Add features
888
- const features = ['cli-build'];
931
+ const features = this.getBuildFeatures();
889
932
  if (features.length > 0) {
890
933
  fullCommand += ` --features ${features.join(',')}`;
891
934
  }
@@ -893,21 +936,7 @@ class WinBuilder extends BaseBuilder {
893
936
  }
894
937
  getBasePath() {
895
938
  const basePath = this.options.debug ? 'debug' : 'release';
896
- // Determine target based on explicit targets option or auto-detect
897
- let target;
898
- if (this.buildArch === 'arm64') {
899
- target = 'aarch64-pc-windows-msvc';
900
- }
901
- else if (this.buildArch === 'x64') {
902
- target = 'x86_64-pc-windows-msvc';
903
- }
904
- else {
905
- // Auto-detect based on current architecture if no explicit target
906
- target =
907
- process.arch === 'arm64'
908
- ? 'aarch64-pc-windows-msvc'
909
- : 'x86_64-pc-windows-msvc';
910
- }
939
+ const target = this.getTauriTarget(this.buildArch, 'win32');
911
940
  return `src-tauri/target/${target}/${basePath}/bundle/`;
912
941
  }
913
942
  }
@@ -923,7 +952,7 @@ class LinuxBuilder extends BaseBuilder {
923
952
  }
924
953
  else {
925
954
  this.buildFormat = target;
926
- this.buildArch = 'auto';
955
+ this.buildArch = this.resolveTargetArch('auto');
927
956
  }
928
957
  // Set targets to format for Tauri
929
958
  this.options.targets = this.buildFormat;
@@ -931,15 +960,17 @@ class LinuxBuilder extends BaseBuilder {
931
960
  getFileName() {
932
961
  const { name, targets } = this.options;
933
962
  const version = tauriConfig.version;
934
- // Determine architecture based on explicit target or auto-detect
963
+ // Determine architecture display name
935
964
  let arch;
936
965
  if (this.buildArch === 'arm64') {
937
966
  arch = targets === 'rpm' || targets === 'appimage' ? 'aarch64' : 'arm64';
938
967
  }
939
968
  else {
940
969
  // Auto-detect or default to current architecture
941
- arch = process.arch === 'x64' ? 'amd64' : process.arch;
942
- if (arch === 'arm64' && (targets === 'rpm' || targets === 'appimage')) {
970
+ const resolvedArch = this.buildArch === 'x64' ? 'amd64' : this.buildArch;
971
+ arch = resolvedArch;
972
+ if (resolvedArch === 'arm64' &&
973
+ (targets === 'rpm' || targets === 'appimage')) {
943
974
  arch = 'aarch64';
944
975
  }
945
976
  }
@@ -958,19 +989,15 @@ class LinuxBuilder extends BaseBuilder {
958
989
  }
959
990
  }
960
991
  }
961
- getBuildCommand() {
962
- const baseCommand = this.options.debug
963
- ? 'npm run build:debug'
964
- : 'npm run build';
965
- // Use temporary config directory to avoid modifying source files
992
+ getBuildCommand(packageManager = 'pnpm') {
966
993
  const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
967
- let fullCommand = `${baseCommand} -- -c "${configPath}"`;
968
- // Add ARM64 target if explicitly specified
969
- if (this.buildArch === 'arm64') {
970
- fullCommand += ' --target aarch64-unknown-linux-gnu';
971
- }
994
+ // Only add target if it's ARM64
995
+ const buildTarget = this.buildArch === 'arm64'
996
+ ? this.getTauriTarget(this.buildArch, 'linux')
997
+ : undefined;
998
+ let fullCommand = this.buildBaseCommand(packageManager, configPath, buildTarget);
972
999
  // Add features
973
- const features = ['cli-build'];
1000
+ const features = this.getBuildFeatures();
974
1001
  if (features.length > 0) {
975
1002
  fullCommand += ` --features ${features.join(',')}`;
976
1003
  }
@@ -979,7 +1006,8 @@ class LinuxBuilder extends BaseBuilder {
979
1006
  getBasePath() {
980
1007
  const basePath = this.options.debug ? 'debug' : 'release';
981
1008
  if (this.buildArch === 'arm64') {
982
- return `src-tauri/target/aarch64-unknown-linux-gnu/${basePath}/bundle/`;
1009
+ const target = this.getTauriTarget(this.buildArch, 'linux');
1010
+ return `src-tauri/target/${target}/${basePath}/bundle/`;
983
1011
  }
984
1012
  return super.getBasePath();
985
1013
  }
@@ -1030,6 +1058,7 @@ const DEFAULT_PAKE_OPTIONS = {
1030
1058
  installerLanguage: 'en-US',
1031
1059
  hideOnClose: true,
1032
1060
  incognito: false,
1061
+ wasm: false,
1033
1062
  };
1034
1063
 
1035
1064
  async function checkUpdateTips() {
@@ -1481,6 +1510,9 @@ program
1481
1510
  .addOption(new Option('--incognito', 'Launch app in incognito/private mode')
1482
1511
  .default(DEFAULT_PAKE_OPTIONS.incognito)
1483
1512
  .hideHelp())
1513
+ .addOption(new Option('--wasm', 'Enable WebAssembly support (Flutter Web, etc.)')
1514
+ .default(DEFAULT_PAKE_OPTIONS.wasm)
1515
+ .hideHelp())
1484
1516
  .addOption(new Option('--installer-language <string>', 'Installer language')
1485
1517
  .default(DEFAULT_PAKE_OPTIONS.installerLanguage)
1486
1518
  .hideHelp())
@@ -1488,13 +1520,10 @@ program
1488
1520
  .action(async (url, options) => {
1489
1521
  await checkUpdateTips();
1490
1522
  if (!url) {
1491
- program.outputHelp((str) => {
1492
- return str
1493
- .split('\n')
1494
- .filter((line) => !/((-h,|--help)|((-v|-V),|--version))\s+.+$/.test(line))
1495
- .join('\n');
1523
+ program.help({
1524
+ error: false,
1496
1525
  });
1497
- process.exit(0);
1526
+ return;
1498
1527
  }
1499
1528
  log.setDefaultLevel('info');
1500
1529
  if (options.debug) {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "3.2.16",
3
+ "version": "3.2.17",
4
4
  "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
5
5
  "engines": {
6
- "node": ">=16.0.0"
6
+ "node": ">=18.0.0"
7
7
  },
8
+ "packageManager": "pnpm@10.15.0",
8
9
  "bin": {
9
10
  "pake": "./dist/cli.js"
10
11
  },
@@ -29,19 +30,20 @@
29
30
  "src-tauri"
30
31
  ],
31
32
  "scripts": {
32
- "start": "npm run dev",
33
- "dev": "npm run tauri dev",
34
- "build": "npm run tauri build --",
35
- "build:debug": "npm run tauri build -- --debug",
36
- "build:mac": "npm run tauri build -- --target universal-apple-darwin",
33
+ "start": "pnpm run dev",
34
+ "dev": "pnpm run tauri dev",
35
+ "build": "tauri build",
36
+ "build:debug": "tauri build --debug",
37
+ "build:mac": "tauri build --target universal-apple-darwin",
37
38
  "build:config": "chmod +x scripts/configure-tauri.mjs && node scripts/configure-tauri.mjs",
38
39
  "analyze": "cd src-tauri && cargo bloat --release --crates",
39
40
  "tauri": "tauri",
40
41
  "cli": "cross-env NODE_ENV=development rollup -c -w",
41
42
  "cli:build": "cross-env NODE_ENV=production rollup -c",
42
- "test": "npm run cli:build && cross-env PAKE_CREATE_APP=1 node tests/index.js",
43
+ "test": "pnpm run cli:build && cross-env PAKE_CREATE_APP=1 node tests/index.js",
43
44
  "format": "prettier --write . --ignore-unknown && find tests -name '*.js' -exec sed -i '' 's/[[:space:]]*$//' {} \\; && cd src-tauri && cargo fmt --verbose",
44
- "prepublishOnly": "npm run cli:build"
45
+ "format:check": "prettier --check . --ignore-unknown",
46
+ "prepublishOnly": "pnpm run cli:build"
45
47
  },
46
48
  "type": "module",
47
49
  "exports": "./dist/cli.js",
@@ -1,14 +1,3 @@
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
-
12
1
  [env]
13
2
  # Fix for macOS 26 Beta compatibility issues
14
3
  # Forces use of compatible SDK when building on macOS 26 Beta