diff --git a/api/justfile b/api/justfile index 7dd7b87a5..e9bc9ef09 100644 --- a/api/justfile +++ b/api/justfile @@ -4,10 +4,6 @@ default: @just --list --justfile {{justfile()}} --list-heading $'\nAPI project recipes:\n' @just list-commands -setup: - pnpm install - pnpm run container:build - # builds js files that can run on an unraid server @build: pnpm run build diff --git a/api/package.json b/api/package.json index bea1dc905..ba380ad94 100644 --- a/api/package.json +++ b/api/package.json @@ -17,11 +17,13 @@ "start": "node dist/main.js", "dev": "vite", "command": "pnpm run build && clear && ./dist/cli.js", - "// Build": "", + "// Build and Deploy": "", "build": "vite build --mode=production", "postbuild": "chmod +x dist/main.js && chmod +x dist/cli.js", "build:docker": "./scripts/dc.sh run --rm builder", "build-and-pack": "tsx ./scripts/build.ts", + "preunraid:deploy": "pnpm build", + "unraid:deploy": "./scripts/deploy-dev.sh", "// GraphQL Codegen": "", "codegen": "MOTHERSHIP_GRAPHQL_LINK='https://staging.mothership.unraid.net/ws' graphql-codegen --config codegen.ts -r dotenv/config './.env.staging'", "codegen:watch": "DOTENV_CONFIG_PATH='./.env.staging' graphql-codegen --config codegen.ts --watch -r dotenv/config", diff --git a/justfile b/justfile index e1be9d01d..b00fa8f5e 100644 --- a/justfile +++ b/justfile @@ -12,9 +12,9 @@ setup: @just ignore .vscode/settings.json api/.vscode/settings.json web/.vscode/settings.json # ignore api local-state files @just ignore api/dev/states/myservers.cfg api/dev/Unraid.net/myservers.cfg - - just api/setup - just web/setup + + pnpm install + just unraid-ui/setup # restore notification files under api/dev restore-notifications: diff --git a/package.json b/package.json index 3ef7c33d3..10aba4f09 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "build": "pnpm -r build", "dev": "pnpm -r dev", + "unraid:deploy": "pnpm -r unraid:deploy", "test": "pnpm -r test", "lint": "pnpm -r lint", "lint:fix": "pnpm -r lint:fix", diff --git a/readme.md b/readme.md index 953a333ab..96cbdb38d 100644 --- a/readme.md +++ b/readme.md @@ -96,6 +96,7 @@ Make sure the following software is installed before proceeding. * Docker (for macOS folks, Orbstack works too) * [Node.js (v20)][Node-url] * [Just](https://github.com/casey/just) +* libvirt (macOS folks can run `brew install libvirt`) * An [Unraid][Unraid-url] server for development Next, create an SSH key if you haven't already. @@ -123,26 +124,27 @@ Once you have your key pair, add your public SSH key to your Unraid server: ``` This will run installation scripts, container builds, and some git scripts to reduce noise (i.e. personal editor customizations, etc). -3. Run the API container + + Alternatively, run `pnpm install` for a lighter, less opinionated setup. +3. Run dev servers ```sh - cd api - npm run container:start + pnpm dev ``` -4. This should bring you inside the API container. There, run the following command to start the server: + This will run every dev server in the monorepo. By default, this means: + + * 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 - npm run dev + pnpm unraid:deploy ``` -5. In another terminal, open the project and navigate to the web directory. Then, run the dev server: - - ```sh - cd web - npm install # just in case - npm run dev - ``` + This will ship a staging build of unraid-api, unraid-ui, and unraid-components to an Unraid server located at ``.

(back to top)

diff --git a/unraid-ui/justfile b/unraid-ui/justfile index 9022e9a22..ffaf99ed8 100644 --- a/unraid-ui/justfile +++ b/unraid-ui/justfile @@ -5,7 +5,6 @@ list-commands: # Prepares the repo for development setup: - pnpm install pnpm run build clean: diff --git a/unraid-ui/package.json b/unraid-ui/package.json index 0a72765b1..59db1d659 100644 --- a/unraid-ui/package.json +++ b/unraid-ui/package.json @@ -13,16 +13,22 @@ "tailwind.config.ts" ], "scripts": { + "// Development": "", "dev": "vite", - "build": "vite build", - "build:wc": "REM_PLUGIN=true vite build -c vite.web-component.ts --mode production", "preview": "vite preview", "test": "vitest", "test:ui": "vitest --ui", "coverage": "vitest run --coverage", - "clean": "rm -rf dist", + "// Build": "", "prebuild": "npm run clean", + "build": "vite build", + "build:wc": "REM_PLUGIN=true vite build -c vite.web-component.ts --mode production", + "clean": "rm -rf dist", "typecheck": "vue-tsc --noEmit", + "// Deploy to Unraid Server": "", + "preunraid:deploy": "pnpm build:wc", + "unraid:deploy": "just deploy", + "// Storybook": "", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build" }, diff --git a/web/.env.production b/web/.env.production new file mode 100644 index 000000000..5231b46eb --- /dev/null +++ b/web/.env.production @@ -0,0 +1,6 @@ +VITE_ACCOUNT=https://account.unraid.net +VITE_CONNECT=https://connect.myunraid.net +VITE_UNRAID_NET=https://unraid.net +VITE_CALLBACK_KEY=Uyv2o8e*FiQe8VeLekTqyX6Z*8XonB +# Keep console logs until components are stabilized +VITE_ALLOW_CONSOLE_LOGS=true \ No newline at end of file diff --git a/web/.gitignore b/web/.gitignore index 6ad53f152..c1e4a69db 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -1 +1,2 @@ -!.env.staging \ No newline at end of file +!.env.staging +!.env.production \ No newline at end of file diff --git a/web/justfile b/web/justfile index a0e477d99..d496691e9 100644 --- a/web/justfile +++ b/web/justfile @@ -4,11 +4,6 @@ default: @just --list --justfile {{justfile()}} --list-heading $'\nWeb project recipes:\n' @just list-commands -setup: - just ../unraid-ui/setup - cp .env.example .env - npm install - clean: rm -rf .nuxt rm -rf node_modules diff --git a/web/package.json b/web/package.json index 11235ff6a..01c9cfc35 100644 --- a/web/package.json +++ b/web/package.json @@ -5,16 +5,19 @@ "license": "GPL-2.0-only", "scripts": { "// Development": "", - "dev": "[ -f .env ] && nuxt dev --dotenv .env || nuxt dev --dotenv .env.staging", + "predev": "pnpm --filter=@unraid/ui build", + "dev": "nuxt dev --dotenv .env.example", "preview": "nuxt preview", "serve": "NODE_ENV=production PORT=${PORT:-4321} node .output/server/index.mjs", "// Build": "", + "prebuild:dev": "pnpm predev", "build:dev": "nuxi build --dotenv .env.staging && pnpm run manifest-ts && pnpm run deploy-to-unraid:dev", "build:webgui": "pnpm run type-check && nuxi build --dotenv .env.production && pnpm run manifest-ts && pnpm run copy-to-webgui-repo", "build": "NODE_ENV=production nuxi build --dotenv .env.production && pnpm run manifest-ts", "generate": "nuxt generate", "manifest-ts": "node ./scripts/add-timestamp-webcomponent-manifest.js", "// Deployment": "", + "unraid:deploy": "pnpm build:dev", "deploy-to-unraid:dev": "./scripts/deploy-dev.sh", "copy-to-webgui-repo": "./scripts/copy-to-webgui-repo.sh", "// Code Quality": "",