Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e5e7732
Include nodemon config in build artifact
elibosley Nov 20, 2025
f6521d8
Add SUPPRESS_LOGS to environment mocks
elibosley Nov 20, 2025
6d3d623
feat: Refactor nodemon configuration and improve error handling in No…
elibosley Nov 21, 2025
b35da13
refactor: Update environment configuration for nodemon paths
elibosley Nov 21, 2025
d4f90d6
test: Add unit tests for nodemon path configuration and enhance error…
elibosley Nov 21, 2025
33e88bc
fix: Simplify return type for killSpy in NodemonService tests
elibosley Nov 21, 2025
1d9c76f
feat: Enhance NodemonService with process management and cleanup
elibosley Nov 21, 2025
9253250
feat: Add process termination and management in NodemonService
elibosley Nov 22, 2025
a5e9b83
feat: Implement waitForNodemonExit method and enhance restart logic i…
elibosley Nov 22, 2025
bec54e4
feat: Enhance NodemonService to improve process management during res…
elibosley Nov 23, 2025
dc7a449
fix: Update log stream handling in NodemonService tests
elibosley Nov 25, 2025
3462e76
feat: Add integration tests for NodemonService with real nodemon exec…
elibosley Nov 25, 2025
fa837db
feat: Add nodemon log file configuration and enhance logging in Nodem…
elibosley Nov 25, 2025
9ff6462
chore: Update API version and refactor pubsub channel references
elibosley Nov 25, 2025
071efea
feat: make casbin not always log
elibosley Nov 25, 2025
9ae3f3c
feat: Enhance UserProfile component to conditionally render banner gr…
elibosley Nov 26, 2025
4c2e212
tmp: add boot diagnistics
pujitm Dec 9, 2025
7197956
feat: improve determinism
pujitm Dec 9, 2025
ca5e84f
fix: narrow api exec command
pujitm Dec 10, 2025
6d9796a
fix: process lock
pujitm Dec 10, 2025
f0cfdfc
fix: ignore errors from /var/log/.pm2 removal
pujitm Dec 11, 2025
7c0d42a
test: unraid-api daemonization
pujitm Dec 9, 2025
22bb548
test: add bats & equivalent vitest system tests setup
pujitm Dec 10, 2025
e5abbcb
test: create vitest based integration suite
pujitm Dec 10, 2025
0d7bee2
add reboot test
pujitm Dec 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ This is the Unraid API monorepo containing multiple packages that provide API fu

## Essential Commands

pnpm does not use `--` to pass additional arguments.
For example, to target a specific test file, `pnpm test <file>` is sufficient.

Comment on lines +17 to +19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Reword pnpm arg-passing guidance (current phrasing is misleading). (pnpm.io)

-pnpm does not use `--` to pass additional arguments.
-For example, to target a specific test file, `pnpm test <file>` is sufficient.
+When running package scripts with pnpm, you generally don’t need `--` as an args separator.
+For example, to target a specific test file, `pnpm test <file>` is sufficient.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pnpm does not use `--` to pass additional arguments.
For example, to target a specific test file, `pnpm test <file>` is sufficient.
When running package scripts with pnpm, you generally don't need `--` as an args separator.
For example, to target a specific test file, `pnpm test <file>` is sufficient.
🤖 Prompt for AI Agents
In CLAUDE.md around lines 17 to 19, the current guidance about passing arguments
to pnpm is misleading (it states pnpm uses `--` to pass additional arguments).
Update the wording to accurately state that pnpm forwards extra arguments
directly to scripts without requiring `--` (e.g., `pnpm test <file>`), and
optionally add a brief link or parenthetical to the pnpm docs for reference;
replace the incorrect sentence with a concise corrected sentence reflecting this
behavior.

### Development

