@choochmeque/tauri-windows-bundle 0.1.14 → 0.1.16
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 +9 -0
- package/dist/cli.js +66 -11
- package/dist/core/appx-content.d.ts +1 -1
- package/dist/core/manifest.d.ts +3 -1
- package/dist/index.js +67 -12
- package/dist/types.d.ts +4 -0
- package/dist/utils/exec.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ MSIX packaging tool for Tauri apps - create Windows Store ready bundles with mul
|
|
|
12
12
|
- **Multiarch Support** - Build for x64 and arm64 in one bundle
|
|
13
13
|
- **tauri.conf.json Integration** - Automatically reads app name, version, icons, and resources
|
|
14
14
|
- **Code Signing** - Support for PFX certificates and Windows certificate store
|
|
15
|
+
- **Resource Indexing** - Optional `resources.pri` generation for qualified assets
|
|
15
16
|
- **Windows Extensions** - Share Target, File Associations, Protocol Handlers, Startup Task, Context Menus, Background Tasks, App Execution Alias, App Services, Toast Activation, Autoplay, Print Task Settings, Thumbnail/Preview Handlers
|
|
16
17
|
|
|
17
18
|
## Prerequisites
|
|
@@ -69,6 +70,10 @@ Edit `src-tauri/gen/windows/bundle.config.json`:
|
|
|
69
70
|
"signing": {
|
|
70
71
|
"pfx": null,
|
|
71
72
|
"pfxPassword": null
|
|
73
|
+
},
|
|
74
|
+
"resourceIndex": {
|
|
75
|
+
"enabled": false,
|
|
76
|
+
"keepConfig": false
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
79
|
```
|
|
@@ -93,6 +98,10 @@ Edit `src-tauri/gen/windows/bundle.config.json`:
|
|
|
93
98
|
|
|
94
99
|
Note: `runFullTrust` is always auto-added (required for Tauri apps).
|
|
95
100
|
|
|
101
|
+
`resourceIndex.enabled` generates `resources.pri` via `msixbundle-cli --makepri` before packing. Enable this when using qualified assets (for example, scale-specific logos like `Square44x44Logo.scale-200.png`).
|
|
102
|
+
|
|
103
|
+
`resourceIndex.keepConfig` keeps generated `priconfig.xml` in each `AppxContent` directory for debugging.
|
|
104
|
+
|
|
96
105
|
**Auto-read from tauri.conf.json / tauri.windows.conf.json:**
|
|
97
106
|
- `displayName` ← `productName`
|
|
98
107
|
- `version` ← `version` (auto-converted to 4-part: `1.0.0` → `1.0.0.0`)
|
package/dist/cli.js
CHANGED
|
@@ -197,6 +197,10 @@ function generateBundleConfig(windowsDir, _tauriConfig) {
|
|
|
197
197
|
pfx: null,
|
|
198
198
|
pfxPassword: null,
|
|
199
199
|
},
|
|
200
|
+
resourceIndex: {
|
|
201
|
+
enabled: false,
|
|
202
|
+
keepConfig: false,
|
|
203
|
+
},
|
|
200
204
|
};
|
|
201
205
|
const configPath = path.join(windowsDir, 'bundle.config.json');
|
|
202
206
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
@@ -402,18 +406,22 @@ function getPackageVersion() {
|
|
|
402
406
|
function loadTemplate(templatePath) {
|
|
403
407
|
return fs.readFileSync(templatePath, 'utf-8');
|
|
404
408
|
}
|
|
405
|
-
function getManifestTemplate() {
|
|
406
|
-
|
|
409
|
+
function getManifestTemplate(windowsDir) {
|
|
410
|
+
const localPath = path.join(windowsDir, 'AppxManifest.xml.template');
|
|
411
|
+
if (!fs.existsSync(localPath)) {
|
|
412
|
+
throw new Error(`AppxManifest.xml.template not found at ${localPath}. Run 'tauri-windows-bundle init' first.`);
|
|
413
|
+
}
|
|
414
|
+
return loadTemplate(localPath);
|
|
407
415
|
}
|
|
408
416
|
function getExtensionTemplate(name) {
|
|
409
417
|
return loadTemplate(path.join(EXTENSIONS_DIR, `${name}.xml`));
|
|
410
418
|
}
|
|
411
419
|
function generateManifestTemplate(windowsDir) {
|
|
412
420
|
const templatePath = path.join(windowsDir, 'AppxManifest.xml.template');
|
|
413
|
-
const template =
|
|
421
|
+
const template = loadTemplate(path.join(TEMPLATES_DIR, 'AppxManifest.xml.template'));
|
|
414
422
|
fs.writeFileSync(templatePath, template);
|
|
415
423
|
}
|
|
416
|
-
function generateManifest(config, arch, minVersion) {
|
|
424
|
+
function generateManifest(config, arch, minVersion, windowsDir) {
|
|
417
425
|
const variables = {
|
|
418
426
|
PACKAGE_NAME: config.identifier,
|
|
419
427
|
PUBLISHER: config.publisher,
|
|
@@ -427,7 +435,18 @@ function generateManifest(config, arch, minVersion) {
|
|
|
427
435
|
EXTENSIONS: generateExtensions(config),
|
|
428
436
|
CAPABILITIES: generateCapabilities(config.capabilities || DEFAULT_CAPABILITIES),
|
|
429
437
|
};
|
|
430
|
-
return replaceTemplateVariables(getManifestTemplate(), variables);
|
|
438
|
+
return replaceTemplateVariables(getManifestTemplate(windowsDir), variables);
|
|
439
|
+
}
|
|
440
|
+
function getDefaultLanguageFromManifestXml(manifestXml) {
|
|
441
|
+
const languageMatch = manifestXml.match(/<Resource\b[^>]*\bLanguage="([^"]+)"/i);
|
|
442
|
+
return languageMatch?.[1];
|
|
443
|
+
}
|
|
444
|
+
function getDefaultLanguageFromManifestFile(manifestPath) {
|
|
445
|
+
if (!fs.existsSync(manifestPath)) {
|
|
446
|
+
return undefined;
|
|
447
|
+
}
|
|
448
|
+
const manifest = fs.readFileSync(manifestPath, 'utf-8');
|
|
449
|
+
return getDefaultLanguageFromManifestXml(manifest);
|
|
431
450
|
}
|
|
432
451
|
function generateExtensions(config) {
|
|
433
452
|
const extensions = [];
|
|
@@ -635,7 +654,6 @@ async function init(options) {
|
|
|
635
654
|
const windowsDir = getWindowsDir(projectRoot);
|
|
636
655
|
// Create directories
|
|
637
656
|
fs.mkdirSync(path.join(windowsDir, 'Assets'), { recursive: true });
|
|
638
|
-
fs.mkdirSync(path.join(windowsDir, 'extensions'), { recursive: true });
|
|
639
657
|
// Generate bundle.config.json
|
|
640
658
|
generateBundleConfig(windowsDir);
|
|
641
659
|
console.log(' Created bundle.config.json');
|
|
@@ -706,11 +724,13 @@ function jsonMergePatch(target, patch) {
|
|
|
706
724
|
return result;
|
|
707
725
|
}
|
|
708
726
|
|
|
709
|
-
function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion) {
|
|
727
|
+
function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion, windowsDir) {
|
|
710
728
|
const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
|
|
711
729
|
const srcTauriDir = path.join(projectRoot, 'src-tauri');
|
|
712
730
|
const buildDir = path.join(srcTauriDir, 'target', target, 'release');
|
|
713
731
|
const appxDir = path.join(srcTauriDir, 'target', 'appx', arch);
|
|
732
|
+
// Clear stale output from previous builds
|
|
733
|
+
fs.rmSync(appxDir, { recursive: true, force: true });
|
|
714
734
|
// Create directories
|
|
715
735
|
fs.mkdirSync(path.join(appxDir, 'Assets'), { recursive: true });
|
|
716
736
|
// Copy exe
|
|
@@ -721,7 +741,7 @@ function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion)
|
|
|
721
741
|
}
|
|
722
742
|
fs.copyFileSync(srcExe, path.join(appxDir, exeName));
|
|
723
743
|
// Generate AppxManifest.xml
|
|
724
|
-
const manifest = generateManifest(config, arch, minVersion);
|
|
744
|
+
const manifest = generateManifest(config, arch, minVersion, windowsDir);
|
|
725
745
|
fs.writeFileSync(path.join(appxDir, 'AppxManifest.xml'), manifest);
|
|
726
746
|
// Copy MSIX Assets
|
|
727
747
|
const windowsAssetsDir = path.join(projectRoot, 'src-tauri', 'gen', 'windows', 'Assets');
|
|
@@ -771,6 +791,16 @@ function copyBundledResources(projectRoot, appxDir, tauriConfig) {
|
|
|
771
791
|
|
|
772
792
|
const execPromise = promisify(exec);
|
|
773
793
|
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
794
|
+
function isCiEnvironment() {
|
|
795
|
+
const ci = process.env.CI;
|
|
796
|
+
if (!ci)
|
|
797
|
+
return false;
|
|
798
|
+
const normalized = ci.toLowerCase();
|
|
799
|
+
return normalized !== '0' && normalized !== 'false';
|
|
800
|
+
}
|
|
801
|
+
function shouldAnimateSpinner() {
|
|
802
|
+
return Boolean(process.stdout.isTTY) && !isCiEnvironment();
|
|
803
|
+
}
|
|
774
804
|
class Spinner {
|
|
775
805
|
frameIndex = 0;
|
|
776
806
|
intervalId = null;
|
|
@@ -835,7 +865,7 @@ function isVersionSufficient(version, minVersion) {
|
|
|
835
865
|
return false;
|
|
836
866
|
return patch >= minPatch;
|
|
837
867
|
}
|
|
838
|
-
const MIN_MSIXBUNDLE_CLI_VERSION = '1.1.
|
|
868
|
+
const MIN_MSIXBUNDLE_CLI_VERSION = '1.1.4';
|
|
839
869
|
async function promptInstall(message) {
|
|
840
870
|
const rl = readline.createInterface({
|
|
841
871
|
input: process.stdin,
|
|
@@ -851,6 +881,8 @@ async function promptInstall(message) {
|
|
|
851
881
|
async function execWithProgress(command, options) {
|
|
852
882
|
const verbose = options?.verbose ?? false;
|
|
853
883
|
const message = options?.message ?? 'Running...';
|
|
884
|
+
const useSpinner = !verbose && shouldAnimateSpinner();
|
|
885
|
+
const useStaticProgress = !verbose && !useSpinner;
|
|
854
886
|
return new Promise((resolve, reject) => {
|
|
855
887
|
const [cmd, ...args] = command.split(' ');
|
|
856
888
|
const child = spawn(cmd, args, {
|
|
@@ -860,10 +892,13 @@ async function execWithProgress(command, options) {
|
|
|
860
892
|
});
|
|
861
893
|
let spinner = null;
|
|
862
894
|
let capturedOutput = '';
|
|
863
|
-
if (
|
|
895
|
+
if (useSpinner) {
|
|
864
896
|
spinner = new Spinner(message);
|
|
865
897
|
spinner.start();
|
|
866
898
|
}
|
|
899
|
+
else if (useStaticProgress) {
|
|
900
|
+
console.log(message);
|
|
901
|
+
}
|
|
867
902
|
child.stdout?.on('data', (data) => {
|
|
868
903
|
if (verbose) {
|
|
869
904
|
process.stdout.write(data);
|
|
@@ -883,10 +918,16 @@ async function execWithProgress(command, options) {
|
|
|
883
918
|
child.on('close', (code) => {
|
|
884
919
|
if (code === 0) {
|
|
885
920
|
spinner?.stop(true);
|
|
921
|
+
if (useStaticProgress) {
|
|
922
|
+
console.log(`Done: ${message}`);
|
|
923
|
+
}
|
|
886
924
|
resolve();
|
|
887
925
|
}
|
|
888
926
|
else {
|
|
889
927
|
spinner?.fail();
|
|
928
|
+
if (useStaticProgress) {
|
|
929
|
+
console.error(`Failed: ${message}`);
|
|
930
|
+
}
|
|
890
931
|
if (!verbose && capturedOutput) {
|
|
891
932
|
console.error('\nBuild output:\n' + capturedOutput);
|
|
892
933
|
}
|
|
@@ -895,6 +936,9 @@ async function execWithProgress(command, options) {
|
|
|
895
936
|
});
|
|
896
937
|
child.on('error', (error) => {
|
|
897
938
|
spinner?.fail();
|
|
939
|
+
if (useStaticProgress) {
|
|
940
|
+
console.error(`Failed: ${message}`);
|
|
941
|
+
}
|
|
898
942
|
if (!verbose && capturedOutput) {
|
|
899
943
|
console.error('\nBuild output:\n' + capturedOutput);
|
|
900
944
|
}
|
|
@@ -1013,7 +1057,7 @@ async function build(options) {
|
|
|
1013
1057
|
}
|
|
1014
1058
|
// Prepare AppxContent directory
|
|
1015
1059
|
console.log(` Preparing AppxContent for ${arch}...`);
|
|
1016
|
-
const appxDir = prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion);
|
|
1060
|
+
const appxDir = prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion, windowsDir);
|
|
1017
1061
|
appxDirs.push({ arch, dir: appxDir });
|
|
1018
1062
|
console.log(` AppxContent ready: ${appxDir}`);
|
|
1019
1063
|
}
|
|
@@ -1026,6 +1070,17 @@ async function build(options) {
|
|
|
1026
1070
|
outDir,
|
|
1027
1071
|
...appxDirs.flatMap(({ arch, dir }) => [`--dir-${arch}`, dir]),
|
|
1028
1072
|
];
|
|
1073
|
+
// Resource index generation (resources.pri)
|
|
1074
|
+
if (bundleConfig.resourceIndex?.enabled) {
|
|
1075
|
+
const defaultLanguage = getDefaultLanguageFromManifestFile(path.join(appxDirs[0].dir, 'AppxManifest.xml'));
|
|
1076
|
+
args.push('--makepri');
|
|
1077
|
+
if (defaultLanguage) {
|
|
1078
|
+
args.push('--makepri-default-language', defaultLanguage);
|
|
1079
|
+
}
|
|
1080
|
+
if (bundleConfig.resourceIndex.keepConfig) {
|
|
1081
|
+
args.push('--makepri-keep-config');
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1029
1084
|
// Signing
|
|
1030
1085
|
if (bundleConfig.signing?.pfx) {
|
|
1031
1086
|
args.push('--pfx', bundleConfig.signing.pfx);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { MergedConfig, TauriConfig } from '../types.js';
|
|
2
|
-
export declare function prepareAppxContent(projectRoot: string, arch: string, config: MergedConfig, tauriConfig: TauriConfig, minVersion: string): string;
|
|
2
|
+
export declare function prepareAppxContent(projectRoot: string, arch: string, config: MergedConfig, tauriConfig: TauriConfig, minVersion: string, windowsDir: string): string;
|
package/dist/core/manifest.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { MergedConfig } from '../types.js';
|
|
2
2
|
export declare function getPackageVersion(): string;
|
|
3
3
|
export declare function generateManifestTemplate(windowsDir: string): void;
|
|
4
|
-
export declare function generateManifest(config: MergedConfig, arch: string, minVersion: string): string;
|
|
4
|
+
export declare function generateManifest(config: MergedConfig, arch: string, minVersion: string, windowsDir: string): string;
|
|
5
|
+
export declare function getDefaultLanguageFromManifestXml(manifestXml: string): string | undefined;
|
|
6
|
+
export declare function getDefaultLanguageFromManifestFile(manifestPath: string): string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -194,6 +194,10 @@ function generateBundleConfig(windowsDir, _tauriConfig) {
|
|
|
194
194
|
pfx: null,
|
|
195
195
|
pfxPassword: null,
|
|
196
196
|
},
|
|
197
|
+
resourceIndex: {
|
|
198
|
+
enabled: false,
|
|
199
|
+
keepConfig: false,
|
|
200
|
+
},
|
|
197
201
|
};
|
|
198
202
|
const configPath = path.join(windowsDir, 'bundle.config.json');
|
|
199
203
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
@@ -399,18 +403,22 @@ function getPackageVersion() {
|
|
|
399
403
|
function loadTemplate(templatePath) {
|
|
400
404
|
return fs.readFileSync(templatePath, 'utf-8');
|
|
401
405
|
}
|
|
402
|
-
function getManifestTemplate() {
|
|
403
|
-
|
|
406
|
+
function getManifestTemplate(windowsDir) {
|
|
407
|
+
const localPath = path.join(windowsDir, 'AppxManifest.xml.template');
|
|
408
|
+
if (!fs.existsSync(localPath)) {
|
|
409
|
+
throw new Error(`AppxManifest.xml.template not found at ${localPath}. Run 'tauri-windows-bundle init' first.`);
|
|
410
|
+
}
|
|
411
|
+
return loadTemplate(localPath);
|
|
404
412
|
}
|
|
405
413
|
function getExtensionTemplate(name) {
|
|
406
414
|
return loadTemplate(path.join(EXTENSIONS_DIR, `${name}.xml`));
|
|
407
415
|
}
|
|
408
416
|
function generateManifestTemplate(windowsDir) {
|
|
409
417
|
const templatePath = path.join(windowsDir, 'AppxManifest.xml.template');
|
|
410
|
-
const template =
|
|
418
|
+
const template = loadTemplate(path.join(TEMPLATES_DIR, 'AppxManifest.xml.template'));
|
|
411
419
|
fs.writeFileSync(templatePath, template);
|
|
412
420
|
}
|
|
413
|
-
function generateManifest(config, arch, minVersion) {
|
|
421
|
+
function generateManifest(config, arch, minVersion, windowsDir) {
|
|
414
422
|
const variables = {
|
|
415
423
|
PACKAGE_NAME: config.identifier,
|
|
416
424
|
PUBLISHER: config.publisher,
|
|
@@ -424,7 +432,18 @@ function generateManifest(config, arch, minVersion) {
|
|
|
424
432
|
EXTENSIONS: generateExtensions(config),
|
|
425
433
|
CAPABILITIES: generateCapabilities(config.capabilities || DEFAULT_CAPABILITIES),
|
|
426
434
|
};
|
|
427
|
-
return replaceTemplateVariables(getManifestTemplate(), variables);
|
|
435
|
+
return replaceTemplateVariables(getManifestTemplate(windowsDir), variables);
|
|
436
|
+
}
|
|
437
|
+
function getDefaultLanguageFromManifestXml(manifestXml) {
|
|
438
|
+
const languageMatch = manifestXml.match(/<Resource\b[^>]*\bLanguage="([^"]+)"/i);
|
|
439
|
+
return languageMatch?.[1];
|
|
440
|
+
}
|
|
441
|
+
function getDefaultLanguageFromManifestFile(manifestPath) {
|
|
442
|
+
if (!fs.existsSync(manifestPath)) {
|
|
443
|
+
return undefined;
|
|
444
|
+
}
|
|
445
|
+
const manifest = fs.readFileSync(manifestPath, 'utf-8');
|
|
446
|
+
return getDefaultLanguageFromManifestXml(manifest);
|
|
428
447
|
}
|
|
429
448
|
function generateExtensions(config) {
|
|
430
449
|
const extensions = [];
|
|
@@ -632,7 +651,6 @@ async function init(options) {
|
|
|
632
651
|
const windowsDir = getWindowsDir(projectRoot);
|
|
633
652
|
// Create directories
|
|
634
653
|
fs.mkdirSync(path.join(windowsDir, 'Assets'), { recursive: true });
|
|
635
|
-
fs.mkdirSync(path.join(windowsDir, 'extensions'), { recursive: true });
|
|
636
654
|
// Generate bundle.config.json
|
|
637
655
|
generateBundleConfig(windowsDir);
|
|
638
656
|
console.log(' Created bundle.config.json');
|
|
@@ -703,11 +721,13 @@ function jsonMergePatch(target, patch) {
|
|
|
703
721
|
return result;
|
|
704
722
|
}
|
|
705
723
|
|
|
706
|
-
function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion) {
|
|
724
|
+
function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion, windowsDir) {
|
|
707
725
|
const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
|
|
708
726
|
const srcTauriDir = path.join(projectRoot, 'src-tauri');
|
|
709
727
|
const buildDir = path.join(srcTauriDir, 'target', target, 'release');
|
|
710
728
|
const appxDir = path.join(srcTauriDir, 'target', 'appx', arch);
|
|
729
|
+
// Clear stale output from previous builds
|
|
730
|
+
fs.rmSync(appxDir, { recursive: true, force: true });
|
|
711
731
|
// Create directories
|
|
712
732
|
fs.mkdirSync(path.join(appxDir, 'Assets'), { recursive: true });
|
|
713
733
|
// Copy exe
|
|
@@ -718,7 +738,7 @@ function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion)
|
|
|
718
738
|
}
|
|
719
739
|
fs.copyFileSync(srcExe, path.join(appxDir, exeName));
|
|
720
740
|
// Generate AppxManifest.xml
|
|
721
|
-
const manifest = generateManifest(config, arch, minVersion);
|
|
741
|
+
const manifest = generateManifest(config, arch, minVersion, windowsDir);
|
|
722
742
|
fs.writeFileSync(path.join(appxDir, 'AppxManifest.xml'), manifest);
|
|
723
743
|
// Copy MSIX Assets
|
|
724
744
|
const windowsAssetsDir = path.join(projectRoot, 'src-tauri', 'gen', 'windows', 'Assets');
|
|
@@ -768,6 +788,16 @@ function copyBundledResources(projectRoot, appxDir, tauriConfig) {
|
|
|
768
788
|
|
|
769
789
|
const execPromise = promisify(exec);
|
|
770
790
|
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
791
|
+
function isCiEnvironment() {
|
|
792
|
+
const ci = process.env.CI;
|
|
793
|
+
if (!ci)
|
|
794
|
+
return false;
|
|
795
|
+
const normalized = ci.toLowerCase();
|
|
796
|
+
return normalized !== '0' && normalized !== 'false';
|
|
797
|
+
}
|
|
798
|
+
function shouldAnimateSpinner() {
|
|
799
|
+
return Boolean(process.stdout.isTTY) && !isCiEnvironment();
|
|
800
|
+
}
|
|
771
801
|
class Spinner {
|
|
772
802
|
frameIndex = 0;
|
|
773
803
|
intervalId = null;
|
|
@@ -832,7 +862,7 @@ function isVersionSufficient(version, minVersion) {
|
|
|
832
862
|
return false;
|
|
833
863
|
return patch >= minPatch;
|
|
834
864
|
}
|
|
835
|
-
const MIN_MSIXBUNDLE_CLI_VERSION = '1.1.
|
|
865
|
+
const MIN_MSIXBUNDLE_CLI_VERSION = '1.1.4';
|
|
836
866
|
async function promptInstall(message) {
|
|
837
867
|
const rl = readline.createInterface({
|
|
838
868
|
input: process.stdin,
|
|
@@ -848,6 +878,8 @@ async function promptInstall(message) {
|
|
|
848
878
|
async function execWithProgress(command, options) {
|
|
849
879
|
const verbose = options?.verbose ?? false;
|
|
850
880
|
const message = options?.message ?? 'Running...';
|
|
881
|
+
const useSpinner = !verbose && shouldAnimateSpinner();
|
|
882
|
+
const useStaticProgress = !verbose && !useSpinner;
|
|
851
883
|
return new Promise((resolve, reject) => {
|
|
852
884
|
const [cmd, ...args] = command.split(' ');
|
|
853
885
|
const child = spawn(cmd, args, {
|
|
@@ -857,10 +889,13 @@ async function execWithProgress(command, options) {
|
|
|
857
889
|
});
|
|
858
890
|
let spinner = null;
|
|
859
891
|
let capturedOutput = '';
|
|
860
|
-
if (
|
|
892
|
+
if (useSpinner) {
|
|
861
893
|
spinner = new Spinner(message);
|
|
862
894
|
spinner.start();
|
|
863
895
|
}
|
|
896
|
+
else if (useStaticProgress) {
|
|
897
|
+
console.log(message);
|
|
898
|
+
}
|
|
864
899
|
child.stdout?.on('data', (data) => {
|
|
865
900
|
if (verbose) {
|
|
866
901
|
process.stdout.write(data);
|
|
@@ -880,10 +915,16 @@ async function execWithProgress(command, options) {
|
|
|
880
915
|
child.on('close', (code) => {
|
|
881
916
|
if (code === 0) {
|
|
882
917
|
spinner?.stop(true);
|
|
918
|
+
if (useStaticProgress) {
|
|
919
|
+
console.log(`Done: ${message}`);
|
|
920
|
+
}
|
|
883
921
|
resolve();
|
|
884
922
|
}
|
|
885
923
|
else {
|
|
886
924
|
spinner?.fail();
|
|
925
|
+
if (useStaticProgress) {
|
|
926
|
+
console.error(`Failed: ${message}`);
|
|
927
|
+
}
|
|
887
928
|
if (!verbose && capturedOutput) {
|
|
888
929
|
console.error('\nBuild output:\n' + capturedOutput);
|
|
889
930
|
}
|
|
@@ -892,6 +933,9 @@ async function execWithProgress(command, options) {
|
|
|
892
933
|
});
|
|
893
934
|
child.on('error', (error) => {
|
|
894
935
|
spinner?.fail();
|
|
936
|
+
if (useStaticProgress) {
|
|
937
|
+
console.error(`Failed: ${message}`);
|
|
938
|
+
}
|
|
895
939
|
if (!verbose && capturedOutput) {
|
|
896
940
|
console.error('\nBuild output:\n' + capturedOutput);
|
|
897
941
|
}
|
|
@@ -1010,7 +1054,7 @@ async function build(options) {
|
|
|
1010
1054
|
}
|
|
1011
1055
|
// Prepare AppxContent directory
|
|
1012
1056
|
console.log(` Preparing AppxContent for ${arch}...`);
|
|
1013
|
-
const appxDir = prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion);
|
|
1057
|
+
const appxDir = prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion, windowsDir);
|
|
1014
1058
|
appxDirs.push({ arch, dir: appxDir });
|
|
1015
1059
|
console.log(` AppxContent ready: ${appxDir}`);
|
|
1016
1060
|
}
|
|
@@ -1023,6 +1067,17 @@ async function build(options) {
|
|
|
1023
1067
|
outDir,
|
|
1024
1068
|
...appxDirs.flatMap(({ arch, dir }) => [`--dir-${arch}`, dir]),
|
|
1025
1069
|
];
|
|
1070
|
+
// Resource index generation (resources.pri)
|
|
1071
|
+
if (bundleConfig.resourceIndex?.enabled) {
|
|
1072
|
+
const defaultLanguage = getDefaultLanguageFromManifestFile(path.join(appxDirs[0].dir, 'AppxManifest.xml'));
|
|
1073
|
+
args.push('--makepri');
|
|
1074
|
+
if (defaultLanguage) {
|
|
1075
|
+
args.push('--makepri-default-language', defaultLanguage);
|
|
1076
|
+
}
|
|
1077
|
+
if (bundleConfig.resourceIndex.keepConfig) {
|
|
1078
|
+
args.push('--makepri-keep-config');
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1026
1081
|
// Signing
|
|
1027
1082
|
if (bundleConfig.signing?.pfx) {
|
|
1028
1083
|
args.push('--pfx', bundleConfig.signing.pfx);
|
|
@@ -1752,4 +1807,4 @@ async function extensionRemove(type, name, options) {
|
|
|
1752
1807
|
}
|
|
1753
1808
|
}
|
|
1754
1809
|
|
|
1755
|
-
export { DEFAULT_CAPABILITIES, DEFAULT_MIN_WINDOWS_VERSION, DEFAULT_RUNNER, DEVICE_CAPABILITIES, GENERAL_CAPABILITIES, MSIX_ASSETS, RESTRICTED_CAPABILITIES, build, extensionAddAppExecutionAlias, extensionAddAppService, extensionAddAutoplay, extensionAddBackgroundTask, extensionAddContextMenu, extensionAddFileAssociation, extensionAddPreviewHandler, extensionAddProtocol, extensionAddThumbnailHandler, extensionDisablePrintTaskSettings, extensionDisableShareTarget, extensionDisableStartupTask, extensionDisableToastActivation, extensionEnablePrintTaskSettings, extensionEnableShareTarget, extensionEnableStartupTask, extensionEnableToastActivation, extensionList, extensionRemove, findProjectRoot, generateManifest, generateManifestTemplate, getPackageVersion, getWindowsDir, init, prepareAppxContent, readBundleConfig$1 as readBundleConfig, readTauriConfig, readTauriWindowsConfig, resolveVersion, toFourPartVersion, validateCapabilities };
|
|
1810
|
+
export { DEFAULT_CAPABILITIES, DEFAULT_MIN_WINDOWS_VERSION, DEFAULT_RUNNER, DEVICE_CAPABILITIES, GENERAL_CAPABILITIES, MSIX_ASSETS, RESTRICTED_CAPABILITIES, build, extensionAddAppExecutionAlias, extensionAddAppService, extensionAddAutoplay, extensionAddBackgroundTask, extensionAddContextMenu, extensionAddFileAssociation, extensionAddPreviewHandler, extensionAddProtocol, extensionAddThumbnailHandler, extensionDisablePrintTaskSettings, extensionDisableShareTarget, extensionDisableStartupTask, extensionDisableToastActivation, extensionEnablePrintTaskSettings, extensionEnableShareTarget, extensionEnableStartupTask, extensionEnableToastActivation, extensionList, extensionRemove, findProjectRoot, generateManifest, generateManifestTemplate, getDefaultLanguageFromManifestFile, getDefaultLanguageFromManifestXml, getPackageVersion, getWindowsDir, init, prepareAppxContent, readBundleConfig$1 as readBundleConfig, readTauriConfig, readTauriWindowsConfig, resolveVersion, toFourPartVersion, validateCapabilities };
|
package/dist/types.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export interface CapabilitiesConfig {
|
|
|
24
24
|
export interface BundleConfig {
|
|
25
25
|
publisher?: string;
|
|
26
26
|
publisherDisplayName?: string;
|
|
27
|
+
resourceIndex?: {
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
keepConfig?: boolean;
|
|
30
|
+
};
|
|
27
31
|
capabilities?: CapabilitiesConfig;
|
|
28
32
|
extensions?: {
|
|
29
33
|
shareTarget?: boolean;
|
package/dist/utils/exec.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function execAsync(command: string, options?: {
|
|
|
16
16
|
export declare function isMsixbundleCliInstalled(): Promise<boolean>;
|
|
17
17
|
export declare function getMsixbundleCliVersion(): Promise<string | null>;
|
|
18
18
|
export declare function isVersionSufficient(version: string, minVersion: string): boolean;
|
|
19
|
-
export declare const MIN_MSIXBUNDLE_CLI_VERSION = "1.1.
|
|
19
|
+
export declare const MIN_MSIXBUNDLE_CLI_VERSION = "1.1.4";
|
|
20
20
|
export declare function promptInstall(message: string): Promise<boolean>;
|
|
21
21
|
export interface ExecWithProgressOptions {
|
|
22
22
|
cwd?: string;
|