Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support installer declarations #100

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a21f519
add install config definitions
Lordfirespeed Feb 14, 2024
5133b24
add install config to encompassing config
Lordfirespeed Feb 14, 2024
d5386ae
allow config providers to provide install config
Lordfirespeed Feb 14, 2024
f482371
add base implementation of GetInstallConfig
Lordfirespeed Feb 14, 2024
fa553fa
add InstallData member to ThunderstoreProject
Lordfirespeed Feb 14, 2024
e78e738
initialize Install data from parameterless ctor
Lordfirespeed Feb 14, 2024
2f48028
Initialize Install data from Config instance
Lordfirespeed Feb 14, 2024
477927e
override GetInstallConfig in ProjectFileConfig (provider)
Lordfirespeed Feb 14, 2024
a579ec7
add installer declarations field to package manifest definition
Lordfirespeed Feb 14, 2024
3344202
Write install config from `Config` instance to `PackageManifestV1` wh…
Lordfirespeed Feb 14, 2024
9b61bc4
remove unused 'using' directives
Lordfirespeed Feb 14, 2024
577b6af
to expression-bodied properties
Lordfirespeed Feb 14, 2024
bb8f07c
implement GetInstallConfig for default config provider
Lordfirespeed Feb 14, 2024
6f57fbc
update to language version 12
Lordfirespeed Feb 14, 2024
a7ec319
use collection expressions
Lordfirespeed Feb 14, 2024
96b2969
standardise fluent-chaining newlines
Lordfirespeed Feb 14, 2024
8899748
remove redundant empty parameters `()`
Lordfirespeed Feb 14, 2024
cd9a6d1
remove redundant null-forgiving
Lordfirespeed Feb 14, 2024
1b3bcb6
remove inaccurate nullable return type annotations
Lordfirespeed Feb 14, 2024
9dddd68
add JsonIgnore attribute to computed FullName property
Lordfirespeed Feb 15, 2024
05a142e
extract MergeConfigFromProvider method
Lordfirespeed Feb 15, 2024
7010ed5
add BlankConfig and DefaultConfig getters
Lordfirespeed Feb 15, 2024
db7ed25
use default config for `tcli init` command
Lordfirespeed Feb 15, 2024
20e6bcc
move default values out of ThunderstoreProject into DefaultConfig
Lordfirespeed Feb 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove redundant empty parameters ()
  • Loading branch information
Lordfirespeed committed Feb 14, 2024
commit 88997480b1f18aff0644785e5cd79251876825dd
2 changes: 1 addition & 1 deletion ThunderstoreCLI/API/ApiHelper.cs
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ public HttpRequestMessage GetPackagesV1(string community)

