add Docker-specific npm and workspace configurations for CI builds

This commit is contained in:
Carlos Santos 2025-10-23 17:30:56 +02:00
parent 4480637255
commit 75284c8687
9 changed files with 465 additions and 58 deletions

22
.npmrc.docker Normal file
View File

@ -0,0 +1,22 @@
# Docker/CI specific npm configuration
# This configuration is used during Docker builds and CI workflows
# to prevent linking workspace packages and use published versions instead
# Disable workspace package linking
# This forces pnpm to install packages from registry or local tarballs
link-workspace-packages=false
# Strict peer dependencies
strict-peer-dependencies=false
# Auto install peers
auto-install-peers=true
# Shamefully hoist - necessary for some packages
shamefully-hoist=true
# Node linker - use hoisted for full compatibility
node-linker=hoisted
# Lockfile settings
lockfile=true

View File

@ -17,17 +17,45 @@ RUN mkdir -p meet-ce/typings meet-ce/frontend/webcomponent meet-ce/backend && \
USER node
# =============================================================================
# Workspace Configuration for Docker/CI
# =============================================================================
# We use Docker-specific configuration files to handle external dependencies:
#
# 1. pnpm-workspace.docker.yaml: Excludes external packages (openvidu-components-angular)
# 2. .npmrc.docker: Disables workspace linking, forces registry/tarball installation
#
# This allows openvidu-components-angular to be installed from:
# - npm registry (e.g., openvidu-components-angular@3.4.0)
# - Local tarball (e.g., ./meet-ce/frontend/openvidu-components-angular-3.4.0.tgz)
#
# The package.json should already have the correct dependency specified by CI
# before docker build is executed.
#
# See docs/ci-docker-dependencies-strategy.md for more information.
# =============================================================================
# Copy workspace configuration files
# Use Docker-specific workspace file that excludes external packages
COPY --chown=node:node pnpm-workspace.docker.yaml ./pnpm-workspace.yaml
COPY --chown=node:node .npmrc package.json pnpm-lock.yaml ./
# Use Docker-specific npmrc that disables workspace linking
COPY --chown=node:node .npmrc.docker ./.npmrc
COPY --chown=node:node package.json pnpm-lock.yaml ./
# Copy package.json files for all workspace packages
COPY --chown=node:node meet-ce/typings/package.json ./meet-ce/typings/
COPY --chown=node:node meet-ce/frontend/package.json ./meet-ce/frontend/
COPY --chown=node:node meet-ce/frontend/webcomponent/package.json ./meet-ce/frontend/webcomponent/
COPY --chown=node:node meet-ce/frontend/projects/shared-meet-components/package.json ./meet-ce/frontend/projects/shared-meet-components/
COPY --chown=node:node meet-ce/backend/package.json ./meet-ce/backend/
# Install dependencies
# Note: openvidu-components-angular will be installed from:
# 1. Local tarball (if exists in meet-ce/frontend/openvidu-components-angular*.tgz)
# 2. npm registry (if specified in package.json)
# The tarball should be placed in meet-ce/frontend/ by CI before docker build
RUN pnpm install --no-frozen-lockfile
# Copy the source code for all packages
COPY --chown=node:node meet-ce/typings/ ./meet-ce/typings/
COPY --chown=node:node meet-ce/frontend/ ./meet-ce/frontend/

View File

