npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grand-central-core

v0.4.0

Published

Shared library for grand-central infrastructure generation

Readme

Grand Central Core

Core library for generating infrastructure configurations from OAM-style specifications.

Features

  • YAML-based infrastructure specification
  • Multi-environment support (dev, prod, etc.)
  • 3-layer configuration merge (Global → Project → Spec)
  • Component type routing (e.g., serviceapp, postgresdatastores)

Installation

npm install

Quick Start

  1. Create a project definition in specs/infra/grand.central.core.yaml.
  2. Run the generator:
    ./scripts/grand-central-core generate
  3. Find generated artifacts in infra/.

CLI Usage

Command: generate-infra (aliases: generate, gen)

Generates infrastructure artifacts from an input specification.

Syntax:

./scripts/grand-central-core generate [options]

Options:

| Option | Alias | Description | Default | |--------|-------|-------------|---------| | --project-root | -p | Path to the project root | process.cwd() | | --input-spec | -i | Path to input spec file (relative to root) | specs/infra/grand.central.core.yaml | | --output-dir | -o | Directory to output artifacts | infra/ | | --dry-run | | Validate and normalize without writing files | false | | --help | | Show help message | | | --version | | Show version number | |

Examples:

# Default usage (looks for specs/infra/grand.central.core.yaml)
./scripts/grand-central-core generate

# Custom spec location
./scripts/grand-central-core generate -i my-spec.yaml

# Dry run to validate spec only
./scripts/grand-central-core gen --dry-run

Command: generate-docs

Generates a Markdown reference of the supported input specification schema and available components.

Syntax:

./scripts/grand-central-core generate-docs [options]

Options:

| Option | Description | Default | |--------|-------------|---------| | --out | Output file path | docs/spec-reference.md |

Example:

# Generate docs/spec-reference.md (default)
./scripts/grand-central-core generate-docs

Input Specification Format

Input specs are YAML files describing the application and its components.

version: '1.0'
app:
  name: "my-app"
  blueprint: "service"

environments:
  - name: "dev"
  - name: "prod"

components:
  - name: "api"
    type: "service"
    properties:
      image: "my-app:latest"
      port: 8080
    traits:
      - type: "lifecycle"
        properties: { enabled: true }
      - type: "env-binding"
        properties:
          environments:
            dev: { replicas: 1 }
            prod: { replicas: 3 }

relations:
  - from: "api"
    to: "db"
    kind: "connects"

Output Artifacts

The generator produces split artifact files tailored for different infrastructure provisioners:

  • app.hudson.yaml: Contains service, worker, frontend, job, batch components.
  • datastores.hudson.yaml: Contains postgres, redis, mysql, mongo, dynamodb, s3, bucket.
  • queues.hudson.yaml: Contains queue, topic, stream, kafka, rabbitmq.

Library API

You can use the core logic programmatically:

import { compileProject, generateArtifacts } from 'grand-central-core';

// 1. Compile (Load -> Validate -> Normalize)
const result = compileProject('/path/to/project', '/path/to/spec.yaml');

if (result.success) {
    // 2. Generate
    generateArtifacts(result.spec, '/path/to/output', '/path/to/source.yaml');
}

Architecture

The library operates in a pipeline:

  1. Input Specs: Zod-validated YAML parsing.
  2. Env Resolver: Calculates component state per environment (Enabled/Disabled + Overrides).
  3. Compiler: Validates and normalizes the spec into a deterministic structure.
  4. Output Artifacts: Partitions components into target-specific files.

Testing

The project maintains high test coverage (~95%) using Jest.

npm test

Current Status: 38 tests passing (Unit + Integration).

Development Workflow

  1. Modify Source: Edit files in src/.
  2. Test: Run npm test to verify changes.
  3. Build: Run npm run build to compile TypeScript and copy assets.
  4. Verify CLI: Run the CLI against a test project to ensure end-to-end functionality.

Releasing

This project is consumed via Git dependencies. To release a new version:

  1. Release: Run a single command to test, build, update docs, tag, and push:

    npm version patch  # or minor, major

    What happens automatically:

    1. preversion: Runs tests. Stops if they fail.
    2. version: Builds project, regenerates docs/spec-reference.md, and adds it to the commit.
    3. postversion: Pushes the new commit and tag to GitHub.
  2. Update Consumers: In the consumer project:

    npm install git+ssh://[email protected]/rakeyshgidwani/grand-central-core.git#vX.Y.Z