@choochmeque/tauri-windows-bundle 0.1.1 → 0.1.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
@@ -544,6 +544,33 @@ function copyBundledResources(projectRoot, appxDir, tauriConfig) {
544
544
  }
545
545
 
546
546
  const execPromise = promisify(exec);
547
+ const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
548
+ class Spinner {
549
+ frameIndex = 0;
550
+ intervalId = null;
551
+ message;
552
+ constructor(message) {
553
+ this.message = message;
554
+ }
555
+ start() {
556
+ this.intervalId = setInterval(() => {
557
+ const frame = SPINNER_FRAMES[this.frameIndex];
558
+ process.stdout.write(`\r${frame} ${this.message}`);
559
+ this.frameIndex = (this.frameIndex + 1) % SPINNER_FRAMES.length;
560
+ }, 80);
561
+ }
562
+ stop(success = true) {
563
+ if (this.intervalId) {
564
+ clearInterval(this.intervalId);
565
+ this.intervalId = null;
566
+ }
567
+ const symbol = success ? '✓' : '✗';
568
+ process.stdout.write(`\r${symbol} ${this.message}\n`);
569
+ }
570
+ fail() {
571
+ this.stop(false);
572
+ }
573
+ }
547
574
  async function execAsync(command, options) {
548
575
  const result = await execPromise(command, { ...options, encoding: 'utf8' });
549
576
  return { stdout: result.stdout, stderr: result.stderr };
@@ -596,6 +623,8 @@ async function promptInstall(message) {
596
623
  });
597
624
  }