@ -5,7 +5,7 @@
"module": "dist/fesm2022/openvidu-meet-shared-components.mjs",
"typings": "dist/index.d.ts",
"peerDependencies": {
"openvidu-components-angular": "^3.0.0"
"openvidu-components-angular": "workspace:*"
},
"dependencies": {
"tslib": "^2.3.0"

50
meet.sh
View File

@ -708,8 +708,6 @@ clone_meet_pro() {
# Build Docker image
build_docker() {
local image_name="$1"
local components_next_version
components_next_version=$(pnpm view openvidu-components-angular@next version | tr -d '\r\n')
shift || true # Remove first argument (image name)
# Validate arguments
@ -721,17 +719,26 @@ build_docker() {
# Parse flags
local is_demos=false
local use_latest_components=false
for _arg in "$@"; do
case "$_arg" in
local components_version=""
local components_tarball=""
while [ $# -gt 0 ]; do
case "$1" in
--demos)
is_demos=true
shift
;;
--with-latest-components)
use_latest_components=true
--components-angular-version)
components_version="$2"
shift 2
;;
--components-angular-tarball)
components_tarball="$2"
shift 2
;;
*)
# ignore unknown flags for forward compatibility
shift
;;
esac
done
@ -752,11 +759,16 @@ build_docker() {
echo -e "${BLUE}=====================================${NC}"
echo
# Optionally install latest components to avoid local dist symlink inside image
if [ "$use_latest_components" = true ]; then
echo "🔧 Installing latest openvidu-components-angular..."
sed -i 's|"openvidu-components-angular": "workspace:\*"|"openvidu-components-angular": "^3.0.0"|g' meet-ce/frontend/projects/shared-meet-components/package.json
pnpm --filter @openvidu-meet/frontend install openvidu-components-angular@${components_next_version}
# Optionally install specific components version
if [ -n "$components_tarball" ]; then
echo -e "${BLUE}🔧 Installing OpenVidu Components Angular from tarball: $components_tarball${NC}"
./scripts/prepare-ci-build.sh --components-angular-tarball "$components_tarball"
elif [ -n "$components_version" ]; then
echo -e "${BLUE}🔧 Installing OpenVidu Components Angular version: $components_version${NC}"
./scripts/prepare-ci-build.sh --components-angular-version "$components_version"
else
echo -e "${YELLOW}⚠️ No specific components version specified, using latest from registry${NC}"
./scripts/prepare-ci-build.sh --components-angular-version latest
fi
echo -e "${GREEN}Using BASE_HREF: $base_href${NC}"
@ -765,19 +777,19 @@ build_docker() {
if docker build --pull --no-cache --rm=true -f meet-ce/docker/Dockerfile -t "$final_image_name" --build-arg BASE_HREF="$base_href" .; then
echo
echo -e "${GREEN}✓ Docker image '$final_image_name' built successfully!${NC}"
# Restore dev config
echo "🔧 Restoring dev config ..."
./scripts/restore-dev-config.sh > /dev/null
else
echo
echo -e "${RED}✗ Failed to build Docker image '$final_image_name'${NC}"
# Restore dev config
echo "🔧 Restoring dev config ..."
./scripts/restore-dev-config.sh > /dev/null
exit 1
fi
# Restore local link if we temporarily installed latest components
if [ "$use_latest_components" = true ]; then
echo "🔧 Restoring openvidu-components-angular to local dist link..."
sed -i 's|"openvidu-components-angular": "^3.0.0"|"openvidu-components-angular": "workspace:*"|g' meet-ce/frontend/projects/shared-meet-components/package.json
sed -i 's|"openvidu-components-angular": "'"${components_next_version}"'"|"openvidu-components-angular": "workspace:*"|g' meet-ce/frontend/package.json
pnpm install --no-frozen-lockfile
fi
}
# Main script logic

39
pnpm-lock.yaml generated
View File

@ -28,7 +28,7 @@ importers:
version: 20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))
'@angular/cdk':
specifier: ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0
version: 20.2.7(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)
version: 20.2.9(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)
'@angular/common':
specifier: ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0
version: 20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)
@ -40,7 +40,7 @@ importers:
version: 20.3.4(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(@angular/platform-browser@20.3.4(@angular/animations@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1)))(rxjs@7.8.2)
'@angular/material':
specifier: ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0
version: 20.2.7(aa99716c8f948d7f0acc37be6fe23365)
version: 20.2.9(b517547b325ffc8400ae4cda6a618bfd)
'@livekit/track-processors':
specifier: ^0.6.0
version: 0.6.1(@types/dom-mediacapture-transform@0.1.11)(livekit-client@2.15.11(@types/dom-mediacapture-record@1.0.22))
@ -1156,13 +1156,6 @@ packages:
vitest:
optional: true
'@angular/cdk@20.2.7':
resolution: {integrity: sha512-QTqxPJSMXyjaswtpUrziwdoKRhqT2P9/Ascwzjg8T/SofV1850pc3YmonoOFrurYrmd4plZzWdr7raGcBWIh/Q==}
peerDependencies:
'@angular/common': ^20.0.0 || ^21.0.0
'@angular/core': ^20.0.0 || ^21.0.0
rxjs: ^6.5.3 || ^7.4.0
'@angular/cdk@20.2.9':
resolution: {integrity: sha512-rbY1AMz9389WJI29iAjWp4o0QKRQHCrQQUuP0ctNQzh1tgWpwiRLx8N4yabdVdsCA846vPsyKJtBlSNwKMsjJA==}
peerDependencies:
@ -1219,16 +1212,6 @@ packages:
'@angular/platform-browser': 20.3.4
rxjs: ^6.5.3 || ^7.4.0
'@angular/material@20.2.7':
resolution: {integrity: sha512-VXsP5qkQQ3sCGkSHsgDku/OVlunGsqssOM057foOKJuajECsI3ZpGuLJ13nvLm9Z147UZOZfP463ixZIjd4XuQ==}
peerDependencies:
'@angular/cdk': 20.2.7
'@angular/common': ^20.0.0 || ^21.0.0
'@angular/core': ^20.0.0 || ^21.0.0
'@angular/forms': ^20.0.0 || ^21.0.0
'@angular/platform-browser': ^20.0.0 || ^21.0.0
rxjs: ^6.5.3 || ^7.4.0
'@angular/material@20.2.9':
resolution: {integrity: sha512-xo/ozyRXCoJMi89XLTJI6fdPKBv2wBngWMiCrtTg23+pHbuyA/kDbk3v62eJkDD1xdhC4auXaIHu4Ddf5zTgSA==}
peerDependencies:
@ -10051,14 +10034,6 @@ snapshots:
- tsx
- yaml
'@angular/cdk@20.2.7(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)':
dependencies:
'@angular/common': 20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)
'@angular/core': 20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1)
parse5: 8.0.0
rxjs: 7.8.2
tslib: 2.8.1
'@angular/cdk@20.2.9(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)':
dependencies:
'@angular/common': 20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)
@ -10134,16 +10109,6 @@ snapshots:
rxjs: 7.8.2
tslib: 2.8.1
'@angular/material@20.2.7(aa99716c8f948d7f0acc37be6fe23365)':
dependencies:
'@angular/cdk': 20.2.7(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)
'@angular/common': 20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)
'@angular/core': 20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1)
'@angular/forms': 20.3.4(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(@angular/platform-browser@20.3.4(@angular/animations@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1)))(rxjs@7.8.2)
'@angular/platform-browser': 20.3.4(@angular/animations@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))
rxjs: 7.8.2
tslib: 2.8.1
'@angular/material@20.2.9(b517547b325ffc8400ae4cda6a618bfd)':
dependencies:
'@angular/cdk': 20.2.9(@angular/common@20.3.4(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@20.3.4(@angular/compiler@20.3.4)(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2)

View File

@ -1,3 +1,15 @@
# =============================================================================
# Docker/CI Workspace Configuration
# =============================================================================
# This workspace configuration is used for Docker builds and CI workflows.
# It EXCLUDES external packages (like openvidu-components-angular) that
# are not part of this repository.
#
# For local development, use pnpm-workspace.yaml instead.
#
# See docs/ci-docker-dependencies-strategy.md for more information.
# =============================================================================
packages:
- meet-ce/typings
- meet-ce/frontend

View File

@ -1,3 +1,15 @@
# =============================================================================
# Development Workspace Configuration
# =============================================================================
# This workspace configuration is used for LOCAL DEVELOPMENT.
# It INCLUDES external packages (like openvidu-components-angular) that
# are located in sibling repositories for fast development with hot-reload.
#
# For Docker builds and CI, use pnpm-workspace.docker.yaml instead.
#
# See docs/ci-docker-dependencies-strategy.md for more information.
# =============================================================================
packages:
- ../openvidu/openvidu-components-angular/projects/openvidu-components-angular
- meet-ce/typings

218
scripts/prepare-ci-build.sh Executable file
View File

@ -0,0 +1,218 @@
#!/bin/bash
# ============================================================================
# prepare-ci-build.sh
# ============================================================================
# This script prepares the workspace for CI/Docker builds by:
# 1. Switching to Docker-specific workspace configuration
# 2. Installing openvidu-components-angular from npm or tarball
# 3. Installing all dependencies
#
# Usage:
# ./scripts/prepare-ci-build.sh [options]
#
# Options:
# --components-angular-version <version> Install from npm registry (e.g., 3.4.0)
# --components-angular-tarball <path> Install from tarball (e.g., ./components.tgz)
# --help Show this help message
#
# Examples:
# # Install from npm registry
# ./scripts/prepare-ci-build.sh --components-angular-version 3.4.0
#
# # Install from tarball
# ./scripts/prepare-ci-build.sh --components-angular-tarball ./openvidu-components-angular.tgz
#
# See docs/ci-docker-dependencies-strategy.md for more information.
# ============================================================================
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Variables
NPM_VERSION=""
TARBALL_PATH=""
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Function to update package.json files
update_package_json() {
local package_path="$1"
local version="$2"
if [ -f "$package_path" ]; then
# Replace workspace:* with specific version
sed -i 's#"openvidu-components-angular": "workspace:\*"#"openvidu-components-angular": "'"$version"'"#g' "$package_path"
echo "✓ Updated $package_path: workspace:* → $version"
fi
}
show_help() {
echo -e "${BLUE}============================================================================${NC}"
echo -e "${BLUE} OpenVidu Meet - Prepare CI Build${NC}"
echo -e "${BLUE}============================================================================${NC}"
echo ""
echo -e "${GREEN}Usage:${NC}"
echo -e " ./scripts/prepare-ci-build.sh [options]"
echo ""
echo -e "${GREEN}Options:${NC}"
echo -e " ${YELLOW}--components-angular-version <version>${NC} Install openvidu-components-angular from npm registry"
echo -e " ${YELLOW}--components-angular-tarball <path>${NC} Install openvidu-components-angular from tarball"
echo -e " ${YELLOW}--help${NC} Show this help message"
echo ""
echo -e "${GREEN}Examples:${NC}"
echo -e " # Install from npm registry"
echo -e " ./scripts/prepare-ci-build.sh --components-angular-version 3.4.0"
echo ""
echo -e " # Install from tarball"
echo -e " ./scripts/prepare-ci-build.sh --components-angular-tarball ./openvidu-components-angular.tgz"
echo ""
echo -e "${BLUE}For more information, see:${NC} docs/ci-docker-dependencies-strategy.md"
echo ""
}
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--components-angular-version)
NPM_VERSION="$2"
shift 2
;;
--components-angular-tarball)
TARBALL_PATH="$2"
shift 2
;;
--help)
show_help
exit 0
;;
*)
echo -e "${RED}Error: Unknown option '$1'${NC}"
show_help
exit 1
;;
esac
done
# Validate arguments
if [ -z "$NPM_VERSION" ] && [ -z "$TARBALL_PATH" ]; then
echo -e "${RED}Error: You must specify either --components-angular-version or --components-angular-tarball${NC}"
show_help
exit 1
fi
if [ -n "$NPM_VERSION" ] && [ -n "$TARBALL_PATH" ]; then
echo -e "${RED}Error: You cannot specify both --components-angular-version and --components-angular-tarball${NC}"
show_help
exit 1
fi
# Validate tarball exists
if [ -n "$TARBALL_PATH" ]; then
if [ ! -f "$TARBALL_PATH" ]; then
echo -e "${RED}Error: Tarball not found: $TARBALL_PATH${NC}"
exit 1
fi
# Convert to absolute path
TARBALL_PATH="$(cd "$(dirname "$TARBALL_PATH")" && pwd)/$(basename "$TARBALL_PATH")"
fi
cd "$PROJECT_ROOT"
echo -e "${BLUE}============================================================================${NC}"
echo -e "${BLUE} Preparing CI Build${NC}"
echo -e "${BLUE}============================================================================${NC}"
echo ""
# Step 1: Switch to Docker workspace configuration
echo -e "${YELLOW}[1/4] Switching to Docker workspace configuration...${NC}"
if [ ! -f "pnpm-workspace.docker.yaml" ]; then
echo -e "${RED}Error: pnpm-workspace.docker.yaml not found${NC}"
exit 1
fi
if [ ! -f ".npmrc.docker" ]; then
echo -e "${RED}Error: .npmrc.docker not found${NC}"
exit 1
fi
cp pnpm-workspace.docker.yaml pnpm-workspace.yaml
cp .npmrc.docker .npmrc
echo -e "${GREEN}✓ Workspace configuration updated${NC}"
echo ""
# Step 2: Copy tarball if needed
if [ -n "$TARBALL_PATH" ]; then
echo -e "${YELLOW}[2/4] Copying tarball to meet-ce/frontend/...${NC}"
mkdir -p meet-ce/frontend
TARBALL_NAME="$(basename "$TARBALL_PATH")"
if [ -f "meet-ce/frontend/$TARBALL_NAME" ]; then
echo -e "${GREEN}✓ Tarball already exists: $TARBALL_NAME${NC}"
else
cp "$TARBALL_PATH" meet-ce/frontend/
echo -e "${GREEN}✓ Tarball copied: $TARBALL_NAME${NC}"
fi
echo ""
fi
# Step 3: Install openvidu-components-angular
echo -e "${YELLOW}[3/4] Installing openvidu-components-angular...${NC}"
if [ -n "$NPM_VERSION" ]; then
echo -e " ${BLUE}Installing from npm registry: $NPM_VERSION${NC}"
# Update package.json files before installation
update_package_json "meet-ce/frontend/package.json" "$NPM_VERSION"
update_package_json "meet-ce/frontend/projects/shared-meet-components/package.json" "$NPM_VERSION"
# Install in both packages
# echo "Installing in meet-ce/frontend..."
# pnpm add --filter @openvidu-meet/frontend openvidu-components-angular@$NPM_VERSION
# echo "Installing in shared-meet-components..."
# pnpm add --filter @openvidu-meet/shared-components openvidu-components-angular@$NPM_VERSION
# echo -e "${GREEN}✓ Installed from npm: openvidu-components-angular@$NPM_VERSION${NC}"
elif [ -n "$TARBALL_PATH" ]; then
TARBALL_NAME="$(basename "$TARBALL_PATH")"
echo -e " ${BLUE}Installing from tarball: $TARBALL_NAME${NC}"
# Update package.json files before installation
update_package_json "meet-ce/frontend/package.json" "file:./$TARBALL_NAME"
update_package_json "meet-ce/frontend/projects/shared-meet-components/package.json" "file:../../$TARBALL_NAME"
# Install in both packages
# echo "Installing in meet-ce/frontend..."
# pnpm add --filter @openvidu-meet/frontend "openvidu-components-angular@$TARBALL_REF"
# echo "Installing in shared-meet-components..."
# pnpm add --filter @openvidu-meet/shared-components "openvidu-components-angular@file:../$TARBALL_NAME"
# pnpm install --recursive
# echo -e "${GREEN}✓ Installed from tarball: $TARBALL_NAME${NC}"
fi
echo ""
# Step 4: Install all dependencies
echo -e "${YELLOW}[4/4] Installing all dependencies...${NC}"
pnpm install --recursive
echo -e "${GREEN}✓ All dependencies installed${NC}"
echo ""
echo -e "${GREEN}============================================================================${NC}"
echo -e "${GREEN} ✓ CI Build preparation completed successfully!${NC}"
echo -e "${GREEN}============================================================================${NC}"
echo ""
echo -e "${BLUE}Next steps:${NC}"
echo -e " - Build the project: ${YELLOW}./meet.sh build${NC}"
echo -e " - Build Docker image: ${YELLOW}docker build -f meet-ce/docker/Dockerfile .${NC}"
echo ""
echo -e "${BLUE}Note:${NC} To restore development configuration, run:"
echo -e " ${YELLOW}git checkout pnpm-workspace.yaml .npmrc${NC}"
echo -e " ${YELLOW}pnpm install${NC}"
echo ""

