Compare commits

...

4 Commits

Author SHA1 Message Date
Louis Lam
e4aedeb7af WIP 2023-08-11 21:26:25 +08:00
Louis Lam
642136780f WIP 2023-08-11 20:27:57 +08:00
Louis Lam
80d5f6840b Merge branch '2.0.X' into npm-publish 2023-08-11 20:27:34 +08:00
Louis Lam
d76a515cbf WIP 2023-08-03 20:51:11 +08:00
5 changed files with 159 additions and 18 deletions

View File

@@ -1,3 +1,5 @@
# Should be very similar to .npmignore, but the syntax is a bit different
/.idea
/node_modules
/data*
@@ -12,9 +14,8 @@
**/.gitignore
**/docker-compose*
**/[Dd]ockerfile*
LICENSE
README.md
.editorconfig
.vs
.vscode
.eslint*
.stylelint*
@@ -32,22 +33,15 @@ tsconfig.json
/tmp
/babel.config.js
/ecosystem.config.js
/extra/healthcheck.exe
/extra/healthcheck
extra/exe-builder
/public
### .gitignore content (commented rules are duplicated)
#node_modules
.DS_Store
#dist
dist-ssr
*.local
#.idea
#/data
#!/data/.gitkeep
#.vscode
### End of .gitignore content
# .dockerignore only, not in .npmignore
/extra/healthcheck.exe
/extra/healthcheck
LICENSE
README.md

45
.npmignore Normal file
View File

@@ -0,0 +1,45 @@
# Should be very similar to .dockerignore, but the syntax is a bit different
/.idea
/node_modules
/data
/cypress
/out
/test
/kubernetes
/.do
/.dockerignore
/private
/.git
/.gitignore
/docker-compose*
/[Dd]ockerfile*
.editorconfig
.vs
.vscode
.eslint*
.stylelint*
/.devcontainer
/.github
yarn.lock
app.json
CODE_OF_CONDUCT.md
CONTRIBUTING.md
CNAME
install.sh
SECURITY.md
tsconfig.json
.env
/tmp
/babel.config.js
/ecosystem.config.js
extra/exe-builder
/public
.DS_Store
dist-ssr
*.local
## .npmignore only, not in .dockerignore
/docker
/extra/healthcheck*

