ReviewOS

pantry-pm/pantry

pantry install should also install npm dependencies (bun install)

#200
Open glennmichael123 opened this 24 days ago · 0 comments
24 days ago

Problem

When migrating CI workflows from bun install to pantry install, npm dependencies are not installed. This causes builds to fail with errors like:

error: Could not resolve: "@stacksjs/clapp". Maybe you need to "bun install"?
error: Could not resolve: "ts-syntax-highlighter". Maybe you need to "bun install"?
error: Could not resolve: "bunfig". Maybe you need to "bun install"?

Current behavior

pantry install handles:

  • System packages (bun runtime, zig, etc.) from pantry.jsonc/deps.yaml
  • Workspace packages placed in pantry/
  • Lockfile management via pantry.lock
  • PHP deps via Composer delegation
  • Zig deps via build.zig.zon sync
  • Pre/post install hooks

But it does not install npm dependencies from package.json dependencies/devDependencies. These packages live in node_modules/ and are managed by bun install.

Expected behavior

pantry install should be a complete replacement for bun install in CI workflows. When a project has a package.json with npm dependencies, pantry install should also run bun install (or equivalent) to populate node_modules/.

This would allow CI workflows to simply use:

- name: Setup Pantry
  uses: home-lang/pantry/packages/action@main

- name: Install Dependencies
  run: pantry install

Instead of needing both:

- name: Setup Pantry
  uses: home-lang/pantry/packages/action@main

- name: Install Dependencies
  run: bun install

Context

We attempted to migrate 3 repos (bunpress, craft, dtsx) from bun install to pantry install in CI. All builds failed because npm packages weren't installed.

The install logic in packages/zig/src/cli/commands/install/core.zig does not delegate to bun install for npm dependencies. It handles pantry registry packages, Composer delegation for PHP, and Zig deps — but no npm/bun delegation.

Suggested implementation

After the pantry-specific install steps complete, detect if package.json exists with npm dependencies and run bun install automatically. Similar to how Composer delegation already works in install/core.zig:981-989.

// Pseudocode for the additional step:
if (fileExists("package.json") && hasNpmDependencies()) {
    runCommand("bun install");
}

This would make pantry install a true superset that handles everything — system packages, language-specific packages, AND npm dependencies.

Sign in to comment on this issue.