diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 847e197d9..31026b3ff 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,20 @@ -@elibosley @pujitm @mdatelle @zackspear \ No newline at end of file +# Default owners for everything in the repo +* @elibosley @pujitm @mdatelle @zackspear + +# API specific files +/api/ @elibosley @pujitm @mdatelle + +# Web frontend files +/web/ @elibosley @mdatelle @zackspear + +# Plugin related files +/plugin/ @elibosley + +# Unraid UI specific files +/unraid-ui/ @mdatelle @zackspear @pujitm + +# GitHub workflows and configuration +/.github/ @elibosley + +# Documentation +*.md @elibosley @pujitm @mdatelle @zackspear \ No newline at end of file diff --git a/api/dev/states/myservers.cfg b/api/dev/states/myservers.cfg index 3f09503b3..e5ba60d29 100644 --- a/api/dev/states/myservers.cfg +++ b/api/dev/states/myservers.cfg @@ -20,5 +20,5 @@ dynamicRemoteAccessType="DISABLED" ssoSubIds="" allowedOrigins="/var/run/unraid-notifications.sock, /var/run/unraid-php.sock, /var/run/unraid-cli.sock, http://localhost:8080, https://localhost:4443, https://tower.local:4443, https://192.168.1.150:4443, https://tower:4443, https://192-168-1-150.thisisfourtyrandomcharacters012345678900.myunraid.net:4443, https://85-121-123-122.thisisfourtyrandomcharacters012345678900.myunraid.net:8443, https://10-252-0-1.hash.myunraid.net:4443, https://10-252-1-1.hash.myunraid.net:4443, https://10-253-3-1.hash.myunraid.net:4443, https://10-253-4-1.hash.myunraid.net:4443, https://10-253-5-1.hash.myunraid.net:4443, https://10-100-0-1.hash.myunraid.net:4443, https://10-100-0-2.hash.myunraid.net:4443, https://10-123-1-2.hash.myunraid.net:4443, https://221-123-121-112.hash.myunraid.net:4443, https://google.com, https://test.com, https://connect.myunraid.net, https://connect-staging.myunraid.net, https://dev-my.myunraid.net:4000, https://studio.apollographql.com" [connectionStatus] -minigraph="ERROR_RETRYING" +minigraph="PRE_INIT" upnpStatus="" diff --git a/api/docs/developer/development.md b/api/docs/developer/development.md index cf7dd36ff..8d4f73933 100644 --- a/api/docs/developer/development.md +++ b/api/docs/developer/development.md @@ -2,7 +2,7 @@ ## Installation -Manual install can be done with the following routes: +Manual install of the staging and production plugins can be done with the following routes: [production](https://stable.dl.unraid.net/unraid-api/dynamix.unraid.net.plg) [staging](https://preview.dl.unraid.net/unraid-api/dynamix.unraid.net.staging.plg) diff --git a/api/docs/developer/repo-organization.md b/api/docs/developer/repo-organization.md index 4fab48120..f0e746f03 100644 --- a/api/docs/developer/repo-organization.md +++ b/api/docs/developer/repo-organization.md @@ -11,11 +11,11 @@ The repository consists of: - Core Modules - Tests -## API Server Architecture +## API Server Architecture The API server is built with NestJS and provides the core functionality for interacting with Unraid systems. -### Key Components: +### Key Components - `src/unraid-api/` - Core NestJS implementation - `src/core/` - Legacy business logic and utilities @@ -61,7 +61,7 @@ The store syncs data in two ways: The repository is organized into several packages: - `api/` - NestJS API server -- `plugin/` - Unraid plugin package +- `plugin/` - Unraid plugin package - `web/` - Frontend application - `unraid-ui/` - Shared UI components diff --git a/api/docs/developer/workflows.md b/api/docs/developer/workflows.md new file mode 100644 index 000000000..96f391705 --- /dev/null +++ b/api/docs/developer/workflows.md @@ -0,0 +1,217 @@ +# Unraid API Development Workflows + +This document outlines the various workflow styles available for developing, building, and deploying the Unraid API monorepo. + +## Repository Structure + +The Unraid API monorepo consists of several packages: + +- `api`: The Unraid API backend +- `web`: The web frontend components +- `plugin`: The Unraid plugin +- `unraid-ui`: UI components library + +## Development Workflows + +### Local Development + +To start all development servers in the monorepo: + +```bash +pnpm dev +``` + +This command runs all development servers concurrently: + +- API server: +- Web components: +- UI components: + +### Package-Specific Development + +If you want to work on a specific package, you can run its development server individually: + +#### API Development + +```bash +cd api +pnpm dev +``` + +#### Web Development + +```bash +cd web +pnpm dev +``` + +#### UI Component Development + +```bash +cd unraid-ui +pnpm dev +``` + +## Building Workflows + +### Building All Packages + +To build all packages in the monorepo: + +```bash +pnpm build +``` + +### Watch Mode Building + +For continuous building during development: + +```bash +pnpm build:watch +``` + +This is useful when you want to see your changes reflected without manually rebuilding. This will also allow you to install a local plugin to test your changes. + +### Package-Specific Building + +#### API Building + +```bash +cd api +pnpm build +``` + +#### Web Building + +```bash +cd web +pnpm build +``` + +#### Development Build for Web + +```bash +cd web +pnpm build:dev +``` + +## Deployment Workflows + +### Deploying to Development Unraid Server + +To deploy to a development Unraid server: + +```bash +pnpm unraid:deploy +``` + +This command builds and deploys all components to the specified Unraid server. + +### Package-Specific Deployment + +#### API Deployment + +```bash +cd api +pnpm unraid:deploy +``` + +#### Web Deployment + +```bash +cd web +pnpm unraid:deploy +``` + +#### Plugin Deployment + +```bash +cd plugin +pnpm unraid:deploy +``` + +## Testing + +To run tests across all packages: + +```bash +pnpm test +``` + +### Package-Specific Testing + +```bash +cd +pnpm test +``` + +## Code Quality Workflows + +### Linting + +To lint all packages: + +```bash +pnpm lint +``` + +To automatically fix linting issues: + +```bash +pnpm lint:fix +``` + +### Type Checking + +To run type checking across all packages: + +```bash +pnpm type-check +``` + +## GraphQL Codegen Workflows + +For packages that use GraphQL, you can generate types from your schema: + +```bash +cd +pnpm codegen +``` + +To watch for changes and regenerate types: + +```bash +cd +pnpm codegen:watch +``` + +## Docker Workflows + +The API package supports Docker-based development: + +```bash +cd api +pnpm container:build # Build the Docker container +pnpm container:start # Start the container +pnpm container:stop # Stop the container +pnpm container:enter # Enter the container shell +pnpm container:test # Run tests in the container +``` + +## CLI Commands + +When working with a deployed Unraid API, you can use the CLI: + +```bash +unraid-api --help +``` + +## Recommended Workflow for New Developers + +1. Clone the repository: `git clone git@github.com:unraid/api.git` +2. Set up the monorepo: `just setup` or `pnpm install` +3. Start development servers: `pnpm dev` +4. Make your changes +5. Test your changes: `pnpm test` +6. Deploy to a development server: `pnpm unraid:deploy ` +7. Verify your changes on the Unraid server diff --git a/api/package.json b/api/package.json index f3e6d6ab3..90f5d68c9 100644 --- a/api/package.json +++ b/api/package.json @@ -20,7 +20,7 @@ "// Build and Deploy": "", "build": "vite build --mode=production", "postbuild": "chmod +x dist/main.js && chmod +x dist/cli.js", - "build:watch": "vite build --mode=production --watch", + "build:watch": "nodemon --watch src --ext ts,js,json --exec 'tsx ./scripts/build.ts'", "build:docker": "./scripts/dc.sh run --rm builder", "build:release": "tsx ./scripts/build.ts", "preunraid:deploy": "pnpm build", diff --git a/api/scripts/build.ts b/api/scripts/build.ts index 042ba1aea..4f328fff3 100755 --- a/api/scripts/build.ts +++ b/api/scripts/build.ts @@ -8,8 +8,6 @@ import { getDeploymentVersion } from './get-deployment-version.js'; try { // Create release and pack directories - // Clean existing deploy folder - await rm('./deploy', { recursive: true }).catch(() => {}); await mkdir('./deploy/release', { recursive: true }); await mkdir('./deploy/pack', { recursive: true }); diff --git a/api/scripts/deploy-dev.sh b/api/scripts/deploy-dev.sh index 04f5e6b5e..a549269b1 100755 --- a/api/scripts/deploy-dev.sh +++ b/api/scripts/deploy-dev.sh @@ -1,26 +1,17 @@ #!/bin/bash -# Path to store the last used server name -state_file="$HOME/.deploy_state" - -# Read the last used server name from the state file -if [[ -f "$state_file" ]]; then - last_server_name=$(cat "$state_file") -else - last_server_name="" -fi - -# Read the server name from the command-line argument or use the last used server name as the default -server_name="${1:-$last_server_name}" +# Arguments +# $1: SSH server name (required) # Check if the server name is provided -if [[ -z "$server_name" ]]; then - echo "Please provide the SSH server name." +if [[ -z "$1" ]]; then + echo "Error: SSH server name is required." + echo "Usage: $0 " exit 1 fi -# Save the current server name to the state file -echo "$server_name" > "$state_file" +# Set server name from command-line argument +server_name="$1" # Source directory path source_directory="./dist" @@ -34,9 +25,11 @@ if [ ! -d "$source_directory" ]; then fi fi -# Change ownership on copy +# Destination directory path +destination_directory="/usr/local/unraid-api" + # Replace the value inside the rsync command with the user's input -rsync_command="rsync -avz -e ssh $source_directory root@${server_name}:/usr/local/unraid-api" +rsync_command="rsync -avz --progress --stats -e ssh \"$source_directory\" \"root@${server_name}:$destination_directory\"" echo "Executing the following command:" echo "$rsync_command" @@ -46,10 +39,10 @@ eval "$rsync_command" exit_code=$? # Chown the directory -ssh root@"${server_name}" "chown -R root:root /usr/local/unraid-api" +ssh root@"${server_name}" 'chown -R root:root /usr/local/unraid-api' # Run unraid-api restart on remote host -ssh root@"${server_name}" "INTROSPECTION=true LOG_LEVEL=trace unraid-api restart" +ssh root@"${server_name}" 'INTROSPECTION=true LOG_LEVEL=trace unraid-api restart' # Play built-in sound based on the operating system if [[ "$OSTYPE" == "darwin"* ]]; then diff --git a/plugin/.env.example b/plugin/.env.example index e64f5debb..e2fa3787e 100644 --- a/plugin/.env.example +++ b/plugin/.env.example @@ -2,5 +2,3 @@ PR=35 # Skip validation (default: true for local testing) SKIP_VALIDATION=true -# Local file server URL (optional) -LOCAL_FILESERVER_URL=http://192.168.1.100:8080 \ No newline at end of file diff --git a/plugin/Dockerfile b/plugin/Dockerfile index 5447dab71..40adbc8c1 100644 --- a/plugin/Dockerfile +++ b/plugin/Dockerfile @@ -23,8 +23,8 @@ RUN corepack enable && pnpm install # Install a simple http server RUN npm install -g http-server -# Expose port 8080 -EXPOSE 8080 +# Expose port 5858 +EXPOSE 5858 COPY scripts/entrypoint.sh /start.sh RUN chmod +x /start.sh diff --git a/plugin/builder/build-txz.ts b/plugin/builder/build-txz.ts index d66a0f772..73327f6a7 100644 --- a/plugin/builder/build-txz.ts +++ b/plugin/builder/build-txz.ts @@ -8,22 +8,35 @@ import { cleanupTxzFiles } from "./utils/cleanup"; // Recursively search for manifest files const findManifestFiles = async (dir: string): Promise => { - const entries = await readdir(dir, { withFileTypes: true }); - const files: string[] = []; + try { + const entries = await readdir(dir, { withFileTypes: true }); + const files: string[] = []; - for (const entry of entries) { - const fullPath = join(dir, entry.name); - if (entry.isDirectory()) { - files.push(...(await findManifestFiles(fullPath))); - } else if ( - entry.isFile() && - (entry.name === "manifest.json" || entry.name === "ui.manifest.json") - ) { - files.push(entry.name); + for (const entry of entries) { + const fullPath = join(dir, entry.name); + if (entry.isDirectory()) { + try { + files.push(...(await findManifestFiles(fullPath))); + } catch (error) { + // Log and continue if a subdirectory can't be read + console.warn(`Warning: Could not read directory ${fullPath}: ${error.message}`); + } + } else if ( + entry.isFile() && + (entry.name === "manifest.json" || entry.name === "ui.manifest.json") + ) { + files.push(entry.name); + } } - } - return files; + return files; + } catch (error) { + if (error.code === 'ENOENT') { + console.warn(`Directory does not exist: ${dir}`); + return []; + } + throw error; // Re-throw other errors + } }; const validateSourceDir = async (validatedEnv: TxzEnv) => { diff --git a/plugin/docker-compose.yml b/plugin/docker-compose.yml index 809c41475..4d288a3f4 100644 --- a/plugin/docker-compose.yml +++ b/plugin/docker-compose.yml @@ -1,7 +1,7 @@ services: plugin-builder: ports: - - 8080:8080 + - 5858:5858 build: . volumes: - ./:/app diff --git a/plugin/package.json b/plugin/package.json index a6637cf27..17e884b0d 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -17,11 +17,11 @@ "license": "GPL-2.0-only", "scripts": { "// Build scripts": "", - "build": "pnpm run build:txz && pnpm run build:plugin", + "build": "pnpm run build:txz && pnpm run build:plugin && ./scripts/output-local-url.sh", "build:txz": "tsx builder/build-txz.ts", "build:plugin": "tsx builder/build-plugin.ts", "build:validate": "npm run env:validate && npm run build", - "build:watcher": "nodemon --watch 'source/**/*' --exec 'pnpm run build'", + "build:watcher": "nodemon --verbose --watch 'source/**/*' --ext ts,js --ignore '*.test.ts' --ignore 'node_modules/**' --ignore 'source/dynamix.unraid.net/install/**' --delay 5s --exec 'pnpm run build'", "// Docker commands": "", "build:watch": "./scripts/dc.sh pnpm run build:watcher", "docker:build": "docker compose build", diff --git a/plugin/scripts/dc.sh b/plugin/scripts/dc.sh index 00b758497..f3ea06bed 100755 --- a/plugin/scripts/dc.sh +++ b/plugin/scripts/dc.sh @@ -17,4 +17,15 @@ fi CI=${CI:-false} TAG="LOCAL_PLUGIN_BUILD" -docker compose run --service-ports --rm -e HOST_LAN_IP="$HOST_LAN_IP" -e CI="$CI" -e TAG="$TAG" plugin-builder "$@" + +# Define container name for easier management +CONTAINER_NAME="plugin-builder" + +# Stop any running plugin-builder container first +echo "Stopping any running plugin-builder containers..." +docker ps -q --filter "name=${CONTAINER_NAME}" | xargs -r docker stop + +# Start the container with the specified environment variables +echo "Starting plugin-builder container..." + +docker compose run --remove-orphans --service-ports -e HOST_LAN_IP="$HOST_LAN_IP" -e CI="$CI" -e TAG="$TAG" ${CONTAINER_NAME} "$@" diff --git a/plugin/scripts/deploy-dev.sh b/plugin/scripts/deploy-dev.sh index 42717c9f2..1d96f3731 100755 --- a/plugin/scripts/deploy-dev.sh +++ b/plugin/scripts/deploy-dev.sh @@ -1,30 +1,18 @@ #!/bin/bash # Arguments -# $1: SSH server name +# $1: SSH server name (required) # $2: {--wc-deploy|--wc-build|--wc-skip} / deploy or build web components w/o prompt -# Path to store the last used server name -state_file="$HOME/.deploy_state" - -# Read the last used server name from the state file -if [[ -f "$state_file" ]]; then - last_server_name=$(cat "$state_file") -else - last_server_name="" -fi - -# Read the server name from the command-line argument or use the last used server name as the default -server_name="${1:-$last_server_name}" - # Check if the server name is provided -if [[ -z "$server_name" ]]; then - echo "Please provide the SSH server name." +if [[ -z "$1" ]]; then + echo "Error: SSH server name is required." + echo "Usage: $0 [--wc-deploy|--wc-build|--wc-skip]" exit 1 fi -# Save the current server name to the state file -echo "$server_name" > "$state_file" +# Set server name from command-line argument +server_name="$1" # Source directory path source_directory="plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins" diff --git a/plugin/scripts/entrypoint.sh b/plugin/scripts/entrypoint.sh index bf0aa59d3..bc1163d15 100644 --- a/plugin/scripts/entrypoint.sh +++ b/plugin/scripts/entrypoint.sh @@ -3,7 +3,7 @@ mkdir -p /app/deploy/ # Start http-server with common fileserver settings http-server /app/deploy/ \ - --port 8080 \ + --port 5858 \ --host 0.0.0.0 \ --cors \ --gzip \ diff --git a/plugin/scripts/output-local-url.sh b/plugin/scripts/output-local-url.sh new file mode 100755 index 000000000..17ff830e4 --- /dev/null +++ b/plugin/scripts/output-local-url.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Use ANSI escape codes for color and formatting +# \e[1m = bold, \e[32m = green, \e[0m = reset formatting +echo -e "\e[1m\e[32m" +echo "==============================================================" +echo " INSTALL THE LOCAL PLUGIN USING THIS URL: " +echo " http://${HOST_LAN_IP}:5858/dynamix.unraid.net.plg " +echo "==============================================================" +echo -e "\e[0m" diff --git a/plugin/source/dynamix.unraid.net/install/doinst.sh b/plugin/source/dynamix.unraid.net/install/doinst.sh index 9c79f0437..4984ad4b8 100755 --- a/plugin/source/dynamix.unraid.net/install/doinst.sh +++ b/plugin/source/dynamix.unraid.net/install/doinst.sh @@ -110,3 +110,207 @@ fi ( cd usr/local/unraid-api/node_modules/esbuild/node_modules/.bin ; ln -sf ../../bin/esbuild esbuild ) ( cd usr/local/unraid-api/node_modules/request/node_modules/.bin ; rm -rf uuid ) ( cd usr/local/unraid-api/node_modules/request/node_modules/.bin ; ln -sf ../uuid/bin/uuid uuid ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf apollo-pbjs ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@apollo/protobufjs/bin/pbjs apollo-pbjs ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf apollo-pbts ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@apollo/protobufjs/bin/pbts apollo-pbts ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf blessed ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../blessed/bin/tput.js blessed ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf esbuild ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../esbuild/bin/esbuild esbuild ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf escodegen ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../escodegen/bin/escodegen.js escodegen ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf esgenerate ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../escodegen/bin/esgenerate.js esgenerate ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf esparse ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../esprima/bin/esparse.js esparse ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf esvalidate ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../esprima/bin/esvalidate.js esvalidate ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf fxparser ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../fast-xml-parser/src/cli/cli.js fxparser ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf glob ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../glob/dist/esm/bin.mjs glob ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf js-yaml ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../js-yaml/bin/js-yaml.js js-yaml ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf jsesc ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../jsesc/bin/jsesc jsesc ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf loose-envify ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../loose-envify/cli.js loose-envify ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf mime ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../mime/cli.js mime ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf mkdirp ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../mkdirp/bin/cmd.js mkdirp ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf mustache ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../mustache/bin/mustache mustache ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf needle ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../needle/bin/needle needle ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf node-which ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../which/bin/node-which node-which ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf opencollective ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@nuxtjs/opencollective/bin/opencollective.js opencollective ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf parser ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@babel/parser/bin/babel-parser.js parser ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pino ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pino/bin.js pino ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pino-pretty ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pino-pretty/bin.js pino-pretty ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pm2 ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pm2/bin/pm2 pm2 ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pm2-dev ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pm2/bin/pm2-dev pm2-dev ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pm2-docker ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pm2/bin/pm2-docker pm2-docker ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pm2-runtime ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pm2/bin/pm2-runtime pm2-runtime ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf prettier ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../prettier/bin/prettier.cjs prettier ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf relay-compiler ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@ardatan/relay-compiler/bin/relay-compiler relay-compiler ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf resolve ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../resolve/bin/resolve resolve ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf semver ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../semver/bin/semver.js semver ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf sha.js ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../sha.js/bin.js sha.js ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf sshpk-conv ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../sshpk/bin/sshpk-conv sshpk-conv ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf sshpk-sign ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../sshpk/bin/sshpk-sign sshpk-sign ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf sshpk-verify ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../sshpk/bin/sshpk-verify sshpk-verify ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf systeminformation ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../systeminformation/lib/cli.js systeminformation ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf tsc ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../typescript/bin/tsc tsc ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf tsserver ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../typescript/bin/tsserver tsserver ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf tsx ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../tsx/dist/cli.mjs tsx ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf ua-parser-js ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../ua-parser-js/script/cli.js ua-parser-js ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf uuid ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../uuid/dist/esm/bin/uuid uuid ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf xss ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../xss/bin/xss xss ) +( cd usr/local/unraid-api/node_modules/@apollo/protobufjs/node_modules/.bin ; rm -rf apollo-pbjs ) +( cd usr/local/unraid-api/node_modules/@apollo/protobufjs/node_modules/.bin ; ln -sf ../../bin/pbjs apollo-pbjs ) +( cd usr/local/unraid-api/node_modules/@apollo/protobufjs/node_modules/.bin ; rm -rf apollo-pbts ) +( cd usr/local/unraid-api/node_modules/@apollo/protobufjs/node_modules/.bin ; ln -sf ../../bin/pbts apollo-pbts ) +( cd usr/local/unraid-api/node_modules/@apollo/server/node_modules/.bin ; rm -rf uuid ) +( cd usr/local/unraid-api/node_modules/@apollo/server/node_modules/.bin ; ln -sf ../uuid/dist/bin/uuid uuid ) +( cd usr/local/unraid-api/node_modules/@nestjs/core/node_modules/.bin ; rm -rf opencollective ) +( cd usr/local/unraid-api/node_modules/@nestjs/core/node_modules/.bin ; ln -sf ../../../../@nuxtjs/opencollective/bin/opencollective.js opencollective ) +( cd usr/local/unraid-api/node_modules/@nestjs/graphql/node_modules/.bin ; rm -rf uuid ) +( cd usr/local/unraid-api/node_modules/@nestjs/graphql/node_modules/.bin ; ln -sf ../uuid/dist/esm/bin/uuid uuid ) +( cd usr/local/unraid-api/node_modules/@pm2/agent/node_modules/.bin ; rm -rf semver ) +( cd usr/local/unraid-api/node_modules/@pm2/agent/node_modules/.bin ; ln -sf ../semver/bin/semver.js semver ) +( cd usr/local/unraid-api/node_modules/@pm2/io/node_modules/.bin ; rm -rf semver ) +( cd usr/local/unraid-api/node_modules/@pm2/io/node_modules/.bin ; ln -sf ../semver/bin/semver.js semver ) +( cd usr/local/unraid-api/node_modules/esbuild/node_modules/.bin ; rm -rf esbuild ) +( cd usr/local/unraid-api/node_modules/esbuild/node_modules/.bin ; ln -sf ../../bin/esbuild esbuild ) +( cd usr/local/unraid-api/node_modules/nestjs-pino/node_modules/.bin ; rm -rf pino ) +( cd usr/local/unraid-api/node_modules/nestjs-pino/node_modules/.bin ; ln -sf ../../../pino/bin.js pino ) +( cd usr/local/unraid-api/node_modules/request/node_modules/.bin ; rm -rf uuid ) +( cd usr/local/unraid-api/node_modules/request/node_modules/.bin ; ln -sf ../uuid/bin/uuid uuid ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf apollo-pbjs ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@apollo/protobufjs/bin/pbjs apollo-pbjs ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf apollo-pbts ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@apollo/protobufjs/bin/pbts apollo-pbts ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf blessed ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../blessed/bin/tput.js blessed ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf esbuild ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../esbuild/bin/esbuild esbuild ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf escodegen ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../escodegen/bin/escodegen.js escodegen ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf esgenerate ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../escodegen/bin/esgenerate.js esgenerate ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf esparse ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../esprima/bin/esparse.js esparse ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf esvalidate ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../esprima/bin/esvalidate.js esvalidate ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf fxparser ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../fast-xml-parser/src/cli/cli.js fxparser ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf glob ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../glob/dist/esm/bin.mjs glob ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf js-yaml ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../js-yaml/bin/js-yaml.js js-yaml ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf jsesc ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../jsesc/bin/jsesc jsesc ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf loose-envify ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../loose-envify/cli.js loose-envify ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf mime ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../mime/cli.js mime ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf mkdirp ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../mkdirp/bin/cmd.js mkdirp ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf mustache ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../mustache/bin/mustache mustache ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf needle ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../needle/bin/needle needle ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf node-which ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../which/bin/node-which node-which ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf opencollective ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@nuxtjs/opencollective/bin/opencollective.js opencollective ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf parser ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@babel/parser/bin/babel-parser.js parser ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pino ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pino/bin.js pino ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pino-pretty ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pino-pretty/bin.js pino-pretty ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pm2 ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pm2/bin/pm2 pm2 ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pm2-dev ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pm2/bin/pm2-dev pm2-dev ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pm2-docker ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pm2/bin/pm2-docker pm2-docker ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf pm2-runtime ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../pm2/bin/pm2-runtime pm2-runtime ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf prettier ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../prettier/bin/prettier.cjs prettier ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf relay-compiler ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../@ardatan/relay-compiler/bin/relay-compiler relay-compiler ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf resolve ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../resolve/bin/resolve resolve ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf semver ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../semver/bin/semver.js semver ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf sha.js ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../sha.js/bin.js sha.js ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf sshpk-conv ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../sshpk/bin/sshpk-conv sshpk-conv ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf sshpk-sign ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../sshpk/bin/sshpk-sign sshpk-sign ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf sshpk-verify ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../sshpk/bin/sshpk-verify sshpk-verify ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf systeminformation ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../systeminformation/lib/cli.js systeminformation ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf tsc ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../typescript/bin/tsc tsc ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf tsserver ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../typescript/bin/tsserver tsserver ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf tsx ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../tsx/dist/cli.mjs tsx ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf ua-parser-js ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../ua-parser-js/script/cli.js ua-parser-js ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf uuid ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../uuid/dist/esm/bin/uuid uuid ) +( cd usr/local/unraid-api/node_modules/.bin ; rm -rf xss ) +( cd usr/local/unraid-api/node_modules/.bin ; ln -sf ../xss/bin/xss xss ) +( cd usr/local/unraid-api/node_modules/@apollo/protobufjs/node_modules/.bin ; rm -rf apollo-pbjs ) +( cd usr/local/unraid-api/node_modules/@apollo/protobufjs/node_modules/.bin ; ln -sf ../../bin/pbjs apollo-pbjs ) +( cd usr/local/unraid-api/node_modules/@apollo/protobufjs/node_modules/.bin ; rm -rf apollo-pbts ) +( cd usr/local/unraid-api/node_modules/@apollo/protobufjs/node_modules/.bin ; ln -sf ../../bin/pbts apollo-pbts ) +( cd usr/local/unraid-api/node_modules/@apollo/server/node_modules/.bin ; rm -rf uuid ) +( cd usr/local/unraid-api/node_modules/@apollo/server/node_modules/.bin ; ln -sf ../uuid/dist/bin/uuid uuid ) +( cd usr/local/unraid-api/node_modules/@nestjs/core/node_modules/.bin ; rm -rf opencollective ) +( cd usr/local/unraid-api/node_modules/@nestjs/core/node_modules/.bin ; ln -sf ../../../../@nuxtjs/opencollective/bin/opencollective.js opencollective ) +( cd usr/local/unraid-api/node_modules/@nestjs/graphql/node_modules/.bin ; rm -rf uuid ) +( cd usr/local/unraid-api/node_modules/@nestjs/graphql/node_modules/.bin ; ln -sf ../uuid/dist/esm/bin/uuid uuid ) +( cd usr/local/unraid-api/node_modules/@pm2/agent/node_modules/.bin ; rm -rf semver ) +( cd usr/local/unraid-api/node_modules/@pm2/agent/node_modules/.bin ; ln -sf ../semver/bin/semver.js semver ) +( cd usr/local/unraid-api/node_modules/@pm2/io/node_modules/.bin ; rm -rf semver ) +( cd usr/local/unraid-api/node_modules/@pm2/io/node_modules/.bin ; ln -sf ../semver/bin/semver.js semver ) +( cd usr/local/unraid-api/node_modules/esbuild/node_modules/.bin ; rm -rf esbuild ) +( cd usr/local/unraid-api/node_modules/esbuild/node_modules/.bin ; ln -sf ../../bin/esbuild esbuild ) +( cd usr/local/unraid-api/node_modules/nestjs-pino/node_modules/.bin ; rm -rf pino ) +( cd usr/local/unraid-api/node_modules/nestjs-pino/node_modules/.bin ; ln -sf ../../../pino/bin.js pino ) +( cd usr/local/unraid-api/node_modules/request/node_modules/.bin ; rm -rf uuid ) +( cd usr/local/unraid-api/node_modules/request/node_modules/.bin ; ln -sf ../uuid/bin/uuid uuid ) diff --git a/readme.md b/readme.md index 96cbdb38d..29c16cc4b 100644 --- a/readme.md +++ b/readme.md @@ -21,7 +21,7 @@
- Logo + Logo

