mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-23 06:11:58 +00:00
feat: add version update functionality and update package versions
- Introduced a new Makefile target `update-version` to streamline version updates across all package.json files. - Added a script `update-versions.sh` to automate the version number update process. - Updated package versions in `apps/docs`, `apps/server`, and `apps/web` to `3.1-beta` for consistency. - Enhanced the build process to include version updates before building the Docker image.
This commit is contained in:
19
Makefile
19
Makefile
@@ -1,10 +1,11 @@
|
|||||||
.PHONY: help build start clean logs stop restart
|
.PHONY: help build start clean logs stop restart update-version
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
help:
|
help:
|
||||||
@echo "🚀 Palmr - Available Commands:"
|
@echo "🚀 Palmr - Available Commands:"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " make build - Build Docker image with multi-platform support"
|
@echo " make build - Build Docker image with multi-platform support"
|
||||||
|
@echo " make update-version - Update version in all package.json files"
|
||||||
@echo " make start - Start the application using docker-compose"
|
@echo " make start - Start the application using docker-compose"
|
||||||
@echo " make stop - Stop all running containers"
|
@echo " make stop - Stop all running containers"
|
||||||
@echo " make logs - Show application logs"
|
@echo " make logs - Show application logs"
|
||||||
@@ -16,9 +17,25 @@ help:
|
|||||||
# Build Docker image using the build script
|
# Build Docker image using the build script
|
||||||
build:
|
build:
|
||||||
@echo "🏗️ Building Palmr Docker image..."
|
@echo "🏗️ Building Palmr Docker image..."
|
||||||
|
@echo "📝 This will update version numbers in all package.json files before building"
|
||||||
|
@echo ""
|
||||||
|
@chmod +x ./infra/update-versions.sh
|
||||||
@chmod +x ./infra/build-docker.sh
|
@chmod +x ./infra/build-docker.sh
|
||||||
|
@echo "🔄 Starting build process..."
|
||||||
@./infra/build-docker.sh
|
@./infra/build-docker.sh
|
||||||
|
|
||||||
|
# Update version in all package.json files
|
||||||
|
update-version:
|
||||||
|
@echo "🔄 Updating version numbers..."
|
||||||
|
@echo "🏷️ Please enter the new version (e.g., v3.0.0, 3.0-beta):"
|
||||||
|
@read -p "Version: " VERSION; \
|
||||||
|
if [ -z "$$VERSION" ]; then \
|
||||||
|
echo "❌ Error: Version cannot be empty"; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
chmod +x ./infra/update-versions.sh; \
|
||||||
|
./infra/update-versions.sh "$$VERSION"
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
start:
|
start:
|
||||||
@echo "🚀 Starting Palmr application..."
|
@echo "🚀 Starting Palmr application..."
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "palmr-docs",
|
"name": "palmr-docs",
|
||||||
"version": "v3.0-beta",
|
"version": "3.1-beta",
|
||||||
"description": "Docs for Palmr",
|
"description": "Docs for Palmr",
|
||||||
"private": true,
|
"private": true,
|
||||||
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",
|
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "palmr-api",
|
"name": "palmr-api",
|
||||||
"version": "3.0-beta",
|
"version": "3.1-beta",
|
||||||
"description": "API for Palmr",
|
"description": "API for Palmr",
|
||||||
"private": true,
|
"private": true,
|
||||||
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",
|
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "palmr-frontend",
|
"name": "palmr-frontend",
|
||||||
"version": "3.0-beta",
|
"version": "3.1-beta",
|
||||||
"description": "Frontend for Palmr",
|
"description": "Frontend for Palmr",
|
||||||
"private": true,
|
"private": true,
|
||||||
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",
|
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",
|
||||||
|
44
infra/update-versions.sh
Executable file
44
infra/update-versions.sh
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Script to update version numbers in all package.json files
|
||||||
|
# Usage: ./update-versions.sh <version>
|
||||||
|
|
||||||
|
VERSION=$1
|
||||||
|
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "❌ Error: Version parameter is required"
|
||||||
|
echo "Usage: $0 <version>"
|
||||||
|
echo "Example: $0 v3.0.0"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🔄 Updating version to $VERSION in all package.json files..."
|
||||||
|
|
||||||
|
# Function to update version in package.json
|
||||||
|
update_package_json() {
|
||||||
|
local file=$1
|
||||||
|
local app_name=$2
|
||||||
|
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
# Use sed to update the version line
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
# macOS requires different sed syntax
|
||||||
|
sed -i '' "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$file"
|
||||||
|
else
|
||||||
|
# Linux sed syntax
|
||||||
|
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ Updated $app_name: $file"
|
||||||
|
else
|
||||||
|
echo "❌ Warning: $file not found"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update all three package.json files
|
||||||
|
update_package_json "apps/web/package.json" "Web App"
|
||||||
|
update_package_json "apps/docs/package.json" "Documentation"
|
||||||
|
update_package_json "apps/server/package.json" "API Server"
|
||||||
|
|
||||||
|
echo "🎉 Version update completed!"
|
||||||
|
echo "📦 All package.json files now have version: $VERSION"
|
Reference in New Issue
Block a user