598
625
  async function execWithProgress(command, options) {
626
+ const verbose = options?.verbose ?? false;
627
+ const message = options?.message ?? 'Running...';
599
628
  return new Promise((resolve, reject) => {
600
629
  const [cmd, ...args] = command.split(' ');
601
630
  const child = spawn(cmd, args, {
@@ -603,21 +632,46 @@ async function execWithProgress(command, options) {
603
632
  stdio: ['inherit', 'pipe', 'pipe'],
604
633
  shell: true,
605
634
  });
635
+ let spinner = null;
636
+ let capturedOutput = '';
637
+ if (!verbose) {
638
+ spinner = new Spinner(message);
639
+ spinner.start();
640
+ }
606
641
  child.stdout?.on('data', (data) => {
607
- process.stdout.write(data);
642
+ if (verbose) {
643
+ process.stdout.write(data);
644
+ }
645
+ else {
646
+ capturedOutput += data.toString();
647
+ }
608
648
  });
609
649
  child.stderr?.on('data', (data) => {
610
- process.stderr.write(data);
650
+ if (verbose) {
651
+ process.stderr.write(data);
652
+ }
653
+ else {
654
+ capturedOutput += data.toString();
655
+ }
611
656
  });
612
657
  child.on('close', (code) => {
613
658
  if (code === 0) {
659
+ spinner?.stop(true);
614
660
  resolve();
615
661
  }
616
662
  else {
663
+ spinner?.fail();
664
+ if (!verbose && capturedOutput) {
665
+ console.error('\nBuild output:\n' + capturedOutput);
666
+ }
617
667
  reject(new Error(`Command failed with exit code ${code}`));
618
668
  }
619
669
  });
620
670
  child.on('error', (error) => {
671
+ spinner?.fail();
672
+ if (!verbose && capturedOutput) {
673
+ console.error('\nBuild output:\n' + capturedOutput);
674
+ }
621
675
  reject(error);
622
676
  });
623
677
  });
@@ -629,10 +683,11 @@ async function build(options) {
629
683
  if (!(await isMsixbundleCliInstalled())) {
630
684
  const shouldInstall = await promptInstall('msixbundle-cli is required but not installed.\n' + 'Install it now? (requires Rust/Cargo)');
631
685
  if (shouldInstall) {
632
- console.log('Installing msixbundle-cli...\n');
633
686
  try {
634
- await execWithProgress('cargo install msixbundle-cli');
635
- console.log('\n msixbundle-cli installed\n');
687
+ await execWithProgress('cargo install msixbundle-cli', {
688
+ verbose: options.verbose,
689
+ message: 'Installing msixbundle-cli...',
690
+ });
636
691
  }
637
692
  catch (error) {
638
693
  console.error('Failed to install msixbundle-cli:', error);
@@ -677,24 +732,28 @@ async function build(options) {
677
732
  const appxDirs = [];
678
733
  const runner = options.runner || DEFAULT_RUNNER;
679
734
  for (const arch of architectures) {
680
- console.log(`Building for ${arch}...`);
681
735
  // Build Tauri app
682
736
  const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
683
737
  const releaseFlag = options.release ? '--release' : '';
684
738
  // Build command based on runner
739
+ // --no-bundle skips MSI/NSIS bundling since we're creating MSIX
685
740
  let buildCommand;
686
741
  if (runner === 'npm') {
687
742
  // npm requires -- to pass args to the script
688
- buildCommand = `npm run tauri build -- --target ${target} ${releaseFlag}`.trim();
743
+ buildCommand = `npm run tauri build -- --target ${target} --no-bundle ${releaseFlag}`.trim();
689
744
  }
690
745
  else {
691
746
  // cargo, pnpm, yarn, bun, etc.
692
- buildCommand = `${runner} tauri build --target ${target} ${releaseFlag}`.trim();
747
+ buildCommand = `${runner} tauri build --target ${target} --no-bundle ${releaseFlag}`.trim();
693
748
  }
694
749
  try {
695
- console.log(` Running: ${buildCommand}\n`);
750
+ if (options.verbose) {
751
+ console.log(` Running: ${buildCommand}\n`);
752
+ }
696
753
  await execWithProgress(buildCommand, {
697
754
  cwd: projectRoot,
755
+ verbose: options.verbose,
756
+ message: `Building for ${arch}...`,
698
757
  });
699
758
  }
700
759
  catch (error) {
@@ -1469,6 +1528,7 @@ program
1469
1528
  .option('--release', 'Build in release mode')
1470
1529
  .option('--min-windows <version>', 'Minimum Windows version', '10.0.17763.0')
1471
1530
  .option('--runner <runner>', 'Build runner (cargo, pnpm, npm, yarn, etc.)', 'cargo')
1531
+ .option('--verbose', 'Show full build output instead of spinner')
1472
1532
  .action(async (options) => {
1473
1533
  try {
1474
1534
  await build(options);
package/dist/index.js CHANGED
@@ -542,6 +542,33 @@ function copyBundledResources(projectRoot, appxDir, tauriConfig) {
542
542
  }
543
543
 
544
544
  const execPromise = promisify(exec);
545
+ const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
546
+ class Spinner {
547
+ frameIndex = 0;
548
+ intervalId = null;
549
+ message;
550
+ constructor(message) {
551
+ this.message = message;
552
+ }
553
+ start() {
554
+ this.intervalId = setInterval(() => {
555
+ const frame = SPINNER_FRAMES[this.frameIndex];
556
+ process.stdout.write(`\r${frame} ${this.message}`);
557
+ this.frameIndex = (this.frameIndex + 1) % SPINNER_FRAMES.length;
558
+ }, 80);
559
+ }
560
+ stop(success = true) {
561
+ if (this.intervalId) {
562
+ clearInterval(this.intervalId);
563
+ this.intervalId = null;
564
+ }
565
+ const symbol = success ? '✓' : '✗';
566
+ process.stdout.write(`\r${symbol} ${this.message}\n`);
567
+ }
568
+ fail() {
569
+ this.stop(false);
570
+ }
571
+ }
545
572
  async function execAsync(command, options) {
546
573
  const result = await execPromise(command, { ...options, encoding: 'utf8' });
547
574
  return { stdout: result.stdout, stderr: result.stderr };
@@ -594,6 +621,8 @@ async function promptInstall(message) {
594
621
  });
595
622
  }
596
623
  async function execWithProgress(command, options) {
624
+ const verbose = options?.verbose ?? false;
625
+ const message = options?.message ?? 'Running...';
597
626
  return new Promise((resolve, reject) => {
598
627
  const [cmd, ...args] = command.split(' ');
599
628
  const child = spawn(cmd, args, {
@@ -601,21 +630,46 @@ async function execWithProgress(command, options) {
601
630
  stdio: ['inherit', 'pipe', 'pipe'],
602
631
  shell: true,
603
632
  });
633
+ let spinner = null;
634
+ let capturedOutput = '';
635
+ if (!verbose) {
636
+ spinner = new Spinner(message);
637
+ spinner.start();
638
+ }
604
639
  child.stdout?.on('data', (data) => {
605
- process.stdout.write(data);
640
+ if (verbose) {
641
+ process.stdout.write(data);
642
+ }
643
+ else {
644
+ capturedOutput += data.toString();
645
+ }
606
646
  });
607
647
  child.stderr?.on('data', (data) => {
608
- process.stderr.write(data);
648
+ if (verbose) {
649
+ process.stderr.write(data);
650
+ }
651
+ else {
652
+ capturedOutput += data.toString();
653
+ }
609
654
  });
610
655
  child.on('close', (code) => {
611
656
  if (code === 0) {
657
+ spinner?.stop(true);
612
658
  resolve();
613
659
  }
614
660
  else {
661
+ spinner?.fail();
662
+ if (!verbose && capturedOutput) {
663
+ console.error('\nBuild output:\n' + capturedOutput);
664
+ }
615
665
  reject(new Error(`Command failed with exit code ${code}`));
616
666
  }
617
667
  });
618
668
  child.on('error', (error) => {
669
+ spinner?.fail();
670
+ if (!verbose && capturedOutput) {
671
+ console.error('\nBuild output:\n' + capturedOutput);
672
+ }
619
673
  reject(error);
620
674
  });
621
675
  });
@@ -627,10 +681,11 @@ async function build(options) {
627
681
  if (!(await isMsixbundleCliInstalled())) {
628
682
  const shouldInstall = await promptInstall('msixbundle-cli is required but not installed.\n' + 'Install it now? (requires Rust/Cargo)');
629
683
  if (shouldInstall) {
630
- console.log('Installing msixbundle-cli...\n');
631
684
  try {
632
- await execWithProgress('cargo install msixbundle-cli');
633
- console.log('\n msixbundle-cli installed\n');
685
+ await execWithProgress('cargo install msixbundle-cli', {
686
+ verbose: options.verbose,
687
+ message: 'Installing msixbundle-cli...',
688
+ });
634
689
  }
635
690
  catch (error) {
636
691
  console.error('Failed to install msixbundle-cli:', error);
@@ -675,24 +730,28 @@ async function build(options) {
675
730
  const appxDirs = [];
676
731
  const runner = options.runner || DEFAULT_RUNNER;
677
732
  for (const arch of architectures) {
678
- console.log(`Building for ${arch}...`);
679
733
  // Build Tauri app
680
734
  const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
681
735
  const releaseFlag = options.release ? '--release' : '';
682
736
  // Build command based on runner
737
+ // --no-bundle skips MSI/NSIS bundling since we're creating MSIX
683
738
  let buildCommand;
684
739
  if (runner === 'npm') {
685
740
  // npm requires -- to pass args to the script
686
- buildCommand = `npm run tauri build -- --target ${target} ${releaseFlag}`.trim();
741
+ buildCommand = `npm run tauri build -- --target ${target} --no-bundle ${releaseFlag}`.trim();
687
742
  }
688
743
  else {
689
744
  // cargo, pnpm, yarn, bun, etc.
690
- buildCommand = `${runner} tauri build --target ${target} ${releaseFlag}`.trim();
745
+ buildCommand = `${runner} tauri build --target ${target} --no-bundle ${releaseFlag}`.trim();
691
746
  }
692
747
  try {
693
- console.log(` Running: ${buildCommand}\n`);
748
+ if (options.verbose) {
749
+ console.log(` Running: ${buildCommand}\n`);
750
+ }
694
751
  await execWithProgress(buildCommand, {
695
752
  cwd: projectRoot,
753
+ verbose: options.verbose,
754
+ message: `Building for ${arch}...`,
696
755
  });
697
756
  }
698
757
  catch (error) {
package/dist/types.d.ts CHANGED
@@ -103,6 +103,7 @@ export interface BuildOptions {
103
103
  release?: boolean;
104
104
  minWindows?: string;
105
105
  runner?: string;
106
+ verbose?: boolean;
106
107
  }
107
108
  export declare const DEFAULT_RUNNER = "cargo";
108
109
  export interface MsixAsset {
@@ -1,3 +1,12 @@
1
+ export declare class Spinner {
2
+ private frameIndex;
3
+ private intervalId;
4
+ private message;
5
+ constructor(message: string);
6
+ start(): void;
7
+ stop(success?: boolean): void;
8
+ fail(): void;
9
+ }
1
10
  export declare function execAsync(command: string, options?: {
2
11
  cwd?: string;
3
12
  }): Promise<{
@@ -9,6 +18,9 @@ export declare function getMsixbundleCliVersion(): Promise<string | null>;
9
18
  export declare function isVersionSufficient(version: string, minVersion: string): boolean;
10
19
  export declare const MIN_MSIXBUNDLE_CLI_VERSION = "1.0.0";
11
20
  export declare function promptInstall(message: string): Promise<boolean>;
12
- export declare function execWithProgress(command: string, options?: {
21
+ export interface ExecWithProgressOptions {
13
22
  cwd?: string;
14
- }): Promise<void>;
23
+ verbose?: boolean;
24
+ message?: string;
25
+ }
26
+ export declare function execWithProgress(command: string, options?: ExecWithProgressOptions): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-windows-bundle",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "MSIX packaging tool for Tauri apps - Windows Store ready bundles",
5
5
  "type": "module",
6
6
  "bin": {