{"id":28076943,"url":"https://github.com/jaredhanson/rivet","last_synced_at":"2025-05-13T01:55:57.826Z","repository":{"id":66002114,"uuid":"5111663","full_name":"jaredhanson/rivet","owner":"jaredhanson","description":"Efficient build tool utilizing JavaScript and Node.js.","archived":false,"fork":false,"pushed_at":"2012-10-26T23:07:32.000Z","size":131,"stargazers_count":13,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-13T01:55:51.956Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredhanson.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":"2012-07-19T15:18:29.000Z","updated_at":"2018-01-20T16:15:52.000Z","dependencies_parsed_at":"2023-02-19T21:15:20.258Z","dependency_job_id":null,"html_url":"https://github.com/jaredhanson/rivet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Frivet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Frivet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Frivet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Frivet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredhanson","download_url":"https://codeload.github.com/jaredhanson/rivet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856639,"owners_count":21974577,"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":"2025-05-13T01:55:57.382Z","updated_at":"2025-05-13T01:55:57.817Z","avatar_url":"https://github.com/jaredhanson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rivet\n\nRivet is a task-based build tool, scripted in JavaScript and executed using\n[Node.js](http://nodejs.org/).  Similar to [make](http://www.gnu.org/software/make/)\nor [rake](http://rake.rubyforge.org/), it can be used in any scenario that can\nbe broken into tasks, from building native and web applications to automating\ndeployment procedures.  \n\n## Installation\n\n    $ npm install -g rivet\n\n## Usage\n\nFrom the command line, simply use rivet to execute a task.\n\n    $ rivet hello\n    \nTasks are declared in a rivet file, by default named \"tasks.js\".\n\n#### Declaring a Task\n\nTasks are declared using `rivet.task()`, and given a name, optional\nprerequisites, and a function to execute.\n\n    module.exports = function(rivet) {\n      rivet.desc('say hello')\n      rivet.task('hello', function() {\n        console.log('Hello!');\n      });\n    }\n\nAll rivet files export a function using standard `module.exports` boilerplate.\nFor brevity, this is omitted from further examples.\n\nAsynchronous tasks are as easy as accepting a `done` callback and invoking it\nwhen the task completes.\n\n    rivet.task('hello', function(done) {\n      setTimeout(function() {\n        console.log('Hello! (in a little while)');\n        done();\n      }, 1000);\n    });\n    \n#### Prerequisites (and The Scratch!)\n\nIn many cases, a task often requires that another task execute first.  These\nare known as prerequisites.  Rivet ensures that all prerequisites have been\nexecuted prior to any task that requires them.\n\n    rivet.task('hello', 'lookup_name', function() {\n      console.log('Hello ' + this.scratch.name + '!');\n    });\n    \n    rivet.task('lookup_name', function() {\n      this.scratch.name = 'Dave';\n    });\n\nAlso demonstrated here is what's known as the \"scratch\".  This is a shared\narea that any task can write to or read from, making it convenient to pass data\nbetween tasks.\n\n#### Namespaces\n\nTasks can be grouped into namespaces, making it easy to organize related tasks\nand limit there scope in larger projects.\n\n    rivet.namespace('formal', function() {\n      rivet.task('hello', function() {\n        console.log('Hello, sir!');\n      });\n\n      rivet.task('greet', 'hello', function() {\n        console.log('How may I be of assistance?');\n      });\n    });\n    \nPrerequisites resolve within the current namespace.  Relative namespaces can be\nused to refer to parent namespaces if necessary.\n\n    rivet.namespace('informal', function() {\n      rivet.task('greet', '^:hello', function() {\n        console.log('What can I help you with?');\n      });\n    });\n\nThe use of a caret (^) is used to refer to a parent namespace.  These can be\nstrung together as needed.  For example, `^:^:hello` would reference the `hello`\ntask in the grandparent namespace.\n\n#### Multi-Step Tasks\n\nA single task can be declared multiple times.  In this case, each function is\nadditive.  When the task is executed, each step will be invoked in sequence.\n\n    rivet.task('archive', function(done) {\n      copy(['app.js', 'utils.js'], 'output', done);\n    })\n    \n    rivet.task('archive', function(done) {\n      zip('output', 'output.zip', done);\n    })\n\nRivet provides syntactic sugar in the form of \"targets\" and \"steps\", which lets\nthis be expressed in a form that is more clear.\n\n    rivet.target('archive', function() {\n      this.step(function(done) {\n        copy(['app.js', 'utils.js'], 'output', done);\n      })\n      this.step(function(done) {\n        zip('output', 'output.zip', done);\n      })\n    });\n\nThis is an effective way to break up a set of asynchronous operations, writing\nthem as if they were sequential commands.\n\n## FAQ\n\n##### How is Rivet different from Jake?\n\nRivet is conceptually the same as [Jake](https://github.com/mde/jake/).  I was\nusing Jake for this purpose, but ultimately found it lacking for the following\nreasons:\n\n1. Jake treats asynchronous tasks as second-class, requiring extra options to\n   enable them.  This works against the Node.js grain.\n2. Tasks are not \"additive\", in that they can't be redeclared.  I found that\n   this tended to result in unnecessary verbosity and nested callbacks.\n3. Prerequisites don't resolve within the containing namespace.  This limited\n   the effectiveness of using namespaces and resulted in parent namespaces being\n   peppered throughout separate files.\n\nAll of these things could (and should, IMO) be fixed in Jake.  However, after\nattempting to do that, I concluded that it would be simpler to start from a\nfresh codebase where other simplifying assumptions could be made.\n\n##### How is Rivet different from Grunt?\n\n[Grunt](https://github.com/cowboy/grunt) does away with prerequisites and\ncentralizes configuration while tying that configuration to the type of task.\nWhile this approach certainly works, it doesn't suit my own personal tastes.\n\nI prefer to decouple the implementation of tasks from their configuration.\nBy embracing the functional aspects of JavaScript, and setup functions\npopularized by [Connect](http://www.senchalabs.org/connect/) and [Express](http://expressjs.com/)\nmiddleware, it is easy to write succinct tasks with declarative, inline\nconfiguration.  For example:\n\n    function zip(dir, zipfile) {\n      return function(done) {\n        var command = 'zip -r ' + zipfile + ' ' + dir;\n        exec(command, done)\n      }\n    }\n   \n    task('zip_app', zip('app', 'app.zip'));\n    task('zip_plugins, zip('plugins', 'plugins.zip'));\n\nWhile completely subjective, I find this much more aesthetically pleasing.  This\nsyntax also makes it easy to retain prerequisites, which are too useful to be\nunsupported by a build tool.\n\n## Tests\n\n    $ npm install --dev\n    $ make test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/rivet.png)](http://travis-ci.org/jaredhanson/rivet)\n\n## Credits\n\n  - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 Jared Hanson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhanson%2Frivet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredhanson%2Frivet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhanson%2Frivet/lists"}