mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: version list
This commit is contained in:
1 parent
133afd2296
commit
a718a83cd6
8 files changed
+14
-11
No files matched your search
@@ -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: {},
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in new issue
Block a user