A parsing library for CircleCI configuration files, powered by the CircleCI Config SDK

Overview

CircleCI Config Parser

A parsing library for CircleCI configuration files, powered by the CircleCI Config SDK

Used by the CircleCI Visual Config Editor to generate an interactive and editable visual representation of your CircleCI config.

Getting Started

Installation

Using npm:

$ npm i @circleci/circleci-config-parser

Using yarn:

$ yarn add @circleci/circleci-config-parser

Usage

In Node.js:

import ConfigParser from '@circleci/circleci-config-parser';

In Browser:

const ConfigParser = require('@circleci/circleci-config-parser');

Loading a Config instance from a config file

import fs from 'fs';

const configSrc = fs.readFileSync('./config.yml', 'utf8');
const config = ConfigParser.parseConfig(configSrc);

Parsing a job config equivalent object, into a CircleCI Config SDK Job instance.

const jobIn = {
  docker: [{ image: 'cimg/base:2022.08' }],
  resource_class: 'medium',
  steps: [
    {
      run: {
        command: 'echo << parameters.greeting >>',
      },
    },
  ],
  parameters: {
    greeting: {
      type: 'string',
    },
  },
};

// Parsing function
ConfigParser.parseJob('Job Name', jobIn);

The equivalent config-sdk instantiation for that object:

new CircleCI.reusable.ParameterizedJob(
  'my_job',
  new CircleCI.executors.DockerExecutor('cimg/node:lts'),
  new CircleCI.parameters.CustomParametersList([
    new CircleCI.parameters.CustomParameter('greeting', 'string'),
  ]),
  [
    new CircleCI.commands.Run({
      command: 'echo << parameters.greeting >>',
    }),
  ],
);

Parsing Orb references requires an OrbManifest, which is a representation of Orbs outward facing properties.

import fs from 'fs';

const customOrbProps = {
  // component type
  jobs: {
    // name of component
    say_hello: {
      // component parameters
      greeting: {
        type: 'string',
      },
    },
  },
  commands: {
    say_it: {
      what: {
        type: 'string',
      },
    },
  },
  executors: {
    python: {
      version: {
        type: 'string',
        default: '1.0.0',
      },
    },
  },
};

const customOrbManifest = ConfigParser.parseOrbManifest(customOrbProps);

const configSrc = fs.readFileSync('./config.yml', 'utf8');
const config = ConfigParser.parseConfig(configSrc, {
  'custom-orb': customOrbManifest,
});
You might also like...

Framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. 🗺️ Remix driver included. 🤟

Framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. 🗺️ Remix driver included. 🤟

About routes-gen is a framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. Think of it as Prisma,

Jan 2, 2023

Runtime object parsing and validation with static TypeScript typing.

TypeParse Runtime object transformation, parsing and validation with inferred static TypeScript typing. Install Using npm npm install typeparse Using

May 5, 2022

A TOML parsing tool written in Rust for Node.js

@daydog/toml A TOML parsing tool written in Rust for Node.js Installation @daydog/toml is available via npm. npm install @daydog/toml Usage parse You

Jul 20, 2022

Command-line toolkit for parsing, compiling, transpiling, optimizing, linking, dataizing, and running EOLANG programs

First, you install npm and Java SE. Then, you install eolang package: $ npm install eolang Then, you write a simple EO program in hello.eo file in th

Nov 17, 2022

Utilities for parsing and manipulating LaTeX ASTs with the Unified.js framework

unified-latex Monorepo for @unified-latex packages. These packages provide a JS/TypeScript interface for creating, manipulating, and printing LaTeX Ab

Dec 27, 2022

Enhanced interval features for Node.js, such as promisified interval and human readable time parsing.

Interval-next Interval-next is a package that extends Javascript's built-in setInterval() capabilities. You have a plain and promisified interval meth

Jul 28, 2022

🚀 Blazing Fast S3 Powered CDN ✨ Powered By Fastify, S3 Buckets & Docker!

🚀 WasiCDN Blazing Fast S3 Powered CDN, Powered By Fastify, S3 Compatible Buckets & Docker! Core DockerHub: https://hub.docker.com/r/maximking19/wasic

Aug 31, 2022

A template to create a React Library. Zero configuration, just use!

React lib template 📦 A simple React lib template based on Parcel and Jest. Usage use this template for your next React lib, modify it and run npm run

Aug 22, 2022

