@choochmeque/tauri-windows-bundle 0.1.13 → 0.1.15

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 CHANGED
@@ -73,6 +73,8 @@ Edit `src-tauri/gen/windows/bundle.config.json`:
73
73
  }
74
74
  ```
75
75
 
76
+ `publisher` and `publisherDisplayName` are optional in `bundle.config.json`. If omitted, `publisher` falls back to `bundle.publisher` from `tauri.conf.json` or `tauri.windows.conf.json`. If `publisherDisplayName` is omitted, it defaults to the resolved `publisher` value.
77
+
76
78
  **Capabilities** are validated at build time. Three types are supported:
77
79
 
78
80
  ```json
@@ -91,14 +93,17 @@ Edit `src-tauri/gen/windows/bundle.config.json`:
91
93
 
92
94
  Note: `runFullTrust` is always auto-added (required for Tauri apps).
93
95
 
94
- **Auto-read from tauri.conf.json:**
96
+ **Auto-read from tauri.conf.json / tauri.windows.conf.json:**
95
97
  - `displayName` ← `productName`
96
98
  - `version` ← `version` (auto-converted to 4-part: `1.0.0` → `1.0.0.0`)
97
99
  - `description` ← `bundle.shortDescription`
100
+ - `publisher` ← `bundle.publisher` (fallback when not in bundle.config.json)
98
101
  - `icons` ← `bundle.icon`
99
102
  - `resources` ← `bundle.resources`
100
103
  - `signing` ← `bundle.windows.certificateThumbprint`
101
104
 
