diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f46b17e1a..3f4550928 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,8 +17,11 @@ The frontend code build into "dist" directory. The server (express.js) exposes t ## Directories +- config (dev config files) - data (App data) +- db (Base database and migration scripts) - dist (Frontend build) +- docker (Dockerfiles) - extra (Extra useful scripts) - public (Frontend resources for dev only) - server (Server source code) @@ -80,13 +83,13 @@ Before deep into coding, discussion first is preferred. Creating an empty pull r ## Project Styles -I personally do not like it when something requires so much learning and configuration before you can finally start the app. +I personally do not like something that requires so many configurations before you can finally start the app. I hope Uptime Kuma installation could be as easy as like installing a mobile app. -- Easy to install for non-Docker users, no native build dependency is needed (at least for x86_64), no extra config, no extra effort required to get it running +- Easy to install for non-Docker users, no native build dependency is needed (for x86_64/armv7/arm64), no extra config, no extra effort required to get it running - Single container for Docker users, no very complex docker-compose file. Just map the volume and expose the port, then good to go -- Settings should be configurable in the frontend. Environment variable is not encouraged, unless it is related to startup such as `DATA_DIR`. +- Settings should be configurable in the frontend. Environment variable is not encouraged, unless it is related to startup such as `DATA_DIR` - Easy to use -- The web UI styling should be consistent and nice. +- The web UI styling should be consistent and nice ## Coding Styles @@ -95,7 +98,7 @@ I personally do not like it when something requires so much learning and configu - Follow ESLint - Methods and functions should be documented with JSDoc -## Name convention +## Name Conventions - Javascript/Typescript: camelCaseType - SQLite: snake_case (Underscore) @@ -109,7 +112,7 @@ I personally do not like it when something requires so much learning and configu - IDE that supports ESLint and EditorConfig (I am using IntelliJ IDEA) - A SQLite GUI tool (SQLite Expert Personal is suggested) -## Install dependencies +## Install Dependencies for Development ```bash npm ci @@ -127,6 +130,12 @@ Port `3000` and port `3001` will be used. npm run dev ``` +But sometimes, you would like to keep restart the server, but not the frontend, you can run these command in two terminals: +``` +npm run start-frontend-dev +npm run start-server-dev +``` + ## Backend Server It binds to `0.0.0.0:3001` by default. @@ -142,12 +151,15 @@ express.js is used for: ### Structure in /server/ +- jobs/ (Jobs that are running in another process) - model/ (Object model, auto mapping to the database table name) - modules/ (Modified 3rd-party modules) +- monitor_types (Monitor Types) - notification-providers/ (individual notification logic) - routers/ (Express Routers) - socket-handler (Socket.io Handlers) -- server.js (Server entry point and main logic) +- server.js (Server entry point) +- uptime-kuma-server.js (UptimeKumaServer class, main logic should be here, but some still in `server.js`) ## Frontend Dev Server @@ -198,18 +210,12 @@ Both frontend and backend share the same package.json. However, the frontend dep ### Update Dependencies -Install `ncu` -https://github.com/raineorshine/npm-check-updates - -```bash -ncu -u -t patch -npm install -``` - Since previously updating Vite 2.5.10 to 2.6.0 broke the application completely, from now on, it should update patch release version only. Patch release = the third digit ([Semantic Versioning](https://semver.org/)) +If for maybe security reasons, a library must be updated. Then you must need to check if there are any breaking changes. + ## Translations Please read: https://github.com/louislam/uptime-kuma/tree/master/src/languages