{"name":"fastify-cli","version":"2.0.1","keywords":["fastify","cli","one command"],"author":{"url":"http://delved.org","name":"Tomas Della Vedova - @delvedor"},"license":"MIT","_id":"fastify-cli@2.0.1","maintainers":[{"name":"allevo","email":"tomallevi@gmail.com"},{"name":"cemremengu","email":"cemremengu@gmail.com"},{"name":"delvedor","email":"tommydelved@gmail.com"},{"name":"eomm","email":"behemoth89@gmail.com"},{"name":"ethan_arrowood","email":"ethan.arrowood@gmail.com"},{"name":"jsumners","email":"james.sumners@gmail.com"},{"name":"matteo.collina","email":"hello@matteocollina.com"},{"name":"starptech","email":"deusdustin@gmail.com"}],"contributors":[{"name":"Matteo Collina","email":"hello@matteocollina.com"}],"homepage":"https://github.com/fastify/fastify-cli#readme","bugs":{"url":"https://github.com/fastify/fastify-cli/issues"},"bin":{"fastify":"cli.js"},"dist":{"shasum":"3f87560b03044d56fc8b62c95c5aad237089f1d0","tarball":"http://registry-npm.ywwl.com/fastify-cli/download/fastify-cli-2.0.1.tgz","fileCount":75,"integrity":"sha512-/b77HUQk0myzPTPvP4joGsgvB7J6dV1ztOtjS5vDvXv+WUknq/fFP+hpVqElIcDdffm+wDVyyHx1A++KBxw8Yw==","signatures":[{"sig":"MEUCIQDAiaBZIaLPCYJWgprQQNvRkg/Dr8w6pr7FuSOmaN7x6gIgP6LabNE33yZ3nIzUJA55H2UmjgA1soI9/aAQlLW7pco=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":97422,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe/L7nCRA9TVsSAnZWagAATmUP/1xxkttJ1AoiQ86KAeh1\nohjiYT3IQdh3AuJLL+UKjI7d1qioY3oByiCZpqO/cDPeexw/PUGXKP/QNuwq\njZMg3gHSNdbcPMmifsDyTl8qQXhhahMeH/3d3ftuxXGhVye1cjRPKmoJmHVM\n7eYqgJmAlQdOClelV4hixA6csH93m0Ox0Cb9YKXJSxQrfXrtIVsCGevz3Dz/\nMdoBv/92yE8tRnISg8yFeMJ0fLA+41l6iqaV5wKw09owzuoAEs2tkT8ykzFS\n/GpvKaYz95iR9JmmjYtv72e9KtTEsRam3SiyvMHOy5HmjKsYbPLEYHAA4jwZ\nx9dMXWbxZBUndzq9N9SXtIRVRrHObbn1hxrFVRd7eo/FqUQS+2MMk5t2BmGd\nNSme+qU2RE6B1vymAQuBhg6qR2ElDXGQ9A8MWr6uoaTzhmTTKgkeu+9oOnjf\n4hpIsY1b2BpmY302YNnH5WQ3zYF14QZt2v/nRQE4IiHDyzFLg+SeODoMxXOR\nDbZu1ZUCQHInxPqUwcvgGoq+nQ6OqLmAgWsIVM4SIhdlcIKWn8H96pPEK45E\n8DWdGscnj1OP64DRVeoI/nOlA6lVCGUiII79h7RPVFo7u2hAmNOZfDf5wNm3\nZmO7uyIrDYpy73z43v0mTBeGcK+1ZVaFWaQl1/n2adg8JBdB9HXor30TN1Rn\n2Wo3\r\n=0GlI\r\n-----END PGP SIGNATURE-----\r\n","size":24540,"noattachment":false,"key":"/fastify-cli/-/fastify-cli-2.0.1.tgz"},"main":"cli.js","readme":"# fastify-cli\n\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) ![Tests](https://github.com/fastify/fastify-cli/workflows/Tests/badge.svg)\n\nCommand line tools for [Fastify](https://github.com/fastify/fastify).\nGenerate, write and run an application with one single command!\n\n## Install\n```bash\nnpm install fastify-cli --global\n```\n\n## Usage\n\n`fastify-cli` offers a single command line interface for your fastify\nproject:\n\n```bash\n$ fastify\n```\n\nWill print an help:\n\n```\nFastify command line interface, available commands are:\n\n  * start         start a server\n  * generate      generate a new project\n  * readme        generate a README.md for the plugin\n  * version       the current fastify-cli version\n  * docs          starts an interactive terminal session to view the fastify docs for the fastify version installed. navigate with arrow keys\n  * help          help about commands\n\nLaunch 'fastify help [command]' to know more about the commands.\n\nThe default command is start, you can hit\n\n  fastify start plugin.js\n\nto start plugin.js.\n```\n\n### start\n\nYou can start any Fastify plugin with:\n\n```bash\n$ fastify start plugin.js\n```\n\nA plugin can be as simple as:\n\n```js\n// plugin.js\nmodule.exports = function (fastify, options, next) {\n  fastify.get('/', function (req, reply) {\n    reply.send({ hello: 'world' })\n  })\n  next()\n}\n```\n\nIf you are using Node 8+, you can use `Promises` or `async` functions too:\n\n```js\n// async-await-plugin.js\nmodule.exports = async function (fastify, options) {\n  fastify.get('/', async function (req, reply) {\n    return { hello: 'world' }\n  })\n}\n```\n\nFor a list of available flags for `fastify start` see the help: `fastify help start`.\n\nIf you want to use custom options for the server creation, just export an options object with your route and run the cli command with the `--options` flag.\n\n```js\n// plugin.js\nmodule.exports = function (fastify, options, next) {\n  fastify.get('/', function (req, reply) {\n    reply.send({ hello: 'world' })\n  })\n  next()\n}\n\nmodule.exports.options = {\n  https: {\n    key: 'key',\n    cert: 'cert'\n  }\n}\n```\n\nIf you want to use custom options for your plugin, just add them after the `--` terminator.\n\n```js\n// plugin.js\nmodule.exports = function (fastify, options, next) {\n  if (option.one) {\n    //...\n  }\n  //...\n  next()\n}\n```\n\n```bash\n$ fastify start plugin.js -- --one\n```\n\n#### Options\nYou can pass the following options via cli arguments, every options has the corresponding environment variable:\n\n| Description                                                                                                                             | Short command | Full command       | Environment variable     |\n| --------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------ | ------------------------ |\n| Port to listen on (default to 3000)                                                                                                     | `-p`          | `--port`           | `FASTIFY_PORT or PORT`   |\n| Address to listen on                                                                                                                    | `-a`          | `--address`        | `FASTIFY_ADDRESS`        |\n| Socket to listen on                                                                                                                     | `-s`          | `--socket`         | `FASTIFY_SOCKET`         |\n| Log level (default to fatal)                                                                                                            | `-l`          | `--log-level`      | `FASTIFY_LOG_LEVEL`      |\n| Start fastify app in debug mode with nodejs inspector                                                                                   | `-d`          | `--debug`          | `FASTIFY_DEBUG`          |\n| Set the inspector port (default: 9320)                                                                                                  | `-I`          | `--debug-port`     | `FASTIFY_DEBUG_PORT`     |\n| Set the inspector host to listen on (default: loopback address or `0.0.0.0` inside Docker)                                              |               | `--debug-host`     | `FASTIFY_DEBUG_HOST`     |\n| Prints pretty logs                                                                                                                      | `-P`          | `--pretty-logs`    | `FASTIFY_PRETTY_LOGS`    |\n| Watch process.cwd() directory for changes, recursively; when that happens, the process will auto reload.                                | `-w`          | `--watch`          | `FASTIFY_WATCH`          |\n| Ignore changes to the specified files or directories when watch is enabled. (e.g. `--ignore-watch='node_modules .git logs/error.log'` ) |               | `--ignore-watch`   | `FASTIFY_IGNORE_WATCH`   |\n| Use custom options                                                                                                                      | `-o`          | `--options`        | `FASTIFY_OPTIONS`        |\n| Set the prefix                                                                                                                          | `-r`          | `--prefix`         | `FASTIFY_PREFIX`         |\n| Set the plugin timeout                                                                                                                  | `-T`          | `--plugin-timeout` | `FASTIFY_PLUGIN_TIMEOUT` |\n| Defines the maximum payload, in bytes,<br>the server is allowed to accept                                                               |               | `--body-limit`     | `FASTIFY_BODY_LIMIT`     |\n\nBy default `fastify-cli` runs [`dotenv`](https://www.npmjs.com/package/dotenv), so it will load all the env variables stored in `.env` in your current working directory.\n\nThe default value for `--plugin-timeout` is 10 seconds.\n\n#### Fastify version discovery\n\nIf Fastify is installed as a project dependency (with `npm install --save fastify`),\nthen `fastify-cli` will use that version of Fastify when running the server.\nOtherwise, `fastify-cli` will use the version of Fastify included within `fastify-cli`.\n\n#### Migrating out of fastify-cli start\n\nIf you would like to turn your application into a standalone executable,\njust add the following `server.js`:\n\n```js\n'use strict'\n\n// Read the .env file.\nrequire('dotenv').config()\n\n// Require the framework\nconst Fastify = require('fastify')\n\n// Instantiate Fastify with some config\nconst app = Fastify({\n  logger: true,\n  pluginTimeout: 10000\n})\n\n// Register your application as a normal plugin.\napp.register(require('./app.js'))\n\n// Start listening.\napp.listen(process.env.PORT || 3000, (err) => {\n  if (err) {\n    app.log.error(err)\n    process.exit(1)\n  }\n})\n```\n\n#### Unhandled rejections\n\nfastify-cli uses [make-promises-safe](https://github.com/mcollina/make-promises-safe) to avoid memory leaks\nin case of a `'unhandledRejection'`.\n\n### generate\n\n`fastify-cli` can also help with generating some project scaffolding to\nkickstart the development of your next Fastify application. To use it:\n\n1. `fastify generate <yourapp>`\n2. `cd yourapp`\n3. `npm install`\n\nThe sample code offers you four npm tasks:\n\n* `npm start` - starts the application\n* `npm run dev` - starts the application with\n  [`pino-colada`](https://github.com/lrlna/pino-colada) pretty logging\n  (not suitable for production)\n* `npm test` - runs the tests\n\nYou will find three different folders:\n- `plugins`: the folder where you will place all your custom plugins\n- `services`: the folder where you will declare all your endpoints\n- `test`: the folder where you will declare all your test\n\nFinally there will be an `app.js` file, which is your entry point.\nIt is a standard Fastify plugin and you will not need to add the `listen` method to run the server, just run it with one of the scripts above.\n\n### readme\n\n`fastify-cli` can also help with generating a concise and informative readme for your plugin. If no `package.json` was provided a new one is generated automatically.\nTo use it:\n\n1. `cd yourplugin`\n2. `fastify readme <path-to-your-plugin-file>`\n\nFinally there will be a new `README.md` file, which provides internal informations about your plugin e.g:\n\n* Install instructions\n* Example usage\n* Plugin dependencies\n* Exposed decorators\n* Encapsulation semantic\n* Compatible Fastify version\n\n### linting\n\n`fastify-cli` is unopinionated on the choice of linter. We recommend you to add a linter, like so:\n\n```diff\n\"devDependencies\": {\n+ \"standard\": \"^11.0.1\",\n}\n\n\"scripts\": {\n+ \"pretest\": \"standard\",\n  \"test\": \"tap test/**/*.test.js\",\n  \"start\": \"fastify start -l info app.js\",\n  \"dev\": \"fastify start -l info -P app.js\",\n+ \"lint\": \"standard --fix\"\n},\n```\n\n### docs\n\n`fastify-cli` allows you to view the documentation for fastify in your terminal. By default, fastify-cli attempts to render the documentation for the fastify version installed in the current working directory node_modules folder, however, if none are found, it should fall back to rendering the documentation for the version that fastify-cli depends on.\n\nThe documentation is rendered using an interactive terminal session that you can navigate with your arrow keys by pressing the enter key to select documentation to view.\n\nrun `fastify docs` to get started.\n\n## Contributing\nIf you feel you can help in any way, be it with examples, extra testing, or new features please open a pull request or open an issue.\n\nThe code follows the Standard code style.\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\n## License\n**[MIT](https://github.com/fastify/fastify-cli/blob/master/LICENSE)**\n\n*The software is provided \"as is\", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.*\n\nCopyright © 2016-2018 Fastify Team\n","engines":{"node":">= 6.15.0"},"gitHead":"1acb82725a43832ad1a99d2a9e6dfd4a9293ff9b","scripts":{"lint":"standard","test":"npm run lint && npm run unit","unit":"tap test/*.test.js templates/app/test/*/*.test.js templates/app-ts/test/*/*.test.ts"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"standard":{"ignore":["test/data/parsing-error.js","test/data/undefinedVariable.js"]},"repository":{"url":"git+https://github.com/fastify/fastify-cli.git","type":"git"},"_npmVersion":"6.14.5","description":"Run a fastify route with one command!","directories":{},"_nodeVersion":"12.18.1","dependencies":{"pump":"^3.0.0","chalk":"^4.1.0","dotenv":"^8.2.0","split2":"^3.1.1","blessed":"^0.1.81","commist":"^1.0.0","fastify":"^3.0.0-rc.5","help-me":"^1.1.0","chokidar":"^3.3.1","generify":"^4.0.0","is-docker":"^2.0.0","pino-colada":"^2.0.1","resolve-from":"^5.0.0","yargs-parser":"^18.1.1","fastify-plugin":"^2.0.0","blessed-contrib":"^4.8.18","make-promises-safe":"^5.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tap":"^14.0.0","sinon":"^9.0.0","mkdirp":"^1.0.3","rimraf":"^3.0.2","walker":"^1.0.7","standard":"^14.3.3","minimatch":"^3.0.4","pre-commit":"^1.2.2","proxyquire":"^2.1.3","simple-get":"^4.0.0","strip-ansi":"^6.0.0","typescript":"^3.8.2","@types/node":"^14.0.14","concurrently":"^5.1.0","fastify-autoload":"^3.0.2"},"_npmOperationalInternal":{"tmp":"tmp/fastify-cli_2.0.1_1593622247447_0.6106183534985581","host":"s3://npm-registry-packages"},"publish_time":1593622247545,"_cnpm_publish_time":1593622247545,"dist-tags":{"latest":"8.0.3","next":"7.0.0"}}