Skip to content

fix: Add build js command to makefile serve commands#4035

Merged
crivetimihai merged 3 commits intomainfrom
fix/build-js-before-make-dev
Apr 5, 2026
Merged

fix: Add build js command to makefile serve commands#4035
crivetimihai merged 3 commits intomainfrom
fix/build-js-before-make-dev

Conversation

@gcgoncalves
Copy link
Copy Markdown
Collaborator

📝 Summary

Adds a js-build target to the Makefile that runs npm install and npm run vite:build, wired as a prerequisite to all non-containerised app-starting targets (serve, serve-ssl, serve-granian, serve-granian-ssl, serve-granian-http2, dev, dev-remote, run). This ensures the Vite JS bundle is always up to date before the server starts, without requiring a separate manual step.


🏷️ Type of Change

  • Bug fix
  • Feature / Enhancement
  • Documentation
  • Refactor
  • Chore (deps, CI, tooling)
  • Other (describe below)

Ensuring the JS/Vite bundle is built as part of the standard server startup workflow


📓 Notes (optional)

The js-build target is declared .PHONY so it always runs. npm install is included before the build step to keep the workflow self-contained - no assumption that node_modules is already present. dev-echo was left unchanged as it is an observability diagnostic variant, not a primary entry point.

@gcgoncalves gcgoncalves force-pushed the fix/build-js-before-make-dev branch from 8e22c7f to 5ba262e Compare April 3, 2026 14:20
gcgoncalves and others added 2 commits April 5, 2026 23:12
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Add js-build as a prerequisite for dev-echo for consistency with all
other serve/dev targets. Update .secrets.baseline line numbers.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai force-pushed the fix/build-js-before-make-dev branch from 226927c to 93b8fd9 Compare April 5, 2026 22:32
crivetimihai
crivetimihai previously approved these changes Apr 5, 2026
Copy link
Copy Markdown
Member

@crivetimihai crivetimihai left a comment

Choose a reason for hiding this comment

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

Nice contribution — this is a solid DX improvement. Having the Vite bundle built automatically before any server target prevents a common "blank UI" gotcha on fresh checkouts.

A couple of changes I made during rebase:

  1. Rebased onto main — the two merge commits are gone, replaced with a clean linear history.
  2. Dropped .secrets.baseline from the original commit — the line-number shifts were artifacts of branch divergence and are handled separately.
  3. Added js-build as a prerequisite to dev-echo — this was the only dev/serve target missing it, and someone running make dev-echo on a fresh checkout would have gotten a broken frontend. Added a follow-up commit for this + the regenerated secrets baseline.

Minor note for future reference: the js-build target uses npm install while CI uses npm ci and Containerfiles use npm install --frozen-lockfile. For local dev this is fine — npm ci would be slower on repeated invocations since it wipes node_modules each time. Just worth keeping in mind if reproducibility ever becomes an issue.

LGTM — approving.

Guard the js-build target so it warns instead of failing when npm is
not installed. This prevents serve/dev targets from breaking in
environments without Node.js — the API server still starts, only the
admin UI bundle is skipped. Also adds --no-audit --no-fund to suppress
noisy npm output during server startup.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai
Copy link
Copy Markdown
Member

Follow-up fix pushed: the js-build target now checks for npm availability before running. If npm isn't installed, it prints a warning and lets the server start anyway — the API works fine without the JS bundle, only the admin UI would be missing.

This avoids introducing Node.js as a hard runtime dependency for make serve / make dev in environments that don't need the admin UI (e.g. headless API deployments, CI runners without Node).

Also added --no-audit --no-fund flags to keep npm output clean during startup.

@crivetimihai crivetimihai merged commit 8577b4f into main Apr 5, 2026
18 of 19 checks passed
@crivetimihai crivetimihai deleted the fix/build-js-before-make-dev branch April 5, 2026 22:39
cafalchio pushed a commit that referenced this pull request Apr 6, 2026
* fix: Add build js command to makefile serve commands

Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix: add js-build dep to dev-echo, update secrets baseline

Add js-build as a prerequisite for dev-echo for consistency with all
other serve/dev targets. Update .secrets.baseline line numbers.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix: make js-build graceful when npm is not available

Guard the js-build target so it warns instead of failing when npm is
not installed. This prevents serve/dev targets from breaking in
environments without Node.js — the API server still starts, only the
admin UI bundle is skipped. Also adds --no-audit --no-fund to suppress
noisy npm output during server startup.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
cafalchio pushed a commit that referenced this pull request Apr 6, 2026
* fix: Add build js command to makefile serve commands

Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix: add js-build dep to dev-echo, update secrets baseline

Add js-build as a prerequisite for dev-echo for consistency with all
other serve/dev targets. Update .secrets.baseline line numbers.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix: make js-build graceful when npm is not available

Guard the js-build target so it warns instead of failing when npm is
not installed. This prevents serve/dev targets from breaking in
environments without Node.js — the API server still starts, only the
admin UI bundle is skipped. Also adds --no-audit --no-fund to suppress
noisy npm output during server startup.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
jonpspri pushed a commit that referenced this pull request Apr 10, 2026
* fix: Add build js command to makefile serve commands

Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix: add js-build dep to dev-echo, update secrets baseline

Add js-build as a prerequisite for dev-echo for consistency with all
other serve/dev targets. Update .secrets.baseline line numbers.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix: make js-build graceful when npm is not available

Guard the js-build target so it warns instead of failing when npm is
not installed. This prevents serve/dev targets from breaking in
environments without Node.js — the API server still starts, only the
admin UI bundle is skipped. Also adds --no-audit --no-fund to suppress
noisy npm output during server startup.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
claudia-gray pushed a commit that referenced this pull request Apr 13, 2026
* fix: Add build js command to makefile serve commands

Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix: add js-build dep to dev-echo, update secrets baseline

Add js-build as a prerequisite for dev-echo for consistency with all
other serve/dev targets. Update .secrets.baseline line numbers.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix: make js-build graceful when npm is not available

Guard the js-build target so it warns instead of failing when npm is
not installed. This prevents serve/dev targets from breaking in
environments without Node.js — the API server still starts, only the
admin UI bundle is skipped. Also adds --no-audit --no-fund to suppress
noisy npm output during server startup.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants