Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@circleci/circleci-config-sdk

Package Overview
Dependencies
Maintainers
122
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@circleci/circleci-config-sdk

An SDK for building CircleCI Configuration files with JavaScript.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30K
increased by5.2%
Maintainers
122
Weekly downloads
 
Created
Source

CircleCI Status GitHub License

CircleCI Config SDK (TypeScript)

Create and manage your CircleCI config with JavaScript and TypeScript.

View the SDK Docs

Installation

Using npm:

$ npm i --save @circleci/circleci-config-sdk

In Node.js:

import CircleCI from "@circleci/circleci-config-sdk"

In Browser:

var CircleCI = require('@circleci/circleci-config-sdk');

Example

Generate a CircleCI config using TypeScript/Javascript, properly typed for full IntelliSense support.

// Instantiate new Config
const myConfig = new CircleCI.Config()
// Create new Workflow
const myWorkflow = new CircleCI.Workflow("myWorkflow")
myConfig.addWorkflow(myWorkflow)

// Create an executor. Reusable.
const nodeExecutor = new CircleCI.Executor.DockerExecutor("node-executor", "cimg/node:lts")
myConfig.addExecutor(nodeExecutor)

// Create Job
const nodeTestJob = new CircleCI.Job("node-test", nodeExecutor)
myConfig.addJob(nodeTestJob)

// Add steps to job
nodeTestJob
	.addStep(new CircleCI.Command.Run({
		command: "npm install",
		name: "NPM Install"}))
	.addStep(new CircleCI.Command.Run({
		command: "npm run test",
		name: "Run tests"}))

// Add Jobs to Workflow
myWorkflow.addJob(nodeTestJob)

// The `stringify()` function on `CircleCI.Config` will return the CircleCI YAML equivalent.
const MyYamlConfig = myConfig.stringify()

MyYamlConfig will hold the following string (A valid CircleCI Config).

version: 2.1
executors:
	node-executor:
		docker:
		- image: cimg/node:lts
jobs:
	node-test:
		executor:
			name: node-executor
		steps:
			- run:
					command: npm install
					name: NPM Install
			- run:
					command: npm run test
					name: Run tests
workflows:
	myWorkflow:
		jobs:
			- node-test: {}

Keywords

FAQs

Package last updated on 30 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc