mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-09 23:47:38 +00:00
Add worflow to crawl APP verisons (#3192)
* Add worflow to crawl verisons * Update Test
This commit is contained in:
committed by
GitHub
parent
64d5caae15
commit
7cc4fee48b
@ -3,13 +3,14 @@ import { promises as fs } from "fs";
|
||||
import path from "path";
|
||||
import { ScriptSchema, type Script } from "@/app/json-editor/_schemas/schemas";
|
||||
import { Metadata } from "@/lib/types";
|
||||
|
||||
console.log('Current directory: ' + process.cwd());
|
||||
const jsonDir = "public/json";
|
||||
const metadataFileName = "metadata.json";
|
||||
const versionsFileName = "versions.json";
|
||||
const encoding = "utf-8";
|
||||
|
||||
const fileNames = (await fs.readdir(jsonDir))
|
||||
.filter((fileName) => fileName !== metadataFileName)
|
||||
.filter((fileName) => fileName !== metadataFileName && fileName !== versionsFileName);
|
||||
|
||||
describe.each(fileNames)("%s", async (fileName) => {
|
||||
let script: Script;
|
||||
@ -20,6 +21,7 @@ describe.each(fileNames)("%s", async (fileName) => {
|
||||
script = JSON.parse(fileContent);
|
||||
})
|
||||
|
||||
|
||||
it("should have valid json according to script schema", () => {
|
||||
ScriptSchema.parse(script);
|
||||
});
|
||||
@ -27,6 +29,8 @@ describe.each(fileNames)("%s", async (fileName) => {
|
||||
it("should have a corresponding script file", () => {
|
||||
script.install_methods.forEach((method) => {
|
||||
const scriptPath = path.resolve("..", method.script)
|
||||
//FIXME: Dose note account for new dir structure and files in /script/tools
|
||||
|
||||
assert(fs.stat(scriptPath), `Script file not found: ${scriptPath}`)
|
||||
})
|
||||
});
|
||||
@ -40,7 +44,6 @@ describe(`${metadataFileName}`, async () => {
|
||||
const fileContent = await fs.readFile(filePath, encoding)
|
||||
metadata = JSON.parse(fileContent);
|
||||
})
|
||||
|
||||
it("should have valid json according to metadata schema", () => {
|
||||
// TODO: create zod schema for metadata. Move zod schemas to /lib/types.ts
|
||||
assert(metadata.categories.length > 0);
|
||||
|
@ -7,6 +7,7 @@ export const dynamic = "force-static";
|
||||
|
||||
const jsonDir = "public/json";
|
||||
const metadataFileName = "metadata.json";
|
||||
const versionFileName = "version.json";
|
||||
const encoding = "utf-8";
|
||||
|
||||
const getMetadata = async () => {
|
||||
@ -18,7 +19,7 @@ const getMetadata = async () => {
|
||||
|
||||
const getScripts = async () => {
|
||||
const filePaths = (await fs.readdir(jsonDir))
|
||||
.filter((fileName) => fileName !== metadataFileName)
|
||||
.filter((fileName) => fileName !== metadataFileName && fileName !== versionFileName)
|
||||
.map((fileName) => path.resolve(jsonDir, fileName));
|
||||
|
||||
const scripts = await Promise.all(
|
||||
|
Reference in New Issue
Block a user