{"id":17355132,"url":"https://github.com/zephinzer/pipelyne","last_synced_at":"2025-08-22T08:13:23.921Z","repository":{"id":57324818,"uuid":"144306077","full_name":"zephinzer/pipelyne","owner":"zephinzer","description":"A theoretical experiment to enable writing a CI/CD pipeline in good ol' JavaScript.","archived":false,"fork":false,"pushed_at":"2018-08-15T15:37:44.000Z","size":133,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-06T21:47:13.585Z","etag":null,"topics":["devops","joeir","wip"],"latest_commit_sha":null,"homepage":null,"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/zephinzer.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":"2018-08-10T15:53:33.000Z","updated_at":"2019-03-20T02:08:56.000Z","dependencies_parsed_at":"2022-09-05T11:31:12.276Z","dependency_job_id":null,"html_url":"https://github.com/zephinzer/pipelyne","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zephinzer/pipelyne","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fpipelyne","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fpipelyne/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fpipelyne/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fpipelyne/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zephinzer","download_url":"https://codeload.github.com/zephinzer/pipelyne/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fpipelyne/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271606595,"owners_count":24788979,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["devops","joeir","wip"],"created_at":"2024-10-15T17:42:25.596Z","updated_at":"2025-08-22T08:13:23.895Z","avatar_url":"https://github.com/zephinzer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pipelyne\nA theoretical experiment to enable writing a CI/CD pipeline in good ol' JavaScript.\n\n[![Build Status](https://travis-ci.org/zephinzer/pipelyne.svg?branch=master)](https://travis-ci.org/zephinzer/pipelyne) [![npm version](https://badge.fury.io/js/pipelyne.svg)](https://badge.fury.io/js/pipelyne)\n\n\u003e \"Atwood would be proud\"\n\n## Benefits\n\n1. Run your pipeline locally\n2. Involve developers by using their favourite language\n3. Run JavaScript instead of Bash\n4. Distribute your pipeline \n5. Write once, export for multiple CI runners\n\n## Scope\n\n### Base\n- [x] Consumer able to define pipeline stages via `.stage()` ([see usage](#defining-a-stage))\n- [x] Consumer able to define pipeline jobs within a stage via `.job()` ([see usage](#defining-a-job))\n- [x] Consumer able to load a Pipelyne by specifying a file path URI ([see usage](#loading-external-pipelyne-via-path))\n- [x] Consumer able to load a an externally defined Pipelyne ([see usage](#loading-external-pipelyne))\n- [x] Consumer able to add manually input bash scripts via `.run()` ([see usage](#defining-a-shell-command))\n\n### Variable Management\n- [x] Consumer able to set and read a variable all during runtime ([see usage](#set-and-read-variable-at-runtime))\n\n### File Operations\n- [x] Consumer able to read contents of a file into memory ([see usage](#reading-file-contents-into-memory))\n\n### NPM Convenience Methods\n- [x] Consumer able to install NPM dependencies ([see usage](#installing-npm-dependencies))\n- [x] Consumer able to publish to NPM ([see usage](#publishing-to-npm))\n- [x] Consumer able to run an NPM script ([see usage](#running-an-npm-script))\n\n### Exporting from Pipelyne\n- [x] Consumer able to export pipeline to Travis format ([see usage](#exporting-pipelyne-for-travis))\n\n### Future\n- [ ] Consumer able to do file manipulation\n- [ ] Consumer able to set file ownership permissions\n- [ ] Consumer able to set file modification/execution permissions\n- [ ] Consumer able to run NPM scripts from `package.json`\n- [ ] Consumer able to publish to DockerHub\n- [ ] Consumer able to do a Git push to repository\n- [ ] Consumer able to export pipeline to GitLab format\n\n## Installation\n\n```bash\n# with npm \u003c 5\nnpm i pipelyne --save;\n# or with npm \u003e 5\nnpm i pipelyne;\n# or with yarn\nyarn add pipelyne\n```\n\n## Usage\n\n### Importing \u0026 Initialisation\n\n```js\nimport {Pipelyne} from 'pipelyne';\n\nconst pipeline = new Pipelyne();\n```\n\n### Defining a Stage\n\n```js\npipeline.stage('stage name', {/* stage options */})\n```\n\n### Defining a Job\n\n```js\npipeline\n  .stage('stage name', {/* stage options */})\n  .job('job name', {/* job options */})\n```\n\n### Defining a Shell Command\n\n```js\npipeline\n  .stage('stage name', {/* stage options */})\n  .job('job name', {/* job options */})\n  .run('pwd') // runs the `pwd` command\n```\n\n### Reading file contents into memory\n\n\u003e Runs at run-time, not build-time\n\n```js\npipeline\n  .stage('stage name')\n  .job('job name')\n  .readFile('./path/to/file', 'testvar');\n\npipeline.getVariable('testvar'); // undefined\n\npipeline.execute();\n\npipeline.getVariable('testvar'); // contents of file\n```\n\n### Set and read variable at runtime\n\n```js\npipeline\n  .stage('stage name')\n  .job('job name')\n  .readFile('./path/to/file', 'testvar')\n  .print('file contents are:', pipeline.ref('testvar'));\n\npipeline.getVariable('testvar'); // undefined\n\npipeline.execute(); // observe \"file contents are: ...\" output\n```\n\n### Loading external Pipelyne via path\n\n```js\npipeline.load('./path/to/pipelyne.js');\n```\n\n\u003e **NOTE**: The file at `./path/to/pipelyne.js` should export a `pipelyne` property.\n\n### Loading external Pipelyne\n\n```js\npipeline.load(require('./path/to/pipelyne.js').pipelyne);\n```\n\n\u003e **NOTE**: The loaded pipelyne should be an instance of Pipelyne.\n\n### Installing NPM Dependencies\n\n```js\npipeline\n  .stage('stage')\n  .job('job')\n  // doing a development dependencies install\n  .npm.install()\n  // doing a production dependencies install\n  .npm.install({production: true});\n```\n\n### Publishing to NPM\n\n```js\npipeline\n  .stage('stage')\n  .job('job')\n  .npm.publish();\n```\n\n### Running an NPM Script\n\n```js\npipeline\n  .stage('stage')\n  .job('job')\n  // npm run build\n  .npm.run('build')\n  // npm run test -- --watch\n  .npm.run('test', {args: '--watch'});\n```\n\n### Exporting Pipelyne for Travis\n\n```js\nconst fs = require('fs');\nconst path = require('path');\n// ...\n// export the pipeline into a file named .travis.yml\nfs.writeFileSync(\n  path.join(__dirname, './.travis.yml'),\n  pipeline.exportFor('travis')\n);\n```\n\n## API\n\n### `Pipelyne` Instance\n\nA Pipelyne instance exposes the following methods:\n\n| Method | Parameters | Description |\n| --- | --- | --- |\n| `.stage` | `:stageName`, `:stageOptions` | Defines a stage named `:stageName`. See [StageOptions](#stageoptions) for possible configurations |\n| `.job` | `:jobName`, `:jobOptions` | Defines a job named `:jobName` under the current stage. See [JobOptions](#joboptions) for possible configurations |\n| `.run` | `:script`, `:commandOptions` | Defines a command that runs a shell script containing the script `:script`. See [CommandOptions](#commandoptions) for possible configurations |\n| `.load` | `:pathToPipelyne` \\| `:Pipelyne` | Loads an externally defined Pipelyne. When the parameter is a String, the String is taken as the relative path URI to a file exporting a property `\"pipelyne\"` which should be a `Pipelyne` instance. When the parameter is a `Pipelyne`, the defined stages are automatically loaded into the current `Pipelyne`. |\n| `.npm.publish` | - | Publishes the current NPM package. |\n| `.npm.install` | `{:production}` | Installs the NPM dependencies |\n| `.npm.run` | `:command`, `{:args}` | Runs the specified NPM command `:command`. If arguments are needed, use the `:arg` property in the options object. |\n| `.ref` | `:variableName` | Returns a function that `Pipelyne` will call on run to draw from a variable that is set during run-time. |\n| `.print` | `...:thingsToPrint` | Prints the arguments as a string. Arguments are delimited by a space. |\n| `.readFile` | `:filePath`, `:variableName` | Loads the file content of the file at `:filePath` relative to the `baseUri` and stores it in the variable named `:variableName` |\n| `.getVariable` | `:variableName` | Returns the variable with name `:variableName`. Runs at build-time. |\n| `.setVariable` | `:variableName`, `:value` | Sets a variable with name `:variableName` to the value `:value`. Runs at build-time. |\n| `.toString` | `:format` | Exports the current Pipelyne as a String. See [PipelyneStringFormat](#pipelynestringformat) for possible formats. |\n| `.exportFor` | `:ciProvider` | Exports the current Pipelyne in the format of the specified `:ciProvider`. Currently only Travis is supported. See [our pipelyne.js](./pipelyne.js) for an example of doing this. The `pipelyne.js` is executed using the NPM script `pipeline`. [See the package.json](./package.json) |\n\n## Configuration\n\n### `RunnableOptions`\n\n| Key | Type | Description |\n| --- | --- | --- |\n| `allowFailure` | Boolean | Decides whether the Runnable is allowed to fail. |\n| `id` | String | Indiciates the ID of the Runnable. This should be automatically generated by the Runnable's constructor. |\n\n### `StageOptions`\nStage options includes all the configurations in [`RunnableOptions`](#runnableoptions) as well as the following:\n\n| Key | Type | Description |\n| --- | --- | --- |\n| `name` | String | Name in normal text. The `id` of the Stage will be set to a `kebab-case`d version of the name. |\n\n### `JobOptions`\nJob options includes all the configurations in [`RunnableOptions`](#runnableoptions) as well as the following:\n\n| Key | Type | Description |\n| --- | --- | --- |\n| `name` | String | Name in normal text. The `id` of the Job will be set to a `kebab-case`d version of the name. |\n\n### `CommandOptions`\nCommand options includes all the configurations in [`RunnableOptions`](#runnableoptions).\n\nNo extra configurations are available.\n\n### `PipelyneStringFormat`\nThis can be one of `\"json\"` or `\"overview\"`.\n\n## Contributing\nFork, make changes, push, merge request with `master`, wait for tests to pass. You know the drill (:\n\n## License\nThis package is licensed under the MIT license.\n\nSee [the attached license file](./LICENSE) for details.\n\n## ChangeLog\n\n| Version | Description |\n| --- | --- |\n| 0.0.7 | Added `.npm` convenience methods with `.publish()`, `.install()` and `.run(:scriptNameFromPackageJson)` |\n| 0.0.6 | Added `.print` to print stuff to the terminal and `.ref` functions to reference run-time variables |\n| 0.0.5 | Added build-time variable support and file content reading |\n| 0.0.4 | Added test resources to `.npmignore` and added stuff to `package.json` |\n| 0.0.3 | Refactored exporter into its own module and enabled setting of `set +x` and `set -x` for allowing/disallowing failure in Travis exports |\n| 0.0.2 | Added undocumented exporter and external Pipelyne loading |\n| 0.0.1 | Initial release |\n\n# Cheers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzephinzer%2Fpipelyne","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzephinzer%2Fpipelyne","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzephinzer%2Fpipelyne/lists"}