Package to dynamically import orbs for the Config SDK

tl;dr I made a package to import orbs for use with the CircleCI Config SDK (link below)

Motivation

As someone who loves strongly typed code, the announcement of the CircleCI Config SDK was very exciting for me! Being able to dynamically generate pipeline configs with Typescript has generally been an enjoyable experience. However, importing external orbs is currently a clunky process with a lot of boilerplate required. Currently, in order to use a single command, it is up to the user to manually specify the name of the command and the expected parameters (source: the SDK wiki).

I do expect the UX to improve here, especially with an NPX command to generate typed orb info as mentioned in the wiki:

We hope to maybe replace this with an NPX command which could automatically generate this information for us in the future.

Package

For now, I have implemented a simple solution to make it easier to use orbs with the SDK: @voiceflow/circleci-config-sdk-orb-import - npm

This package exposes an importOrb function that fetches the orb manifest from CircleCI and returns an OrbImport object containing the components in that orb, ready for use in your workflows. See the README for more detailed info on how to use this function with the SDK.

Please let me know if you expericence any issues with the package! Hope others find it useful when using the Config SDK!

4 Likes

Such a nice contribution to the community!

This is awesome!