@choochmeque/tauri-windows-bundle 0.1.2 → 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 +69 -12
- package/dist/index.js +68 -12
- package/dist/types.d.ts +1 -0
- package/dist/utils/exec.d.ts +14 -2
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,27 +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
|
|
685
|
-
// --
|
|
739
|
+
// --no-bundle skips MSI/NSIS bundling since we're creating MSIX
|
|
686
740
|
let buildCommand;
|
|
687
741
|
if (runner === 'npm') {
|
|
688
742
|
// npm requires -- to pass args to the script
|
|
689
|
-
buildCommand =
|
|
690
|
-
`npm run tauri build -- --target ${target} --bundles none ${releaseFlag}`.trim();
|
|
743
|
+
buildCommand = `npm run tauri build -- --target ${target} --no-bundle ${releaseFlag}`.trim();
|
|
691
744
|
}
|
|
692
745
|
else {
|
|
693
746
|
// cargo, pnpm, yarn, bun, etc.
|
|
694
|
-
buildCommand =
|
|
695
|
-
`${runner} tauri build --target ${target} --bundles none ${releaseFlag}`.trim();
|
|
747
|
+
buildCommand = `${runner} tauri build --target ${target} --no-bundle ${releaseFlag}`.trim();
|
|
696
748
|
}
|
|
697
749
|
try {
|
|
698
|
-
|
|
750
|
+
if (options.verbose) {
|
|
751
|
+
console.log(` Running: ${buildCommand}\n`);
|
|
752
|
+
}
|
|
699
753
|
await execWithProgress(buildCommand, {
|
|
700
754
|
cwd: projectRoot,
|
|
755
|
+
verbose: options.verbose,
|
|
756
|
+
message: `Building for ${arch}...`,
|
|
701
757
|
});
|
|
702
758
|
}
|
|
703
759
|
catch (error) {
|
|
@@ -1472,6 +1528,7 @@ program
|
|
|
1472
1528
|
.option('--release', 'Build in release mode')
|
|
1473
1529
|
.option('--min-windows <version>', 'Minimum Windows version', '10.0.17763.0')
|
|
1474
1530
|
.option('--runner <runner>', 'Build runner (cargo, pnpm, npm, yarn, etc.)', 'cargo')
|
|
1531
|
+
.option('--verbose', 'Show full build output instead of spinner')
|
|
1475
1532
|
.action(async (options) => {
|
|
1476
1533
|
try {
|
|
1477
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,27 +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
|
|
683
|
-
// --
|
|
737
|
+
// --no-bundle skips MSI/NSIS bundling since we're creating MSIX
|
|
684
738
|
let buildCommand;
|
|
685
739
|
if (runner === 'npm') {
|
|
686
740
|
// npm requires -- to pass args to the script
|
|
687
|
-
buildCommand =
|
|
688
|
-
`npm run tauri build -- --target ${target} --bundles none ${releaseFlag}`.trim();
|
|
741
|
+
buildCommand = `npm run tauri build -- --target ${target} --no-bundle ${releaseFlag}`.trim();
|
|
689
742
|
}
|
|
690
743
|
else {
|
|
691
744
|
// cargo, pnpm, yarn, bun, etc.
|
|
692
|
-
buildCommand =
|
|
693
|
-
`${runner} tauri build --target ${target} --bundles none ${releaseFlag}`.trim();
|
|
745
|
+
buildCommand = `${runner} tauri build --target ${target} --no-bundle ${releaseFlag}`.trim();
|
|
694
746
|
}
|
|
695
747
|
try {
|
|
696
|
-
|
|
748
|
+
if (options.verbose) {
|
|
749
|
+
console.log(` Running: ${buildCommand}\n`);
|
|
750
|
+
}
|
|
697
751
|
await execWithProgress(buildCommand, {
|
|
698
752
|
cwd: projectRoot,
|
|
753
|
+
verbose: options.verbose,
|
|
754
|
+
message: `Building for ${arch}...`,
|
|
699
755
|
});
|
|
700
756
|
}
|
|
701
757
|
catch (error) {
|
package/dist/types.d.ts
CHANGED
package/dist/utils/exec.d.ts
CHANGED
|
@@ -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
|
|
21
|
+
export interface ExecWithProgressOptions {
|
|
13
22
|
cwd?: string;
|
|
14
|
-
|
|
23
|
+
verbose?: boolean;
|
|
24
|
+
message?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function execWithProgress(command: string, options?: ExecWithProgressOptions): Promise<void>;
|