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

circon

v0.2.0

Published

[![npm version](https://badge.fury.io/js/circon.svg)](https://badge.fury.io/js/circon) [![CircleCI](https://circleci.com/gh/acro5piano/circon.svg?style=svg)](https://circleci.com/gh/acro5piano/circon)

Downloads

3

Readme

npm version CircleCI

Circon

CircleCI Config generator

Install

npm -g install circon

Or if you use Yarn:

yarn global add circon

tl;dr

const config = require('circon')

// prettier-ignore
config
  .docker('circleci/node:10.3.0')
  .docker('postgres', {
    environment: {
      TZ: '/usr/share/zoneinfo/Africa/Abidjan',
    },
  })

// prettier-ignore
config
  .define('test')
  .usePackage('yarn')
  .tasks`
    yarn test
  `

console.log(config.dump())

Outputs:

version: 2
jobs:
  test:
    docker:
      - image: 'circleci/node:10.3.0'
      - image: 'postgres'
        environment:
          TZ: /usr/share/zoneinfo/Africa/Abidjan
    working_directory: ~/repo
    steps:
      - checkout
      - restore_cache:
          keys:
            - 'v2-dependencies-{{ checksum "yarn.lock" }}'
            - v2-dependencies-
      - run: yarn install
      - save_cache:
          paths:
            - node_modules
          key: 'v2-dependencies-{{ checksum "yarn.lock" }}'
      - run: yarn test
workflows:
  version: 2
  master_jobs:
    jobs:
      - test

Motivation

CircleCI is great, but if we have a lot of jobs & workflows, the configuration file become messy.

Although CircleCI can interpret YAML syntax like <<: *defaults or - run: *setup_awscli, still verbose.

circon comes in to address this issue. It reduces a lot of your YAML code! For example, let's say more complex configuration:

const config = require('circon')

config
  .docker('circleci/node:10.3.0', {
    environment: {
      TZ: '/usr/share/zoneinfo/Asia/Tokyo',
    },
  })
  .docker('postgres', {
    environment: {
      TZ: '/usr/share/zoneinfo/Africa/Abidjan',
    },
  })

// prettier-ignore
config
  .define('graphdoc')
  .usePackage('yarn')
  .tasks`
    yarn graphdoc
  `

// prettier-ignore
config
  .define('test')
  .usePackage('yarn')
  .branches('develop')
  .docker('nats')
  .tasks`
    yarn test
  `

// prettier-ignore
config
  .define('deploy')
  .usePackage('yarn')
  .branches('beta', 'master')
  .requires('test')
  .tasks`
    yarn deploy
  `

// prettier-ignore
config
  .define('publish')
  .usePackage('yarn')
  .branches('release')
  .requires('test', 'deploy')
  .tasks`
    yarn publish
  `

console.log(config.dump())

The output is too long to paste here. Please see https://github.com/acro5piano/circon/blob/master/src/index.test.ts

Options

config.docker(name: string, config: any)

Define default docker container to run. If you set this option after define, containers will run only in the job.

config.define(taskName: string)

Define a task.

config.usePackage(package: 'yarn' | 'npm')

Use specified package manager to install dependencies before tasks and save its cache.

config.branches(name: ...string[])

Run only if current branch is specified branches.

config.requires(name: ...string[])

Do not run job if specified job failed.

config.tasks(name: TemplateStringsArray)

Run specified commands.

CLI

Create a configuration file (say circle.js) like this:

// circle.js

// prettier-ignore
config
  .define('test')
  .docker('circleci/node:10.3.0')
  .usePackage('yarn')
  .tasks`
    yarn test
  `

module.exports = config

Then run

circon circle.js

TODO

  • [ ] git tag support