Hamburger Cross Icon
Engines Pinned
+
Node.js Collector

Engines Pinned + Node.js Collector

Guardrail Collector Stable Devex Build And Ci

Enforce Engines Pinned using data collected by Node.js Collector. Automatically check devex build and ci standards on every PR.

Guardrail: Ensures the engines.node field is set in package.json. Pinning the Node.js engine version prevents compatibility issues across environments.
Data Source: Analyze Node.js projects to collect package metadata, dependencies, test coverage, and CI/CD command tracking. Enforce Node.js-specific engineering standards.

How Node.js Collector Powers This Guardrail

The Node.js Collector gathers metadata from your languages, build systems. This data flows into Lunar's Component JSON, where the Engines Pinned guardrail evaluates it against your standards.

When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.

1
Node.js Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Engines Pinned Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# Step 1: Enable the Node.js Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/nodejs@v1.0.0
    # with: ...

# Step 2: Enable the Node.js Project Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/nodejs@v1.0.0
    include: [engines-pinned]
    # with: ...

What Node.js Collector Collects

This collector gathers the following data that the Engines Pinned guardrail evaluates.

Collector code

project

Analyzes Node.js project structure by detecting package.json, lockfiles, TypeScript configuration, ESLint, Prettier, monorepo setup, and engines.node. Writes project metadata to .lang.nodejs with build system info.

Collector code

dependencies

Extracts direct and dev dependencies from package.json. Captures package names and version ranges for dependency tracking and policy enforcement.

Collector ci-before-command

cicd

Records every npm, yarn, or pnpm command executed in CI pipelines along with the Node.js version. Writes command strings and version info to .lang.nodejs.cicd for audit trails and build reproducibility analysis.

Collector ci-after-command

test-coverage

Extracts coverage percentage from existing test coverage output after tests complete. Parses coverage-summary.json to calculate total coverage and writes results to .lang.nodejs.tests.coverage and .testing.coverage.

Example Data Flow

Here's an example of the data that Node.js Collector writes to the Component JSON, which Engines Pinned then evaluates.

{ } component.json From Node.js Collector
{
  "lang": {
    "nodejs": {
      "version": "20.11.0",
      "build_systems": ["npm"],
      "package_json_exists": true,
      "package_lock_exists": true,
      "yarn_lock_exists": false,
      "pnpm_lock_exists": false,
      "tsconfig_exists": true,
      "eslint_configured": true,
      "prettier_configured": false,
      "engines_node": ">=18",
      "monorepo": { "type": "workspaces" },
      "source": { "tool": "node", "integration": "code" },
      "cicd": {
        "cmds": [{ "cmd": "npm test", "version": "20.11.0" }],
        "source": { "tool": "node", "integration": "ci" }
      },
      "tests": {
        "coverage": {
          "percentage": 85.5,
          "source": { "tool": "jest", "integration": "ci" }
        }
      },
      "dependencies": {
        "direct": [
          { "path": "express", "version": "^4.18.2" }
        ],
        "dev": [
          { "path": "jest", "version": "^29.7.0" }
        ],
        "source": { "tool": "npm", "integration": "code" }
      }
    }
  }
}

Configuration Options

Node.js Project Guardrails Inputs

Input Required Default Description
min_node_version Optional 18 Minimum required Node.js major version (e.g., "18", "20")
min_node_version_cicd Optional 18 Minimum required Node.js major version for CI/CD commands (e.g., "18", "20")

Ready to Automate Your Standards?

See how Lunar can turn your engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.

Works with any process
check Infrastructure conventions
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Turn any process doc into guardrails
Book a Demo