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

@tsops/core

v0.9.0

Published

Core library for tsops - TypeScript toolkit for Kubernetes

Readme

@tsops/core

Core library for tsops, providing the domain model, configuration resolvers, and orchestration logic.

Architecture

The core package is organized into several layers:

1. Configuration Layer (config/)

Resolvers that transform user configuration into runtime values:

  • project.ts – Project metadata and service naming
  • domain.ts – Domain resolution by region
  • namespaces.ts – Namespace selection and context creation
  • images.ts – Docker image reference building with tag strategies
  • apps.ts – Application configuration resolution (host, env, network)
  • network-normalizers.ts – Network configuration helpers (ingress, ingressRoute, certificate)

Key concept: Each resolver has a single responsibility and depends only on other resolvers it needs.

2. Operations Layer (operations/)

High-level operations that implement the main workflows:

  • planner.ts – Resolves configuration into deployment plans
  • builder.ts – Orchestrates Docker image builds
  • deployer.ts – Generates manifests and applies them via kubectl

3. Ports Layer (ports/)

Type-only contracts that describe external integrations. Implementations live in platform packages such as @tsops/node:

  • docker.tsDockerClient interface used by Builder
  • kubectl.tsKubectlClient interface used by Deployer

4. Infrastructure Layer

  • environment-provider.ts – Abstraction for accessing environment variables (bundler-safe defaults)
  • logger.ts – Logging interface and console implementation

5. Main Orchestrator

tsops.ts – The TsOps class that ties everything together and provides the public API.

Key Design Principles

Dependency Injection

All classes accept their dependencies through constructors:

class Builder {
  constructor(dependencies: {
    docker: DockerService
    logger: Logger
    resolver: ConfigResolver<TConfig>
  }) {
    // ...
  }
}

This makes the code testable and allows swapping implementations.

Single Responsibility

Each class/module has one clear purpose:

  • Planner – only planning
  • Builder – only building
  • Deployer – only deploying

Environment Independence

No direct access to process.env or external state. Everything goes through abstractions:

  • EnvironmentProvider for env vars
  • CommandRunner for external commands
  • Logger for output

Usage

Basic Example (Node runtime)

import { createNodeTsOps } from '@tsops/node'
import config from './tsops.config'

const tsops = createNodeTsOps(config, { dryRun: true })

const plan = await tsops.planWithChanges({ namespace: 'prod' })
await tsops.build({ app: 'api' })
await tsops.deploy({ namespace: 'prod', app: 'api' })

createNodeTsOps wires the Node adapters (Docker, Kubectl, DefaultCommandRunner) together with the default environment provider (GitEnvironmentProvider(ProcessEnvironmentProvider)) so the orchestrator stays platform-neutral.

With Custom Dependencies

You can still instantiate TsOps directly when you need to provide bespoke adapters (for example, using mocked runners in tests or targeting a different execution environment):

import { TsOps, ConsoleLogger, type Logger } from '@tsops/core'
import {
  DefaultCommandRunner,
  Docker,
  Kubectl,
  GitEnvironmentProvider,
  ProcessEnvironmentProvider
} from '@tsops/node'

const runner = new DefaultCommandRunner()
const logger: Logger = new ConsoleLogger()
const env = new GitEnvironmentProvider(new ProcessEnvironmentProvider())

const tsops = new TsOps(config, {
  docker: new Docker({ runner, logger, dryRun: true }),
  kubectl: new Kubectl({ runner, logger, dryRun: true }),
  logger,
  env,
  dryRun: true
})

Configuration

See the main README for full configuration documentation. Key concepts:

  • defineConfig – Type-safe configuration helper
  • Tag strategiesgit-sha, git-tag, timestamp, or custom
  • Namespace selection – Resolvers automatically determine which apps deploy where
  • Network helpers – Dynamic ingress/certificate configuration based on context

Development

The package is built with TypeScript and exports .js files with declaration maps:

pnpm build       # Compile TypeScript
pnpm build:watch # Watch mode

Related Packages

  • tsops – CLI package that also exports defineConfig
  • @tsops/node – Node-specific adapters (createNodeTsOps, Docker/kubectl runners)
  • @tsops/k8 – Kubernetes manifest builders