{"id":18320851,"url":"https://github.com/bazaarvoice/unshackle","last_synced_at":"2025-04-05T22:32:03.412Z","repository":{"id":57386852,"uuid":"72017956","full_name":"bazaarvoice/unshackle","owner":"bazaarvoice","description":"A JavaScript software release script runner.","archived":false,"fork":false,"pushed_at":"2018-11-12T21:03:50.000Z","size":25,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-11-01T02:19:06.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazaarvoice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-26T15:37:02.000Z","updated_at":"2018-11-12T21:03:48.000Z","dependencies_parsed_at":"2022-09-26T16:50:43.327Z","dependency_job_id":null,"html_url":"https://github.com/bazaarvoice/unshackle","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Funshackle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Funshackle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Funshackle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Funshackle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazaarvoice","download_url":"https://codeload.github.com/bazaarvoice/unshackle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223221170,"owners_count":17108522,"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":[],"created_at":"2024-11-05T18:17:38.954Z","updated_at":"2024-11-05T18:17:39.519Z","avatar_url":"https://github.com/bazaarvoice.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003c!-- Borrowed under a CC0 Public Domain license from https://pixabay.com/en/animal-game-asset-call-invertebrate-1296937/ --\u003e\n  \u003cimg alt=\"unshackle\" src=\"https://cloud.githubusercontent.com/assets/1095217/19737639/cf70c50c-9b79-11e6-8d46-8d469c7c3b76.png\" width=\"480\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/bazaarvoice/unshackle\"\u003e\n    \u003cimg alt=\"Travis Status\" src=\"https://travis-ci.org/bazaarvoice/unshackle.svg?branch=master\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## About\n\nUnshackle is a small release scripting [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) for JavaScript projects. If releasing new versions of your JavaScript application involves running the same dozens of Git commands, intermixed with various CLI tools and manual by-a-human steps, it might be for you. In particular, unshackle aims to provide a simple language for combining a series of shell, human, and arbitrary JavaScript tasks.\n\n## Installation\n\n```bash\nnpm install unshackle\n```\n\n## Usage\n\nTypical usage involves writing a script for your release that loads the unshackle\npackage and uses it to execute a series of steps.\n\nYou can execute your script and view its output in the console. Prompts will\npause and wait for your input.\n\nFor now, you must run your script from the working directory that any shell\ncommands should start in.\n\n```javascript\n#!/usr/bin/env node\n\nconst unshackle = require('unshackle')\n\n// Create a bucket for remembering state throughout the run.\nconst state = {}\n\nunshackle\n.start('You are starting an example release. Good luck.')\n// Print does what you expect.\n.print('First on the agenda, listing files with ls.')\n\n// Run executes string commands in a shell.\n.run('ls')\n\n// Prompts pause for user input.\n.prompt('What is your favorite letter?', ['a', 'b', 'c'])\n\n// JavaScript steps are functions that accept the output of preceding steps as\n// input.\n.run(letter =\u003e console.log(`Proceeding with a release for the letter ${letter}.`))\n\n// JavaScript steps can return a promise to perform asynchronous tasks.\n.run(() =\u003e {\n  console.log('Crunching numbers, or something...')\n  return new Promise (resolve =\u003e setTimeout(resolve, 3000))\n})\n\n// Use state to remember user input.\n.prompt('What is your favorite letter now?', ['a', 'b', 'c'])\n\n// Define a labeled mark in the process.\n.run('trap-state', letter =\u003e state.letter = letter)\n\n// Use the unshackle runner in a custom step, making sure to return the promise\n// property, to block.\n.run(() =\u003e unshackle.prompt(`Please manually confirm your appreciation for the letter ${state.letter}.`).promise)\n\n// Use fail to abort and exit if something goes wrong.\n.run(() =\u003e {\n  if (Math.random() \u003c .1) {\n    unshackle.fail('Today is not a good day.')\n  }\n})\n\n// Exit the entire process, with a message.\n.done('Thanks! This release has been a success.')\n```\n\n### Relocating your release script\n\nIf you want to edit a release script that is in source control, you might want\nto make a copy of it outside of your project. For example, if changes were to\nmake your Git working directory dirty, for example, it could interfere with\ncertain Git commands you might have in your release script.\n\n### Marks\n\nSteps have an optional first argument for defining a mark. Marks are useful in\nthat they create readable labels in the output of your release, and they give\nyou a way to restart failed or incomplete releases at a certain step.\n\nYou can start from a mark by passing it as a second argument to\n`unshackle.start`. Starting from a mark skips all steps before that mark, with\nsome exceptions. There may be steps that occur before the mark that are\nrequired to run, usually those that prompt the user for information, as no\ninformation is saved between executions of your release script. You can\nforce such a step to always run, and prompts always run by default.\n\n```javascript\nconst state = {}\n\nunshackle\n// An optional step to print a message. It can also be used to specify a mark.\n.start('Starting a release', 'deploy')\n\n// This step is skipped, because it is before the \"deploy\" mark.\n.run('echo \"You should not be reading this\"')\n\n// At this point in time, prompts are never skipped and will always run.\n.prompt('What type of release is this?', ['major', 'minor', 'patch'])\n\n// The true parameter forces this step to run, even when starting from the\n// \"deploy\" mark\n.run(type =\u003e state.type = type, true)\n\n// This step has the \"deploy\" mark, so when used, all steps from here on will\n// run.\n.run('deploy', () =\u003e {\n  deployVersion(state.type)\n})\n\n// This prints a message and exits the entire process.\n.done('Deployment complete')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazaarvoice%2Funshackle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazaarvoice%2Funshackle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazaarvoice%2Funshackle/lists"}