105
+ **Platform-specific config:** Values in `tauri.windows.conf.json` override `tauri.conf.json` using [JSON Merge Patch (RFC 7396)](https://datatracker.ietf.org/doc/html/rfc7396). This lets you define Windows-specific settings like `identifier`, `productName`, or `bundle.publisher` separately.
106
+
102
107
  ### Build
103
108
 
104
109
  ```bash
package/dist/cli.js CHANGED
@@ -72,6 +72,26 @@ function readBundleConfig$1(windowsDir) {
72
72
  function getWindowsDir(projectRoot) {
73
73
  return path.join(projectRoot, 'src-tauri', 'gen', 'windows');
74
74
  }
75
+ function resolveVersion(version, tauriConfigDir) {
76
+ const resolvedPath = path.resolve(tauriConfigDir, version);
77
+ if (fs.existsSync(resolvedPath) && fs.statSync(resolvedPath).isFile()) {
78
+ try {
79
+ const content = fs.readFileSync(resolvedPath, 'utf-8');
80
+ const json = JSON.parse(content);
81
+ if (!json.version || typeof json.version !== 'string') {
82
+ throw new Error(`File ${version} does not contain a valid "version" field`);
83
+ }
84
+ return json.version;
85
+ }
86
+ catch (error) {
87
+ if (error instanceof SyntaxError) {
88
+ throw new Error(`Failed to parse ${version} as JSON: ${error.message}`);
89
+ }
90
+ throw error;
91
+ }
92
+ }
93
+ return version;
94
+ }
75
95
  function toFourPartVersion(version) {
76
96
  const parts = version.split('.');
77
97
  while (parts.length < 4)
@@ -382,18 +402,22 @@ function getPackageVersion() {
382
402
  function loadTemplate(templatePath) {
383
403
  return fs.readFileSync(templatePath, 'utf-8');
384
404
  }
385
- function getManifestTemplate() {
386
- return loadTemplate(path.join(TEMPLATES_DIR, 'AppxManifest.xml.template'));
405
+ function getManifestTemplate(windowsDir) {
406
+ const localPath = path.join(windowsDir, 'AppxManifest.xml.template');
407
+ if (!fs.existsSync(localPath)) {
408
+ throw new Error(`AppxManifest.xml.template not found at ${localPath}. Run 'tauri-windows-bundle init' first.`);
409
+ }
410
+ return loadTemplate(localPath);
387
411
  }
388
412
  function getExtensionTemplate(name) {
389
413
  return loadTemplate(path.join(EXTENSIONS_DIR, `${name}.xml`));
390
414
  }
391
415
  function generateManifestTemplate(windowsDir) {
392
416
  const templatePath = path.join(windowsDir, 'AppxManifest.xml.template');
393
- const template = getManifestTemplate();
417
+ const template = loadTemplate(path.join(TEMPLATES_DIR, 'AppxManifest.xml.template'));
394
418
  fs.writeFileSync(templatePath, template);
395
419
  }
396
- function generateManifest(config, arch, minVersion) {
420
+ function generateManifest(config, arch, minVersion, windowsDir) {
397
421
  const variables = {
398
422
  PACKAGE_NAME: config.identifier,
399
423
  PUBLISHER: config.publisher,
@@ -407,7 +431,7 @@ function generateManifest(config, arch, minVersion) {
407
431
  EXTENSIONS: generateExtensions(config),
408
432
  CAPABILITIES: generateCapabilities(config.capabilities || DEFAULT_CAPABILITIES),
409
433
  };
410
- return replaceTemplateVariables(getManifestTemplate(), variables);
434
+ return replaceTemplateVariables(getManifestTemplate(windowsDir), variables);
411
435
  }
412
436
  function generateExtensions(config) {
413
437
  const extensions = [];
@@ -615,7 +639,6 @@ async function init(options) {
615
639
  const windowsDir = getWindowsDir(projectRoot);
616
640
  // Create directories
617
641
  fs.mkdirSync(path.join(windowsDir, 'Assets'), { recursive: true });
618
- fs.mkdirSync(path.join(windowsDir, 'extensions'), { recursive: true });
619
642
  // Generate bundle.config.json
620
643
  generateBundleConfig(windowsDir);
621
644
  console.log(' Created bundle.config.json');
@@ -686,7 +709,7 @@ function jsonMergePatch(target, patch) {
686
709
  return result;
687
710
  }
688
711
 
689
- function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion) {
712
+ function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion, windowsDir) {
690
713
  const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
691
714
  const srcTauriDir = path.join(projectRoot, 'src-tauri');
692
715
  const buildDir = path.join(srcTauriDir, 'target', target, 'release');
@@ -701,7 +724,7 @@ function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion)
701
724
  }
702
725
  fs.copyFileSync(srcExe, path.join(appxDir, exeName));
703
726
  // Generate AppxManifest.xml
704
- const manifest = generateManifest(config, arch, minVersion);
727
+ const manifest = generateManifest(config, arch, minVersion, windowsDir);
705
728
  fs.writeFileSync(path.join(appxDir, 'AppxManifest.xml'), manifest);
706
729
  // Copy MSIX Assets
707
730
  const windowsAssetsDir = path.join(projectRoot, 'src-tauri', 'gen', 'windows', 'Assets');
@@ -939,13 +962,22 @@ async function build(options) {
939
962
  process.exit(1);
940
963
  }
941
964
  }
965
+ // Resolve publisher with fallback to tauriConfig
966
+ const publisher = bundleConfig.publisher || tauriConfig.bundle?.publisher;
967
+ if (!publisher) {
968
+ console.error('Publisher is required. Set it in bundle.config.json or in tauri.conf.json / tauri.windows.conf.json under bundle.publisher');
969
+ process.exit(1);
970
+ }
971
+ const publisherDisplayName = bundleConfig.publisherDisplayName || publisher;
942
972
  // Merge config
943
973
  const config = {
944
974
  displayName: tauriConfig.productName || 'App',
945
- version: toFourPartVersion(tauriConfig.version || '1.0.0'),
975
+ version: toFourPartVersion(resolveVersion(tauriConfig.version || '1.0.0', path.join(projectRoot, 'src-tauri'))),
946
976
  description: tauriConfig.bundle?.shortDescription || '',
947
977
  identifier: tauriConfig.identifier || 'com.example.app',
948
978
  ...bundleConfig,
979
+ publisher,
980
+ publisherDisplayName,
949
981
  };
950
982
  // Architectures from CLI flag
951
983
  const architectures = options.arch?.split(',') || ['x64'];
@@ -984,7 +1016,7 @@ async function build(options) {
984
1016
  }
985
1017
  // Prepare AppxContent directory
986
1018
  console.log(` Preparing AppxContent for ${arch}...`);
987
- const appxDir = prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion);
1019
+ const appxDir = prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion, windowsDir);
988
1020
  appxDirs.push({ arch, dir: appxDir });
989
1021
  console.log(` AppxContent ready: ${appxDir}`);
990
1022
  }
@@ -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;
@@ -1,4 +1,4 @@
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;
@@ -4,4 +4,5 @@ export declare function readTauriConfig(projectRoot: string): TauriConfig;
4
4
  export declare function readTauriWindowsConfig(projectRoot: string): TauriConfig | null;
5
5
  export declare function readBundleConfig(windowsDir: string): BundleConfig;
6
6
  export declare function getWindowsDir(projectRoot: string): string;
7
+ export declare function resolveVersion(version: string, tauriConfigDir: string): string;
7
8
  export declare function toFourPartVersion(version: string): string;
package/dist/index.js CHANGED
@@ -153,6 +153,26 @@ function readBundleConfig$1(windowsDir) {
153
153
  function getWindowsDir(projectRoot) {
154
154
  return path.join(projectRoot, 'src-tauri', 'gen', 'windows');
155
155
  }
156
+ function resolveVersion(version, tauriConfigDir) {
157
+ const resolvedPath = path.resolve(tauriConfigDir, version);
158
+ if (fs.existsSync(resolvedPath) && fs.statSync(resolvedPath).isFile()) {
159
+ try {
160
+ const content = fs.readFileSync(resolvedPath, 'utf-8');
161
+ const json = JSON.parse(content);
162
+ if (!json.version || typeof json.version !== 'string') {
163
+ throw new Error(`File ${version} does not contain a valid "version" field`);
164
+ }
165
+ return json.version;
166
+ }
167
+ catch (error) {
168
+ if (error instanceof SyntaxError) {
169
+ throw new Error(`Failed to parse ${version} as JSON: ${error.message}`);
170
+ }
171
+ throw error;
172
+ }
173
+ }
174
+ return version;
175
+ }
156
176
  function toFourPartVersion(version) {
157
177
  const parts = version.split('.');
158
178
  while (parts.length < 4)
@@ -379,18 +399,22 @@ function getPackageVersion() {
379
399
  function loadTemplate(templatePath) {
380
400
  return fs.readFileSync(templatePath, 'utf-8');
381
401
  }
382
- function getManifestTemplate() {
383
- return loadTemplate(path.join(TEMPLATES_DIR, 'AppxManifest.xml.template'));
402
+ function getManifestTemplate(windowsDir) {
403
+ const localPath = path.join(windowsDir, 'AppxManifest.xml.template');
404
+ if (!fs.existsSync(localPath)) {
405
+ throw new Error(`AppxManifest.xml.template not found at ${localPath}. Run 'tauri-windows-bundle init' first.`);
406
+ }
407
+ return loadTemplate(localPath);
384
408
  }
385
409
  function getExtensionTemplate(name) {
386
410
  return loadTemplate(path.join(EXTENSIONS_DIR, `${name}.xml`));
387
411
  }
388
412
  function generateManifestTemplate(windowsDir) {
389
413
  const templatePath = path.join(windowsDir, 'AppxManifest.xml.template');
390
- const template = getManifestTemplate();
414
+ const template = loadTemplate(path.join(TEMPLATES_DIR, 'AppxManifest.xml.template'));
391
415
  fs.writeFileSync(templatePath, template);
392
416
  }
393
- function generateManifest(config, arch, minVersion) {
417
+ function generateManifest(config, arch, minVersion, windowsDir) {
394
418
  const variables = {
395
419
  PACKAGE_NAME: config.identifier,
396
420
  PUBLISHER: config.publisher,
@@ -404,7 +428,7 @@ function generateManifest(config, arch, minVersion) {
404
428
  EXTENSIONS: generateExtensions(config),
405
429
  CAPABILITIES: generateCapabilities(config.capabilities || DEFAULT_CAPABILITIES),
406
430
  };
407
- return replaceTemplateVariables(getManifestTemplate(), variables);
431
+ return replaceTemplateVariables(getManifestTemplate(windowsDir), variables);
408
432
  }
409
433
  function generateExtensions(config) {
410
434
  const extensions = [];
@@ -612,7 +636,6 @@ async function init(options) {
612
636
  const windowsDir = getWindowsDir(projectRoot);
613
637
  // Create directories
614
638
  fs.mkdirSync(path.join(windowsDir, 'Assets'), { recursive: true });
615
- fs.mkdirSync(path.join(windowsDir, 'extensions'), { recursive: true });
616
639
  // Generate bundle.config.json
617
640
  generateBundleConfig(windowsDir);
618
641
  console.log(' Created bundle.config.json');
@@ -683,7 +706,7 @@ function jsonMergePatch(target, patch) {
683
706
  return result;
684
707
  }
685
708
 
686
- function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion) {
709
+ function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion, windowsDir) {
687
710
  const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
688
711
  const srcTauriDir = path.join(projectRoot, 'src-tauri');
689
712
  const buildDir = path.join(srcTauriDir, 'target', target, 'release');
@@ -698,7 +721,7 @@ function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion)
698
721
  }
699
722
  fs.copyFileSync(srcExe, path.join(appxDir, exeName));
700
723
  // Generate AppxManifest.xml
701
- const manifest = generateManifest(config, arch, minVersion);
724
+ const manifest = generateManifest(config, arch, minVersion, windowsDir);
702
725
  fs.writeFileSync(path.join(appxDir, 'AppxManifest.xml'), manifest);
703
726
  // Copy MSIX Assets
704
727
  const windowsAssetsDir = path.join(projectRoot, 'src-tauri', 'gen', 'windows', 'Assets');
@@ -936,13 +959,22 @@ async function build(options) {
936
959
  process.exit(1);
937
960
  }
938
961
  }
962
+ // Resolve publisher with fallback to tauriConfig
963
+ const publisher = bundleConfig.publisher || tauriConfig.bundle?.publisher;
964
+ if (!publisher) {
965
+ console.error('Publisher is required. Set it in bundle.config.json or in tauri.conf.json / tauri.windows.conf.json under bundle.publisher');
966
+ process.exit(1);
967
+ }
968
+ const publisherDisplayName = bundleConfig.publisherDisplayName || publisher;
939
969
  // Merge config
940
970
  const config = {
941
971
  displayName: tauriConfig.productName || 'App',
942
- version: toFourPartVersion(tauriConfig.version || '1.0.0'),
972
+ version: toFourPartVersion(resolveVersion(tauriConfig.version || '1.0.0', path.join(projectRoot, 'src-tauri'))),
943
973
  description: tauriConfig.bundle?.shortDescription || '',
944
974
  identifier: tauriConfig.identifier || 'com.example.app',
945
975
  ...bundleConfig,
976
+ publisher,
977
+ publisherDisplayName,
946
978
  };
947
979
  // Architectures from CLI flag
948
980
  const architectures = options.arch?.split(',') || ['x64'];
@@ -981,7 +1013,7 @@ async function build(options) {
981
1013
  }
982
1014
  // Prepare AppxContent directory
983
1015
  console.log(` Preparing AppxContent for ${arch}...`);
984
- const appxDir = prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion);
1016
+ const appxDir = prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion, windowsDir);
985
1017
  appxDirs.push({ arch, dir: appxDir });
986
1018
  console.log(` AppxContent ready: ${appxDir}`);
987
1019
  }
@@ -1723,4 +1755,4 @@ async function extensionRemove(type, name, options) {
1723
1755
  }
1724
1756
  }
1725
1757
 
1726
- 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, toFourPartVersion, validateCapabilities };
1758
+ 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 };
package/dist/types.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface TauriConfig {
6
6
  icon?: string[];
7
7
  shortDescription?: string;
8
8
  longDescription?: string;
9
+ publisher?: string;
9
10
  resources?: (string | {
10
11
  src: string;
11
12
  target: string;
@@ -21,8 +22,8 @@ export interface CapabilitiesConfig {
21
22
  restricted?: string[];
22
23
  }
23
24
  export interface BundleConfig {
24
- publisher: string;
25
- publisherDisplayName: string;
25
+ publisher?: string;
26
+ publisherDisplayName?: string;
26
27
  capabilities?: CapabilitiesConfig;
27
28
  extensions?: {
28
29
  shareTarget?: boolean;
@@ -95,6 +96,8 @@ export interface PreviewHandler {
95
96
  fileTypes: string[];
96
97
  }
97
98
  export interface MergedConfig extends BundleConfig {
99
+ publisher: string;
100
+ publisherDisplayName: string;
98
101
  displayName: string;
99
102
  version: string;
100
103
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-windows-bundle",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "MSIX packaging tool for Tauri apps - Windows Store ready bundles",
5
5
  "type": "module",
6
6
  "bin": {