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

@okeeffed/gitlab-ci-kit

v0.0.7

Published

GitLab CI pipelines in TypeScript

Readme

GitLab CI Kit

A TypeScript library for generating GitLab CI pipelines with type safety and auto-generated schema types.

Overview

GitLab CI Kit provides a programmatic way to define GitLab CI/CD pipelines using TypeScript instead of manually writing YAML. The library automatically generates TypeScript types from GitLab's official JSON schema, ensuring your pipelines are always compatible with the latest GitLab CI features.

Define your jobs and pipeline configuration in TypeScript, then synthesize them to valid GitLab CI YAML with automatic snake_case conversion.

Features

  • 🎯 Type-Safe Pipeline Definitions - Full TypeScript support with auto-generated types from GitLab's official schema
  • 🔄 Auto-Generated Types - Types are generated directly from GitLab's CI JSON schema
  • 🐍 Automatic snake_case Conversion - Write in camelCase, output in snake_case
  • Built-in Validation - Catch configuration errors before committing
  • 🎨 Clean YAML Output - Synthesizes to readable GitLab CI YAML
  • 🧩 Composable Jobs - Build reusable job configurations with type safety

Installation

npm install @okeeffed/gitlab-ci-kit

Quick Start

import { Job, Rule, Default, synth } from '@okeeffed/gitlab-ci-kit';

// Define jobs with camelCase properties
const jobs = {
  build: new Job({
    stage: 'build',
    image: 'node:20',
    script: ['npm ci', 'npm run build'],
    cache: {
      key: '${CI_COMMIT_REF_SLUG}',
      paths: ['node_modules/'],
    },
    artifacts: {
      paths: ['dist/'],
      expireIn: '1 week', // camelCase!
    },
  }),

  test: new Job({
    stage: 'test',
    image: 'node:20',
    script: ['npm test'],
    beforeScript: ['npm ci'], // camelCase!
    allowFailure: true, // camelCase!
  }),

  deploy: new Job({
    stage: 'deploy',
    image: 'node:20',
    script: ['npm run deploy'],
    rules: [
      new Rule({ if: '$CI_COMMIT_BRANCH == "main"' }),
      new Rule({
        if: '$CI_PIPELINE_SOURCE == "merge_request_event"',
        when: 'manual',
      }),
    ],
    environment: {
      name: 'production',
      url: 'https://example.com',
    },
  }),
};

// Pipeline configuration with camelCase
const config = {
  variables: {
    NODE_VERSION: '20',
  },
  stages: ['build', 'test', 'deploy'],
  default: new Default({
    idTokens: { // camelCase!
      GITLAB_OIDC_TOKEN: {
        aud: 'https://gitlab.com',
      },
    },
    tags: ['docker'],
  }),
};

// Generate YAML (automatically converts to snake_case)
const yaml = synth(jobs, config);
console.log(yaml);

Core Concepts

Job

Individual tasks that execute scripts, build artifacts, run tests, or deploy applications. Jobs are defined using the Job class with type-safe properties.

Rule

Workflow rules that determine when jobs run. Create rules using the Rule class.

Default

Global default settings applied to all jobs. Define using the Default class.

synth()

The synthesizer function that converts your TypeScript job definitions and configuration into valid GitLab CI YAML, automatically converting camelCase properties to snake_case.

Type Generation

The library includes a script that fetches the latest GitLab CI JSON schema and generates TypeScript types:

npm run generate:types

This ensures your pipeline definitions stay in sync with GitLab's latest features and validates your configuration against the official schema.

Schema Source: GitLab CI JSON Schema

Development

# Install dependencies
npm install

# Build the library
npm run build

# Run tests
npm test

# Generate types from GitLab's schema
npm run generate:types

# Type checking
npm run type-check

# Lint
npm run lint

# Format code
npm run format

Examples

See the examples/ directory for complete pipeline examples.

Requirements

  • Node.js >= 18.0.0

License

MIT