feat(cli): add debug development config (#22712)

* add debug and change ts-node with tsx

* update pr changes

* update pnpm-lock

* remove ts-node from readme

* typo

* resolve conflicts

* remove tsx

* launch from dist

* add preLaunchTask

* update readme

* undo main in package.json

* remove typo

* Apply suggestion from @bwees

Co-authored-by: Brandon Wees <brandonwees@gmail.com>

* revert pnpm-lock changes

* @jrasm91 suggestions

* chore: run node with source maps

---------

Co-authored-by: Jason Rasmussen <jason@rasm.me>
Co-authored-by: Brandon Wees <brandonwees@gmail.com>
This commit is contained in:
Jorge Montejo
2025-10-08 19:08:33 +02:00
committed by GitHub
parent 9838634067
commit 7ee1b977c1
4 changed files with 32 additions and 4 deletions

14
.vscode/launch.json vendored
View File

@@ -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": ["<node_internals>/**"],
"preLaunchTask": "Build Immich CLI"
}
]
}

5
.vscode/tasks.json vendored
View File

@@ -70,6 +70,11 @@
"runOn": "folderOpen"
},
"problemMatcher": []
},
{
"label": "Build Immich CLI",
"type": "shell",
"command": "pnpm --filter cli build:dev"
}
]
}

View File

@@ -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

View File

@@ -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",