Skip to content

Commit

Permalink
feat: allow missing GameVersion if SML dependency is present
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Aug 11, 2024
1 parent a66ac66 commit 3f247ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/lib/components/versions/VersionForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@
</span>
{/if}

<span><strong>Game version:</strong> {$modMeta.uplugin.GameVersion}<br /></span>
{#if $modMeta.uplugin.GameVersion !== undefined}
<span><strong>Game version:</strong> {$modMeta.uplugin.GameVersion}<br /></span>
{:else}
<span class="text-yellow-600">
{$t('version-form.missing-game-version')}
</span>
{/if}
</p>

<span><strong>Targets:</strong> {$modMeta.targets.join(', ')}<br /></span>
Expand Down
7 changes: 5 additions & 2 deletions src/lib/models/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ const readUPluginJson = async (

const parsed = JSON.parse(uPluginJson) as VersionMetadata['uplugin'];

if (!parsed.GameVersion) {
const hasSMLDependency = parsed.Plugins?.some((plugin) => plugin.Name === 'SML');
const hasGameVersion = !!parsed.GameVersion;

if (!hasSMLDependency && !hasGameVersion) {
return {
message: `missing GameVersion in ${modReference}.uplugin`
message: `either GameVersion or SML dependency must be present in ${modReference}.uplugin`
};
}

Expand Down

0 comments on commit 3f247ae

Please sign in to comment.