Skip to content

Commit

Permalink
Hide installer version selection, and fix package name validation.
Browse files Browse the repository at this point in the history
Closes #73
Closes #72
  • Loading branch information
modmuss50 committed Dec 14, 2023
1 parent 9a68c98 commit 3ae6b14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion scripts/src/lib/Installer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import DownloadIcon from "./DownloadIcon.svelte";
const win32 = navigator.platform == "Win32"
const showVersionSelection = false;
let expertOptions = false;
let selectedVersion = "";
Expand Down Expand Up @@ -38,7 +39,7 @@

<br />
<br />
{:else}
{:else if showVersionSelection}
{#await getVersion() then latest}
<p>
{#if latest?.stable}Installer Version: {latest.version} (Latest){/if}
Expand Down
4 changes: 2 additions & 2 deletions scripts/src/lib/template/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export function getJavaVersion(minecraftVersion: string): JavaVersion {
return JAVA_17;
}

const JAVA_PACKAGE_REGEX = /^[a-zA-Z]+(\.[a-zA-Z][a-zA-Z0-9]*)*$/;
const JAVA_PACKAGE_REGEX = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/;
const RESERVED_PACKAGE_PREFIXES = ["net.minecraft.", "com.mojang.", "net.fabricmc.", "java."];

export function computePackageNameErrors(packageName: string): string[] {
let errorList : string[] = [];

if (!JAVA_PACKAGE_REGEX.test(packageName)) {
if (!JAVA_PACKAGE_REGEX.test(packageName.toLowerCase())) {
errorList.push("Package name is not a valid Java package name!");
}

Expand Down

0 comments on commit 3ae6b14

Please sign in to comment.