aRkker-XIV-Plugins/make-pluginmasterjson.js

71 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2022-10-25 19:26:37 +00:00
const fs = require("fs");
var execSync = require("child_process").execSync;
2022-05-06 12:28:26 +00:00
const API_LEVEL = 6;
/*
{
"Author": "aRkker",
"Name": "World Map Enhancer",
"InternalName": "WorldMapEnhancer",
"AssemblyVersion": "1.0.0.1",
"Description": "Simply zoom out by right clicking the world map, like God intended it",
"ApplicableVersion": "any",
"Tags": [
"world",
"map",
"enhance",
"rightclick",
"zoom"
],
"DalamudApiLevel": 6,
"LoadPriority": 0,
"Punchline": "Right click to zoom out the big map",
"IsHide": "False",
"IsTestingExclusive": "False",
"DownloadCount": 0,
"CategoryTags": [
"utility",
"other",
"ui"
],
"LastUpdate": "1651838531",
"DownloadLinkInstall": "https://raw.githubusercontent.com/aRkker/DalamudPlugins/master/plugins/WorldMapEnhancer/latest.zip",
"DownloadLinkTesting": "https://raw.githubusercontent.com/aRkker/DalamudPlugins/master/plugins/WorldMapEnhancer/latest.zip",
"DownloadLinkUpdate": "https://raw.githubusercontent.com/aRkker/DalamudPlugins/master/plugins/WorldMapEnhancer/latest.zip"
}
*/
2022-10-25 19:26:37 +00:00
fs.readdir("./plugins", (err, files) => {
const categoryFallbacks = JSON.parse(fs.readFileSync("./categoryfallbacks.json").toString());
2022-05-06 12:28:26 +00:00
2022-10-25 19:26:37 +00:00
let masterJson = [];
for (let d of files) {
console.log(d);
const pluginJsonPath = `plugins/${d}/${d}.json`;
2022-05-06 12:28:26 +00:00
2022-10-25 19:26:37 +00:00
const pluginJson = JSON.parse(fs.readFileSync(pluginJsonPath).toString());
2022-05-06 12:28:26 +00:00
2022-10-25 19:26:37 +00:00
console.log(pluginJson);
2022-05-06 12:28:26 +00:00
2022-10-25 19:26:37 +00:00
const updatedDate = execSync(`git log -1 --pretty="format:%ct" plugins/${pluginJson.InternalName}/latest.zip`).toString();
2022-05-06 12:28:26 +00:00
2022-10-25 19:26:37 +00:00
const masterJsonInsert = {
...pluginJson,
2022-11-02 23:12:31 +00:00
LastUpdate: updatedDate.length < 2 ? Math.round(Date.now() / 1000) : updatedDate,
2022-10-25 19:26:37 +00:00
IsHide: "False",
DownloadCount: 69420,
IsTestingExclusive: "False",
CategoryTags: pluginJson.CategoryTags ?? categoryFallbacks[pluginJson.InternalName],
2024-07-06 04:00:27 +00:00
DownloadLinkInstall: `https://gitea.vrcp.pm/aRkker/aRkker-XIV-Plugins/raw/branch/master/plugins/${pluginJson.InternalName}/latest.zip`,
DownloadLinkTesting: `https://gitea.vrcp.pm/aRkker/aRkker-XIV-Plugins/raw/branch/master/plugins/${pluginJson.InternalName}/latest.zip`,
DownloadLinkUpdate: `https://gitea.vrcp.pm/aRkker/aRkker-XIV-Plugins/raw/branch/master/plugins/${pluginJson.InternalName}/latest.zip`,
2022-10-25 19:26:37 +00:00
};
2022-05-06 12:28:26 +00:00
2022-10-25 19:26:37 +00:00
masterJson.push(masterJsonInsert);
console.log(masterJsonInsert);
}
2022-05-06 12:28:26 +00:00
2022-10-25 19:26:37 +00:00
fs.writeFileSync("./pluginmaster.json", JSON.stringify(masterJson, null, 2));
});