pake-cli 3.16.2 โ†’ 3.16.3

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
@@ -19,7 +19,7 @@ import * as psl from 'psl';
19
19
  import { InvalidArgumentError, program as program$1, Option } from 'commander';
20
20
 
21
21
  var name = "pake-cli";
22
- var version = "3.16.2";
22
+ var version = "3.16.3";
23
23
  var description = "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with one command. ๐Ÿคฑ๐Ÿป ไธ€้”ฎๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆ่ฝป้‡ๆกŒ้ขๅบ”็”จใ€‚";
24
24
  var engines = {
25
25
  node: ">=20.9.0"
@@ -538,15 +538,8 @@ async function acquireBuildCache(targetDirectory) {
538
538
  async function enterBuildWorkspace() {
539
539
  const previousTarget = process.env.CARGO_TARGET_DIR;
540
540
  const targetDirectory = path.resolve(packageDirectory, previousTarget || 'src-tauri/target');
541
- const release = await acquireBuildCache(targetDirectory);
542
- let directory;
543
- try {
544
- directory = await createBuildWorkspace(packageDirectory);
545
- }
546
- catch (error) {
547
- await release();
548
- throw error;
549
- }
541
+ const directory = await createBuildWorkspace(packageDirectory);
542
+ let release;
550
543
  setBuildDirectory(directory);
551
544
  process.env.CARGO_TARGET_DIR = targetDirectory;
552
545
  const leave = async () => {
@@ -567,7 +560,7 @@ async function enterBuildWorkspace() {
567
560
  }
568
561
  finally {
569
562
  try {
570
- await release();
563
+ await release?.();
571
564
  }
572
565
  catch (error) {
573
566
  logger.warn(`Could not release the compilation cache lock: ${String(error)}`);
@@ -578,7 +571,11 @@ async function enterBuildWorkspace() {
578
571
  await leave();
579
572
  throwIfBuildCancelled();
580
573
  }
581
- return leave;
574
+ return Object.assign(leave, {
575
+ async lockCache() {
576
+ release = await acquireBuildCache(targetDirectory);
577
+ },
578
+ });
582
579
  }
583
580
 
584
581
  async function terminateBuildTree(pid) {
@@ -1663,9 +1660,14 @@ class BaseBuilder {
1663
1660
  await shellExec({ executable: packageManager, args });
1664
1661
  }
1665
1662
  async buildAndCopy(url, target, logSuccess = true) {
1666
- const { name = 'pake-app' } = this.options;
1663
+ await this.prepareBuild(url);
1664
+ await this.runBuildCommand(this.getBuildCommand(await detectPackageManager()), target);
1665
+ await this.copyBuildArtifacts(target, logSuccess);
1666
+ }
1667
+ async prepareBuild(url) {
1667
1668
  await mergeConfig(url, this.options, structuredClone(tauriConfig));
1668
- const packageManager = await detectPackageManager();
1669
+ }
1670
+ async runBuildCommand(buildCommand, target) {
1669
1671
  // Build app
1670
1672
  const buildSpinner = getSpinner('Building app...');
1671
1673
  buildSpinner.stop();
@@ -1684,7 +1686,6 @@ class BaseBuilder {
1684
1686
  if (isLinuxAppImage && !buildEnv.NO_STRIP && this.options.debug) {
1685
1687
  logger.warn('โš  AppImage strip step can fail on glibc 2.38+; Pake will auto-retry with NO_STRIP=1.');
1686
1688
  }
1687
- const buildCommand = this.getBuildCommand(packageManager);
1688
1689
  const buildTimeout = getBuildTimeout();
1689
1690
  try {
1690
1691
  await shellExec(buildCommand, buildTimeout, resolveExecEnv());
@@ -1711,6 +1712,9 @@ class BaseBuilder {
1711
1712
  throw retryError;
1712
1713
  }
1713
1714
  }
1715
+ }
1716
+ async copyBuildArtifacts(target, logSuccess = true) {
1717
+ const { name = 'pake-app' } = this.options;
1714
1718
  // With --no-bundle there is no installer to copy; surface the raw
1715
1719
  // executable the build produced instead.
1716
1720
  if (this.options.bundle === false) {
@@ -2083,6 +2087,7 @@ class LinuxBuilder extends BaseBuilder {
2083
2087
  constructor(options) {
2084
2088
  super(options);
2085
2089
  this.currentBuildType = '';
2090
+ this.compiled = false;
2086
2091
  const target = options.targets || 'deb';
2087
2092
  if (target.includes('-arm64')) {
2088
2093
  this.buildFormat = target.replace('-arm64', '');
@@ -2118,6 +2123,8 @@ class LinuxBuilder extends BaseBuilder {
2118
2123
  return `${name}_${version}_${arch}`;
2119
2124
  }
2120
2125
  async build(url) {
2126
+ this.compiled = false;
2127
+ this.currentBuildType = '';
2121
2128
  // --no-bundle: build the executable once with no per-format packaging loop.
2122
2129
  if (this.options.bundle === false) {
2123
2130
  await this.buildAndCopy(url, 'deb');
@@ -2128,6 +2135,13 @@ class LinuxBuilder extends BaseBuilder {
2128
2135
  throw new Error(`No valid Linux target in "${this.options.targets}". Valid targets: ${LINUX_TARGET_TYPES.join(', ')}.`);
2129
2136
  }
2130
2137
  const useTemporaryDebForZst = needsTemporaryDebForZst(targets);
2138
+ if (targets.length > 1) {
2139
+ await this.prepareBuild(url);
2140
+ const command = this.getBuildCommand(await detectPackageManager());
2141
+ command.args.push('--no-bundle');
2142
+ await this.runBuildCommand(command, 'compile');
2143
+ this.compiled = true;
2144
+ }
2131
2145
  // With a single explicit target, fail fast. With multiple targets (the
2132
2146
  // distro-aware default, or an explicit comma list) keep building the rest
2133
2147
  // when one fails, so a usable installer is still produced, e.g. AppImage
@@ -2293,7 +2307,24 @@ post_remove() {
2293
2307
  // Override buildAndCopy to ensure currentBuildType is synced if called directly, though the loop above handles it most of the time.
2294
2308
  async buildAndCopy(url, target, logSuccess = true) {
2295
2309
  this.currentBuildType = target;
2296
- await super.buildAndCopy(url, target, logSuccess);
2310
+ if (!this.compiled) {
2311
+ await super.buildAndCopy(url, target, logSuccess);
2312
+ return;
2313
+ }
2314
+ const packageManager = await detectPackageManager();
2315
+ const args = ['run', 'tauri'];
2316
+ if (packageManager === 'npm')
2317
+ args.push('--');
2318
+ args.push('bundle', '--config', path.join('src-tauri', '.pake', 'tauri.conf.json'));
2319
+ args.push('--bundles', target, '--features', this.getBuildFeatures().join(','));
2320
+ if (this.options.debug)
2321
+ args.push('--debug');
2322
+ if (this.options.debug || target === 'appimage' || process.env.PAKE_VERBOSE)
2323
+ args.push('--verbose');
2324
+ if (this.buildArch === 'arm64')
2325
+ args.push('--target', this.getTauriTarget('arm64', 'linux'));
2326
+ await this.runBuildCommand({ executable: packageManager, args }, target);
2327
+ await this.copyBuildArtifacts(target, logSuccess);
2297
2328
  }
2298
2329
  getBuildCommand(packageManager = 'pnpm') {
2299
2330
  const configPath = path.join('src-tauri', '.pake', 'tauri.conf.json');
@@ -3847,7 +3878,8 @@ program.action(async (urlArg, options) => {
3847
3878
  }
3848
3879
  endCancellation = beginBuildCancellation();
3849
3880
  phase = 'prepare';
3850
- leaveWorkspace = await enterBuildWorkspace();
3881
+ const workspace = await enterBuildWorkspace();
3882
+ leaveWorkspace = workspace;
3851
3883
  phase = 'input';
3852
3884
  const appOptions = await handleOptions(options, url);
3853
3885
  throwIfBuildCancelled();
@@ -3857,6 +3889,8 @@ program.action(async (urlArg, options) => {
3857
3889
  await builder.prepare();
3858
3890
  throwIfBuildCancelled();
3859
3891
  phase = 'build';
3892
+ await workspace.lockCache();
3893
+ throwIfBuildCancelled();
3860
3894
  await builder.build(url);
3861
3895
  throwIfBuildCancelled();
3862
3896
  await leaveWorkspace();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "3.16.2",
3
+ "version": "3.16.3",
4
4
  "description": "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with one command. ๐Ÿคฑ๐Ÿป ไธ€้”ฎๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆ่ฝป้‡ๆกŒ้ขๅบ”็”จใ€‚",
5
5
  "engines": {
6
6
  "node": ">=20.9.0"
@@ -2564,7 +2564,7 @@ dependencies = [
2564
2564
 
2565
2565
  [[package]]
2566
2566
  name = "pake"
2567
- version = "3.16.2"
2567
+ version = "3.16.3"
2568
2568
  dependencies = [
2569
2569
  "block2",
2570
2570
  "dispatch",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pake"
3
- version = "3.16.2"
3
+ version = "3.16.3"
4
4
  description = "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with Rust."
5
5
  authors = ["Tw93"]
6
6
  license = "GPL-3.0-or-later"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "productName": "Weekly",
3
3
  "identifier": "com.pake.weekly",
4
- "version": "3.16.2",
4
+ "version": "3.16.3",
5
5
  "app": {
6
6
  "withGlobalTauri": true,
7
7
  "trayIcon": {