From 0926005632adafc87e1606c3bc7c1f615f1edc03 Mon Sep 17 00:00:00 2001 From: Medcl Date: Fri, 20 Dec 2024 16:30:36 +0800 Subject: [PATCH] chore: add Makefile (#53) * chore: update license * chore: add Makefile --- Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ web/package.json | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d7ebbd24..6f673376 100755 --- a/Makefile +++ b/Makefile @@ -13,3 +13,45 @@ APP_PLUGIN_FOLDER := plugin # GO15VENDOREXPERIMENT="1" GO111MODULE=off easyjson -all domain.go include ../framework/Makefile + +NVM_VERSION=0.39.3 +NODE_VERSION=16.20.2 +NVM_INSTALL_URL=https://raw.githubusercontent.com/nvm-sh/nvm/v$(NVM_VERSION)/install.sh + +# Initialize the web development environment +init-web-dev: + @if ! command -v nvm > /dev/null 2>&1; then \ + echo "nvm not found. Installing..."; \ + curl -o- $(NVM_INSTALL_URL) | bash; \ + export NVM_DIR="$$(echo ~/.nvm)"; \ + [ -s "$$NVM_DIR/nvm.sh" ] && \. "$$NVM_DIR/nvm.sh"; \ + fi; \ + export NVM_DIR="$$(echo ~/.nvm)"; \ + [ -s "$$NVM_DIR/nvm.sh" ] && \. "$$NVM_DIR/nvm.sh"; \ + nvm install $(NODE_VERSION); \ + nvm use $(NODE_VERSION); \ + echo "Using Node.js version: $$(node -v)"; \ + (cd web && npm install) + +# Clean node_modules +clean-web-dev: + @echo "Cleaning node_modules..." + @(cd web && rm -rf node_modules) + @echo "Done." + +# Lint the code +web-lint: + @echo "Running lint..." + @(cd web && npx eslint . --ext .js,.jsx,.ts,.tsx) + @echo "Linting complete." + +# Build the web app +build-web: + @echo "Building the web app..." + @(cd web && npm run build) + @echo "Build complete." + +# Run the development server +dev-web: + @echo "Starting the development server..." + @(cd web && npm run dev) \ No newline at end of file diff --git a/web/package.json b/web/package.json index ad297f5f..3f8e0ae5 100644 --- a/web/package.json +++ b/web/package.json @@ -5,7 +5,7 @@ "title": "INFINI Console", "description": "Pursuing Excellence, Infinite Possibilities!", "author": "INFINI.LTD", - "license": "INFINI-EULA", + "license": "AGPL-3.0-or-later", "official_website": "https://infinilabs.com", "dependencies": { "@ant-design/charts": "1.4.2",