Skip to content

Commit 8160363

Browse files
authoredMar 20, 2024··
feat: add config options for setting MinVersion and MaxVersionTested fields in appx manifest (#8142)
1 parent 9f4b458 commit 8160363

File tree

6 files changed

+40
-2
lines changed

6 files changed

+40
-2
lines changed
 

‎.changeset/pretty-lemons-trade.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": minor
3+
---
4+
5+
feat: add config options for setting `MinVersion` and `MaxVersionTested` fields in appx manifest

‎docs/configuration/appx.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ All options are optional. All required for AppX configuration is inferred and co
1515
<li><code id="AppXOptions-customExtensionsPath">customExtensionsPath</code> String - Relative path to custom extensions xml to be included in an <code>appmanifest.xml</code>.</li>
1616
<li><code id="AppXOptions-showNameOnTiles">showNameOnTiles</code> = <code>false</code> Boolean - Whether to overlay the app’s name on top of tile images on the Start screen. Defaults to <code>false</code>. (<a href="https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles">https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles</a>) in the dependencies.</li>
1717
<li><code id="AppXOptions-setBuildNumber">setBuildNumber</code> = <code>false</code> Boolean - Whether to set build number. See <a href="https://github.com/electron-userland/electron-builder/issues/3875">https://github.com/electron-userland/electron-builder/issues/3875</a></li>
18+
<li><code id="AppXOptions-minVersion">minVersion</code> = <code>arch === Arch.arm64 ? &quot;10.0.16299.0&quot; : &quot;10.0.14316.0&quot;</code> String | “undefined” - Set the MinVersion field in the appx manifest.xml</li>
19+
<li><code id="AppXOptions-maxVersionTested">maxVersionTested</code> = <code>arch === Arch.arm64 ? &quot;10.0.16299.0&quot; : &quot;10.0.14316.0&quot;</code> String | “undefined” - Set the <code>MaxVersionTested</code> field in the appx manifest.xml</li>
1820
</ul>
1921
<p>Inherited from <code>TargetSpecificOptions</code>:</p>
2022
<ul>

‎packages/app-builder-lib/scheme.json

+16
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,22 @@
223223
}
224224
]
225225
},
226+
"maxVersionTested": {
227+
"default": "arch === Arch.arm64 ? \"10.0.16299.0\" : \"10.0.14316.0\"",
228+
"description": "Set the `MaxVersionTested` field in the appx manifest.xml",
229+
"type": [
230+
"null",
231+
"string"
232+
]
233+
},
234+
"minVersion": {
235+
"default": "arch === Arch.arm64 ? \"10.0.16299.0\" : \"10.0.14316.0\"",
236+
"description": "Set the MinVersion field in the appx manifest.xml",
237+
"type": [
238+
"null",
239+
"string"
240+
]
241+
},
226242
"publish": {
227243
"anyOf": [
228244
{

‎packages/app-builder-lib/src/options/AppXOptions.ts

+12
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ export interface AppXOptions extends TargetSpecificOptions {
6969
*/
7070
readonly setBuildNumber?: boolean
7171

72+
/**
73+
* Set the MinVersion field in the appx manifest.xml
74+
* @default arch === Arch.arm64 ? "10.0.16299.0" : "10.0.14316.0"
75+
*/
76+
readonly minVersion?: string | null
77+
78+
/**
79+
* Set the `MaxVersionTested` field in the appx manifest.xml
80+
* @default arch === Arch.arm64 ? "10.0.16299.0" : "10.0.14316.0"
81+
*/
82+
readonly maxVersionTested?: string | null
83+
7284
/** @private */
7385
readonly makeappxArgs?: Array<string> | null
7486
}

‎packages/app-builder-lib/src/targets/AppxTarget.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ export default class AppXTarget extends Target {
180180
const executable = `app\\${appInfo.productFilename}.exe`
181181
const displayName = options.displayName || appInfo.productName
182182
const extensions = await this.getExtensions(executable, displayName)
183+
const archSpecificMinVersion = arch === Arch.arm64 ? "10.0.16299.0" : "10.0.14316.0"
183184

184185
const manifest = (await readFile(path.join(getTemplatePath("appx"), "appxmanifest.xml"), "utf8")).replace(/\${([a-zA-Z0-9]+)}/g, (match, p1): string => {
185186
switch (p1) {
@@ -252,10 +253,10 @@ export default class AppXTarget extends Target {
252253
return extensions
253254

254255
case "minVersion":
255-
return arch === Arch.arm64 ? "10.0.16299.0" : "10.0.14316.0"
256+
return options.minVersion || archSpecificMinVersion
256257

257258
case "maxVersionTested":
258-
return arch === Arch.arm64 ? "10.0.16299.0" : "10.0.14316.0"
259+
return options.maxVersionTested || options.minVersion || archSpecificMinVersion
259260

260261
default:
261262
throw new Error(`Macro ${p1} is not defined`)

‎test/src/windows/appxTest.ts

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ it(
6565
cscKeyPassword: "test",
6666
appx: {
6767
languages: ["de-DE", "ru-RU"],
68+
minVersion: "10.0.16299.0",
69+
maxVersionTested: "10.0.16299.0",
6870
},
6971
},
7072
})

0 commit comments

Comments
 (0)
Please sign in to comment.