private static string SerializeFileData(string filePath)
{
return new FileData()
return new FileData
{
Filename = Path.GetFileName(filePath),
Filesize = new FileInfo(filePath).Length
2 changes: 1 addition & 1 deletion ThunderstoreCLI/Commands/BuildCommand.cs
Original file line number Diff line number Diff line change
@@ -296,7 +296,7 @@ public static string SerializeManifest(Config config)
var dependencies = config.PackageConfig.Dependencies ?? new Dictionary<string, string>();
IEnumerable<InstallerDeclaration>? installerDeclarations = config.InstallConfig.InstallerDeclarations;
installerDeclarations ??= Array.Empty<InstallerDeclaration>();
var manifest = new PackageManifestV1()
var manifest = new PackageManifestV1
{
Namespace = config.PackageConfig.Namespace,
Name = config.PackageConfig.Name,
2 changes: 1 addition & 1 deletion ThunderstoreCLI/Commands/PublishCommand.cs
Original file line number Diff line number Diff line change
@@ -253,7 +253,7 @@ private static void PublishPackageRequest(Config config, string uploadUuid)
throw new PublishCommandException();
}

return new CompletedUpload.CompletedPartData()
return new CompletedUpload.CompletedPartData
{
ETag = response.Headers.ETag.Tag,
PartNumber = part.PartNumber
16 changes: 8 additions & 8 deletions ThunderstoreCLI/Configuration/CLIParameterConfig.cs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ public BaseConfig(T options)

public override GeneralConfig GetGeneralConfig()
{
return new GeneralConfig()
return new GeneralConfig
{
TcliConfig = options.TcliDirectory,
Repository = options.Repository
@@ -29,7 +29,7 @@ public CLIParameterConfig(T opts) : base(opts) { }
{
if (options == null)
return null;
return new PackageConfig()
return new PackageConfig
{
ProjectConfigPath = options.ConfigPath,
Namespace = options.Namespace,
@@ -45,7 +45,7 @@ public CLIInitCommandConfig(InitOptions options) : base(options) { }

public override InitConfig GetInitConfig()
{
return new InitConfig()
return new InitConfig
{
Overwrite = options.Overwrite
};
@@ -63,15 +63,15 @@ public CLIPublishCommandConfig(PublishOptions options) : base(options) { }

public override PublishConfig GetPublishConfig()
{
return new PublishConfig()
return new PublishConfig
{
File = options.File
};
}

public override AuthConfig GetAuthConfig()
{
return new AuthConfig()
return new AuthConfig
{
AuthToken = options.Token
};
@@ -84,7 +84,7 @@ public ModManagementCommandConfig(ModManagementOptions options) : base(options)

public override ModManagementConfig? GetModManagementConfig()
{
return new ModManagementConfig()
return new ModManagementConfig
{
GameIdentifer = options.GameName,
ProfileName = options.Profile,
@@ -99,7 +99,7 @@ public GameImportCommandConfig(GameImportOptions options) : base(options) { }

public override GameImportConfig? GetGameImportConfig()
{
return new GameImportConfig()
return new GameImportConfig
{
ExePath = options.ExePath,
GameId = options.GameId,
@@ -113,7 +113,7 @@ public RunGameCommandConfig(RunGameOptions options) : base(options) { }

public override RunGameConfig? GetRunGameConfig()
{
return new RunGameConfig()
return new RunGameConfig
{
GameName = options.GameName,
ProfileName = options.Profile,
2 changes: 1 addition & 1 deletion ThunderstoreCLI/Configuration/Config.cs
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ public string GetBuildOutputFile()

public PackageUploadMetadata GetUploadMetadata(string fileUuid)
{
return new PackageUploadMetadata()
return new PackageUploadMetadata
{
AuthorName = PackageConfig.Namespace,
Categories = PublishConfig.Categories!.GetOrDefault("") ?? Array.Empty<string>(),
10 changes: 5 additions & 5 deletions ThunderstoreCLI/Configuration/DefaultConfig.cs
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ class DefaultConfig : EmptyConfig
{
public override GeneralConfig? GetGeneralConfig()
{
return new GeneralConfig()
return new GeneralConfig
{
Repository = Defaults.REPOSITORY_URL
};
}

public override PackageConfig GetPackageMeta()
{
return new PackageConfig()
return new PackageConfig
{
ProjectConfigPath = Defaults.PROJECT_CONFIG_PATH,
Namespace = "AuthorName",
@@ -30,15 +30,15 @@ public override PackageConfig GetPackageMeta()

public override InitConfig GetInitConfig()
{
return new InitConfig()
return new InitConfig
{
Overwrite = false
};
}

public override BuildConfig GetBuildConfig()
{
return new BuildConfig()
return new BuildConfig
{
IconPath = "./icon.png",
ReadmePath = "./README.md",
@@ -49,7 +49,7 @@ public override BuildConfig GetBuildConfig()

public override PublishConfig GetPublishConfig()
{
return new PublishConfig()
return new PublishConfig
{
File = null
};
2 changes: 1 addition & 1 deletion ThunderstoreCLI/Configuration/EnvironmentConfig.cs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ class EnvironmentConfig : EmptyConfig

public override AuthConfig GetAuthConfig()
{
return new AuthConfig()
return new AuthConfig
{
AuthToken = ReadEnv(AUTH_TOKEN)
};
8 changes: 4 additions & 4 deletions ThunderstoreCLI/Configuration/ProjectFileConfig.cs
Original file line number Diff line number Diff line change
@@ -25,15 +25,15 @@ public override void Parse(Config currentConfig)

public override GeneralConfig? GetGeneralConfig()
{
return new GeneralConfig()
return new GeneralConfig
{
Repository = Project.Publish?.Repository!
};
}

public override PackageConfig? GetPackageMeta()
{
return new PackageConfig()
return new PackageConfig
{
Namespace = Project.Package?.Namespace,
Name = Project.Package?.Name,
@@ -48,7 +48,7 @@ public override void Parse(Config currentConfig)

public override BuildConfig? GetBuildConfig()
{
return new BuildConfig()
return new BuildConfig
{
CopyPaths = Project.Build?.CopyPaths
.Select(static path => new CopyPathMap(path.Source, path.Target))
@@ -61,7 +61,7 @@ public override void Parse(Config currentConfig)

public override PublishConfig? GetPublishConfig()
{
return new PublishConfig()
return new PublishConfig
{
Categories = Project.Publish?.Categories.Categories,
Communities = Project.Publish?.Communities
8 changes: 4 additions & 4 deletions ThunderstoreCLI/Models/ThunderstoreProject.cs
Original file line number Diff line number Diff line change
@@ -143,12 +143,12 @@ public ThunderstoreProject(bool initialize)

public ThunderstoreProject(Config config)
{
Package = new PackageData()
Package = new PackageData
{
Namespace = config.PackageConfig.Namespace!,
Name = config.PackageConfig.Name!
};
Build = new BuildData()
Build = new BuildData
{
Icon = config.GetPackageIconPath(),
OutDir = config.GetBuildOutputDir(),
@@ -157,13 +157,13 @@ public ThunderstoreProject(Config config)
.Select(x => new BuildData.CopyPath { Source = x.From, Target = x.To })
.ToArray()!
};
Publish = new PublishData()
Publish = new PublishData
{
Categories = new CategoryDictionary { Categories = config.PublishConfig.Categories! },
Communities = config.PublishConfig.Communities!,
Repository = config.GeneralConfig.Repository
};
Install = new InstallData()
Install = new InstallData
{
InstallerDeclarations = config.InstallConfig.InstallerDeclarations!
.Select(x => new InstallData.InstallerDeclaration { Identifier = x.Identifier })