chore: migrate project to pnpm and update workspace configuration - Added pnpm workspace configuration in pnpm-workspace.yaml to manage packages. - Updated prepare.sh script to use pnpm for installing and building packages. - Modified testapp/package.json scripts to use pnpm instead of npm. - Enhanced tsconfig.client.json and tsconfig.json with additional options and exclusions. - Updated typings README.md to reflect the use of pnpm for installation and building. streamline build process in prepare script and update dependency installation Refactor code structure for improved readability and maintainability refactor: optimize Dockerfile for better layer caching and dependency installation refactor: migrate typings from '@lib/typings/ce' to '@openvidu-meet/typings' - Updated imports across multiple components and services to use the new '@openvidu-meet/typings' package. - Removed legacy typings references and adjusted paths in the frontend and webcomponent projects. - Cleaned up the typings package structure and added build scripts for TypeScript. - Removed the sync-types.sh script as it is no longer needed with the new structure. - Updated README and package.json files to reflect the new package name and structure. feat: add nodemon configuration for API documentation updates and enhance development scripts feat: implement type checking in watch mode and update development scripts feat: enhance development scripts with wait-for-typings and watch-typings utilities fix: remove obsolete sync:backend script and enhance dev script with preserveWatchOutput option feat: enhance development scripts with typings guard and improve watch behavior Refactors build and dev scripts Simplifies and consolidates build and development-related scripts for improved maintainability. - Updates the build process to be more streamlined. - Improves the development workflow by consolidating common tasks. - Removes redundant scripts. Replaces prepare script with meet script Replaces the old `prepare.sh` script with a new `meet.sh` script to provide a more user-friendly and comprehensive interface for building and managing the project. - Integrates command-line arguments for different build targets. - Includes documentation generation for web components and REST APIs. - Provides improved error handling and user feedback. - Simplifies the build process with `pnpm`. chore: update typescript version to 5.9.2 across multiple package.json files refactor: replace constructor injection with inject function for AppDataService feat: add commands to build webcomponent and run unit tests meet.sh: add end-to-end testing support for webcomponent with optional Playwright browser installation chore: update pnpm version to 10 and streamline test commands in workflows meet.sh: rename build_webcomponent_only to build_webcomponent and streamline dependency installation gitignore: add test-results directory to ignore list meet.sh: rename build_webcomponent_only to build_webcomponent for consistency Updated pnpm-lock.yml refactor: streamline build scripts and enhance service start options in meet.sh ci: update OpenVidu Meet actions to use meet-pnpm-migration version refactor: update import paths for WebComponentCommand and WebComponentEvent to use shared typings fix: add moduleNameMapper for typings path in jest configuration fix: correct action version syntax for OpenVidu Meet setup in workflow fix: update typings imports to use shared @openvidu-meet/typings package fix: add skip-install and skip-typings options to meet.sh and update workflows meet.sh: add development mode command and update start services options fix: format code in meeting.component.ts and remove unused export in public-api.ts added openvidu-components-angular to the local workspace and watch for changes in dev mode fix: update Node.js action to v5 and streamline build steps in wc-unit-test.yaml fix: remove pnpm install from build scripts in package.json fix: update backend unit test workflow and add test unit command in meet.sh fix: update unit test command in package.json to use pnpm exec Updates import path for LiveKit permissions Updates the import path for LiveKit permissions to align with the new typings package location, ensuring the test suite remains functional after the project's dependencies are migrated. fix: remove redundant dependency installation and build steps in start_services function fix: update Node.js setup action version and adjust OpenVidu actions for pnpm migration fix: update tsconfig.json to exclude specific type declaration paths fix: remove deprecated dependencies and update openapi-generate-html version fix: update build messages and streamline start commands for production and CI modes fix: update OpenVidu Meet and Testapp actions to use main branch and streamline pre-startup commands Refactors type import for auth mode Updates the import path for the authentication transport mode type. This change ensures consistency across the application by using a centralized type definition. Refactors backend integration tests Streamlines the backend integration test workflow. Consolidates test jobs for better organization and efficiency. Leverages matrix testing for recordings API with different storage providers. Improves AWS runner management for recording tests. Adds artifact cleanup to prevent storage bloat. Sets up Node.js and pnpm Adds Node.js and pnpm setup steps to the integration test workflow. This enables the use of pnpm for managing dependencies during integration tests. Refactors test commands to use pnpm exec Updates the test commands in package.json to use `pnpm exec` for running Jest. This ensures that the Jest CLI is executed within the pnpm managed environment, resolving potential path and dependency issues. Refactors imports to use the new typings package Updates imports to use the new `@openvidu-meet/typings` package. Removes now-unnecessary module name mappings. This change is part of the pnpm migration, ensuring correct resolution of shared types. Enhances backend integration tests and updates Node.js setup Simplifies integration tests execution Updates integration test scripts to streamline execution. - Uses a single, parameterized script to run all backend integration tests. - Removes redundant prefixes from test script names. Refactors jest configuration to include moduleNameMapper for improved module resolution Updates Jest integration test commands to use experimental VM modules and adjusts TypeScript root directory settings for better output structure Ensures OpenVidu Meet logs are uploaded Guarantees OpenVidu Meet logs are uploaded as artifacts, regardless of test outcome. Moves log upload to ensure consistent capture, and does so for all test scenarios. Commented backend integration tests Fix build script to specify TypeScript configuration file Refactor integration test command to use pnpm bin for jest execution Update integration test commands to use relative paths for Jest execution Revert "Commented backend integration tests" This reverts commit 1da8cddb55e29036c2a816244f4bc8b665ede581. Change log upload condition to trigger on failure for OpenVidu Meet logs Add caching step for OpenVidu local deployment images in backend integration tests Revert "Add caching step for OpenVidu local deployment images in backend integration tests" This reverts commit bf4692d168c671100a88c09853a460ec5417979d. Enhance AWS runner setup with storage provider matrix and update job names for clarity Refactor AWS runner setup to separate jobs for S3, ABS, and GCS, enhancing clarity and maintainability Update README.md to enhance structure and clarity, including detailed sections on prerequisites, getting started, development, and documentation. Refactor Dockerfile and entrypoint script, remove deprecated image creation scripts, and enhance meet.sh with Docker build functionality and base href support Update README.md to reflect changes in Docker image build commands using meet.sh Update package.json to correct versioning and remove redundant entries Added browser sync for live reloading chore: update @typescript-eslint packages to version 8.46.1 in frontend and pnpm-lock.yaml fix: correct argument skipping logic and ensure typings are built in install_dependencies function Adapt project structure backend: add TypeScript type annotations for Router instances in route files fix: update path for nodemon configuration in dev:rest-api-docs script fix: update paths in webcomponent documentation generation scripts fix: update Dockerfile and entrypoint script for correct directory structure and improve error handling fix: update .dockerignore and Dockerfile for improved directory handling and permissions; add backend type checker script Added all tests files Updates OpenVidu Meet action refs to main Updates the OpenVidu Meet GitHub Action references in the CI workflows to point to the `main` branch. This ensures that the workflows use the latest version of the action.
627 lines
18 KiB
Bash
Executable File
627 lines
18 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# Colors for messages
|
|
BLUE='\033[0;34m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Global flags (can be set via environment or arguments)
|
|
SKIP_INSTALL=${SKIP_INSTALL:-false}
|
|
SKIP_BUILD=${SKIP_BUILD:-false}
|
|
SKIP_TYPINGS=${SKIP_TYPINGS:-false}
|
|
BASE_HREF=${BASE_HREF:-/}
|
|
|
|
# Function to check if pnpm is installed
|
|
check_pnpm() {
|
|
if ! command -v pnpm >/dev/null 2>&1; then
|
|
printf "${RED}Error: pnpm is not installed.${NC}\n"
|
|
printf "${YELLOW}pnpm is required to run this script.${NC}\n\n"
|
|
printf "Would you like to install pnpm globally? (y/n): "
|
|
read REPLY
|
|
case "$REPLY" in
|
|
[Yy]*)
|
|
printf "${BLUE}Installing pnpm globally (requires sudo)...${NC}\n"
|
|
if sudo npm install -g pnpm; then
|
|
printf "${GREEN}pnpm installed successfully!${NC}\n"
|
|
else
|
|
printf "${RED}Failed to install pnpm. Please install it manually.${NC}\n"
|
|
exit 1
|
|
fi
|
|
;;
|
|
*)
|
|
printf "${YELLOW}pnpm installation cancelled. Please install it manually and try again.${NC}\n"
|
|
exit 1
|
|
;;
|
|
esac
|
|
fi
|
|
}
|
|
|
|
|
|
# Parse global flags from arguments
|
|
parse_global_flags() {
|
|
SKIP_INSTALL=false
|
|
SKIP_BUILD=false
|
|
SKIP_TYPINGS=false
|
|
BASE_HREF="/"
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--skip-install)
|
|
SKIP_INSTALL=true
|
|
;;
|
|
--skip-build)
|
|
SKIP_BUILD=true
|
|
;;
|
|
--skip-typings)
|
|
SKIP_TYPINGS=true
|
|
;;
|
|
--base-href)
|
|
shift
|
|
BASE_HREF="$1"
|
|
;;
|
|
--base-href=*)
|
|
BASE_HREF="${1#*=}"
|
|
;;
|
|
*)
|
|
# Unknown argument, ignore
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
}
|
|
|
|
|
|
# Function to display help
|
|
show_help() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} OpenVidu Meet - Build Script${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
echo -e "${GREEN}Usage:${NC} ./meet.sh [command] [options]"
|
|
echo
|
|
echo -e "${GREEN}Global Options (can be used with any command):${NC}"
|
|
echo -e " ${YELLOW}--skip-install${NC} Skip dependency installation (useful in CI)"
|
|
echo -e " ${YELLOW}--skip-build${NC} Skip build steps (for testing only)"
|
|
echo -e " ${YELLOW}--skip-typings${NC} Skip typings build (when already built)"
|
|
echo -e " ${YELLOW}--base-href <path>${NC} Set base href for frontend build (default: /)"
|
|
echo
|
|
echo -e "${GREEN}Commands:${NC}"
|
|
echo
|
|
echo -e " ${BLUE}install${NC}"
|
|
echo " Install all dependencies (pnpm install)"
|
|
echo
|
|
echo -e " ${BLUE}build${NC}"
|
|
echo " Build all project components (typings, frontend, backend, webcomponent)"
|
|
echo
|
|
echo -e " ${BLUE}build-typings${NC}"
|
|
echo " Build only the shared typings"
|
|
echo
|
|
echo -e " ${BLUE}build-webcomponent${NC}"
|
|
echo " Build only the webcomponent package"
|
|
echo
|
|
echo -e " ${BLUE}build-testapp${NC}"
|
|
echo " Build the testapp"
|
|
echo
|
|
echo -e " ${BLUE}test-unit-webcomponent${NC}"
|
|
echo " Run unit tests for the webcomponent project"
|
|
echo
|
|
echo -e " ${BLUE}test-unit-backend${NC}"
|
|
echo " Run unit tests for the backend project"
|
|
echo
|
|
echo -e " ${BLUE}test-e2e-webcomponent${NC}"
|
|
echo " Run end-to-end tests for the webcomponent project"
|
|
echo -e " ${YELLOW}Options:${NC} --force-install Force reinstall of Playwright browsers"
|
|
echo
|
|
echo -e " ${BLUE}dev${NC}"
|
|
echo " Start development mode with watchers"
|
|
echo
|
|
echo -e " ${BLUE}start${NC}"
|
|
echo " Start services in production or CI mode"
|
|
echo -e " ${YELLOW}Options:${NC} --prod Start in production mode"
|
|
echo -e " ${NC} --ci Start in CI mode"
|
|
echo
|
|
echo -e " ${BLUE}start-testapp${NC}"
|
|
echo " Start the testapp"
|
|
echo
|
|
echo -e " ${BLUE}build-webcomponent-doc${NC} [output_dir]"
|
|
echo " Generate webcomponent documentation"
|
|
echo
|
|
echo -e " ${BLUE}build-rest-api-doc${NC} [output_dir]"
|
|
echo " Generate REST API documentation"
|
|
echo
|
|
echo -e " ${BLUE}build-docker${NC} <image-name> [--demos]"
|
|
echo " Build Docker image (use --demos for demo deployment)"
|
|
echo
|
|
echo -e " ${BLUE}help${NC}"
|
|
echo " Show this help message"
|
|
echo
|
|
echo -e "${GREEN}CI/CD Optimized Examples:${NC}"
|
|
echo -e " ${YELLOW}# Install once${NC}"
|
|
echo -e " ./meet.sh install"
|
|
echo
|
|
echo -e " ${YELLOW}# Build typings once${NC}"
|
|
echo -e " ./meet.sh build-typings"
|
|
echo
|
|
echo -e " ${YELLOW}# Start development mode${NC}"
|
|
echo -e " ./meet.sh dev"
|
|
echo
|
|
echo -e " ${YELLOW}# Build webcomponent (skip install & typings)${NC}"
|
|
echo -e " ./meet.sh build-webcomponent --skip-install --skip-typings"
|
|
echo
|
|
echo -e " ${YELLOW}# Run tests (skip install)${NC}"
|
|
echo -e " ./meet.sh test-unit-webcomponent --skip-install"
|
|
echo
|
|
echo -e " ${YELLOW}# Build Docker image${NC}"
|
|
echo -e " ./meet.sh build-docker openvidu-meet-ce"
|
|
echo
|
|
echo -e " ${YELLOW}# Build Docker image for demos${NC}"
|
|
echo -e " ./meet.sh build-docker openvidu-meet-ce --demos"
|
|
echo
|
|
}
|
|
|
|
# Install dependencies
|
|
install_dependencies() {
|
|
if [ "$SKIP_INSTALL" = true ]; then
|
|
echo -e "${YELLOW}Skipping dependency installation (--skip-install flag)${NC}"
|
|
return 0
|
|
fi
|
|
|
|
check_pnpm
|
|
echo -e "${BLUE}Installing dependencies...${NC}"
|
|
pnpm install --frozen-lockfile
|
|
}
|
|
|
|
# Build typings
|
|
build_typings() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Building Typings${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
install_dependencies
|
|
pnpm run build:typings
|
|
echo -e "${GREEN}✓ Typings built successfully!${NC}"
|
|
}
|
|
|
|
# Build entire project
|
|
build_project() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Building OpenVidu Meet${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
install_dependencies
|
|
echo
|
|
|
|
echo -e "${GREEN}Building all components...${NC}"
|
|
export BASE_HREF
|
|
pnpm run build
|
|
|
|
echo
|
|
echo -e "${GREEN}✓ Build completed successfully!${NC}"
|
|
}
|
|
|
|
# Build only webcomponent
|
|
build_webcomponent() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Building Webcomponent${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
install_dependencies
|
|
build_typings
|
|
echo
|
|
|
|
echo -e "${GREEN}Building webcomponent...${NC}"
|
|
pnpm run build:webcomponent
|
|
|
|
echo
|
|
echo -e "${GREEN}✓ Webcomponent build completed successfully!${NC}"
|
|
}
|
|
|
|
# Build testapp
|
|
build_testapp() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Building TestApp${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
install_dependencies
|
|
build_typings
|
|
echo
|
|
|
|
echo -e "${GREEN}Building testapp...${NC}"
|
|
pnpm run build:testapp
|
|
echo -e "${GREEN}✓ Testapp build completed successfully!${NC}"
|
|
}
|
|
|
|
# Run unit tests for webcomponent
|
|
test_unit_webcomponent() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Running Webcomponent Unit Tests${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
install_dependencies
|
|
|
|
echo -e "${GREEN}Running webcomponent unit tests...${NC}"
|
|
pnpm run test:unit-webcomponent
|
|
}
|
|
|
|
# Run unit tests for backend
|
|
test_unit_backend() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Running Backend Unit Tests${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
install_dependencies
|
|
|
|
echo -e "${GREEN}Running backend unit tests...${NC}"
|
|
pnpm run test:unit-backend
|
|
}
|
|
|
|
# Run e2e tests for webcomponent
|
|
test_e2e_webcomponent() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Running Webcomponent E2E Tests${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
# Parse optional flags
|
|
FORCE_INSTALL=false
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--force-install|-f)
|
|
FORCE_INSTALL=true
|
|
;;
|
|
esac
|
|
done
|
|
|
|
install_dependencies
|
|
|
|
echo -e "${GREEN}Preparing Playwright browsers (chromium)...${NC}"
|
|
PW_BROWSERS_PATH=${PLAYWRIGHT_BROWSERS_PATH:-/tmp/ms-playwright}
|
|
mkdir -p "$PW_BROWSERS_PATH"
|
|
|
|
MARKER_FILE="$PW_BROWSERS_PATH/.playwright_chromium_installed"
|
|
|
|
chromium_present=false
|
|
if ls "$PW_BROWSERS_PATH" 2>/dev/null | grep -qi chromium; then
|
|
chromium_present=true
|
|
fi
|
|
|
|
if [ "$FORCE_INSTALL" = true ]; then
|
|
echo -e "${YELLOW}Force install requested. Will reinstall Playwright browsers.${NC}"
|
|
chromium_present=false
|
|
fi
|
|
|
|
if [ "$chromium_present" = true ] && [ -f "$MARKER_FILE" ]; then
|
|
echo -e "${GREEN}Chromium already installed in $PW_BROWSERS_PATH, skipping install.${NC}"
|
|
else
|
|
echo -e "${GREEN}Installing Playwright browsers...${NC}"
|
|
PLAYWRIGHT_BROWSERS_PATH="$PW_BROWSERS_PATH" pnpm exec playwright install --with-deps chromium
|
|
PLAYWRIGHT_VER=$(PLAYWRIGHT_BROWSERS_PATH="$PW_BROWSERS_PATH" pnpm exec playwright --version 2>/dev/null || true)
|
|
echo "installed_at=$(date --iso-8601=seconds)" > "$MARKER_FILE" || true
|
|
echo "playwright_version=$PLAYWRIGHT_VER" >> "$MARKER_FILE" || true
|
|
fi
|
|
|
|
echo -e "${GREEN}Running webcomponent E2E tests...${NC}"
|
|
pnpm run test:e2e-webcomponent
|
|
}
|
|
|
|
|
|
dev() {
|
|
echo -e "${BLUE}=============================================${NC}"
|
|
echo -e "${BLUE} 🚀 Starting OpenVidu Meet in dev mode...${NC}"
|
|
echo -e "${BLUE}=============================================${NC}"
|
|
echo
|
|
|
|
install_dependencies
|
|
|
|
# Paths
|
|
COMPONENTS_PATH="../openvidu/openvidu-components-angular/dist/openvidu-components-angular/package.json"
|
|
|
|
# Define concurrent commands
|
|
COMPONENTS_CMD="npm --prefix ../openvidu/openvidu-components-angular run lib:serve"
|
|
TYPINGS_CMD="./scripts/dev/watch-typings.sh"
|
|
BACKEND_CMD="node ./scripts/dev/watch-with-typings-guard.mjs 'pnpm run dev:backend'"
|
|
FRONTEND_CMD="sleep 3 && wait-on ${COMPONENTS_PATH} && node ./scripts/dev/watch-with-typings-guard.mjs 'pnpm run dev:frontend'"
|
|
REST_API_DOCS_CMD="pnpm run dev:rest-api-docs"
|
|
BROWSERSYNC_CMD="node --input-type=module -e \"
|
|
import browserSync from 'browser-sync';
|
|
import chalk from 'chalk';
|
|
|
|
const bs = browserSync.create();
|
|
const port = 5080;
|
|
|
|
bs.init({
|
|
proxy: 'http://localhost:6080',
|
|
files: ['meet-ce/backend/public/**/*'],
|
|
open: false,
|
|
reloadDelay: 500,
|
|
port
|
|
});
|
|
|
|
bs.emitter.on('browser:reload', () => {
|
|
const now = Date.now();
|
|
const time = new Date().toLocaleTimeString();
|
|
console.log(chalk.yellowBright('🔁 Browser reloaded at ' + time));
|
|
|
|
const urls = bs.getOption('urls');
|
|
const local = urls?.get('local') ?? 'undefined';
|
|
const external = urls?.get('external') ?? 'undefined';
|
|
console.log(chalk.cyanBright(' OpenVidu Meet: http://localhost:6080'));
|
|
console.log(chalk.cyanBright(' Live reload Local: ' + local));
|
|
console.log(chalk.cyanBright(' Live reload LAN: ' + external));
|
|
|
|
console.log(chalk.gray('---------------------------------------------'));
|
|
});
|
|
\""
|
|
|
|
echo -e "${YELLOW}⏳ Launching all development watchers...${NC}"
|
|
echo
|
|
|
|
# Run processes concurrently
|
|
pnpm exec concurrently -k \
|
|
--names "components,typings,backend,frontend,rest-api-docs,browser-sync" \
|
|
--prefix-colors "red,green,cyan,magenta,yellow,blue" \
|
|
"$COMPONENTS_CMD" \
|
|
"$TYPINGS_CMD" \
|
|
"$BACKEND_CMD" \
|
|
"$FRONTEND_CMD" \
|
|
"$REST_API_DOCS_CMD" \
|
|
"$BROWSERSYNC_CMD"
|
|
}
|
|
|
|
# Start services
|
|
start_services() {
|
|
MODE=""
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--prod)
|
|
MODE="prod" ;;
|
|
--ci)
|
|
MODE="ci" ;;
|
|
esac
|
|
done
|
|
|
|
if [ -z "$MODE" ]; then
|
|
echo -e "${RED}Error: start command requires --prod or --ci option${NC}"
|
|
echo -e "${YELLOW}Usage: ./meet.sh start --prod or ./meet.sh start --ci${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
case "$MODE" in
|
|
prod)
|
|
echo -e "${BLUE}Building and starting in production mode...${NC}"
|
|
NODE_ENV=production pnpm --filter openvidu-meet-backend run start
|
|
;;
|
|
ci)
|
|
echo -e "${BLUE}Building and starting in CI mode...${NC}"
|
|
NODE_ENV=ci pnpm --filter openvidu-meet-backend run start
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Start testapp
|
|
start_testapp() {
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Starting TestApp${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
install_dependencies
|
|
echo -e "${GREEN}Starting testapp...${NC}"
|
|
pnpm run start:testapp
|
|
}
|
|
|
|
# Build webcomponent documentation
|
|
build_webcomponent_doc() {
|
|
local output_dir="$1"
|
|
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Building Webcomponent Docs${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
check_pnpm
|
|
|
|
echo -e "${GREEN}Generating webcomponent documentation...${NC}"
|
|
pnpm run build:webcomponent-doc
|
|
|
|
if [ -n "$output_dir" ]; then
|
|
output_dir="${output_dir%/}"
|
|
|
|
if [ ! -d "$output_dir" ]; then
|
|
echo -e "${YELLOW}Creating output directory: $output_dir${NC}"
|
|
mkdir -p "$output_dir"
|
|
fi
|
|
|
|
if [ -f "docs/webcomponent-events.md" ] && [ -f "docs/webcomponent-commands.md" ] && [ -f "docs/webcomponent-attributes.md" ]; then
|
|
echo -e "${GREEN}Copying documentation to: $output_dir${NC}"
|
|
cp docs/webcomponent-events.md "$output_dir/webcomponent-events.md"
|
|
cp docs/webcomponent-commands.md "$output_dir/webcomponent-commands.md"
|
|
cp docs/webcomponent-attributes.md "$output_dir/webcomponent-attributes.md"
|
|
echo -e "${GREEN}✓ Documentation copied successfully!${NC}"
|
|
else
|
|
echo -e "${RED}Error: Documentation files not found in docs/ directory${NC}"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo -e "${YELLOW}No output directory specified. Documentation remains in docs/ directory.${NC}"
|
|
fi
|
|
|
|
echo
|
|
echo -e "${GREEN}✓ Webcomponent documentation generated successfully!${NC}"
|
|
echo -e "${YELLOW}Output directory: $output_dir${NC}"
|
|
rm -f docs/webcomponent-events.md docs/webcomponent-commands.md docs/webcomponent-attributes.md
|
|
}
|
|
|
|
# Build REST API documentation
|
|
build_rest_api_doc() {
|
|
local output_dir="$1"
|
|
CE_REST_API_DOC_PATH="meet-ce/backend/public/openapi/"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Building REST API Docs${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
check_pnpm
|
|
|
|
echo -e "${GREEN}Generating REST API documentation...${NC}"
|
|
pnpm run build:rest-api-docs
|
|
|
|
if [ -n "$output_dir" ]; then
|
|
output_dir="${output_dir%/}"
|
|
|
|
if [ ! -d "$output_dir" ]; then
|
|
echo -e "${YELLOW}Creating output directory: $output_dir${NC}"
|
|
mkdir -p "$output_dir"
|
|
fi
|
|
|
|
if [ -f "$CE_REST_API_DOC_PATH/public.html" ]; then
|
|
echo -e "${GREEN}Copying REST API documentation to: $output_dir${NC}"
|
|
cp "$CE_REST_API_DOC_PATH/public.html" "$output_dir/public.html"
|
|
echo -e "${GREEN}✓ Documentation copied successfully!${NC}"
|
|
else
|
|
echo -e "${RED}Error: REST API documentation files not found${NC}"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo -e "${YELLOW}No output directory specified. Documentation remains in backend/ directory.${NC}"
|
|
fi
|
|
|
|
echo
|
|
echo -e "${GREEN}✓ REST API documentation generated successfully!${NC}"
|
|
}
|
|
|
|
# Build Docker image
|
|
build_docker() {
|
|
local image_name="$1"
|
|
local is_demos=false
|
|
|
|
if [ -z "$image_name" ]; then
|
|
echo -e "${RED}Error: You need to specify an image name${NC}"
|
|
echo -e "${YELLOW}Usage: ./meet.sh build-docker <image-name> [--demos]${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Parse remaining arguments for flags
|
|
shift # Remove image_name from arguments
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--demos)
|
|
is_demos=true
|
|
;;
|
|
esac
|
|
done
|
|
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo -e "${BLUE} Building Docker Image${NC}"
|
|
echo -e "${BLUE}=====================================${NC}"
|
|
echo
|
|
|
|
local final_image_name="$image_name"
|
|
local base_href="/"
|
|
|
|
if [ "$is_demos" = true ]; then
|
|
final_image_name="${image_name}-demos"
|
|
base_href="/openvidu-meet/"
|
|
echo -e "${GREEN}Building demos image: $final_image_name${NC}"
|
|
else
|
|
echo -e "${GREEN}Building production image: $final_image_name${NC}"
|
|
fi
|
|
|
|
echo -e "${GREEN}Using BASE_HREF: $base_href${NC}"
|
|
export BUILDKIT_PROGRESS=plain && \
|
|
docker build --pull --no-cache --rm=true -f meet-ce/docker/Dockerfile -t "$final_image_name" --build-arg BASE_HREF="$base_href" .
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo
|
|
echo -e "${GREEN}✓ Docker image '$final_image_name' built successfully!${NC}"
|
|
else
|
|
echo
|
|
echo -e "${RED}✗ Failed to build Docker image '$final_image_name'${NC}"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# Main script logic
|
|
main() {
|
|
if [ $# -eq 0 ]; then
|
|
echo -e "${YELLOW}No command specified.${NC}"
|
|
echo
|
|
show_help
|
|
exit 1
|
|
fi
|
|
|
|
command="$1"
|
|
shift
|
|
|
|
# Parse global flags
|
|
parse_global_flags "$@"
|
|
|
|
case "$command" in
|
|
install)
|
|
SKIP_INSTALL=false # Force install even if flag was set
|
|
install_dependencies
|
|
;;
|
|
build)
|
|
build_project
|
|
;;
|
|
build-typings)
|
|
SKIP_TYPINGS=false # Force build typings
|
|
build_typings
|
|
;;
|
|
build-webcomponent)
|
|
build_webcomponent
|
|
;;
|
|
build-testapp)
|
|
build_testapp
|
|
;;
|
|
test-unit-webcomponent)
|
|
test_unit_webcomponent
|
|
;;
|
|
test-unit-backend)
|
|
test_unit_backend
|
|
;;
|
|
test-e2e-webcomponent)
|
|
test_e2e_webcomponent "$@"
|
|
;;
|
|
dev)
|
|
dev
|
|
;;
|
|
start)
|
|
start_services "$@"
|
|
;;
|
|
start-testapp)
|
|
start_testapp
|
|
;;
|
|
build-webcomponent-doc)
|
|
build_webcomponent_doc "$1"
|
|
;;
|
|
build-rest-api-doc)
|
|
build_rest_api_doc "$1"
|
|
;;
|
|
build-docker)
|
|
build_docker "$@"
|
|
;;
|
|
help|--help|-h)
|
|
show_help
|
|
;;
|
|
*)
|
|
echo -e "${RED}Error: Unknown command '$command'${NC}"
|
|
echo
|
|
show_help
|
|
exit 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Run main function with all arguments
|
|
main "$@"
|