Remove package.json references and client version

This commit is contained in:
2026-01-09 18:59:20 +01:00
parent 0b5488be00
commit 77152f5d22
4 changed files with 1 additions and 36 deletions

View File

@@ -10,7 +10,6 @@ RUN mvn -B package -DskipTests
FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=build /app/target/imgfloat-*.jar app.jar
COPY package.json ./
EXPOSE 8080 8443
ENV JAVA_OPTS=""
ENTRYPOINT ["sh", "-c", "exec java ${JAVA_OPTS} -jar app.jar"]

View File

@@ -19,9 +19,6 @@ RUNTIME_ENV = IMGFLOAT_ASSETS_PATH=$(IMGFLOAT_ASSETS_PATH) \
SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE=$(SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE) \
SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE=$(SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE)
node_modules: package-lock.json
npm install
.PHONY: build
build:
mvn compile

11
pom.xml
View File

@@ -128,17 +128,6 @@
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>package.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>

View File

@@ -20,13 +20,11 @@ public class VersionService {
private static final Pattern PACKAGE_VERSION_PATTERN = Pattern.compile("\"version\"\\s*:\\s*\"([^\"]+)\"");
private final String serverVersion;
private final String clientVersion;
private final String releaseVersion;
public VersionService() throws IOException {
this.serverVersion = resolveServerVersion();
this.clientVersion = resolveClientVersion();
this.releaseVersion = normalizeReleaseVersion(this.clientVersion);
this.releaseVersion = normalizeReleaseVersion(serverVersion);
}
public String getVersion() {
@@ -143,22 +141,4 @@ public class VersionService {
}
return null;
}
private String resolveClientVersion() throws IOException {
Path packageJsonPath = Paths.get("package.json");
if (!Files.exists(packageJsonPath) || !Files.isRegularFile(packageJsonPath)) {
throw new FileNotFoundException("package.json not found at " + packageJsonPath.toAbsolutePath());
}
String packageJson = Files.readString(packageJsonPath, StandardCharsets.UTF_8);
Matcher matcher = PACKAGE_VERSION_PATTERN.matcher(packageJson);
if (matcher.find()) {
String version = matcher.group(1);
if (version != null && !version.isBlank()) {
return version.trim();
}
}
throw new IllegalStateException("Version not found or invalid in package.json");
}
}