From 20d34dc33aca5e921097ff8a36acf04595b1e261 Mon Sep 17 00:00:00 2001 From: Jakub Meysner Date: Wed, 1 May 2024 16:01:10 +0200 Subject: [PATCH] Added `publish` command `--noCommit` option Resolves microsoft/msstore-cli#32 --- .../PublishCommandUnitTests.cs | 26 ++++++++++ MSStore.CLI/Commands/InitCommand.cs | 50 ++++++++++++++---- MSStore.CLI/Commands/PublishCommand.cs | 29 +++++++++-- .../Helpers/IStorePackagedAPIExtensions.cs | 47 +++++++++++------ .../ElectronProjectConfigurator.cs | 52 ++++++++++++++----- .../FileProjectConfigurator.cs | 17 +++--- .../ProjectConfigurators/IProjectPublisher.cs | 4 +- .../MSIXProjectPublisher.cs | 17 ++++-- .../PWAProjectConfigurator.cs | 31 ++++++----- 9 files changed, 205 insertions(+), 68 deletions(-) diff --git a/MSStore.CLI.UnitTests/PublishCommandUnitTests.cs b/MSStore.CLI.UnitTests/PublishCommandUnitTests.cs index dd71889..1a5cd76 100644 --- a/MSStore.CLI.UnitTests/PublishCommandUnitTests.cs +++ b/MSStore.CLI.UnitTests/PublishCommandUnitTests.cs @@ -270,5 +270,31 @@ public async Task PublishCommandForMSIXAppsShouldSucceed() result.Should().Contain("Submission commit success! Here is some data:"); result.Should().Contain("test.msix"); } + + [TestMethod] + public async Task PublishCommandForMSIXAppsWithNoCommitShouldNotCommit() + { + var path = CopyFilesRecursively("MSIXProject"); + + var msixPath = Path.Combine(path, "test.msix"); + + AddDefaultFakeSuccessfulSubmission(); + + var result = await ParseAndInvokeAsync( + new string[] + { + "publish", + msixPath, + "--appId", + FakeApps[0].Id!, + "--verbose", + "--noCommit" + }); + + ZipFileManager + .Verify(x => x.ExtractZip(It.IsAny(), It.IsAny()), Times.Never); + + result.Should().Contain("Skipping submission commit."); + } } } \ No newline at end of file diff --git a/MSStore.CLI/Commands/InitCommand.cs b/MSStore.CLI/Commands/InitCommand.cs index f22d4e0..b715df0 100644 --- a/MSStore.CLI/Commands/InitCommand.cs +++ b/MSStore.CLI/Commands/InitCommand.cs @@ -67,18 +67,30 @@ bool IsUri() }); Output = new Option( - aliases: new string[] { "--output", "-o" }, + aliases: new string[] + { + "--output", + "-o" + }, description: "The output directory where the packaged app will be stored. If not provided, the default directory for each different type of app will be used."); Arch = new Option>( - aliases: new string[] { "--arch", "-a" }, + aliases: new string[] + { + "--arch", + "-a" + }, description: "The architecture(s) to build for. If not provided, the default architecture for the current OS, and project type, will be used.") { AllowMultipleArgumentsPerToken = true, }; Version = new Option( - aliases: new string[] { "--version", "-ver" }, + aliases: new string[] + { + "--version", + "-ver" + }, parseArgument: result => { var version = result.Tokens.Single().Value; @@ -99,19 +111,29 @@ public InitCommand() AddArgument(PathOrUrl); var publisherDisplayName = new Option( - aliases: new string[] { "--publisherDisplayName", "-n" }, + aliases: new string[] + { + "--publisherDisplayName", + "-n" + }, description: "The Publisher Display Name used to configure the application. If provided, avoids an extra APIs call."); AddOption(publisherDisplayName); var package = new Option( - aliases: new string[] { "--package" }, + aliases: new string[] + { + "--package" + }, description: "If supported by the app type, automatically packs the project."); AddOption(package); var publish = new Option( - aliases: new string[] { "--publish" }, + aliases: new string[] + { + "--publish" + }, description: "If supported by the app type, automatically publishes the project. Implies '--package true'"); AddOption(publish); @@ -187,9 +209,15 @@ public async Task InvokeAsync(InvocationContext context) var props = new Dictionary { - { "withPDN", (PublisherDisplayName != null).ToString() }, - { "Package", (Package == true).ToString() }, - { "Publish", (Publish == true).ToString() } + { + "withPDN", (PublisherDisplayName != null).ToString() + }, + { + "Package", (Package == true).ToString() + }, + { + "Publish", (Publish == true).ToString() + } }; if (configurator == null) @@ -356,7 +384,7 @@ public async Task InvokeAsync(InvocationContext context) return await _telemetryClient.TrackCommandEventAsync(-5, props, ct); } - result = await projectPublisher.PublishAsync(PathOrUrl, app, outputDirectory, storePackagedAPI, ct); + result = await projectPublisher.PublishAsync(PathOrUrl, app, outputDirectory, false, storePackagedAPI, ct); } return await _telemetryClient.TrackCommandEventAsync(result, props, ct); @@ -437,4 +465,4 @@ private async Task OpenMicrosoftStoreRegistrationPageAsync(CancellationToken ct) } } } -} +} \ No newline at end of file diff --git a/MSStore.CLI/Commands/PublishCommand.cs b/MSStore.CLI/Commands/PublishCommand.cs index c330652..6bf61ef 100644 --- a/MSStore.CLI/Commands/PublishCommand.cs +++ b/MSStore.CLI/Commands/PublishCommand.cs @@ -26,7 +26,11 @@ public PublishCommand() AddArgument(InitCommand.PathOrUrl); var inputDirectory = new Option( - aliases: new string[] { "--inputDirectory", "-i" }, + aliases: new string[] + { + "--inputDirectory", + "-i" + }, description: "The directory where the '.msix' or '.msixupload' file to be used for the publishing command. If not provided, the cli will try to find the best candidate based on the 'pathOrUrl' argument.", parseArgument: result => { @@ -50,10 +54,25 @@ public PublishCommand() AddOption(inputDirectory); var appIdOption = new Option( - aliases: new string[] { "--appId", "-id" }, + aliases: new string[] + { + "--appId", + "-id" + }, description: "Specifies the Application Id. Only needed if the project has not been initialized before with the 'init' command."); AddOption(appIdOption); + + var noCommitOption = new Option( + aliases: new string[] + { + "--noCommit", + "-nc" + }, + description: "Disables committing the submission, keeping it in draft state.", + getDefaultValue: () => false); + + AddOption(noCommitOption); } public new class Handler : ICommandHandler @@ -69,6 +88,8 @@ public new class Handler : ICommandHandler public DirectoryInfo? InputDirectory { get; set; } = null!; + public bool NoCommit { get; set; } + public Handler( IProjectConfiguratorFactory projectConfiguratorFactory, IStoreAPIFactory storeAPIFactory, @@ -135,8 +156,8 @@ public async Task InvokeAsync(InvocationContext context) } return await _telemetryClient.TrackCommandEventAsync( - await projectPublisher.PublishAsync(PathOrUrl, app, InputDirectory, storePackagedAPI, ct), props, ct); + await projectPublisher.PublishAsync(PathOrUrl, app, InputDirectory, NoCommit, storePackagedAPI, ct), props, ct); } } } -} +} \ No newline at end of file diff --git a/MSStore.CLI/Helpers/IStorePackagedAPIExtensions.cs b/MSStore.CLI/Helpers/IStorePackagedAPIExtensions.cs index 28cf857..490990c 100644 --- a/MSStore.CLI/Helpers/IStorePackagedAPIExtensions.cs +++ b/MSStore.CLI/Helpers/IStorePackagedAPIExtensions.cs @@ -132,8 +132,8 @@ private static async IAsyncEnumerable Enumera yield return submissionStatus; } while ("CommitStarted".Equals(submissionStatus.Status, StringComparison.Ordinal) - && submissionStatus.StatusDetails?.Errors.IsNullOrEmpty() == true - && submissionStatus.StatusDetails?.CertificationReports.IsNullOrEmpty() == true); + && submissionStatus.StatusDetails?.Errors.IsNullOrEmpty() == true + && submissionStatus.StatusDetails?.CertificationReports.IsNullOrEmpty() == true); } public static async Task PollSubmissionStatusAsync(this IStorePackagedAPI storePackagedAPI, string productId, string submissionId, bool waitFirst, ILogger? logger, CancellationToken ct = default) @@ -165,7 +165,7 @@ public static async Task HandleLastSubmissionStatusAsync(this IStorePackage await browserLauncher.OpenBrowserAsync($"https://partner.microsoft.com/dashboard/products/{productId}/submissions/{submissionId}/ageratings", true, ct); } else if (lastSubmissionStatus.StatusDetails?.Errors?.Count == 1 && - error?.Code == "InvalidState") + error?.Code == "InvalidState") { AnsiConsole.WriteLine("Submission has failed. Submission has active validation errors which cannot be exposed via API."); @@ -291,7 +291,22 @@ public static async Task DeleteSubmissionAsync(this IStorePackagedAPI stor return application; } - public static async Task PublishAsync(this IStorePackagedAPI storePackagedAPI, DevCenterApplication app, FirstSubmissionDataCallback firstSubmissionDataCallback, AllowTargetFutureDeviceFamily[] allowTargetFutureDeviceFamilies, DirectoryInfo output, IEnumerable input, IBrowserLauncher _browserLauncher, IConsoleReader consoleReader, IZipFileManager zipFileManager, IFileDownloader fileDownloader, IAzureBlobManager azureBlobManager, IEnvironmentInformationService environmentInformationService, ILogger logger, CancellationToken ct) + public static async Task PublishAsync( + this IStorePackagedAPI storePackagedAPI, + DevCenterApplication app, + FirstSubmissionDataCallback firstSubmissionDataCallback, + AllowTargetFutureDeviceFamily[] allowTargetFutureDeviceFamilies, + DirectoryInfo output, + IEnumerable input, + bool noCommit, + IBrowserLauncher _browserLauncher, + IConsoleReader consoleReader, + IZipFileManager zipFileManager, + IFileDownloader fileDownloader, + IAzureBlobManager azureBlobManager, + IEnvironmentInformationService environmentInformationService, + ILogger logger, + CancellationToken ct) { if (app?.Id == null) { @@ -440,6 +455,12 @@ public static async Task PublishAsync(this IStorePackagedAPI storePackagedA return -1; } + if (noCommit) + { + AnsiConsole.WriteLine("Skipping submission commit."); + return 0; + } + var submissionCommit = await storePackagedAPI.CommitSubmissionAsync(app.Id, submission.Id, ct); if (submissionCommit == null) @@ -506,8 +527,7 @@ public static async Task PublishAsync(this IStorePackagedAPI storePackagedA var newApplicationPackage = new ApplicationPackage { - FileStatus = FileStatus.PendingUpload, - FileName = file.Name + FileStatus = FileStatus.PendingUpload, FileName = file.Name }; submission.ApplicationPackages.Add(newApplicationPackage); @@ -525,9 +545,9 @@ public static async Task PublishAsync(this IStorePackagedAPI storePackagedA if (listing.Value?.BaseListing?.Images?.Count > 0) { var imagesToDownload = listing.Value.BaseListing.Images.Where(i => - i.FileStatus == FileStatus.PendingUpload && - i.FileName != null && - i.FileName.StartsWith("http", StringComparison.OrdinalIgnoreCase)); + i.FileStatus == FileStatus.PendingUpload && + i.FileName != null && + i.FileName.StartsWith("http", StringComparison.OrdinalIgnoreCase)); if (imagesToDownload.Any()) { @@ -674,8 +694,7 @@ private static async Task FulfillApplicationAsync(DevCenterApplication app, DevC { BaseListing = new BaseListing { - Title = app.PrimaryName, - Description = submissionData.Description, + Title = app.PrimaryName, Description = submissionData.Description, } }; @@ -687,9 +706,7 @@ private static async Task FulfillApplicationAsync(DevCenterApplication app, DevC { listing.BaseListing.Images.Add(new Image { - FileName = image.FileName, - FileStatus = FileStatus.PendingUpload, - ImageType = image.ImageType.ToString() + FileName = image.FileName, FileStatus = FileStatus.PendingUpload, ImageType = image.ImageType.ToString() }); } } @@ -722,4 +739,4 @@ void UpdateIfNotSet(AllowTargetFutureDeviceFamily allowTargetFutureDeviceFamily) UpdateIfNotSet(AllowTargetFutureDeviceFamily.Xbox); } } -} +} \ No newline at end of file diff --git a/MSStore.CLI/ProjectConfigurators/ElectronProjectConfigurator.cs b/MSStore.CLI/ProjectConfigurators/ElectronProjectConfigurator.cs index 52d3c80..8e00296 100644 --- a/MSStore.CLI/ProjectConfigurators/ElectronProjectConfigurator.cs +++ b/MSStore.CLI/ProjectConfigurators/ElectronProjectConfigurator.cs @@ -32,7 +32,10 @@ public ElectronProjectConfigurator(IExternalCommandExecutor externalCommandExecu public override string ToString() => "Electron"; - public override string[] PackageFilesExtensionInclude => new[] { ".appx" }; + public override string[] PackageFilesExtensionInclude => new[] + { + ".appx" + }; public override string[]? PackageFilesExtensionExclude { get; } public override SearchOption PackageFilesSearchOption { get; } = SearchOption.TopDirectoryOnly; public override PublishFileSearchFilterStrategy PublishFileSearchFilterStrategy { get; } = PublishFileSearchFilterStrategy.All; @@ -53,7 +56,11 @@ public string DefaultBuildResources } } - public override IEnumerable? DefaultBuildArchs => new[] { BuildArch.X64, BuildArch.Arm64 }; + public override IEnumerable? DefaultBuildArchs => new[] + { + BuildArch.X64, + BuildArch.Arm64 + }; public override bool PackageOnlyOnWindows => true; @@ -114,10 +121,18 @@ private void CopyDefaultImages(DirectoryInfo projectRootPath) { var defaultAssets = new Dictionary() { - { "SampleAppx.50x50.png", "StoreLogo.png" }, - { "SampleAppx.150x150.png", "Square150x150Logo.png" }, - { "SampleAppx.44x44.png", "Square44x44Logo.png" }, - { "SampleAppx.310x150.png", "Wide310x150Logo.png" } + { + "SampleAppx.50x50.png", "StoreLogo.png" + }, + { + "SampleAppx.150x150.png", "Square150x150Logo.png" + }, + { + "SampleAppx.44x44.png", "Square44x44Logo.png" + }, + { + "SampleAppx.310x150.png", "Wide310x150Logo.png" + } }; var appxAssetsFolder = GetDefaultAssetsAppxFolder(); @@ -169,7 +184,7 @@ private void CopyDefaultImages(DirectoryInfo projectRootPath) Directory.GetFiles(appxFolder) .Where(f => fileNames .Any(n => Path.GetFileNameWithoutExtension(f) - .Equals(n, StringComparison.OrdinalIgnoreCase))) + .Equals(n, StringComparison.OrdinalIgnoreCase))) .ToList()); } @@ -220,12 +235,18 @@ internal static async Task UpdateManifestAsync(FileInfo electr { if (jsonValue.TryGetValue(out string? existingTarget)) { - electronManifest.Build.Windows.Targets = new JsonArray { JsonNode.Parse("\"appx\""), JsonNode.Parse($"\"{existingTarget}\"") }; + electronManifest.Build.Windows.Targets = new JsonArray + { + JsonNode.Parse("\"appx\""), JsonNode.Parse($"\"{existingTarget}\"") + }; } } else { - electronManifest.Build.Windows.Targets = new JsonArray { JsonNode.Parse("\"appx\"") }; + electronManifest.Build.Windows.Targets = new JsonArray + { + JsonNode.Parse("\"appx\"") + }; } electronManifest.Build.Appx ??= new ElectronManifestBuildAppX(); @@ -337,7 +358,12 @@ public override async Task<(int returnCode, DirectoryInfo? outputDirectory)> Pac var cleanedStdOut = System.Text.RegularExpressions.Regex.Replace(result.StdOut, @"\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)", string.Empty); - var msixLine = cleanedStdOut.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.None).LastOrDefault(line => line.Contains("target=AppX")); + var msixLine = cleanedStdOut.Split( + new string[] + { + "\n", + Environment.NewLine + }, StringSplitOptions.None).LastOrDefault(line => line.Contains("target=AppX")); int index; var search = "file="; if (msixLine == null || (index = msixLine.IndexOf(search, StringComparison.OrdinalIgnoreCase)) == -1) @@ -387,7 +413,7 @@ private async Task EnsureElectronManifestAsync(FileInfo? fileInfo, CancellationT _electronManifest ??= await _electronManifestManager.LoadAsync(fileInfo, ct); } - public override async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, IStorePackagedAPI storePackagedAPI, CancellationToken ct) + public override async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, bool noCommit, IStorePackagedAPI storePackagedAPI, CancellationToken ct) { if (_electronManifest == null) { @@ -395,7 +421,7 @@ public override async Task PublishAsync(string pathOrUrl, DevCenterApplicat await EnsureElectronManifestAsync(manifestFile, ct); } - return await base.PublishAsync(pathOrUrl, app, inputDirectory, storePackagedAPI, ct); + return await base.PublishAsync(pathOrUrl, app, inputDirectory, noCommit, storePackagedAPI, ct); } } -} +} \ No newline at end of file diff --git a/MSStore.CLI/ProjectConfigurators/FileProjectConfigurator.cs b/MSStore.CLI/ProjectConfigurators/FileProjectConfigurator.cs index 5626620..0cddccc 100644 --- a/MSStore.CLI/ProjectConfigurators/FileProjectConfigurator.cs +++ b/MSStore.CLI/ProjectConfigurators/FileProjectConfigurator.cs @@ -105,7 +105,12 @@ protected static FileInfo FindFile(DirectoryInfo projectRootPath, string searchP { var files = projectRootPath.GetFiles(searchPattern, SearchOption.AllDirectories).ToList(); - var rootDirectoriesToIgnore = new string[] { "node_modules", "obj", "bin" }; + var rootDirectoriesToIgnore = new string[] + { + "node_modules", + "obj", + "bin" + }; foreach (var ignoreDirectory in rootDirectoriesToIgnore) { @@ -142,7 +147,7 @@ private Task<(string, List)> GetFirstSubmissionDataAsync(string return Task.FromResult<(string, List)>((description, images)); } - public virtual async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, IStorePackagedAPI storePackagedAPI, CancellationToken ct) + public virtual async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, bool noCommit, IStorePackagedAPI storePackagedAPI, CancellationToken ct) { var (projectRootPath, projectFile) = GetInfo(pathOrUrl); @@ -171,8 +176,8 @@ public virtual async Task PublishAsync(string pathOrUrl, DevCenterApplicati var output = projectRootPath.CreateSubdirectory(OutputSubdirectory); var packageFiles = inputDirectory.GetFiles("*.*", PackageFilesSearchOption) - .Where(f => PackageFilesExtensionInclude.Contains(f.Extension, StringComparer.OrdinalIgnoreCase) - && PackageFilesExtensionExclude?.All(e => !f.Name.EndsWith(e, StringComparison.OrdinalIgnoreCase)) != false); + .Where(f => PackageFilesExtensionInclude.Contains(f.Extension, StringComparer.OrdinalIgnoreCase) + && PackageFilesExtensionExclude?.All(e => !f.Name.EndsWith(e, StringComparison.OrdinalIgnoreCase)) != false); if (PublishFileSearchFilterStrategy == PublishFileSearchFilterStrategy.Newest) { @@ -185,7 +190,7 @@ public virtual async Task PublishAsync(string pathOrUrl, DevCenterApplicati Logger.LogInformation("Trying to publish these {FileCount} files: {FileNames}", packageFiles.Count(), string.Join(", ", packageFiles.Select(f => $"'{f.FullName}'"))); - return await storePackagedAPI.PublishAsync(app, GetFirstSubmissionDataAsync, AllowTargetFutureDeviceFamilies, output, packageFiles, _browserLauncher, _consoleReader, _zipFileManager, _fileDownloader, _azureBlobManager, _environmentInformationService, _logger, ct); + return await storePackagedAPI.PublishAsync(app, GetFirstSubmissionDataAsync, AllowTargetFutureDeviceFamilies, output, packageFiles, noCommit, _browserLauncher, _consoleReader, _zipFileManager, _fileDownloader, _azureBlobManager, _environmentInformationService, _logger, ct); } protected virtual DirectoryInfo GetInputDirectory(DirectoryInfo projectRootPath) @@ -198,4 +203,4 @@ public Task CanPublishAsync(string pathOrUrl, CancellationToken ct) return CanConfigureAsync(pathOrUrl, ct); } } -} +} \ No newline at end of file diff --git a/MSStore.CLI/ProjectConfigurators/IProjectPublisher.cs b/MSStore.CLI/ProjectConfigurators/IProjectPublisher.cs index a462a27..f77138e 100644 --- a/MSStore.CLI/ProjectConfigurators/IProjectPublisher.cs +++ b/MSStore.CLI/ProjectConfigurators/IProjectPublisher.cs @@ -17,6 +17,6 @@ internal interface IProjectPublisher SearchOption PackageFilesSearchOption { get; } AllowTargetFutureDeviceFamily[] AllowTargetFutureDeviceFamilies { get; } Task CanPublishAsync(string pathOrUrl, CancellationToken ct); - Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, IStorePackagedAPI storePackagedAPI, CancellationToken ct); + Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, bool noCommit, IStorePackagedAPI storePackagedAPI, CancellationToken ct); } -} +} \ No newline at end of file diff --git a/MSStore.CLI/ProjectConfigurators/MSIXProjectPublisher.cs b/MSStore.CLI/ProjectConfigurators/MSIXProjectPublisher.cs index a26b136..a3a83fa 100644 --- a/MSStore.CLI/ProjectConfigurators/MSIXProjectPublisher.cs +++ b/MSStore.CLI/ProjectConfigurators/MSIXProjectPublisher.cs @@ -18,7 +18,11 @@ namespace MSStore.CLI.ProjectConfigurators { internal class MSIXProjectPublisher : IProjectPublisher { - public string[] PackageFilesExtensionInclude => new[] { ".msix", ".msixbundle" }; + public string[] PackageFilesExtensionInclude => new[] + { + ".msix", + ".msixbundle" + }; public override string ToString() => "MSIX"; @@ -100,7 +104,7 @@ public Task CanPublishAsync(string pathOrUrl, CancellationToken ct) return Task.FromResult(_appXManifestManager.GetAppId(appxManifest)); } - public async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, IStorePackagedAPI storePackagedAPI, CancellationToken ct) + public async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, bool noCommit, IStorePackagedAPI storePackagedAPI, CancellationToken ct) { var msix = new FileInfo(pathOrUrl); @@ -130,11 +134,14 @@ public async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, var output = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "MSStore", "TempUpload", Path.GetFileNameWithoutExtension(Path.GetRandomFileName()))); - var packageFiles = new List { msix }; + var packageFiles = new List + { + msix + }; _logger.LogInformation("Trying to publish these {FileCount} files: {FileNames}", packageFiles.Count, string.Join(", ", packageFiles.Select(f => $"'{f.FullName}'"))); - return await storePackagedAPI.PublishAsync(_app, GetFirstSubmissionDataAsync, AllowTargetFutureDeviceFamilies, output, packageFiles, _browserLauncher, _consoleReader, _zipFileManager, _fileDownloader, _azureBlobManager, _environmentInformationService, _logger, ct); + return await storePackagedAPI.PublishAsync(_app, GetFirstSubmissionDataAsync, AllowTargetFutureDeviceFamilies, output, packageFiles, noCommit, _browserLauncher, _consoleReader, _zipFileManager, _fileDownloader, _azureBlobManager, _environmentInformationService, _logger, ct); } private Task<(string Description, List Images)> GetFirstSubmissionDataAsync(string listingLanguage, CancellationToken ct) @@ -142,4 +149,4 @@ private Task<(string Description, List Images)> GetFirstSubmiss throw new NotImplementedException("This seems to be your first submission for this app. We don't support first submission loose MSIX files."); } } -} +} \ No newline at end of file diff --git a/MSStore.CLI/ProjectConfigurators/PWAProjectConfigurator.cs b/MSStore.CLI/ProjectConfigurators/PWAProjectConfigurator.cs index 0c21f37..ed209c0 100644 --- a/MSStore.CLI/ProjectConfigurators/PWAProjectConfigurator.cs +++ b/MSStore.CLI/ProjectConfigurators/PWAProjectConfigurator.cs @@ -55,8 +55,17 @@ internal class PWAProjectConfigurator : IProjectConfigurator, IProjectPackager, public override string ToString() => "PWA"; - public string[] PackageFilesExtensionInclude => new[] { ".appxbundle", ".msixbundle", ".msix", ".appx" }; - public string[]? PackageFilesExtensionExclude { get; } = new[] { ".sideload.msix" }; + public string[] PackageFilesExtensionInclude => new[] + { + ".appxbundle", + ".msixbundle", + ".msix", + ".appx" + }; + public string[]? PackageFilesExtensionExclude { get; } = new[] + { + ".sideload.msix" + }; public SearchOption PackageFilesSearchOption { get; } = SearchOption.AllDirectories; public IEnumerable? DefaultBuildArchs { get; } @@ -229,13 +238,11 @@ public async Task<(int returnCode, DirectoryInfo? outputDirectory)> ConfigureAsy AllowSigning = true, ClassicPackage = new ClassicPackage { - Generate = true, - Version = classicVersion.ToString() + Generate = true, Version = classicVersion.ToString() }, Publisher = new Publisher { - DisplayName = publisherDisplayName, - CommonName = app.PublisherName + DisplayName = publisherDisplayName, CommonName = app.PublisherName }, ResourceLanguage = "en-us", // TODO: parametrize this }, @@ -284,8 +291,7 @@ public async Task<(int returnCode, DirectoryInfo? outputDirectory)> ConfigureAsy await _pwaAppInfoManager.SaveAsync( new PWAAppInfo { - AppId = app.Id, - Uri = uri, + AppId = app.Id, Uri = uri, }, zipDir, ct); @@ -319,7 +325,7 @@ public Task<(int returnCode, DirectoryInfo? outputDirectory)> PackageAsync(strin return Task.FromResult((0, (DirectoryInfo?)new DirectoryInfo(pathOrUrl))); } - public async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, IStorePackagedAPI storePackagedAPI, CancellationToken ct) + public async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, DirectoryInfo? inputDirectory, bool noCommit, IStorePackagedAPI storePackagedAPI, CancellationToken ct) { Uri? uri = GetUri(pathOrUrl); @@ -374,8 +380,8 @@ public async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, } var packageFiles = pwaBuilderExtractedBundle.GetFiles("*.*", PackageFilesSearchOption) - .Where(f => PackageFilesExtensionInclude.Contains(f.Extension, StringComparer.OrdinalIgnoreCase) - && PackageFilesExtensionExclude?.All(e => !f.Name.EndsWith(e, StringComparison.OrdinalIgnoreCase)) != false); + .Where(f => PackageFilesExtensionInclude.Contains(f.Extension, StringComparer.OrdinalIgnoreCase) + && PackageFilesExtensionExclude?.All(e => !f.Name.EndsWith(e, StringComparison.OrdinalIgnoreCase)) != false); if (packageFiles?.Any() != true) { @@ -389,6 +395,7 @@ public async Task PublishAsync(string pathOrUrl, DevCenterApplication? app, AllowTargetFutureDeviceFamilies, output, packageFiles, + noCommit, _browserLauncher, _consoleReader, _zipFileManager, @@ -472,4 +479,4 @@ public Task CanPublishAsync(string pathOrUrl, CancellationToken ct) return CanConfigureAsync(pathOrUrl, ct); } } -} +} \ No newline at end of file