<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> The only way to set if a task is continuous is either directly in `project.json` or via Project Graph Plugins. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> Executors know if they are definitely continuous or not. Plenty of existing continuous tasks are using executors. Executors are now able to define if they are continuous in their `schema.json` files. Thus, existing tasks configured with certain executors will automatically become continuous. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
91 lines
6.4 KiB
JSON
91 lines
6.4 KiB
JSON
{
|
|
"name": "server",
|
|
"implementation": "/packages/next/src/executors/server/server.impl.ts",
|
|
"schema": {
|
|
"version": 2,
|
|
"continuous": true,
|
|
"outputCapture": "pipe",
|
|
"cli": "nx",
|
|
"title": "Next Serve",
|
|
"description": "Serve a Next.js app.",
|
|
"type": "object",
|
|
"properties": {
|
|
"dev": {
|
|
"type": "boolean",
|
|
"description": "Serve the application in the dev mode.",
|
|
"default": true
|
|
},
|
|
"buildTarget": {
|
|
"type": "string",
|
|
"description": "Target which builds the application.",
|
|
"x-priority": "important"
|
|
},
|
|
"port": {
|
|
"type": "number",
|
|
"description": "Port to listen on.",
|
|
"default": 4200,
|
|
"x-priority": "important"
|
|
},
|
|
"staticMarkup": {
|
|
"type": "boolean",
|
|
"description": "Static markup.",
|
|
"default": false
|
|
},
|
|
"quiet": {
|
|
"type": "boolean",
|
|
"description": "Hide error messages containing server information.",
|
|
"default": false
|
|
},
|
|
"customServerTarget": {
|
|
"type": "string",
|
|
"description": "Target which builds the custom server."
|
|
},
|
|
"hostname": {
|
|
"type": "string",
|
|
"description": "Hostname on which the application is served."
|
|
},
|
|
"buildLibsFromSource": {
|
|
"type": "boolean",
|
|
"description": "Read buildable libraries from source instead of building them separately.",
|
|
"default": true
|
|
},
|
|
"keepAliveTimeout": {
|
|
"type": "number",
|
|
"description": "Max milliseconds to wait before closing inactive connection."
|
|
},
|
|
"turbo": {
|
|
"type": "boolean",
|
|
"description": "Activate the incremental bundler for Next.js, which is implemented in Rust. Please note, this feature is exclusively available in development mode."
|
|
},
|
|
"experimentalHttps": {
|
|
"type": "boolean",
|
|
"description": "Enable HTTPS support for the Next.js development server."
|
|
},
|
|
"experimentalHttpsKey": {
|
|
"type": "string",
|
|
"description": "Path to a HTTPS key file."
|
|
},
|
|
"experimentalHttpsCert": {
|
|
"type": "string",
|
|
"description": "Path to a HTTPS certificate file."
|
|
},
|
|
"experimentalHttpsCa": {
|
|
"type": "string",
|
|
"description": "Path to a HTTPS certificate authority file."
|
|
},
|
|
"customServerHttps:": {
|
|
"type": "boolean",
|
|
"description": "Enable HTTPS support for the custom server."
|
|
}
|
|
},
|
|
"required": ["buildTarget"],
|
|
"examplesFile": "---\ntitle: Next.js server executor examples\ndescription: This page contains examples for the @nx/next:serve executor.\n---\n\n`project.json`:\n\n```json\n//...\n{\n \"name\": \"acme\",\n \"$schema\": \"node_modules/nx/schemas/project-schema.json\",\n \"sourceRoot\": \".\",\n \"projectType\": \"application\",\n \"targets\": {\n //...\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"production\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n }\n }\n //...\n }\n}\n```\n\n```bash\nnx run acme:serve\n```\n\n## Examples\n\n### For Next.js Standalone projects\n\n{% tabs %}\n{% tab label=\"Default configuration\" %}\n\nThis is the default configuration for Next.js standalone projects. Our `@nx/next:server` executor is integrated to use Next.js' CLI. You can read more about the serve options at [Next.js CLI Options](https://nextjs.org/docs/app/api-reference/next-cli)\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true\n },\n \"production\": {\n \"buildTarget\": \"acme:build:production\",\n \"dev\": false\n }\n }\n },\n```\n\n{% /tab %}\n{% tab label=\"Enable turbo\" %}\n\nTurbopack (beta) is a cutting-edge bundler designed for JavaScript and TypeScript. To read more about support features see [Next.js Turbopack Documentation](https://turbo.build/pack/docs/features)\n\nIn the context of Nx, you can utilize Turbopack within both the `pages` and `app` directories of Next.js to enhance local development speed. To activate Turbopack, simply:\n\nAppend the `--turbo` flag while executing the Nx development server.\n\n```shell\nnx run acme:serve --turbo\n```\n\nUpdating the build options to include `turbo`.\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true,\n \"turbo\": true\n },\n //\n }\n }\n```\n\n```bash\nnx run acme:serve\n```\n\n{% /tab %}\n\n{% tab label=\"Adding keep alive timeout\" %}\n\nWhen using Nx with Next.js behind a downstream proxy, it's important to make sure that the `keep-alive timeouts` of Next.js' HTTP server are set to longer durations than the timeouts of the proxy. If you don't do this, Node.js will unexpectedly end TCP connections without notifying the proxy when the `keep-alive timeout` is reached. This can lead to a proxy error when the proxy tries to reuse a connection that Node.js has already terminated.\n\nTo configure timeout values (in milliseconds) you can:\n\nPass `--keepAliveTimeout`\n\n```shell\nnx run acme:serve --keepAliveTimeout 60000\n```\n\nUpdating the serve options to include `keepAliveTimeout`.\n\n```json\n \"serve\": {\n \"executor\": \"@nx/next:server\",\n \"defaultConfiguration\": \"development\",\n \"options\": {\n \"buildTarget\": \"acme:build\",\n \"dev\": true\n },\n \"configurations\": {\n \"development\": {\n \"buildTarget\": \"acme:build:development\",\n \"dev\": true,\n \"keepAliveTimeout\": 60000\n },\n //\n }\n }\n```\n\n```shell\nnx run acme:serve\n```\n\n{% /tab %}\n\n{% /tabs %}\n",
|
|
"presets": []
|
|
},
|
|
"description": "Serve a Next.js application.",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/next/src/executors/server/schema.json",
|
|
"type": "executor"
|
|
}
|