138
scripts/restore-dev-config.sh Executable file
View File

@ -0,0 +1,138 @@
#!/bin/bash
# ============================================================================
# restore-dev-config.sh
# ============================================================================
# This script restores the development workspace configuration after
# preparing for CI/Docker builds.
#
# Usage:
# ./scripts/restore-dev-config.sh
#
# This will:
# 1. Restore pnpm-workspace.yaml from git
# 2. Restore .npmrc from git
# 3. Reinstall dependencies with workspace linking enabled
#
# See docs/ci-docker-dependencies-strategy.md for more information.
# ============================================================================
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
echo -e "${BLUE}============================================================================${NC}"
echo -e "${BLUE} Restoring Development Configuration${NC}"
echo -e "${BLUE}============================================================================${NC}"
echo ""
# Step 1: Restore workspace configuration and package.json files
echo -e "${YELLOW}[1/4] Restoring workspace configuration and package.json files...${NC}"
# List of files to restore
FILES_TO_RESTORE=(
"pnpm-workspace.yaml"
".npmrc"
"meet-ce/frontend/package.json"
"meet-ce/frontend/projects/shared-meet-components/package.json"
)
# Check if any files were modified
ANY_MODIFIED=false
for file in "${FILES_TO_RESTORE[@]}"; do
if [ -f "$file" ] && ! git diff --quiet "$file" 2>/dev/null; then
ANY_MODIFIED=true
break
fi
done
if [ "$ANY_MODIFIED" = false ]; then
echo -e "${GREEN}✓ All files are already in development mode${NC}"
else
# Restore all files from git
git checkout "${FILES_TO_RESTORE[@]}" 2>/dev/null || {
echo -e "${RED}Error: Could not restore configuration files from git${NC}"
echo -e "${YELLOW}Make sure you're in a git repository${NC}"
exit 1
}
echo -e "${GREEN}✓ Configuration and package.json files restored${NC}"
fi
echo ""
# Step 2: Clean up any tarball artifacts
# echo -e "${YELLOW}[2/4] Cleaning up tarball artifacts...${NC}"
# if ls meet-ce/frontend/*.tgz >/dev/null 2>&1; then
# rm -f meet-ce/frontend/*.tgz
# echo -e "${GREEN}✓ Tarball artifacts removed${NC}"
# else
# echo -e "${GREEN}✓ No tarball artifacts to clean${NC}"
# fi
echo ""
# Step 3: Reinstall dependencies
echo -e "${YELLOW}[3/4] Reinstalling dependencies with workspace linking...${NC}"
echo -e "${BLUE}This will link openvidu-components-angular from ../openvidu/...${NC}"
echo ""
# Check if external package exists
if [ ! -d "../openvidu/openvidu-components-angular" ]; then
echo -e "${RED}Warning: External package not found: ../openvidu/openvidu-components-angular${NC}"
echo -e "${YELLOW}You may need to clone the openvidu repository:${NC}"
echo -e " ${YELLOW}git clone https://github.com/OpenVidu/openvidu.git ../openvidu${NC}"
echo ""
read -p "Continue anyway? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "${RED}Aborted${NC}"
exit 1
fi
fi
pnpm install
echo -e "${GREEN}✓ Dependencies installed with workspace linking${NC}"
echo ""
# Step 4: Verify workspace linking is active
echo -e "${YELLOW}[4/4] Verifying workspace linking...${NC}"
# Check if openvidu-components-angular is using workspace protocol
if grep -q '"openvidu-components-angular": "workspace:\*"' meet-ce/frontend/package.json; then
echo -e "${GREEN}✓ Frontend: openvidu-components-angular using workspace:*${NC}"
else
echo -e "${RED}✗ Frontend: openvidu-components-angular NOT using workspace:*${NC}"
echo -e "${YELLOW} Current value in package.json:${NC}"
grep "openvidu-components-angular" meet-ce/frontend/package.json || echo " Not found"
fi
if grep -q '"openvidu-components-angular": "\^' meet-ce/frontend/projects/shared-meet-components/package.json; then
echo -e "${GREEN}✓ Shared-components: openvidu-components-angular using ^version (peerDependency)${NC}"
else
echo -e "${YELLOW}⚠ Shared-components: Verify peerDependency manually${NC}"
fi
# Check if pnpm list shows workspace link
if pnpm list openvidu-components-angular 2>/dev/null | grep -q "link:"; then
echo -e "${GREEN}✓ Workspace linking is active (linked from ../openvidu/...)${NC}"
else
echo -e "${RED}✗ WARNING: Workspace linking might not be active${NC}"
echo -e "${YELLOW} This is normal if openvidu-components-angular is not in ../openvidu/${NC}"
fi
echo ""
echo -e "${GREEN}============================================================================${NC}"
echo -e "${GREEN} ✓ Development configuration restored successfully!${NC}"
echo -e "${GREEN}============================================================================${NC}"
echo ""
echo -e "${BLUE}You can now continue local development:${NC}"
echo -e " ${YELLOW}./meet.sh dev${NC}"
echo ""