utils: fix locate-pm2

This commit is contained in:
undefined committed 2024-09-18 03:05:56 +08:00
1 parent e521d00a03
commit 4cf6aac436
8 files changed
+38 -31

No files matched your search

+1 -1
View File
@@ -6,6 +6,6 @@
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@elastic/elasticsearch": "^8.14.0"
"@elastic/elasticsearch": "^8.15.0"
}
}
+1 -1
View File
@@ -13,7 +13,7 @@
"schemastery": "^3.14.6",
"semver": "^7.6.3",
"shell-quote": "^1.8.1",
"superagent": "^9.0.2",
"superagent": "^10.1.0",
"ws": "^8.18.0"
},
"preferUnplugged": true,
+5 -5
View File
@@ -12,10 +12,10 @@
},
"preferUnplugged": true,
"dependencies": {
"@aws-sdk/client-s3": "3.645.0",
"@aws-sdk/lib-storage": "3.645.0",
"@aws-sdk/s3-presigned-post": "3.645.0",
"@aws-sdk/s3-request-presigner": "3.645.0",
"@aws-sdk/client-s3": "3.651.1",
"@aws-sdk/lib-storage": "3.651.1",
"@aws-sdk/s3-presigned-post": "3.651.1",
"@aws-sdk/s3-request-presigner": "3.651.1",
"@graphql-tools/schema": "^10.0.6",
"@hydrooj/framework": "workspace:^",
"@hydrooj/utils": "workspace:^",
@@ -49,7 +49,7 @@
"schemastery": "^3.14.6",
"semver": "^7.6.3",
"shorty.js": "^1.0.1",
"superagent": "^9.0.2",
"superagent": "^10.1.0",
"tar": "6.2.1",
"thirty-two": "^1.0.2"
},
+12 -12
View File
@@ -16,16 +16,16 @@
"devDependencies": {
"@blueprintjs/core": "^5.12.0",
"@cordisjs/core": "3.17.3",
"@fontsource/dm-mono": "^5.0.21",
"@fontsource/fira-code": "^5.0.19",
"@fontsource/inconsolata": "^5.0.19",
"@fontsource/jetbrains-mono": "^5.0.21",
"@fontsource/pt-mono": "^5.0.14",
"@fontsource/roboto-mono": "^5.0.19",
"@fontsource/source-code-pro": "^5.0.19",
"@fontsource/ubuntu-mono": "^5.0.21",
"@fontsource/dm-mono": "^5.1.0",
"@fontsource/fira-code": "^5.1.0",
"@fontsource/inconsolata": "^5.1.0",
"@fontsource/jetbrains-mono": "^5.1.0",
"@fontsource/pt-mono": "^5.1.0",
"@fontsource/roboto-mono": "^5.1.0",
"@fontsource/source-code-pro": "^5.1.0",
"@fontsource/ubuntu-mono": "^5.1.0",
"@hydrooj/utils": "workspace:^",
"@sentry/browser": "^8.28.0",
"@sentry/browser": "^8.30.0",
"@sentry/webpack-plugin": "^2.22.4",
"@simplewebauthn/browser": "9.0.1",
"@svgr/webpack": "^8.1.0",
@@ -37,7 +37,7 @@
"@types/nunjucks": "^3.2.6",
"@types/pickadate": "^3.5.35",
"@types/qrcode": "^1.5.5",
"@types/react": "^18.3.5",
"@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0",
"@types/redux-logger": "^3.0.13",
"@types/uuid": "^10.0.0",
@@ -69,7 +69,7 @@
"jquery.easing": "^1.4.1",
"jquery.transit": "^0.9.12",
"matchmedia-polyfill": "^0.3.2",
"md-editor-rt": "^4.19.2",
"md-editor-rt": "^4.20.1",
"mini-css-extract-plugin": "^2.9.1",
"moment": "^2.30.1",
"monaco-editor": "0.50.0",
@@ -131,7 +131,7 @@
"katex": "^0.16.11",
"lodash": "^4.17.21",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^9.1.0",
"markdown-it-anchor": "^9.2.0",
"markdown-it-attrs": "^4.2.0",
"markdown-it-footnote": "^4.0.0",
"markdown-it-imsize": "^2.0.1",
+3
View File
@@ -3,12 +3,15 @@ import path from 'path';
const PATH = process.env.PATH?.split(':') || [];
/* eslint-disable import/no-dynamic-require */
// @ts-ignore
const pm2: typeof import('pm2') | null = (() => {
for (const dir of PATH) {
try {
const info = fs.readlinkSync(path.resolve(dir, 'pm2'));
const p = path.resolve(dir, info);
if (p.startsWith('/nix')) return require(`${p.split('/bin')[0]}/lib/node_modules/pm2`);
// installed by yarn
return require(`${p.split('.bin')[0]}pm2`); // eslint-disable-line import/no-dynamic-require
} catch (e) { }
}