```bash
Expand Down
2 changes: 1 addition & 1 deletion api/dev/configs/api.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.25.3",
"version": "4.27.2",
"extraOrigins": [],
"sandbox": true,
"ssoSubIds": [],
Expand Down
22 changes: 0 additions & 22 deletions api/ecosystem.config.json

This file was deleted.

4 changes: 2 additions & 2 deletions api/generated-schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1673,8 +1673,8 @@ type PackageVersions {
"""npm version"""
npm: String

"""pm2 version"""
pm2: String
"""nodemon version"""
nodemon: String

"""Git version"""
git: String
Expand Down
2 changes: 1 addition & 1 deletion api/legacy/generated-schema-legacy.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ type Versions {
openssl: String
perl: String
php: String
pm2: String
nodemon: String
postfix: String
postgresql: String
python: String
Expand Down
17 changes: 17 additions & 0 deletions api/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"watch": [
"dist/main.js"
],
"ignore": [
"node_modules",
"src",
".env.*"
],
"exec": "node $UNRAID_API_SERVER_ENTRYPOINT",
"signal": "SIGTERM",
"ext": "js,json",
"restartable": "rs",
"env": {
"NODE_ENV": "production"
}
}
Comment on lines +1 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

nodemon exec environment variable expansion $VAR shell

💡 Result:

Short answer: nodemon’s --exec runs your command directly (no shell), so shell $VAR expansion won’t happen. Run a shell explicitly (sh -c or bash -c) or put the env on the same command line.

Examples:

  • Force shell expansion:
    nodemon --exec "sh -c 'node server.js --opt="$MYVAR"'"

  • Set var for the command:
    MYVAR=foo nodemon --exec "node server.js"

References: Node child_process (spawn vs exec) and common patterns showing sh -c and nodemon in containers. [1][2][3]

Sources

  1. Node.js child_process docs (spawn vs exec and shell behavior). [turn3search7]
  2. FreeCodeCamp article – exec vs spawn and shell syntax. [turn3search0]
  3. Example using sh -c with nodemon in Docker / run commands. [turn2search2]

🏁 Script executed:

# Check the nodemon version used in the project
cd api && cat package.json | grep -A 5 -B 5 nodemon || echo "nodemon not found in api/package.json"

Repository: unraid/api

Length of output: 1091


🏁 Script executed:

# Check if there's a main project package.json
cat package.json | grep -A 5 -B 5 nodemon || echo "nodemon not found in root package.json"

Repository: unraid/api

Length of output: 92


🏁 Script executed:

# Look for any documentation or configuration examples in the repo
find . -type f \( -name "*.md" -o -name "*.txt" \) -exec grep -l "nodemon\|UNRAID_API_SERVER_ENTRYPOINT" {} \; 2>/dev/null | head -20

Repository: unraid/api

Length of output: 90


🏁 Script executed:

# Double-check: Look at the actual nodemon.json file being reviewed
cat api/nodemon.json

Repository: unraid/api

Length of output: 355


Fix nodemon exec to use shell wrapper for env-var expansion (Line 11).

The exec command "node $UNRAID_API_SERVER_ENTRYPOINT" will not expand the environment variable because nodemon spawns the command directly without a shell. Change to: "exec": "sh -c 'node $UNRAID_API_SERVER_ENTRYPOINT'" to ensure the variable is properly resolved at runtime.

🤖 Prompt for AI Agents
In api/nodemon.json around lines 1 to 17, the exec value currently uses "node
$UNRAID_API_SERVER_ENTRYPOINT" which won't expand the environment variable
because nodemon executes commands without a shell; update the exec to run via a
shell wrapper so env-vars expand by changing it to use sh -c 'node
$UNRAID_API_SERVER_ENTRYPOINT' (ensure proper quoting) so the environment
variable is resolved at runtime.

5 changes: 3 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"nestjs-pino": "4.4.0",
"node-cache": "5.1.2",
"node-window-polyfill": "1.0.4",
"nodemon": "3.1.10",
"openid-client": "6.6.4",
"p-retry": "7.0.0",
"passport-custom": "1.1.1",
Expand All @@ -137,7 +138,7 @@
"pino": "9.9.0",
"pino-http": "10.5.0",
"pino-pretty": "13.1.1",
"pm2": "6.0.8",
"proper-lockfile": "^4.1.2",
"reflect-metadata": "^0.1.14",
"rxjs": "7.8.2",
"semver": "7.7.2",
Expand Down Expand Up @@ -188,6 +189,7 @@
"@types/mustache": "4.2.6",
"@types/node": "22.18.0",
"@types/pify": "6.1.0",
"@types/proper-lockfile": "^4.1.4",
"@types/semver": "7.7.0",
"@types/sendmail": "1.4.7",
"@types/stoppable": "1.1.3",
Expand All @@ -203,7 +205,6 @@
"eslint-plugin-no-relative-import-paths": "1.6.1",
"eslint-plugin-prettier": "5.5.4",
"jiti": "2.5.1",
"nodemon": "3.1.10",
"prettier": "3.6.2",
"rollup-plugin-node-externals": "8.1.0",
"supertest": "7.1.4",
Expand Down
4 changes: 2 additions & 2 deletions api/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { exit } from 'process';
import type { PackageJson } from 'type-fest';
import { $, cd } from 'zx';

import { getDeploymentVersion } from './get-deployment-version.js';
import { getDeploymentVersion } from '@app/../scripts/get-deployment-version.js';

type ApiPackageJson = PackageJson & {
version: string;
Expand Down Expand Up @@ -94,7 +94,7 @@ try {

await writeFile('./deploy/pack/package.json', JSON.stringify(parsedPackageJson, null, 4));
// Copy necessary files to the pack directory
await $`cp -r dist README.md .env.* ecosystem.config.json ./deploy/pack/`;
await $`cp -r dist README.md .env.* nodemon.json ./deploy/pack/`;

// Change to the pack directory and install dependencies
cd('./deploy/pack');
Expand Down
5 changes: 0 additions & 5 deletions api/src/__test__/core/utils/pm2/dummy-process.js

This file was deleted.

222 changes: 0 additions & 222 deletions api/src/__test__/core/utils/pm2/unraid-api-running.integration.test.ts

This file was deleted.

Loading