Contributing

Contributing to cem

Thank you for your interest in contributing to cem! This guide will help you set up your environment for development, building, and testing. Please read carefully and reach out if you have questions.

  • Fork and clone the repo:
    git clone https://github.com/bennypowers/cem.git
    cd cem
    
  • Install Go (version 1.24 or newer recommended).
  • Install Node.js (version 22 recommended) and npm.

To build the project for your local architecture:

make build

The binary will be output to dist/cem.

You can cross-compile Windows binaries from any OS using Podman (or Docker). This will output cem-windows-x64.exe and cem-windows-arm64.exe in your project root.

  1. Install Podman for your platform.
  2. Run:
    make windows
    
    This will build both Windows x64 and arm64 executables using the parameterized Containerfile.

Tip:
You can build a specific Windows architecture:

  • x64: make windows-x64
  • arm64: make windows-arm64

Note: These builds are cross-compiled and cannot be run directly on macOS or Linux. Test on a Windows machine or VM if needed.

The workspace package provides a consistent interface for working with local and remote packages. It abstracts away the details of whether files are on the local filesystem or need to be fetched from a remote source like the npm registry. This allows the list command to work with both local and remote packages seamlessly.

This project includes both unit tests and end-to-end (E2E) tests.

  • Run unit tests: make test-unit
  • Run E2E tests: make test-e2e
  • Run all tests: make test

To view the test coverage report, run:

make show-coverage

This will open an HTML report in your browser.

  • All PRs are built and tested via GitHub Actions.
  • The CI will cross-compile for Linux, macOS, and Windows (x64 and arm64), package npm binaries for each platform, and check that npm packaging works.
  • You can see the exact build matrices in .github/workflows/release.yml and .github/workflows/test-build.yml.

The project produces platform-specific npm packages. Platform detection and binary installation are managed by scripts in the npm directory. You can test npm packaging locally with:

node scripts/gen-platform-package-jsons.js

and validate the package with:

cd platforms/cem-<platform>-<arch>
npm pack --dry-run

cem uses an esbuild-style optionalDependencies strategy for platform binaries.

  1. Tag your release (e.g., v1.2.3) in the main branch.
  2. The CI workflow will:
    • Cross-compile and publish each @pwrs/cem-PLATFORM-ARCH package with the correct binary.
    • Publish the main @pwrs/cem package with all subpackages as optionalDependencies.
  • Use npm install --ignore-scripts to test installation.
  • The wrapper (bin/cem.js) will find and invoke the platform-specific binary.
  • Node.js 22+ is required for all packages.
  • All packages are ESM-only ("type": "module").
  • Add a new entry in scripts/gen-platform-package-jsons.mjs and build logic.
  • Update the main package’s optionalDependencies.
  • The main package (@pwrs/cem) does not ship a binary.
  • On install, npm will only pull in the appropriate platform package.
  • The wrapper script detects your platform and runs the correct binary.
  • Go:
    make format
    make lint
    
  • Open a pull request from your fork.
  • Ensure all CI checks pass.
  • Provide a clear description of your changes.

Thank you for contributing!

Contributing to cem

Thank you for your interest in contributing to cem! This guide will help you set up your environment for development, building, and testing. Please read carefully and reach out if you have questions.

  • Fork and clone the repo:
    git clone https://github.com/bennypowers/cem.git
    cd cem
    
  • Install Go (version 1.24 or newer recommended).
  • Install Node.js (version 22 recommended) and npm.

To build the project for your local architecture:

make build

The binary will be output to dist/cem.

You can cross-compile Windows binaries from any OS using Podman (or Docker). This will output cem-windows-x64.exe and cem-windows-arm64.exe in your project root.

  1. Install Podman for your platform.
  2. Run:
    make windows
    
    This will build both Windows x64 and arm64 executables using the parameterized Containerfile.

Tip:
You can build a specific Windows architecture:

  • x64: make windows-x64
  • arm64: make windows-arm64

Note: These builds are cross-compiled and cannot be run directly on macOS or Linux. Test on a Windows machine or VM if needed.

The workspace package provides a consistent interface for working with local and remote packages. It abstracts away the details of whether files are on the local filesystem or need to be fetched from a remote source like the npm registry. This allows the list command to work with both local and remote packages seamlessly.

This project includes both unit tests and end-to-end (E2E) tests.

  • Run unit tests: make test-unit
  • Run E2E tests: make test-e2e
  • Run all tests: make test

To view the test coverage report, run:

make show-coverage

This will open an HTML report in your browser.

  • All PRs are built and tested via GitHub Actions.
  • The CI will cross-compile for Linux, macOS, and Windows (x64 and arm64), package npm binaries for each platform, and check that npm packaging works.
  • You can see the exact build matrices in .github/workflows/release.yml and .github/workflows/test-build.yml.

The project produces platform-specific npm packages. Platform detection and binary installation are managed by scripts in the npm directory. You can test npm packaging locally with:

node scripts/gen-platform-package-jsons.js

and validate the package with:

cd platforms/cem-<platform>-<arch>
npm pack --dry-run

cem uses an esbuild-style optionalDependencies strategy for platform binaries.

  1. Tag your release (e.g., v1.2.3) in the main branch.
  2. The CI workflow will:
    • Cross-compile and publish each @pwrs/cem-PLATFORM-ARCH package with the correct binary.
    • Publish the main @pwrs/cem package with all subpackages as optionalDependencies.
  • Use npm install --ignore-scripts to test installation.
  • The wrapper (bin/cem.js) will find and invoke the platform-specific binary.
  • Node.js 22+ is required for all packages.
  • All packages are ESM-only ("type": "module").
  • Add a new entry in scripts/gen-platform-package-jsons.mjs and build logic.
  • Update the main package’s optionalDependencies.
  • The main package (@pwrs/cem) does not ship a binary.
  • On install, npm will only pull in the appropriate platform package.
  • The wrapper script detects your platform and runs the correct binary.
  • Go:
    make format
    make lint
    
  • Open a pull request from your fork.
  • Ensure all CI checks pass.
  • Provide a clear description of your changes.

Thank you for contributing!