mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-04 23:39:22 +00:00
[NAK_CVR_Mods] test
This commit is contained in:
parent
8f8f2ad1fb
commit
a2e29149e2
1 changed files with 17 additions and 9 deletions
16
.github/scripts/update-modlist.js
vendored
16
.github/scripts/update-modlist.js
vendored
|
@ -1,6 +1,5 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const ROOT = '.';
|
const ROOT = '.';
|
||||||
const EXPERIMENTAL = '.Experimental';
|
const EXPERIMENTAL = '.Experimental';
|
||||||
const README_PATH = 'README.md';
|
const README_PATH = 'README.md';
|
||||||
|
@ -46,17 +45,27 @@ function extractDescription(readmePath) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkIfDllExists(modPath, modName) {
|
||||||
|
const dllPath = path.join(modPath, `${modName}.dll`);
|
||||||
|
return fs.existsSync(dllPath);
|
||||||
|
}
|
||||||
|
|
||||||
function formatTable(mods, baseDir) {
|
function formatTable(mods, baseDir) {
|
||||||
if (mods.length === 0) return '';
|
if (mods.length === 0) return '';
|
||||||
|
|
||||||
let rows = mods.map(modPath => {
|
let rows = mods.map(modPath => {
|
||||||
const modName = path.basename(modPath);
|
const modName = path.basename(modPath);
|
||||||
const readmeLink = path.join(modPath, 'README.md');
|
const readmeLink = path.join(modPath, 'README.md');
|
||||||
const dllLink = path.join(modPath, `${modName}.dll`);
|
|
||||||
const readmePath = path.join(modPath, 'README.md');
|
const readmePath = path.join(modPath, 'README.md');
|
||||||
const description = extractDescription(readmePath);
|
const description = extractDescription(readmePath);
|
||||||
|
|
||||||
return `| [${modName}](${readmeLink}) | ${description} | [Download](${dllLink}) |`;
|
// Check if DLL exists and format download cell accordingly
|
||||||
|
const hasDll = checkIfDllExists(modPath, modName);
|
||||||
|
const downloadCell = hasDll
|
||||||
|
? `[Download](${path.join(modPath, `${modName}.dll`)})`
|
||||||
|
: 'No Download';
|
||||||
|
|
||||||
|
return `| [${modName}](${readmeLink}) | ${description} | ${downloadCell} |`;
|
||||||
});
|
});
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -73,7 +82,6 @@ function updateReadme(modListSection) {
|
||||||
const readme = fs.readFileSync(README_PATH, 'utf8');
|
const readme = fs.readFileSync(README_PATH, 'utf8');
|
||||||
const before = readme.split(MARKER_START)[0];
|
const before = readme.split(MARKER_START)[0];
|
||||||
const after = readme.split(MARKER_END)[1];
|
const after = readme.split(MARKER_END)[1];
|
||||||
|
|
||||||
const newReadme = `${before}${MARKER_START}\n\n${modListSection}\n${MARKER_END}${after}`;
|
const newReadme = `${before}${MARKER_START}\n\n${modListSection}\n${MARKER_END}${after}`;
|
||||||
fs.writeFileSync(README_PATH, newReadme);
|
fs.writeFileSync(README_PATH, newReadme);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue