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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@voiceflow/circleci-config-sdk-orb-import

v0.2.0

Published

A lightweight utility to import orbs for use with the CircleCI Config SDK

Downloads

830

Readme

Orb Import for CircleCI Config SDK

NPM Version License

This package allows you to import and use external orbs with the CircleCI Config SDK.

Installation

Using npm:

   npm install @voiceflow/circleci-config-sdk-orb-import 

Using yarn:

    yarn add @voiceflow/circleci-config-sdk-orb-import 

Usage

This package provides a single function, importOrb, to fetch the manifest for an external orb and return them as an OrbImport compatible with the CircleCI Config SDK.

import * as CircleCI from "@circleci/circleci-config-sdk";
import { importOrb } from "circleci-config-sdk-orb-import";

// Instantiate a new Config
const config = new CircleCI.Config();

// Use the importOrb function to fetch a given external orb
// This is equivalent to putting `node: circleci/[email protected]` in the `.circleci/config.yml` file
const node = await importOrb({
  alias: "node",
  namespace: "circleci",
  orb: "node",
  version: "5.0.3",
});

// Add the imported orb to the generated config
config.importOrb(node);

// Use an executor from the orb in your jobs
const exampleExecutor = new CircleCI.reusable.ReusedExecutor(
  node.executors["default"],
  {
    tag: "16",
  }
);

const exampleJob = new CircleCI.Job("install-node", exampleExecutor, [
  new CircleCI.commands.Checkout(),
  // Use a command from the orb in your jobs
  new CircleCI.reusable.ReusedCommand(node.commands["install-packages"], {
    "check-cache": "always",
    "pkg-manager": "yarn-berry",
  }),
]);
config.addJob(exampleJob);

const exampleWorkflow = new CircleCI.Workflow("example", [
  exampleJob,
  // Use a job from the orb in your workflows
  new CircleCI.workflow.WorkflowJob(node.jobs["run"], {
    "yarn-run": "build",
  }),
]);
config.addWorkflow(exampleWorkflow);

The above config generates the following YAML config:

version: 2.1
setup: false
jobs:
  install-node:
    executor:
      name: node/default
      tag: "16"
    steps:
      - checkout
      - node/install-packages:
          check-cache: always
          pkg-manager: yarn-berry
workflows:
  example:
    jobs:
      - install-node
      - node/run:
          yarn-run: build
orbs:
  node: circleci/[email protected]

Compatibility

This version has been tested with version 0.10.1 of the CircleCI Config SDK. Compatibility with other versions cannot be guaranteed.

License

Licensed under ISC