From b99a4304b306f14c31e1d7752ec47ffe2505d3b4 Mon Sep 17 00:00:00 2001 From: Ionut Stoica Date: Thu, 17 Oct 2024 16:06:09 +0200 Subject: [PATCH] feat: support completely custom AppxManifest.xml --- packages/app-builder-lib/scheme.json | 7 +++++++ packages/app-builder-lib/src/options/AppXOptions.ts | 5 +++++ packages/app-builder-lib/src/targets/AppxTarget.ts | 9 +++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/app-builder-lib/scheme.json b/packages/app-builder-lib/scheme.json index 6c70de56c35..9afaa63c350 100644 --- a/packages/app-builder-lib/scheme.json +++ b/packages/app-builder-lib/scheme.json @@ -183,6 +183,13 @@ "description": "Relative path to custom extensions xml to be included in an `appmanifest.xml`.", "type": "string" }, + "customManifestPath": { + "description": "Path to custom AppxManifest.xml", + "type": [ + "null", + "string" + ] + }, "displayName": { "description": "A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).\nDefaults to the application product name.", "type": [ diff --git a/packages/app-builder-lib/src/options/AppXOptions.ts b/packages/app-builder-lib/src/options/AppXOptions.ts index 30de2277a08..7b01a214665 100644 --- a/packages/app-builder-lib/src/options/AppXOptions.ts +++ b/packages/app-builder-lib/src/options/AppXOptions.ts @@ -51,6 +51,11 @@ export interface AppXOptions extends TargetSpecificOptions { */ readonly customExtensionsPath?: string + /** + * Path to custom `AppxManifest.xml`. + */ + readonly customManifestPath?: string + /** * Whether to overlay the app's name on top of tile images on the Start screen. Defaults to `false`. (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles) in the dependencies. * @default false diff --git a/packages/app-builder-lib/src/targets/AppxTarget.ts b/packages/app-builder-lib/src/targets/AppxTarget.ts index 2ffee2b7e4e..607cc2c7d13 100644 --- a/packages/app-builder-lib/src/targets/AppxTarget.ts +++ b/packages/app-builder-lib/src/targets/AppxTarget.ts @@ -98,8 +98,13 @@ export default class AppXTarget extends Target { const assetInfo = await AppXTarget.computeUserAssets(vm, vendorPath, userAssetDir) const userAssets = assetInfo.userAssets - const manifestFile = stageDir.getTempFile("AppxManifest.xml") - await this.writeManifest(manifestFile, arch, await this.computePublisherName(), userAssets) + const manifestFile = this.options.customManifestPath || stageDir.getTempFile("AppxManifest.xml") + if (this.options.customManifestPath) { + log.info({ reason: "Custom manifest path provided" }, "Manifest writing skipped") + } else { + await this.writeManifest(manifestFile, arch, await this.computePublisherName(), userAssets) + } + await packager.info.callAppxManifestCreated(manifestFile) mappingList.push(assetInfo.mappings) mappingList.push([`"${vm.toVmFile(manifestFile)}" "AppxManifest.xml"`])