1
0
Fork 0
forked from svrjs/svrjs

Add SVR.JS name and documentation URL to svrjs.json file.

This commit is contained in:
Dorian Niemiec 2024-08-24 17:13:59 +02:00
parent 1161256ab9
commit 519e68465a
9 changed files with 29 additions and 21 deletions

View file

@ -6,7 +6,8 @@ const archiver = require("archiver");
const dependencies = JSON.parse(fs.readFileSync(__dirname + "/package.json")).dependencies || {};
const requiredDependencyList = Object.keys(dependencies);
let dependencyList = Object.keys(dependencies);
const version = JSON.parse(fs.readFileSync(__dirname + "/svrjs.json")).version;
const svrjsInfo = JSON.parse(fs.readFileSync(__dirname + "/svrjs.json"));
const {name, version, documentationURL} = svrjsInfo;
// Function to find and add all dependencies into the dependencyList array.
function findAllDependencies(curList) {
@ -53,7 +54,8 @@ let licenseElements = "";
dependencyList.forEach((dependency) => {
const packageJSON = JSON.parse(fs.readFileSync(__dirname + "/node_modules/" + dependency.replace(/\/\.\./g,"") + "/package.json").toString());
licenseElements += licenseElementTemplate({
name: packageJSON.name,
moduleName: packageJSON.name,
name: name,
license: packageJSON.license,
description: packageJSON.description || "No description",
author: packageJSON.author ? packageJSON.author.name : packageJSON.author,
@ -63,24 +65,28 @@ dependencyList.forEach((dependency) => {
// Generate pages
const licensesPage = layoutTemplate({
title: "SVR.JS " + version + " Licenses",
title: name + " " + version + " Licenses",
content: licensesTemplate({
name: name,
version: version,
licenses: licenseElements
})
});
const testsPage = layoutTemplate({
title: "SVR.JS " + version + " Tests",
title: name + " " + version + " Tests",
content: testsTemplate({
name: name,
version: version
})
});
const indexPage = layoutTemplate({
title: "SVR.JS " + version,
title: name + " " + version,
content: indexTemplate({
version: version
name: name,
version: version,
documentationURL: documentationURL
})
});

View file

@ -4,7 +4,7 @@ const fs = require("fs");
//const getOS = require("./utils/getOS.js");
const generateServerString = require("./utils/generateServerString.js")
const svrjsInfo = require("../svrjs.json");
const version = svrjsInfo.version;
const {version} = svrjsInfo;
//const parseURL = require("./utils/urlParser.js");
//const fixNodeMojibakeURL = require("./utils/urlMojibakeFixer.js");

View file

@ -5,7 +5,6 @@ const generateErrorStack = require("../utils/generateErrorStack.js");
const generateServerString = require("../utils/generateServerString.js");
const serverHTTPErrorDescs = require("../res/httpErrorDescriptions.js");
const fixNodeMojibakeURL = require("../utils/urlMojibakeFixer.js");
//const getOS = require("../utils/getOS.js");
const ipMatch = require("../utils/ipMatch.js");
const svrjsInfo = require("../../svrjs.json");
const version = svrjsInfo.version;

View file

@ -1,10 +1,11 @@
const svrjsInfo = require("../../svrjs.json");
const version = svrjsInfo.version;
const {version, name} = svrjsInfo;
const getOS = require("./getOS.js");
function generateServerString(exposeServerVersion) {
return exposeServerVersion
? "SVR.JS/" +
? name +
"/" +
version +
" (" +
getOS() +
@ -13,7 +14,7 @@ function generateServerString(exposeServerVersion) {
? "Bun/v" + process.versions.bun + "; like Node.JS/" + process.version
: "Node.JS/" + process.version) +
")"
: "SVR.JS";
: name;
}
module.exports = generateServerString;

View file

@ -1,3 +1,5 @@
{
"version": "Nightly-GitNext"
"version": "Nightly-GitNext",
"name": "SVR.JS",
"documentationURL": "https://svrjs.org/docs"
}

View file

@ -1,4 +1,4 @@
<h1>Welcome to SVR.JS <%= version %></h1>
<h1>Welcome to <%= name %> <%= version %></h1>
<% if (version.indexOf("Nightly-") == 0) { %>
<div style="background-color: #ffff00; color: #000000; border-color: #ff7f00; border-width: 5px; border-style: solid; padding: 5px; display: inline-block;">
<b style="font-size: 26px">WARNING!</b><br />
@ -82,8 +82,8 @@
<p>
<a href="/tests.html">Tests</a><br />
<a href="/licenses/">Licenses</a><br />
<a href="/svrjsstatus.svr">SVR.JS status page</a><br />
<a href="https://svrjs.org/docs">SVR.JS documentation</a>
<a href="/svrjsstatus.svr"><%= name %> status page</a><br />
<a href="<%= documentationURL %>"><%= name %> documentation</a>
</p>
<img src="/powered.png" />
</body>

View file

@ -1,10 +1,10 @@
<div style="width: 100%; background-color: #ccc; background-color: rgba(200, 200, 200, 0.3); border: 1px solid green; text-align: left; margin: 10px 0;">
<div style="float: right;">License: <%= license %></div>
<div style="font-size: 20px;">
<b><%= name %></b><% if (author) { %> (by <%= author %>)<% } %>
<b><%= moduleName %></b><% if (author) { %> (by <%= author %>)<% } %>
</div>
<div style="font-size: 12px;">
<%= description %><% if (required) { %><br/>
<b>Required by SVR.JS.</b><% } %>
<b>Required by <%= name %>.</b><% } %>
</div>
</div>

View file

@ -1,5 +1,5 @@
<h1>SVR.JS <%= version %> Licenses</h1>
<h2>SVR.JS <%= version %></h2>
<h1><%= name %> <%= version %> Licenses</h1>
<h2><%= name %> <%= version %></h2>
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
MIT License<br/>
<br/>
@ -23,7 +23,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
SOFTWARE.<br/>
</div>
<h2>Packages used by SVR.JS <%= version %></h2>
<h2>Packages used by <%= name %> <%= version %></h2>
<div style="width: 100%; max-width: 1280px; margin: auto">
<%- licenses %>
</div>

View file

@ -1,4 +1,4 @@
<h1>SVR.JS <%= version %> Tests</h1>
<h1><%= name %> <%= version %> Tests</h1>
<h2>Directory (without trailing slash)</h2>
<iframe src="/testdir" width="75%" height="300px"></iframe>
<h2>Directory (with query)</h2>