75
extra/cli.js Normal file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/env node
const path = require("path");
const args = require("args-parser")(process.argv);
// Set the data directory
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);
}
}
// Change the working directory to the root of the project, so it can read the dist folder
process.chdir(path.join(__dirname, ".."));
if (args.run) {
require("../server/server");
} else if (args.installService) {
if (process.platform === "win32") {
let Service = require("node-windows").Service;
// Create a new service object
let svc = new Service({
name: "Uptime Kuma",
description: "Uptime Kuma is an easy-to-use self-hosted monitoring tool.",
script: "C:\\path\\to\\helloworld.js",
nodeOptions: [
"--harmony",
"--max_old_space_size=4096"
]
//, workingDirectory: '...'
//, allowServiceLogon: true
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on("install", function () {
svc.start();
});
svc.install();
} else if (process.platform === "linux") {
} else {
console.error("Unable to install service on platform: " + process.platform);
process.exit(1);
}
} else if (args.version || args.v) {
const version = require("../package.json").version;
console.log("Uptime Kuma version: " + version);
} else {
console.log(`Usage: uptime-kuma [options]
Options:
--install-service Install Uptime Kuma service (Windows and Linux only)
--uninstall-service Uninstall Uptime Kuma service
--run Run Uptime Kuma directly in the terminal
--data-dir="your path" Set the data directory
--version Print the version
--help Print this help
`);
}

18
package-lock.json generated
View File

@@ -53,6 +53,7 @@
"nanoid": "~3.3.4",
"node-cloudflared-tunnel": "~1.0.9",
"node-radius-client": "~1.0.0",
"node-windows": "^1.0.0-beta.8",
"nodemailer": "~6.6.5",
"nostr-tools": "^1.13.1",
"notp": "~2.0.3",
@@ -76,6 +77,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",
@@ -14642,6 +14646,15 @@
"node": ">= 10"
}
},
"node_modules/node-windows": {
"version": "1.0.0-beta.8",
"resolved": "https://registry.npmjs.org/node-windows/-/node-windows-1.0.0-beta.8.tgz",
"integrity": "sha512-uLekXnSeem3nW5escID224Fd0U/1VtvE796JpSpOY+c73Cslz/Qn2WUHRJyPQJEMrNGAy/FMRFjjhh4z1alZTA==",
"dependencies": {
"xml": "1.0.1",
"yargs": "^17.5.1"
}
},
"node_modules/nodemailer": {
"version": "6.6.5",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.5.tgz",
@@ -19016,6 +19029,11 @@
}
}
},
"node_modules/xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw=="
},
"node_modules/xmlbuilder": {
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz",

View File

@@ -1,5 +1,6 @@
{
"name": "uptime-kuma",
"description": "Uptime Kuma is an easy-to-use self-hosted monitoring tool",
"version": "1.23.0-beta.1",
"license": "MIT",
"repository": {
@@ -9,7 +10,11 @@
"engines": {
"node": "14 || 16 || 18 || >= 20.4.0"
},
"bin": {
"uptime-kuma": "./extra/cli.js"
},
"scripts": {
"uptime-kuma": "node ./extra/cli.js",
"install-legacy": "npm install",
"update-legacy": "npm update",
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
@@ -55,8 +60,8 @@
"simple-dns-server": "node extra/simple-dns-server.js",
"simple-mqtt-server": "node extra/simple-mqtt-server.js",
"update-language-files": "cd extra/update-language-files && node index.js && cross-env-shell eslint ../../src/languages/$npm_config_language.js --fix",
"release-final": "node ./extra/test-docker.js && node extra/update-version.js && npm run build-docker && node ./extra/press-any-key.js && npm run upload-artifacts && node ./extra/update-wiki-version.js",
"release-beta": "node ./extra/test-docker.js && node extra/beta/update-version.js && npm run build && node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:$VERSION -t louislam/uptime-kuma:beta . --target release --push && node ./extra/press-any-key.js && npm run upload-artifacts",
"release-final": "node ./extra/test-docker.js && node extra/update-version.js && npm run build-docker && node ./extra/press-any-key.js && npm run upload-artifacts && node ./extra/update-wiki-version.js && npm run publish-to-npm",
"release-beta": "node ./extra/test-docker.js && node extra/beta/update-version.js && npm run build && node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:$VERSION -t louislam/uptime-kuma:beta . --target release --push && node ./extra/press-any-key.js && npm run upload-artifacts && npm run publish-to-npm-beta",
"git-remove-tag": "git tag -d",
"build-dist-and-restart": "npm run build && npm run start-server-dev",
"start-pr-test": "node extra/checkout-pr.js && npm install && npm run dev",
@@ -68,7 +73,10 @@
"deploy-demo-server": "node extra/deploy-demo-server.js",
"sort-contributors": "node extra/sort-contributors.js",
"quick-run-nightly": "docker run --rm --env NODE_ENV=development -p 3001:3001 louislam/uptime-kuma:nightly2",
"start-dev-container": "cd docker && docker-compose -f docker-compose-dev.yml up --force-recreate"
"start-dev-container": "cd docker && docker-compose -f docker-compose-dev.yml up --force-recreate",
"publish-to-npm-dev": "npm run build && npm publish --tag dev",
"publish-to-npm-beta": "npm publish --tag beta",
"publish-to-npm": "npm publish"
},
"dependencies": {
"@grpc/grpc-js": "~1.7.3",
@@ -115,6 +123,7 @@
"nanoid": "~3.3.4",
"node-cloudflared-tunnel": "~1.0.9",
"node-radius-client": "~1.0.0",
"node-windows": "^1.0.0-beta.8",
"nodemailer": "~6.6.5",
"nostr-tools": "^1.13.1",
"notp": "~2.0.3",