{"id":22428395,"url":"https://github.com/momsfriendlydevco/gulpy","last_synced_at":"2025-03-27T06:43:42.542Z","repository":{"id":65855243,"uuid":"184493511","full_name":"MomsFriendlyDevCo/gulpy","owner":"MomsFriendlyDevCo","description":"A series of fixes for small irritations in Gulp","archived":false,"fork":false,"pushed_at":"2023-02-14T05:19:57.000Z","size":431,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T12:50:54.938Z","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/MomsFriendlyDevCo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-01T23:13:25.000Z","updated_at":"2022-01-18T02:08:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac829934-4a28-4079-bd1a-250d1a324936","html_url":"https://github.com/MomsFriendlyDevCo/gulpy","commit_stats":{"total_commits":58,"total_committers":2,"mean_commits":29.0,"dds":0.06896551724137934,"last_synced_commit":"ee850f9106b489407431871eb6d7851e12b0df84"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fgulpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fgulpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fgulpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fgulpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MomsFriendlyDevCo","download_url":"https://codeload.github.com/MomsFriendlyDevCo/gulpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245798538,"owners_count":20673901,"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-12-05T20:14:42.054Z","updated_at":"2025-03-27T06:43:42.523Z","avatar_url":"https://github.com/MomsFriendlyDevCo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"@MomsFriendlyDevCo/Gulpy\n========================\nLike [Gulp](https://gulpjs.com) but with a few extras.\n\nThis module fixes a few irritations with the new Gulp 4 standard and makes some gulp task definitions easier to read.\n\nThe intention here is to remain as-close-as-possible to the actual Gulp release while still supporting some of the nicer syntax (IMHO) of Gulp@3.\n\n\nWhy?\n----\n\n* **Call-forwards** - Like any company with a large sprawling codebase we separate our gulp files up into multiple chunks and sometimes things like calling between these gulp tasks is required. The Gulp@4 standard doesn't really seem to take this into account so the `gulp.task(id, func)` invocation has to be called in an exact order or you get an error. This can be fixed with [some workarounds](https://github.com/gulpjs/undertaker-forward-reference) but even the official Gulp docs say this is likely to be abandoned at some future point.\n* **Non-Async functions** - I honestly see no earthly reason why Gulp@4 now insists that all functions should be async except as an aesthetic choice. Forgetting to add the magical `async` bit before a function when it just returns an inline operation seems extremely arbitrary.\n* **Task prerequisites** - Yes I know you can use `gulp.task(id, gulp.series(foo, bar, baz))` to show the execution order but if the last one of these is a function things get messy. I much prefer the `gulp.task(id, [prereqs...], func)` way of doing things\n* **Run-once tasks** - An easier way to specify that a task should be executed only once, even if called multiple times as a pre-requisite.\n* **Emit \"finish\" event for cleanup** - I've honestly no idea how [cleaning up after multiple tasks is not a problem to solve](https://github.com/gulpjs/gulp/issues/1275) but disconnecting from the database and so on should be handled properly\n* **Tidier task display** - Automatically hides all weird \"Parallel\", \"Series\" anonymous tasks unless `--verbose` is specified\n\n\nInstallation \u0026 Usage\n--------------------\nThis module works as a mixin of Gulp. Set your `gulp` instance to it to inherit regular Gulp behaviour as well as the extra features and fixes of this module.\n\n1. Simply install the NPM\n\n```\nnpm install @momsfriendlydevco/gulpy\n```\n\n\n2. And include at the top of your main gulpfile where you would normally reference `gulp`:\n\n```javascript\nvar gulp = require('@momsfriendlydevoco/gulpy');\n\ngulp.task(id, func); // etc...\n```\n\n\nDebugging\n---------\nThis module uses the [Debug NPM package](https://github.com/visionmedia/debug#readme) and responds to `gulpy`.\n\nTo see verbose debugging output simply set `DEBUG=gulpy` or any valid glob expression.\n\n```\n\u003e DEBUG=gulpy gulp taskID\n```\n\n\nFeatures\n========\n\n\nCall-forwards\n-------------\nCalling a task that hasn't been defined yet is now wrapped in a function which defers until a later point.\n\n\n```javascript\nvar gulp = require('@momsfriendlydevco/gulpy');\n\ngulp.task('foo', gulp.series('bar', async ()=\u003e console.log('Out:Foo')));\ngulp.task('bar', gulp.series('baz', async ()=\u003e console.log('Out:Bar')));\ngulp.task('baz', async ()=\u003e console.log('Out:Baz'));\n```\n\nThis is also possible with the [undertaker-forward-reference](https://github.com/gulpjs/undertaker-forward-reference) registry but the author has no intention to keep that up-to-date.\n\n\nNon-async functions\n-------------------\nNo idea why Gulp@4 demands this but if you declare a Gulp task without the magical `async` it will now be wrapped in a promise on your behalf.\n\n\n```javascript\nvar gulp = require('@momsfriendlydevco/gulpy');\n\ngulp.task('foo', gulp.series('bar', ()=\u003e console.log('Out:Foo')));\ngulp.task('bar', gulp.series('baz', ()=\u003e console.log('Out:Bar')));\ngulp.task('baz', ()=\u003e console.log('Out:Baz'));\n```\n\n\nTask chaining\n-------------\nEasily specify task-prerequisites and execution order.\n\n\n```javascript\nvar gulp = require('@momsfriendlydevco/gulpy');\n\ngulp.task('default', ['foo']);\ngulp.task('foo', 'bar', ()=\u003e console.log('Out:Foo'));\ngulp.task('bar', ['baz'], ()=\u003e console.log('Out:Bar'));\ngulp.task('baz', 'baz:real');\ngulp.task('baz:real', ()=\u003e console.log('Out:Baz'));\n```\n\n\n\n| Gulpy shorthand                       | Gulp@4 equivalent                                 | Description                                             |\n|---------------------------------------|---------------------------------------------------|---------------------------------------------------------|\n| `gulp.task(id, func)`                 | `gulp.task(id, func)`                             | Standard `gulp.task()` usage                            |\n| `gulp.task(id, 'foo')`                | `gulp.task(id, gulp.series('foo'))`               | Redirect a task to another                              |\n| `gulp.task(id, 'foo', 'bar')`         | `gulp.task(id, gulp.series('foo', 'bar'))`        | Set up a chain of tasks to be run in series by their ID |\n| `gulp.task(id, ['foo', 'bar'], func)` | `gulp.task(id, gulp.series('foo', 'bar'', func))` | Run a task with prerequisites                           |\n\n\n\nRun-once\n--------\nTo specify that a task should be run only once during the life of the Gulp process simply suffix each `.task` call with `.once`:\n\n```javascript\ngulp.task.once('setup', ()=\u003e ...);\ngulp.task('foo', ['setup'], ()=\u003e ...);\ngulp.task('bar', ['setup'], ()=\u003e ...);\ngulp.task('build', ['foo', 'bar']); // 'setup' runs only once, followed by 'foo', 'bar', in parallel\n```\n\n\nEvent management\n----------------\nGulpy uses [eventer](https://github.com/MomsFriendlyDevCo/eventer) to manage promisable events at each stage of the lifecycle.\n\n```javascript\ngulp.on('finish', ()=\u003e ...)\n```\n\nSupported events are:\n\n| Event       | Args     | Description                                                                 |\n|-------------|----------|-----------------------------------------------------------------------------|\n| `start`     | `()`     | Emitted on the very first task (or when the task buffer is empty)           |\n| `taskStart` | `(task)` | Emitted at the start of each new task with the task object                  |\n| `taskEnd`   | `(task)` | Emitted at the end of a task with the task object                           |\n| `finish`    | `()`     | Emitted at the very end of the task stack (or when the task buffer empties) |\n\n\nAPI\n===\nThis module is a mixin to Gulp which extends some existing Gulp functions to work with the features listed above.\nIt also provides the following extra functionality in addition to the standard Gulp API.\n\n\ngulpy.isGulpy\n-------------\nAlways true, this can be used as a check to see if `gulpy.mutate()` has been called. If it has then `gulp.isGulpy` will also be true.\n\n\ngulpy.log(...msgs)\n------------------\nLog output using the same style used when rendering task start / ends.\n\n\ngulpy.colors\n------------\n[Chalk](https://github.com/chalk/chalk) instance.\n\n\ngulpy.mutate()\n--------------\nOverwrite the gulpy mutated functions in the `gulp`, effectively turning every `require('gulp')` call into `require('@momsfriendlydevco/gulpy')`.\nOnly use this if you know what you are doing as this may have side-effects with downstream modules.\n\n\ngulpy.run(...tasks)\n-------------------\nInline replacement for `gulp.series()` and `gulp.parallel()`.\nThis funciton is used to process all arguments after the task alias in `gulp.task()`\n\nThis function can take any number of the following arguments:\n\n* (string) already declared tasks\n* (string) future tasks (i.e. not yet present)\n* Async functions\n* Promises + Promise factories\n* Callback functions\n* Plain functions\n* Array of any of the above (child items executed in parallel)\n* An event-emitter (include Gulp / Vinyl chains) - if an `.on()` function is found we wait for `end` to be signalled before continuing\n\n\n```javascript\n// Run 'Foo' then 'Bar', then 'Baz'\ngulp.run('foo', 'bar', 'baz');\n\n// Run 'Foo' then 'Bar' + 'Baz' (the latter two in parallel\ngulp.run('foo', ['bar', 'baz']);\n\n// Declare a task 'foo' which runs 'bar' then 'baz' + 'quz' in parallel\ngulp.task('foo', 'bar', ['baz', 'quz']);\n```\n\n\ngulpy.start(...tasks)\n---------------------\nAlias of `gulp.run()`\n\n\ngulpy.hasUserTask(task)\n-----------------------\nCheck if `task` was specifically requested by the user - via the CLI.\n\nExamples:\n\n* If run with `gulp foo` then `gulpy.hasUserTask('foo') //=true`\n* If run with `gulp bar` then `gulpy.hasUserTask('foo') //=false` (even if bar calls 'foo' internally)\n\n\ngulpy.settings\n--------------\nObject of settings used by Gulpy.\n\nAvailable options:\n\n| Setting             | Type     | Default   | Description                                                                            |\n|---------------------|----------|-----------|----------------------------------------------------------------------------------------|\n| `futureTaskTries`   | Number   | `20`      | How many tries before giving up on finding a future task alias as-yet-to-be-declared   |\n| `futureTaskWait`    | Number   | `50`      | The millisecond wait between each future task alias attempt                            |\n| `logging`           | Boolean  | `true`    | Whether to call any of the log functions when running tasks                            |\n| `loggingOnce`       | Boolean  | `false`   | Whether to log any tasks marked as `.once()`, these are off by default as they are typically utility functions |\n| `taskStart`         | Function | See code  | Called as `(task)` when a task starts, override to change logging                      |\n| `taskEnd`           | Function | See code  | Called as `(task)` when a task ends, override to change logging                        |\n\n\n\n\ngulpy.gulp\n----------\nThe original gulp instance if raw access is required.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Fgulpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomsfriendlydevco%2Fgulpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Fgulpy/lists"}