Skip to content

Update mer init to work with npm/pip installed binaries #79

@justrach

Description

@justrach

Problem

When mer is installed via npm or pip, the mer init command needs to handle:

  1. Detecting it's running from a wrapper-installed binary
  2. Properly setting up the scaffold with all required files
  3. Handling platform-specific paths correctly

Current State

The mer init command currently:

  • Creates scaffold files from embedded templates
  • Runs zig build to get fingerprint
  • Sets up build.zig, build.zig.zon, starter pages

Required Updates

1. Binary Path Detection

// Need to detect if running from npm/pip wrapper
// npm: binary at node_modules/merjs/bin/mer
// pip: binary at site-packages/merjs/bin/mer

2. Template Resolution

  • Ensure template files are found regardless of install method
  • May need to check multiple locations for embedded files

3. Post-Init Message

Update the success message to show package-manager-specific next steps:

# For npm users:
npx mer init my-app  →  cd my-app && npm install && npm run dev

# For pip users:  
pip install merjs && mer init my-app  →  cd my-app && zig build serve

Acceptance Criteria

  • mer init works correctly when mer is installed via npm
  • mer init works correctly when mer is installed via pip
  • Clear error messages if Zig is not installed
  • Platform-specific paths handled correctly on Windows

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions