core: version list

This commit is contained in:
undefined committed 2022-01-13 20:54:11 +08:00
1 parent 133afd2296
commit a718a83cd6
8 files changed
+14 -11

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ console.log('Process', process.pid, 'running as', process.env.NODE_APP_INSTANCE
if (!global.Hydro) {
global.Hydro = {
version: {
node: process.version,
node: process.version.split('v')[1],
hydrooj: require('hydrooj/package.json').version,
},
handler: {},
+4
View File
@@ -29,6 +29,10 @@ export function addon(addonPath: string, prepend = false) {
try {
// Is a npm package
const packagejson = require.resolve(`${addonPath}/package.json`);
// eslint-disable-next-line import/no-dynamic-require
const payload = require(packagejson);
const name = payload.name.startsWith('@hydrooj/') ? payload.name.split('@hydrooj/')[1] : payload.name;
global.Hydro.version[name] = payload.version;
const modulePath = path.dirname(packagejson);
const publicPath = path.resolve(modulePath, 'public');
if (fs.existsSync(publicPath)) {