{"id":16773831,"url":"https://github.com/ziflex/gulp-tasks-registrator","last_synced_at":"2025-03-16T17:21:29.995Z","repository":{"id":57259217,"uuid":"45743106","full_name":"ziflex/gulp-tasks-registrator","owner":"ziflex","description":"Gulp tasks registrator ","archived":false,"fork":false,"pushed_at":"2018-06-01T16:10:55.000Z","size":321,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T04:14:44.973Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ziflex.github.io/gulp-tasks-registrator/","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/ziflex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-11-07T15:58:58.000Z","updated_at":"2018-06-01T16:10:26.000Z","dependencies_parsed_at":"2022-08-25T03:01:41.313Z","dependency_job_id":null,"html_url":"https://github.com/ziflex/gulp-tasks-registrator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziflex%2Fgulp-tasks-registrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziflex%2Fgulp-tasks-registrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziflex%2Fgulp-tasks-registrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziflex%2Fgulp-tasks-registrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziflex","download_url":"https://codeload.github.com/ziflex/gulp-tasks-registrator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243903166,"owners_count":20366434,"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-10-13T06:47:09.151Z","updated_at":"2025-03-16T17:21:29.973Z","avatar_url":"https://github.com/ziflex.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-tasks-registrator\n\n\u003e Clean up your Gulpfile by splitting it into small isolated tasks\n\nGulp tasks registrator.\n\n[![npm version](https://badge.fury.io/js/gulp-tasks-registrator.svg)](https://www.npmjs.com/package/gulp-tasks-registrator)\n[![Build Status](https://secure.travis-ci.org/ziflex/gulp-tasks-registrator.svg?branch=master)](http://travis-ci.org/ziflex/gulp-tasks-registrator)  \n\nRegistrator runs through a given directory and registers found ```.js``` files as gulp tasks.  \n\n## Install\n\n```sh\n\n    $ npm install --save-dev gulp-tasks-registrator\n\n```\n\n## Basic Usage\n\nFor example, we have this folder structure with our tasks:\n\n````sh\n\n    tasks\n        env.js\n        build\n            scripts\n                app.js\n                vendors.js\n            styles.js\n\n````\n\nRegistrator will create tasks using convention - {folder1}:{folderN}:{filename}, ignoring root folder:  \n\n* env  \n* build:styles  \n* build:scripts:app  \n* build:scripts:vendors\n\n#### ./gulpfile.js\n\n```javascript\n\n    var path = require('path');\n    var $ = require('gulp-load-plugins')(\n        pattern: [\n            'gulp',\n            'gulp-*',\n            'gulp.*'\n        ]\n    );\n\n    require('gulp-tasks-registrator')({\n        gulp: $.gulp,\n        dir: path.join(__dirname, '/tasks'),\n        args: [$]\n    });\n\n```\n\n#### ./tasks/env.js\nEach file should contain factory function which returns an actual task function.  \nFactory will receive any arguments that were passed into registrator.\n\n```javascript\n\n    module.exports = function factory($) {\n        return task() {\n            return $.gulp.src(...)\n        };\n    };\n\n````\n\n## Grouping tasks\nWe can group small tasks with, so called, high order tasks, just by setting ```group``` parameter to ```true```.\n\n```javascript\n\n    require('gulp-tasks-registrator')({\n        gulp: gulp,\n        dir: path.join(__dirname, '/tasks'),\n        args: [gulp],\n        group: true\n    });\n\n```\n\nFor example, we have this folder structure with our tasks:\n\n````sh\n\n    tasks\n        env.js\n        build\n            scripts.js\n            styles.js\n            assets.js\n\n````\n\nExcept regular tasks, we will register high order task called ```build```, which will have all nested tasks as dependencies (nested high order tasks included).\n\nIt will be the same if we created it manually, like this:\n\n````javascript\n\n    gulp.task('build', ['build:scripts', 'build:styles', 'build:assets'], function(done) {\n        done();\n    });\n\n````\n\n## Tasks dependencies\nAlso, since version 0.3.0, it is possible to define dependencies for each tasks:\n\n````javascript\n\n    module.exports = function factory($) {\n        const task = task() {\n            return $.gulp.src(...)\n        };\n\n        task.dependencies = ['task1', 'task2'];\n\n        return task;\n    };\n\n````\n\n### API\n\n#### registrator(options)\n\n#### options.gulp\nType: `object`.  \nGulp instance.  \n\n#### options.dir\nType: `string`.  \nFull path to task factories directory.   \n\n### options.group\nType: `boolean`.    \nCreates gulp task based on folder name and adds nested tasks as dependencies.      \nOptional.    \n\n#### options.args\nType: `Array\u003cany\u003e`.  \nArguments to pass to task factories.  \nOptional.  \n\n#### options.filter\nType: `String|Function`.  \nRegExp string or a function for tasks filtering.  \nTask full path is passed as a function argument.   \nOptional.  \n\n#### options.verbose\nType: `boolean`.  \nDefines whether to push to console logs.  \nOptional.  \nDefault false.  \n\n#### options.panic\nType: `boolean`.  \nDefines whether to throw error if task registration failed.  \nOptional.  \nDefault true.\n\n### License\n\nThe MIT License (MIT)    \nCopyright (C) 2015 Tim Voronov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies 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,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziflex%2Fgulp-tasks-registrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziflex%2Fgulp-tasks-registrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziflex%2Fgulp-tasks-registrator/lists"}