@choochmeque/tauri-windows-bundle 0.1.12 → 0.1.13

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
@@ -43,6 +43,19 @@ function readTauriConfig(projectRoot) {
43
43
  throw new Error(`Failed to parse tauri.conf.json: ${error instanceof Error ? error.message : error}`);
44
44
  }
45
45
  }
46
+ function readTauriWindowsConfig(projectRoot) {
47
+ const configPath = path.join(projectRoot, 'src-tauri', 'tauri.windows.conf.json');
48
+ if (!fs.existsSync(configPath)) {
49
+ return null;
50
+ }
51
+ try {
52
+ const content = fs.readFileSync(configPath, 'utf-8');
53
+ return JSON.parse(content);
54
+ }
55
+ catch (error) {
56
+ throw new Error(`Failed to parse tauri.windows.conf.json: ${error instanceof Error ? error.message : error}`);
57
+ }
58
+ }
46
59
  function readBundleConfig$1(windowsDir) {
47
60
  const configPath = path.join(windowsDir, 'bundle.config.json');
48
61
  if (!fs.existsSync(configPath)) {
@@ -382,7 +395,7 @@ function generateManifestTemplate(windowsDir) {
382
395
  }
383
396
  function generateManifest(config, arch, minVersion) {
384
397
  const variables = {
385
- PACKAGE_NAME: config.identifier.replace(/\./g, ''),
398
+ PACKAGE_NAME: config.identifier,
386
399
  PUBLISHER: config.publisher,
387
400
  VERSION: config.version,
388
401
  ARCH: arch,
@@ -654,6 +667,25 @@ function updatePackageJson(projectRoot) {
654
667
  }
655
668
  }
656
669
 
670
+ function isObject(val) {
671
+ return val !== null && typeof val === 'object' && !Array.isArray(val);
672
+ }
673
+ function jsonMergePatch(target, patch) {
674
+ if (!isObject(patch)) {
675
+ return patch;
676
+ }
677
+ const result = isObject(target) ? { ...target } : {};
678
+ for (const [key, value] of Object.entries(patch)) {
679
+ if (value === null) {
680
+ delete result[key];
681
+ }
682
+ else {
683
+ result[key] = jsonMergePatch(result[key], value);
684
+ }
685
+ }
686
+ return result;
687
+ }
688
+
657
689
  function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion) {
658
690
  const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
659
691
  const srcTauriDir = path.join(projectRoot, 'src-tauri');
@@ -890,7 +922,11 @@ async function build(options) {
890
922
  const projectRoot = findProjectRoot();
891
923
  const windowsDir = getWindowsDir(projectRoot);
892
924
  // Read configs
893
- const tauriConfig = readTauriConfig(projectRoot);
925
+ let tauriConfig = readTauriConfig(projectRoot);
926
+ const windowsConfig = readTauriWindowsConfig(projectRoot);
927
+ if (windowsConfig) {
928
+ tauriConfig = jsonMergePatch(tauriConfig, windowsConfig);
929
+ }
894
930
  const bundleConfig = readBundleConfig$1(windowsDir);
895
931
  // Validate capabilities
896
932
  if (bundleConfig.capabilities) {
@@ -1,6 +1,7 @@
1
1
  import type { TauriConfig, BundleConfig } from '../types.js';
2
2
  export declare function findProjectRoot(startDir?: string): string;
3
3
  export declare function readTauriConfig(projectRoot: string): TauriConfig;
4
+ export declare function readTauriWindowsConfig(projectRoot: string): TauriConfig | null;
4
5
  export declare function readBundleConfig(windowsDir: string): BundleConfig;
5
6
  export declare function getWindowsDir(projectRoot: string): string;
6
7
  export declare function toFourPartVersion(version: string): string;
package/dist/index.js CHANGED
@@ -124,6 +124,19 @@ function readTauriConfig(projectRoot) {
124
124
  throw new Error(`Failed to parse tauri.conf.json: ${error instanceof Error ? error.message : error}`);
125
125
  }
126
126
  }
127
+ function readTauriWindowsConfig(projectRoot) {
128
+ const configPath = path.join(projectRoot, 'src-tauri', 'tauri.windows.conf.json');
129
+ if (!fs.existsSync(configPath)) {
130
+ return null;
131
+ }
132
+ try {
133
+ const content = fs.readFileSync(configPath, 'utf-8');
134
+ return JSON.parse(content);
135
+ }
136
+ catch (error) {
137
+ throw new Error(`Failed to parse tauri.windows.conf.json: ${error instanceof Error ? error.message : error}`);
138
+ }
139
+ }
127
140
  function readBundleConfig$1(windowsDir) {
128
141
  const configPath = path.join(windowsDir, 'bundle.config.json');
129
142
  if (!fs.existsSync(configPath)) {
@@ -379,7 +392,7 @@ function generateManifestTemplate(windowsDir) {
379
392
  }
380
393
  function generateManifest(config, arch, minVersion) {
381
394
  const variables = {
382
- PACKAGE_NAME: config.identifier.replace(/\./g, ''),
395
+ PACKAGE_NAME: config.identifier,
383
396
  PUBLISHER: config.publisher,
384
397
  VERSION: config.version,
385
398
  ARCH: arch,
@@ -651,6 +664,25 @@ function updatePackageJson(projectRoot) {
651
664
  }
652
665
  }
653
666
 
667
+ function isObject(val) {
668
+ return val !== null && typeof val === 'object' && !Array.isArray(val);
669
+ }
670
+ function jsonMergePatch(target, patch) {
671
+ if (!isObject(patch)) {
672
+ return patch;
673
+ }
674
+ const result = isObject(target) ? { ...target } : {};
675
+ for (const [key, value] of Object.entries(patch)) {
676
+ if (value === null) {
677
+ delete result[key];
678
+ }
679
+ else {
680
+ result[key] = jsonMergePatch(result[key], value);
681
+ }
682
+ }
683
+ return result;
684
+ }
685
+
654
686
  function prepareAppxContent(projectRoot, arch, config, tauriConfig, minVersion) {
655
687
  const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
656
688
  const srcTauriDir = path.join(projectRoot, 'src-tauri');
@@ -887,7 +919,11 @@ async function build(options) {
887
919
  const projectRoot = findProjectRoot();
888
920
  const windowsDir = getWindowsDir(projectRoot);
889
921
  // Read configs
890
- const tauriConfig = readTauriConfig(projectRoot);
922
+ let tauriConfig = readTauriConfig(projectRoot);
923
+ const windowsConfig = readTauriWindowsConfig(projectRoot);
924
+ if (windowsConfig) {
925
+ tauriConfig = jsonMergePatch(tauriConfig, windowsConfig);
926
+ }
891
927
  const bundleConfig = readBundleConfig$1(windowsDir);
892
928
  // Validate capabilities
893
929
  if (bundleConfig.capabilities) {
@@ -1687,4 +1723,4 @@ async function extensionRemove(type, name, options) {
1687
1723
  }
1688
1724
  }
1689
1725
 
1690
- 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, toFourPartVersion, validateCapabilities };
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 };
@@ -0,0 +1 @@
1
+ export declare function jsonMergePatch<T>(target: T, patch: unknown): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-windows-bundle",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "MSIX packaging tool for Tauri apps - Windows Store ready bundles",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,14 +36,14 @@
36
36
  "@rollup/plugin-node-resolve": "^16.0.0",
37
37
  "@rollup/plugin-typescript": "^12.0.0",
38
38
  "@types/node": "^25.0.3",
39
- "@vitest/coverage-v8": "^2.0.0",
39
+ "@vitest/coverage-v8": "^4.0.0",
40
40
  "eslint": "^9.0.0",
41
41
  "prettier": "^3.0.0",
42
42
  "rollup": "^4.0.0",
43
43
  "tslib": "^2.6.0",
44
44
  "typescript": "^5.3.3",
45
45
  "typescript-eslint": "^8.0.0",
46
- "vitest": "^2.0.0"
46
+ "vitest": "^4.0.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "rollup -c",