Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore(dev): update build guides
johnnyjoy3c0d01108555
diff --git a/.gitignore b/.gitignoreindex ef37960b9..e512e7ab7 100644--- a/.gitignore+++ b/.gitignore@@ -15,11 +15,7 @@ build# Docker Compose Environment File.env-bin/air--dev-dist-dist# VSCode settings-/.vscode+.vscodediff --git a/docs/development-windows.md b/docs/development-windows.mddeleted file mode 100644index 097ed7a16..000000000--- a/docs/development-windows.md+++ /dev/null@@ -1,90 +0,0 @@-# Development in Windows--Memos is built with a curated tech stack. It is optimized for developer experience and is very easy to start working on the code:--1. It has no external dependency.-2. It requires zero config.-3. 1 command to start backend and 1 command to start frontend, both with live reload support.--## Tech Stack--| Frontend | Backend |-| ---------------------------------------- | --------------------------------- |-| [React](https://react.dev/) | [Go](https://go.dev/) |-| [Tailwind CSS](https://tailwindcss.com/) | [SQLite](https://www.sqlite.org/) |-| [Vite](https://vitejs.dev/) | |-| [pnpm](https://pnpm.io/) | |--## Prerequisites--- [Go](https://golang.org/doc/install)-- [Air](https://github.com/cosmtrek/air#installation) for backend live reload-- [Node.js](https://nodejs.org/)-- [pnpm](https://pnpm.io/installation)--## Steps--(Using PowerShell)--1. pull source code-- ```powershell- git clone https://github.com/usememos/memos- # or- gh repo clone usememos/memos- ```--2. cd into the project root directory-- ```powershell- cd memos- ```--3. start backend using air (with live reload)-- ```powershell- air -c .\scripts\.air-windows.toml- ```--4. start frontend dev server-- ```powershell- cd web; pnpm i; pnpm dev- ```--Memos should now be running at [http://localhost:3001](http://localhost:3001) and changing either frontend or backend code would trigger live reload.--## Building--Frontend must be built before backend. The built frontend must be placed in the backend ./server/frontend/dist directory. Otherwise, you will get a "No frontend embedded" error.--### Frontend--```powershell-Move-Item "./server/frontend/dist" "./server/frontend/dist.bak"-cd web; pnpm i --frozen-lockfile; pnpm build; cd ..;-Move-Item "./web/dist" "./server/" -Force-```--### Backend--```powershell-go build -o ./build/memos.exe ./bin/memos/main.go-```--## ❕ Notes--- Start development servers easier by running the provided `start.ps1` script.- This will start both backend and frontend in detached PowerShell windows:-- ```powershell- .\scripts\start.ps1- ```--- Produce a local build easier using the provided `build.ps1` script to build both frontend and backend:-- ```powershell- .\scripts\build.ps1- ```-- This will produce a memos.exe file in the ./build directory.diff --git a/docs/development.md b/docs/development.mdindex 53511ab96..d267ed1c6 100644--- a/docs/development.md+++ b/docs/development.md@@ -9,7 +9,6 @@ Memos is built with a curated tech stack. It is optimized for developer experien## Prerequisites- [Go](https://golang.org/doc/install)-- [Air](https://github.com/cosmtrek/air#installation) for backend live reload- [Node.js](https://nodejs.org/)- [pnpm](https://pnpm.io/installation)@@ -21,12 +20,14 @@ Memos is built with a curated tech stack. It is optimized for developer experiengit clone https://github.com/usememos/memos```-2. Start backend server with [`air`](https://github.com/cosmtrek/air) (with live reload)+2. Build and run backend server```bash- air -c scripts/.air.toml+ sh scripts/build.sh```+ Then you can run the server following building outputs.+3. Install frontend dependencies and generate TypeScript code from protobuf```diff --git a/scripts/.air-windows.toml b/scripts/.air-windows.tomldeleted file mode 100644index edf60cecc..000000000--- a/scripts/.air-windows.toml+++ /dev/null@@ -1,16 +0,0 @@-root = "."-tmp_dir = "build"--[build]-bin = "./build/memos.exe --mode dev"-cmd = "go build -o ./build/memos.exe ./bin/memos/main.go"-delay = 1000-exclude_dir = ["web", "build"]-include_ext = ["go", "mod", "sum"]-exclude_file = []-exclude_regex = []-exclude_unchanged = true-follow_symlink = false-send_interrupt = true-kill_delay = 2000-stop_on_error = truediff --git a/scripts/.air.toml b/scripts/.air.tomldeleted file mode 100644index c0d50eb0f..000000000--- a/scripts/.air.toml+++ /dev/null@@ -1,16 +0,0 @@-root = "."-tmp_dir = "build"--[build]-bin = "./build/memos --mode dev"-cmd = "go build -o ./build/memos ./bin/memos/main.go"-delay = 1000-exclude_dir = ["web", "build"]-include_ext = ["go", "mod", "sum"]-exclude_file = []-exclude_regex = []-exclude_unchanged = true-follow_symlink = false-send_interrupt = true-kill_delay = 2000-stop_on_error = truediff --git a/scripts/build.sh b/scripts/build.shnew file mode 100644index 000000000..5340941a7--- /dev/null+++ b/scripts/build.sh@@ -0,0 +1,29 @@+#!/bin/sh++# Exit when any command fails+set -e++# Get the script directory and change to the project root+cd "$(dirname "$0")/../"++# Detect the operating system+OS=$(uname -s)++# Set output file name based on the OS+if [[ "$OS" == *"CYGWIN"* || "$OS" == *"MINGW"* || "$OS" == *"MSYS"* ]]; then+ OUTPUT="./build/memos.exe"+else+ OUTPUT="./build/memos"+fi++echo "Building for $OS..."++# Build the executable+go build -o "$OUTPUT" ./bin/memos/main.go++# Output the success message+echo "Build successful!"++# Output the command to run+echo "To run the application, execute the following command:"+echo "$OUTPUT --mode dev"