{"id":23041261,"url":"https://github.com/sophilabs/gilp","last_synced_at":"2025-08-14T21:31:34.404Z","repository":{"id":39707662,"uuid":"61815122","full_name":"sophilabs/gilp","owner":"sophilabs","description":"Gilp: A node tool to implement pre-commit and other git hooks over gulp","archived":false,"fork":false,"pushed_at":"2023-01-06T15:19:16.000Z","size":1991,"stargazers_count":15,"open_issues_count":16,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-12-08T15:59:33.138Z","etag":null,"topics":["gilp","git-hooks","pre-commit"],"latest_commit_sha":null,"homepage":"https://sophilabs.co/open-source","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/sophilabs.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":"2016-06-23T15:15:06.000Z","updated_at":"2024-10-10T07:06:58.000Z","dependencies_parsed_at":"2023-02-06T05:46:46.188Z","dependency_job_id":null,"html_url":"https://github.com/sophilabs/gilp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sophilabs%2Fgilp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sophilabs%2Fgilp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sophilabs%2Fgilp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sophilabs%2Fgilp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sophilabs","download_url":"https://codeload.github.com/sophilabs/gilp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229865783,"owners_count":18136366,"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":["gilp","git-hooks","pre-commit"],"created_at":"2024-12-15T19:32:12.319Z","updated_at":"2024-12-15T19:32:12.968Z","avatar_url":"https://github.com/sophilabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gilp\n\n[![travis][travis-image]][travis-url]\n[![coverage][coveralls-image]][coveralls-url]\n[![npm][npm-image]][npm-url]\n[![downloads][downloads-image]][downloads-url]\n[![js-semistandard-style][semi-image]][semi-url]\n[![license][license-image]][license-url]\n[![dependencies][dependencies-image]][dependencies-url]\n[![dev-dependencies][dev-dependencies-image]][dev-dependencies-url]\n\nGit has a lot of hooks for client and server side but the most used and known \nhook is pre-commit, where you can run some validations (like linters) and cancel \na commit if something fails. Gilp is a tool to define (using gulp tasks), install \nand run hooks.\n\n## Why gilp over gulp?\n\nThere are 2 main reasons:\n\n- The regular pre-commit hook managers run using the local file's content instead \n  of git staged content. Gulp comes with `vinyl`, a virtual file format where we \n  can create an in-memory version of a file to use as content for the tasks. Like \n  `gulp.src`, we created a new stream provider for that: `srcFromStaged`. If we \n  need to run the same tools but over a `commit`, `branch` or `tag` instead \n  (e.g. in a CI), you can do it using `srcFromCommit` without a `checkout`.\n\n- Gulp is plenty of plugins ready to use, \n  [just check it](https://www.npmjs.com/browse/keyword/gulpplugin).\n\n## Yarn, please.\n\nWe recommend to use `yarn` instead of `npm` because the error report is less verbose \nwhen `gulp` returns a non-zero code (on error) so we can focus on the \"real\" error.\n\n\n## Installation\n\n```bash\nyarn add --dev gilp\n```\n\n## Usage\n\nYou can use any [gulp](https://www.npmjs.com/browse/keyword/gulpplugin) or \n[gilp](https://www.npmjs.com/browse/keyword/gilpplugin) plugin.\n\n### Define a hook\n\n```javascript\nconst gulp = require('gulp');\nconst eslint = require('gulp-eslint');\nconst gilp = require('gilp')(gulp);\n\ngilp.hook('pre-commit', function () {\n  return gilp.srcFromStaged(['**/*.js']) \n    .pipe(eslint())\n    .pipe(eslint.failAfterError());\n});\n```\n\n**  Get a stream of files to be committed: **\n\n```javascript\n  gilp.srcFromStaged();\n```\n\n**  Get a stream of files from a commit: **\n\n```javascript\n  gilp.srcFromCommit('e3bca34');\n```\n\n### Install defined hooks (.git/hooks)\n\n```bash\nyarn run gulp gilp-install\n```\n\nTo auto-install the hooks after `yarn` installation, add in your `package.json` the \nfollowing `postinstall` command:\n\n```javascript\n{\n  // ...\n  \"scripts\": {\n    // ...\n    \"gulp\": \"gulp\",\n    \"postinstall\": \"gulp gilp-install\"\n  },\n  // ...\n}\n```\n\n### Run a task on the CI to check the commit\n\n```javascript\nconst gulp = require('gulp');\nconst eslint = require('gulp-eslint');\nconst gilp = require('gilp')(gulp);\n\ngulp.task('check-commit', function () {\n  return gilp.srcFromCommit('e3bca34', ['**/*.js']) \n    .pipe(eslint())\n    .pipe(eslint.failAfterError());\n});\n```\n\n## Example\n\nSee full working [example](examples/full.js).\n\n\n## License\n\nGilp is Copyright (c) 2016 sophilabs, inc. It is free software, and may be\nredistributed under the terms specified in the [license] file.\n\n## About\n\n[![sophilabs][sophilabs-image]][sophilabs-url]\n\nGilp is maintained and funded by sophilabs, inc. The names and logos for\nsophilabs are trademarks of sophilabs, inc.\n\n[license]: /LICENSE\n[sophilabs-image]: https://s3.amazonaws.com/sophilabs-assets/logo/logo_300x66.gif\n[sophilabs-url]: https://sophilabs.co\n[travis-image]: https://img.shields.io/travis/sophilabs/gilp.svg?style=flat-square\n[travis-url]: https://travis-ci.org/sophilabs/gilp\n[npm-image]: https://img.shields.io/npm/v/gilp.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/gilp\n[downloads-image]: https://img.shields.io/npm/dm/gilp.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/gilp\n[semi-image]: https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square\n[semi-url]: https://github.com/Flet/semistandard\n[coveralls-image]: https://img.shields.io/coveralls/sophilabs/gilp.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/github/sophilabs/gilp?branch=master\n[license-image]: https://img.shields.io/github/license/sophilabs/gilp.svg?style=flat-square\n[license-url]: /LICENSE\n[dependencies-image]: https://david-dm.org/sophilabs/gilp.svg?style=flat-square\n[dependencies-url]: https://david-dm.org/sophilabs/gilp\n[dev-dependencies-image]: https://david-dm.org/sophilabs/gilp/dev-status.svg?style=flat-square\n[dev-dependencies-url]: https://david-dm.org/sophilabs/gilp#info=devDependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsophilabs%2Fgilp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsophilabs%2Fgilp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsophilabs%2Fgilp/lists"}