{"id":17104597,"url":"https://github.com/imyelo/grunt-wait-server","last_synced_at":"2025-06-23T02:06:03.485Z","repository":{"id":12513746,"uuid":"15183493","full_name":"imyelo/grunt-wait-server","owner":"imyelo","description":"make grunt wait for a server start","archived":false,"fork":false,"pushed_at":"2018-08-15T13:32:31.000Z","size":17,"stargazers_count":5,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T14:41:04.967Z","etag":null,"topics":["grunt-plugins","wait"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mongo-express/mongo-express","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imyelo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-14T10:01:07.000Z","updated_at":"2018-08-15T13:31:04.000Z","dependencies_parsed_at":"2022-09-16T23:40:41.640Z","dependency_job_id":null,"html_url":"https://github.com/imyelo/grunt-wait-server","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/imyelo/grunt-wait-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imyelo%2Fgrunt-wait-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imyelo%2Fgrunt-wait-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imyelo%2Fgrunt-wait-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imyelo%2Fgrunt-wait-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imyelo","download_url":"https://codeload.github.com/imyelo/grunt-wait-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imyelo%2Fgrunt-wait-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259747194,"owners_count":22905308,"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":["grunt-plugins","wait"],"created_at":"2024-10-14T15:37:21.968Z","updated_at":"2025-06-23T02:05:58.453Z","avatar_url":"https://github.com/imyelo.png","language":"JavaScript","readme":"# grunt-wait-server\n\n\u003e make grunt wait for server start\n\n[![NPM version](https://badge.fury.io/js/grunt-wait-server.png)](http://badge.fury.io/js/grunt-wait-server)\n[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)\n\n## Getting Started\nThis plugin requires Grunt `~0.4.2`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-wait-server --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-wait-server');\n```\n\n## The \"waitServer\" task\n\n### Overview\nIn your project's Gruntfile, add a section named `waitServer` or `wait-server` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  waitServer: {\n    options: {\n      req: 'http://localhost:8080',\n      fail: function () {},\n      timeout: 10 * 1000,\n      isforce: false,\n      interval: 800,\n      print: true\n    },\n\n    server: {\n      options: {\n        req: {\n          url: 'http://localhost:8080',\n          method: 'HEAD'\n        }\n      }\n    },\n\n    remoteServer: {\n      options: {\n        req: 'http://example.com',\n        print: false\n      }\n    },\n\n    db: {\n      options: {\n        net: {\n          port: 3306\n        },\n        timeout: 0\n      }\n    }\n  }\n});\n```\n\n### Options\n\n#### options.req\nType: `string` or an options `object`  \nDefault value: `undefined`  \nSee [request#options](https://github.com/request/request#requestoptions-callback) for available options.\n\n#### options.net\nType: options `object`  \nDefault value: `undefined`  \nSee [net.connect#options](https://nodejs.org/api/net.html#net_net_connect_options_connectlistener) for available options.\n\n\n##### You must supply either `options.req` or `options.net`.\n\n\n#### options.fail  \nType: `function`  \nDefault value: `function () {}`  \n\n\n#### options.timeout  \nType: `number`  \nDefault value: `10 * 1000`  \n`0` disables the timeout, will wait forever.\n\n\n#### options.isforce  \nType: `boolean`  \nDefault value: `false`  \n\n\n#### options.interval  \nType: `number`  \nDefault value: `800`  \n\n\n#### options.print  \nType: `boolean`  \nDefault value: `true` \n\n\nWhen `options.isforce` is true, \nthe task will continue after `options.timeout`, \neven if the `done` signal in `options.wait` never came.  \n\n### Usage Examples  \n\n#### Default Options  \nIn this example, the `waitServer` task will wait for the server start with the least options.  \n\n```js\ngrunt.initConfig({\n  waitServer: {\n    server: {\n      options: {\n        req: 'http://localhost:8080'\n      }\n    },\n  },\n});\n```\n\n#### Custom Options  \n\n```js\ngrunt.initConfig({\n  waitServer: {\n    server: {\n      options: {\n        req: 'http://localhost:8080',\n        fail: function () {\n          console.error('the server had not start'); \n        },\n        timeout: 20 * 1000,\n        isforce: true,\n        interval: 200,\n        print: false\n      }\n    }\n  },\n});\n```\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## Release History\n_(Nothing yet)_\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/imyelo/grunt-wait-server/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimyelo%2Fgrunt-wait-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimyelo%2Fgrunt-wait-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimyelo%2Fgrunt-wait-server/lists"}