{"id":16410606,"url":"https://github.com/acro5piano/circon","last_synced_at":"2025-06-11T01:31:58.805Z","repository":{"id":47400753,"uuid":"196364326","full_name":"acro5piano/circon","owner":"acro5piano","description":"[deprecated] Simple CircleCI Config meta-language powered by JavaScript","archived":false,"fork":false,"pushed_at":"2023-01-04T04:24:57.000Z","size":743,"stargazers_count":13,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T13:50:05.656Z","etag":null,"topics":["circleci","cli","configuration","devops","javascript","typescript","utility"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/circon","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acro5piano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-11T09:34:16.000Z","updated_at":"2021-07-06T14:05:11.000Z","dependencies_parsed_at":"2023-02-01T20:00:56.241Z","dependency_job_id":null,"html_url":"https://github.com/acro5piano/circon","commit_stats":null,"previous_names":["acro5piano/ccg"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acro5piano%2Fcircon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acro5piano%2Fcircon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acro5piano%2Fcircon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acro5piano%2Fcircon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acro5piano","download_url":"https://codeload.github.com/acro5piano/circon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acro5piano%2Fcircon/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259180954,"owners_count":22817838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circleci","cli","configuration","devops","javascript","typescript","utility"],"created_at":"2024-10-11T06:43:24.048Z","updated_at":"2025-06-11T01:31:58.779Z","avatar_url":"https://github.com/acro5piano.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/circon.svg)](https://badge.fury.io/js/circon)\n[![CircleCI](https://circleci.com/gh/acro5piano/circon.svg?style=svg)](https://circleci.com/gh/acro5piano/circon)\n\n[warning] I found alternatives after created this package. `command` and `executer` added at CircleCI 2.1, and YAML anchor would save your time.\n\n# Circon\n\nCircleCI Config generator\n\n# Install\n\n```\nnpm -g install circon\n```\n\nOr if you use Yarn:\n\n```\nyarn global add circon\n```\n\n# tl;dr\n\n```typescript\nconst config = require('circon')\n\nconfig\n  .docker('circleci/node:10.3.0')\n  .docker('postgres', {\n    environment: {\n      TZ: '/usr/share/zoneinfo/Africa/Abidjan',\n    },\n  })\n\nconfig\n  .define('test')\n  .usePackage('yarn')\n  .tasks`\n    yarn test\n  `\n\nconsole.log(config.dump())\n```\n\nOutputs:\n\n```yml\nversion: 2\njobs:\n  test:\n    docker:\n      - image: 'circleci/node:10.3.0'\n      - image: 'postgres'\n        environment:\n          TZ: /usr/share/zoneinfo/Africa/Abidjan\n    working_directory: ~/repo\n    steps:\n      - checkout\n      - restore_cache:\n          keys:\n            - 'v2-dependencies-{{ checksum \"yarn.lock\" }}'\n            - v2-dependencies-\n      - run: yarn install\n      - save_cache:\n          paths:\n            - node_modules\n          key: 'v2-dependencies-{{ checksum \"yarn.lock\" }}'\n      - run: yarn test\nworkflows:\n  version: 2\n  master_jobs:\n    jobs:\n      - test\n```\n\n# Motivation\n\nCircleCI is great, but if we have a lot of jobs \u0026 workflows, the configuration file become messy.\n\nAlthough CircleCI can interpret YAML syntax like `\u003c\u003c: *defaults` or `- run: *setup_awscli`, still verbose.\n\n**circon** comes in to address this issue. It reduces a lot of your YAML code! For example, let's say more complex configuration:\n\n```typescript\nconst config = require('circon')\n\nconst installAwsCli = `\n  mkdir ~/.aws\n  echo '[default]' \u003e\u003e ~/.aws/credentials\n  echo aws_access_key_id = $AWS_ACCESS_KEY_ID \u003e\u003e ~/.aws/credentials\n  echo aws_secret_access_key = $AWS_SECRET_ACCESS_KEY \u003e\u003e ~/.aws/credentials\n  echo region = ap-northeast-1 \u003e\u003e ~/.aws/credentials\n`\n\nconfig\n  .docker('circleci/node:10.3.0', {\n    environment: {\n      TZ: '/usr/share/zoneinfo/Asia/Tokyo',\n    },\n  })\n  .docker('postgres', {\n    environment: {\n      TZ: '/usr/share/zoneinfo/Africa/Abidjan',\n    },\n  })\n\nconfig\n  .define('graphdoc')\n  .usePackage('yarn')\n  .tasks`\n    yarn graphdoc\n  `\n\nconfig\n  .define('test')\n  .usePackage('yarn')\n  .branches('develop')\n  .docker('nats')\n  .tasks`\n    yarn test\n  `\n\nconfig\n  .define('deploy')\n  .usePackage('yarn')\n  .branches('beta', 'master')\n  .requires('test')\n  .tasks`\n    ${installAwsCli}\n    yarn deploy\n  `\n\nconfig\n  .define('publish')\n  .usePackage('yarn')\n  .branches('release')\n  .requires('test', 'deploy')\n  .tasks`\n    ${installAwsCli}\n    yarn publish\n  `\n\nconsole.log(config.dump())\n```\n\nThe output is too long to paste here. Please see https://github.com/acro5piano/circon/blob/master/src/index.test.ts\n\n# Options\n\n**`config.docker(name: string, config: any)`**\n\nDefine default docker container to run. If you set this option after `define`, containers will run only in the job.\n\n**`config.define(taskName: string)`**\n\nDefine a task.\n\n**`config.usePackage(package: 'yarn' | 'npm')`**\n\nUse specified package manager to install dependencies before tasks and save its cache.\n\n**`config.branches(name: ...string[])`**\n\nRun only if current branch is specified branches.\n\n**`config.requires(name: ...string[])`**\n\nDo not run job if specified job failed.\n\n**`config.tasks(name: TemplateStringsArray)`**\n\nRun specified commands.\n\n# CLI\n\nCreate a configuration file (say `circle.js`) like this:\n\n```typescript\n// circle.js\n\nconfig\n  .define('test')\n  .docker('circleci/node:10.3.0')\n  .usePackage('yarn')\n  .tasks`\n    yarn test\n  `\n\nmodule.exports = config\n```\n\nThen run\n\n```\ncircon circle.js\n```\n\n# TODO\n\n- [ ] `git tag` support\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facro5piano%2Fcircon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facro5piano%2Fcircon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facro5piano%2Fcircon/lists"}