Unraid Connect

@@ -112,39 +112,25 @@ Once you have your key pair, add your public SSH key to your Unraid server: 1. Clone and enter the repo ```sh - # Optionally, give the cloned folder a more specific name - gh repo clone unraid/api api-monorepo - cd api-monorepo + git clone git@github.com:unraid/api.git + cd api ``` 2. Run the monorepo setup command. ```sh - just setup + pnpm install ``` - This will run installation scripts, container builds, and some git scripts to reduce noise (i.e. personal editor customizations, etc). - - Alternatively, run `pnpm install` for a lighter, less opinionated setup. -3. Run dev servers +3. Run the build watcher to build the components and serve a local plugin file that can be installed on your Unraid server. ```sh - pnpm dev + pnpm build:watch ``` - This will run every dev server in the monorepo. By default, this means: + Navigate to Plugins->Install and install the local plugin file that is output to the console. - * The unraid-api will be available at localhost:3001 - * The dev server for "rich" web components (like the User Profile Component) will be at localhost:4321 -- Note that shipping to unraid is preferred, as the dev environment is significantly different. - * The vite server for unraid-ui development will be at localhost:5173 - -4. Test on Unraid - - ```js - pnpm unraid:deploy - ``` - - This will ship a staging build of unraid-api, unraid-ui, and unraid-components to an Unraid server located at ``. +## View other workflows (local dev, etc.) in the [Developer Workflows](./api/docs/developer/workflows.md)

(back to top)

diff --git a/web/scripts/deploy-dev.sh b/web/scripts/deploy-dev.sh index 430bbfcdb..01d98983e 100755 --- a/web/scripts/deploy-dev.sh +++ b/web/scripts/deploy-dev.sh @@ -1,26 +1,14 @@ #!/bin/bash -# Path to store the last used server name -state_file="$HOME/.deploy_state" - -# Read the last used server name from the state file -if [[ -f "$state_file" ]]; then - last_server_name=$(cat "$state_file") -else - last_server_name="" -fi - -# Read the server name from the command-line argument or use the last used server name as the default -server_name="${1:-$last_server_name}" - # Check if the server name is provided -if [[ -z "$server_name" ]]; then - echo "Please provide the SSH server name." +if [[ -z "$1" ]]; then + echo "Error: SSH server name is required." + echo "Usage: $0 " exit 1 fi -# Save the current server name to the state file -echo "$server_name" > "$state_file" +# Set server name from command-line argument +server_name="$1" # Source directory path source_directory=".nuxt/nuxt-custom-elements/dist/unraid-components"