Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions changelog.d/frontend-npm-prefix-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: **Frontend install command compatibility**: generated web-frontend builds now run `npm --prefix frontend install`, matching the existing build/dev command shape and avoiding npm versions that look for a root `package.json` when `--prefix` follows `install`.
2 changes: 1 addition & 1 deletion examples/next/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub fn build(b: *std.Build) void {
linkPlatform(b, target, app_mod, exe, selected_platform, web_engine, native_sdk_path, cef_dir, cef_auto_install);
b.installArtifact(exe);

const frontend_install = b.addSystemCommand(&.{ "npm", "install", "--prefix", "frontend" });
const frontend_install = b.addSystemCommand(&.{ "npm", "--prefix", "frontend", "install" });
const frontend_install_step = b.step("frontend-install", "Install frontend dependencies");
frontend_install_step.dependOn(&frontend_install.step);

Expand Down
2 changes: 1 addition & 1 deletion examples/react/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub fn build(b: *std.Build) void {
linkPlatform(b, target, app_mod, exe, selected_platform, web_engine, native_sdk_path, cef_dir, cef_auto_install);
b.installArtifact(exe);

const frontend_install = b.addSystemCommand(&.{ "npm", "install", "--prefix", "frontend" });
const frontend_install = b.addSystemCommand(&.{ "npm", "--prefix", "frontend", "install" });
const frontend_install_step = b.step("frontend-install", "Install frontend dependencies");
frontend_install_step.dependOn(&frontend_install.step);

Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub fn build(b: *std.Build) void {
linkPlatform(b, target, app_mod, exe, selected_platform, web_engine, native_sdk_path, cef_dir, cef_auto_install);
b.installArtifact(exe);

const frontend_install = b.addSystemCommand(&.{ "npm", "install", "--prefix", "frontend" });
const frontend_install = b.addSystemCommand(&.{ "npm", "--prefix", "frontend", "install" });
const frontend_install_step = b.step("frontend-install", "Install frontend dependencies");
frontend_install_step.dependOn(&frontend_install.step);

Expand Down
2 changes: 1 addition & 1 deletion examples/vue/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub fn build(b: *std.Build) void {
linkPlatform(b, target, app_mod, exe, selected_platform, web_engine, native_sdk_path, cef_dir, cef_auto_install);
b.installArtifact(exe);

const frontend_install = b.addSystemCommand(&.{ "npm", "install", "--prefix", "frontend" });
const frontend_install = b.addSystemCommand(&.{ "npm", "--prefix", "frontend", "install" });
const frontend_install_step = b.step("frontend-install", "Install frontend dependencies");
frontend_install_step.dependOn(&frontend_install.step);

Expand Down
6 changes: 3 additions & 3 deletions src/tooling/templates.zig
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
\\ linkPlatform(b, target, app_mod, exe, selected_platform, web_engine, native_sdk_path, cef_dir, cef_auto_install);
\\ b.installArtifact(exe);
\\
\\ const frontend_install = b.addSystemCommand(&.{ "npm", "install", "--prefix", "frontend" });
\\ const frontend_install = b.addSystemCommand(&.{ "npm", "--prefix", "frontend", "install" });
\\ const frontend_install_step = b.step("frontend-install", "Install frontend dependencies");
\\ frontend_install_step.dependOn(&frontend_install.step);
\\
Expand Down Expand Up @@ -2704,7 +2704,7 @@ fn readme(allocator: std.mem.Allocator, names: TemplateNames, framework_path: []
\\`zig build dev`, `zig build run`, and `zig build package` install frontend dependencies automatically. To install them explicitly, run:
\\
\\```sh
\\npm install --prefix frontend
\\npm --prefix frontend install
\\```
\\
\\The generated build defaults to this Native SDK framework path:
Expand Down Expand Up @@ -2830,7 +2830,7 @@ test "writeDefaultApp emits Vite project files" {
try std.testing.expect(std.mem.indexOf(u8, app_zon_text, "npm") != null);
try std.testing.expect(std.mem.indexOf(u8, app_zon_text, ".windows") != null);
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "frontend-install") != null);
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "\"npm\", \"install\", \"--prefix\", \"frontend\"") != null);
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "\"npm\", \"--prefix\", \"frontend\", \"install\"") != null);
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "frontend-build") != null);
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "frontend_build.step.dependOn(&frontend_install.step)") != null);
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "\"native\", \"dev\"") != null);
Expand Down