diff --git a/.vscode/launch.json b/.vscode/launch.json index 0cc9b256ca..9ed2bb77b8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,6 +18,20 @@ "name": "Immich Workers", "remoteRoot": "/usr/src/app/server", "localRoot": "${workspaceFolder}/server" + }, + { + "type": "node", + "request": "launch", + "name": "Immich CLI", + "program": "${workspaceFolder}/cli/dist/index.js", + "args": ["upload", "--help"], + "runtimeArgs": ["--enable-source-maps"], + "console": "integratedTerminal", + "resolveSourceMapLocations": ["${workspaceFolder}/cli/dist/**/*.js.map"], + "sourceMaps": true, + "outFiles": ["${workspaceFolder}/cli/dist/**/*.js"], + "skipFiles": ["/**"], + "preLaunchTask": "Build Immich CLI" } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 278e7e4fd3..478a46b4bd 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -70,6 +70,11 @@ "runOn": "folderOpen" }, "problemMatcher": [] + }, + { + "label": "Build Immich CLI", + "type": "shell", + "command": "pnpm --filter cli build:dev" } ] } diff --git a/cli/README.md b/cli/README.md index 09f5b163f7..b9d61fce09 100644 --- a/cli/README.md +++ b/cli/README.md @@ -13,15 +13,23 @@ Then, to build the open-api client run the following in the open-api folder: $ ./bin/generate-open-api.sh -To run the Immich CLI from source, run the following in the cli folder: +## Run from build + +Go to the cli folder and build it: $ pnpm install $ pnpm run build - $ ts-node . + $ node dist/index.js -You'll need ts-node, the easiest way to install it is to use pnpm: +## Run and Debug from source (VSCode) - $ pnpm i -g ts-node +With VScode you can run and debug the Immich CLI. Go to the launch.json file, find the Immich CLI config and change this with the command you need to debug + +`"args": ["upload", "--help"],` + +replace that for the command of your choice. + +## Install from build You can also build and install the CLI using diff --git a/cli/package.json b/cli/package.json index dfd2cc3610..3fff0c1031 100644 --- a/cli/package.json +++ b/cli/package.json @@ -43,6 +43,7 @@ }, "scripts": { "build": "vite build", + "build:dev": "vite build --sourcemap true", "lint": "eslint \"src/**/*.ts\" --max-warnings 0", "lint:fix": "npm run lint -- --fix", "prepack": "npm run build",