This is a library that makes it possible to change the configuration values of the Remix compiler (esbuild).

💽 remix-esbuild-override ⚠️ While I believe you will most likely get a lot of benefit from using this library, it can sometimes destroy your product.

Dec 22, 2022
Comments
  • [Snyk] Upgrade ajv from 8.11.0 to 8.11.2

    [Snyk] Upgrade ajv from 8.11.0 to 8.11.2

    Snyk has created this PR to upgrade ajv from 8.11.0 to 8.11.2.

    :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 2 versions ahead of your current version.
    • The recommended version was released a month ago, on 2022-11-13.
    Release notes
    Package name: ajv from ajv GitHub release notes
    Commit messages
    Package name: ajv
    • 1f83903 8.11.2
    • 92e5a1e 8.11.1
    • 16af695 export ValidationError and MissingRefError, closes #1926, closes #1840 (#2020)
    • 65220d6 build(deps-dev): bump lint-staged from 12.5.0 to 13.0.3 (#2019)
    • b3c53ed build(deps-dev): bump mocha from 9.2.2 to 10.0.0 (#1972)
    • fa4343b build(deps-dev): bump @ types/node from 17.0.45 to 18.11.9 (#2151)
    • b8f563b build(deps-dev): bump @ rollup/plugin-node-resolve from 13.3.0 to 15.0.1 (#2143)
    • f38d269 docs: remove invisible character in README (#1990)
    • b2a109c Update security.md -> ReDoS Attack Section (#1953)
    • 67e7f1c docs: fix broken links (#2006)
    • d0beea5 build(deps-dev): bump fast-uri from 1.0.1 to 2.1.0 (#2007)
    • f90a1cf build(deps-dev): bump @ rollup/plugin-commonjs from 21.1.0 to 23.0.2 (#2142)
    • 5d5c803 docs: fix link for useDefaults (#1955)
    • d6f3ac9 fix: typo (#2010)
    • 00b3939 ensure that nullable is not set for required parameters (#2079)
    • 69d7897 build(deps-dev): bump husky from 7.0.4 to 8.0.2 (#2153)
    • b3cbbc1 docs: parsing does not support non-standard JTD keywords (#2072)
    • 7516a09 Doc: update the documentation of addKeyword args (#2090)
    • d6d8d5f npm installs version 8 by default (#2088)
    • 58f9e7f Remove unnecessary console.log (#2138)
    • 572c843 update typescript, fix broken annotation (#2157)
    • 948ffbf Update README.md
    • 13caf47 Update README.md
    • 1657fe4 Update README.md

    Compare


    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
  • [Snyk] Upgrade yaml from 2.1.1 to 2.1.3

    [Snyk] Upgrade yaml from 2.1.1 to 2.1.3

    Snyk has created this PR to upgrade yaml from 2.1.1 to 2.1.3.

    :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 2 versions ahead of your current version.
    • The recommended version was released 2 months ago, on 2022-10-05.
    Release notes
    Package name: yaml
    • 2.1.3 - 2022-10-05
      • Set correct node-end position for block collections with comments (#413)
    • 2.1.2 - 2022-10-02
      • Set correct node-end position for empty values with comments (#413)
    • 2.1.1 - 2022-05-29

      No changes in executable code, only TS types.

      • Revert "Use TS named tuple for range (#385)" -- see #393
      • Fix types for compatibility with TS 4.2 and 4.7
      • Add CI workflow for testing published type in a range of TS versions
    from yaml GitHub release notes
    Commit messages
    Package name: yaml
    • 8e7e57f 2.1.3
    • 8b0a3a4 fix: Set correct node-end position for block collections with comments (#413)
    • acb5f47 2.1.2
    • 6e7fba7 chore: Refresh lockfile
    • 4ac0f5d fix: Set correct node-end position for empty values with comments (#413)
    • e97948d ci: Uninstall @ jest/types before testing types on TS 4.0 and 3.8
    • 17a56bd chore: Update to jest 29
    • 26526d7 chore: Satisfy updated Typescript (4.8.2) & Prettier
    • c3c265b chore: Refresh lockfile
    • 57a29cd chore: Update docs-slate
    • 3197c60 docs: Use https in README.md link (#400)

    Compare


    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
  • [Snyk] Upgrade @circleci/circleci-config-sdk from 0.10.1 to 0.12.0

    [Snyk] Upgrade @circleci/circleci-config-sdk from 0.10.1 to 0.12.0

    Snyk has created this PR to upgrade @circleci/circleci-config-sdk from 0.10.1 to 0.12.0.

    :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 3 versions ahead of your current version.
    • The recommended version was released a month ago, on 2022-11-17.
    Release notes
    Package name: @circleci/circleci-config-sdk from @circleci/circleci-config-sdk GitHub release notes
    Commit messages
    Package name: @circleci/circleci-config-sdk
    • 79e0b77 fix: export docker image types (#164)
    • 137e014 fix: Use omit instead of exclude (#162)
    • 8450296 docs: add writeFile example (#159)
    • 891c8d5 feat: agnostic config saving (#157)
    • 871b65b feat: add Browser-or-Node (#158)
    • 80c13b9 feat: Disable aliasDuplicateObjects by default (#155)
    • 29299f2 fix(executor): fix generateContents method (#149)
    • c1ebea3 docs: switch browser and node usage (#140)
    • 34a9dfa feat: add docker layer caching support (#147)

    Compare


    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
Releases(v0.10.0-alpha.3)
  • v0.10.0-alpha.3(Sep 24, 2022)

    What's Changed

    • refactor!: reduced amount of dependencies by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/18

    Full Changelog: https://github.com/CircleCI-Public/circleci-config-parser-ts/compare/v0.10.0-alpha.2...v0.10.0-alpha.3

    Source code(tar.gz)
    Source code(zip)
  • v0.10.0-alpha.2(Sep 23, 2022)

    What's Changed

    • fix: set global to this in webpack config by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/17

    Full Changelog: https://github.com/CircleCI-Public/circleci-config-parser-ts/compare/v0.10.0-alpha.1...v0.10.0-alpha.2

    Source code(tar.gz)
    Source code(zip)
  • v0.10.0-alpha.1(Sep 22, 2022)

    What's Changed

    • feat: orb parsing by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/1
    • Add docs by @KyleTryon in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/2
    • refactor!: extracted parsers from parsing namespace by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/4
    • ci: setup husky with precommit and commitlint by @KyleTryon in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/6
    • GitHub forms by @KyleTryon in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/5
    • docs(readme): provided usage examples by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/8
    • chore: added webpack specific tsconfig by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/9
    • ci: configure circleci by @KyleTryon in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/7
    • fix: resolved inconsistencies with executor parsing by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/10
    • ci: add ssh fingerprint by @KyleTryon in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/12
    • chore: revert "docs: readded feature request" by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/13
    • feat: accept advanced linux vm resource classes by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/14
    • feat: added parsing for optional job properties by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/11
    • feat: parse extended parameter types by @Jaryt in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/15

    New Contributors

    • @Jaryt made their first contribution in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/1
    • @KyleTryon made their first contribution in https://github.com/CircleCI-Public/circleci-config-parser-ts/pull/2

    Full Changelog: https://github.com/CircleCI-Public/circleci-config-parser-ts/commits/v0.10.0-alpha.1

    Source code(tar.gz)
    Source code(zip)
Owner
CircleCI Public
CircleCI Public
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
This repository contains a basic example on how to set up and run test automation jobs with CircleCI and report results to Testmo.

CircleCI test automation example This repository contains a basic example on how to set up and run test automation jobs with CircleCI and report resul

Testmo 2 Dec 23, 2021
The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling rapid development of iofod extensions through the SDK.

iofod-sdk English | 简体中文 The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling

iofod, Inc. 47 Oct 17, 2022
Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's `move-ts`.

Movehat Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's move-ts. Movehat aspires to b

Pentagon 10 Sep 30, 2022
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
Vite plugin to client bundle i18next locales composited from one to many json/yaml files from one to many libraries. Zero config HMR support included.

vite-plugin-i18next-loader yarn add -D vite-plugin-i18next-loader Vite plugin to client bundle i18next locales composited from one to many json/yaml f

AlienFast 4 Nov 30, 2022
This is a Google Apps Script library for parsing the form object from HTML form and appending the submitted values to the Spreadsheet.

HtmlFormApp Overview This is a Google Apps Script library for parsing the form object from HTML form and appending the submitted values to the Spreads

Kanshi TANAIKE 18 Oct 23, 2022
A custom action for setting GitHub Workflow environment variables with YAML configuration files.

yaml-env-action - A custom action for setting GitHub Workflow environment variables with YAML configuration files. Introduction yaml-env-action is a c

Piper Dougherty 3 Dec 13, 2022