Remove npm legacy errors, created single source of truth for ESlint. updated analytics url. updated script background (#5498)

* Update ScriptAccordion and ScriptItem components for improved styling

* Add README.md for Proxmox VE Helper-Scripts Frontend

* Remove testing dependencies and related test files from the frontend project

* Update analytics URL in siteConfig to point to community-scripts.org

* Refactor ESLint configuration to have one source of truth and run "npm lint" to apply new changes

* Update lint script in package.json to remove npm

* Add 'next' option to ESLint configuration for improved compatibility

* Update package dependencies and versions in package.json and package-lock.json

* Refactor theme provider import and enhance calendar component for dynamic icon rendering

* rename sidebar, alerts and buttons

* rename description and interfaces files

* rename more files

* change folder name

* Refactor tooltip logic to improve updateable condition handling

* Enhance CommandMenu to prevent duplicate scripts across categories

* Remove test step from frontend CI/CD workflow
This commit is contained in:
Bram Suurd 2025-06-28 00:38:09 +02:00 committed by GitHub
parent d60911a063
commit 0067075ed1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
91 changed files with 8049 additions and 4043 deletions

View file

@ -1,7 +1,8 @@
import { Metadata, Script } from "@/lib/types";
import { promises as fs } from "fs";
import { NextResponse } from "next/server";
import path from "path";
import { promises as fs } from "node:fs";
import path from "node:path";
import type { Metadata, Script } from "@/lib/types";
export const dynamic = "force-static";
@ -10,21 +11,21 @@ const metadataFileName = "metadata.json";
const versionFileName = "version.json";
const encoding = "utf-8";
const getMetadata = async () => {
async function getMetadata() {
const filePath = path.resolve(jsonDir, metadataFileName);
const fileContent = await fs.readFile(filePath, encoding);
const metadata: Metadata = JSON.parse(fileContent);
return metadata;
};
}
const getScripts = async () => {
async function getScripts() {
const filePaths = (await fs.readdir(jsonDir))
.filter((fileName) =>
fileName.endsWith(".json") &&
fileName !== metadataFileName &&
fileName !== versionFileName
.filter(fileName =>
fileName.endsWith(".json")
&& fileName !== metadataFileName
&& fileName !== versionFileName,
)
.map((fileName) => path.resolve(jsonDir, fileName));
.map(fileName => path.resolve(jsonDir, fileName));
const scripts = await Promise.all(
filePaths.map(async (filePath) => {
@ -34,7 +35,7 @@ const getScripts = async () => {
}),
);
return scripts;
};
}
export async function GET() {
try {
@ -43,7 +44,7 @@ export async function GET() {
const categories = metadata.categories
.map((category) => {
category.scripts = scripts.filter((script) =>
category.scripts = scripts.filter(script =>
script.categories?.includes(category.id),
);
return category;
@ -51,7 +52,8 @@ export async function GET() {
.sort((a, b) => a.sort_order - b.sort_order);
return NextResponse.json(categories);
} catch (error) {
}
catch (error) {
console.error(error as Error);
return NextResponse.json(
{ error: "Failed to fetch categories" },

View file

@ -1,9 +1,9 @@
import { AppVersion } from "@/lib/types";
import { error } from "console";
import { promises as fs } from "fs";
// import Error from "next/error";
import { NextResponse } from "next/server";
import path from "path";
import { promises as fs } from "node:fs";
import path from "node:path";
import type { AppVersion } from "@/lib/types";
export const dynamic = "force-static";
@ -11,33 +11,32 @@ const jsonDir = "public/json";
const versionsFileName = "versions.json";
const encoding = "utf-8";
const getVersions = async () => {
async function getVersions() {
const filePath = path.resolve(jsonDir, versionsFileName);
const fileContent = await fs.readFile(filePath, encoding);
const versions: AppVersion[] = JSON.parse(fileContent);
const modifiedVersions = versions.map(version => {
const modifiedVersions = versions.map((version) => {
let newName = version.name;
newName = newName.toLowerCase().replace(/[^a-z0-9/]/g, '');
newName = newName.toLowerCase().replace(/[^a-z0-9/]/g, "");
return { ...version, name: newName, date: new Date(version.date) };
});
return modifiedVersions;
};
}
export async function GET() {
try {
const versions = await getVersions();
return NextResponse.json(versions);
} catch (error) {
}
catch (error) {
console.error(error);
const err = error as globalThis.Error;
return NextResponse.json({
name: err.name,
message: err.message || "An unexpected error occurred",
version: "No version found - Error"
version: "No version found - Error",
}, {
status: 500,
});