This commit is contained in:
Louis Lam 2023-08-03 20:51:11 +08:00
parent 062e9db2a7
commit d76a515cbf
3 changed files with 24 additions and 0 deletions

18
extra/cli.js Normal file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env node
if (!process.env.DATA_DIR) {
if (process.platform === "win32") {
process.env.DATA_DIR = process.env.LOCALAPPDATA + "\\uptime-kuma\\";
} else if (process.platform === "linux") {
process.env.DATA_DIR = process.env.HOME + "/.local/share/uptime-kuma/";
} else if (process.platform === "darwin") {
// TODO: Not sure if this is the correct path for macOS
process.env.DATA_DIR = process.env.HOME + "/Library/Preferences/uptime-kuma/";
} else {
console.error("Unable to detect app data directory on platform: " + process.platform);
console.error("Please set the DATA_DIR environment variable or `--data-dir=` to the directory where you want to store your data.");
process.exit(1);
}
}
require("../server/server");

3
package-lock.json generated
View file

@ -75,6 +75,9 @@
"thirty-two": "~1.0.2",
"ws": "^8.13.0"
},
"bin": {
"uptime-kuma": "extra/cli.js"
},
"devDependencies": {
"@actions/github": "~5.0.1",
"@babel/eslint-parser": "^7.22.7",

View file

@ -9,6 +9,9 @@
"engines": {
"node": "14 || 16 || 18 || >= 20.4.0"
},
"bin": {
"uptime-kuma": "./extra/cli.js"
},
"scripts": {
"install-legacy": "npm install",
"update-legacy": "npm update",