UNPKG

@apployees-nx/webserver

Version:

A create-react-app inspired plugin for Nx, with SSR and PWA capabilities.

375 lines (373 loc) 15.8 kB
{ "title": "Webserver Application Build Target", "description": "Webserver application build target options for Build Facade", "type": "object", "properties": { "dev": { "type": "boolean", "description": "Build the application for development mode. Will watch for changes.", "default": true }, "devHost": { "type": "string", "default": "localhost", "description": "The host to use to run the server when in dev mode (i.e. when dev=true)." }, "devHttps": { "type": "boolean", "description": "True if the dev server should use HTTPS. False by default. Only valid when dev=true.", "default": false }, "devHttpsSslKey": { "type": "string", "description": "The path to the SSL key to use for serving HTTPS when devHttps=true." }, "devHttpsSslCert": { "type": "string", "description": "The path to the SSL certificate to use for serving HTTPS when devHttps=true." }, "devAppPort": { "type": "number", "default": 3000, "description": "The port to use to run the application server when in dev mode (i.e. when dev=true)." }, "devWebpackPort": { "type": "number", "default": 3030, "description": "The port to run the Webpack server when in dev mode (i.e. dev=true). This is the server that runs HMR." }, "appHtml": { "type": "string", "description": "The name of the HTML file that will be used for all routes." }, "serverMain": { "type": "string", "description": "The name of the main entry-point file for the server." }, "clientMain": { "type": "string", "description": "The name of the main entry-point file for the client." }, "clientOtherEntries": { "type": "object", "description": "Additional entries that you want to define for the CLIENT. The key is the name of the file and the value is the entry. Each of these entries becomes an independent bundle injected into the appHtml file. If you suffix the key with '_head' the bundle will get injected in the <head> portion of the appHtml file (this technique is useful for polyfills)." }, "tsConfig": { "type": "string", "description": "The name of the Typescript configuration file." }, "sourceMap": { "type": "boolean", "description": "Produce source maps for code in server build when dev=false. This flag is only used when dev=false and only for the server build. When dev=true, source maps are always produced for the server build and the client build. When dev=false, source maps on client are never produced.", "default": false }, "sourceMapForStyles": { "type": "boolean", "description": "Produce source maps for CSS, SCSS, and LESS styles on the client build when dev=true. This flag is only used for dev=true. When dev=false, source maps on client are never produced.", "default": false }, "progress": { "type": "boolean", "description": "Log progress to the console while building. Only works for dev=true.", "default": true }, "notifier": { "description": "Pops up a notifier when the build is done. Works only in dev=true mode. If set to true, all notifications will be shown. Otherwise, you can configure options for it (see schema or https://github.com/johnnyreilly/fork-ts-checker-notifier-webpack-plugin).", "oneOf": [ { "type": "boolean" }, { "type": "object", "properties": { "excludeWarnings": { "type": "boolean", "description": "If set to true, warnings will not cause a notification.", "default": false }, "alwaysNotify": { "type": "boolean", "description": "Trigger a notification every time. Call it \"noisy-mode\".", "default": false }, "skipFirstNotification": { "type": "boolean", "description": "Do not notify on the first build. This allows you to receive notifications on subsequent incremental builds without being notified on the initial build.", "default": false }, "skipSuccessful": { "type": "boolean", "description": "Skip notifications for successful builds.", "default": true } } } ], "default": true }, "assets": { "type": "array", "description": "List of static application assets. Instead of using this, it is preferred that you import/require assets directly in code -- this way you won't have to tweak around with URLs.", "default": [], "items": { "$ref": "#/definitions/assetPattern" } }, "favicon": { "type": "string", "description": "The path to the png, svg, or other image from which favicons will be generated for various devices. Note: this is only for when dev=false (i.e. for production)." }, "manifestJson": { "type": "string", "description": "Provide a manifest.json file which will be used as the base for the generated manifest.json file." }, "envFolderPath": { "type": "string", "description": "The path to the folder that contains this project's .env environment files. Defaults to a folder called 'envs' in the root of the project." }, "additionalEnvFile": { "type": "string", "description": "The path to an additional environment file. This will be loaded first before any others for the NODE_ENV are loaded, and will take priority over all others." }, "imageInlineSizeLimit": { "type": "number", "description": "The size threshold after which images should not be inlined. Defined in bytes.", "default": 10000 }, "assetsUrl": { "type": "string", "description": "The \"public path\" at which the static assets are served -- you can override this with ASSETS_URL environment variable. We need to know this so we can put the right <script> hrefs into HTML even in single-page apps that may serve app.html for nested URLs like /todos/42. We can't use a relative path in HTML because we don't want to load something like /todos/42/static/js/bundle.7289d.js. We have to know the root.", "default": "/" }, "publicUrl": { "type": "string", "description": "The \"public path\" at which the app itself is served -- you can override this with PUBLIC_URL environment variable. This will be used for things like start_url in the manifest.json.", "default": "/" }, "serverExternalDependencies": { "oneOf": [ { "type": "string", "enum": ["none", "all"] }, { "type": "array", "items": { "type": "string" } } ], "description": "node_module dependencies to keep external to the server bundle. (\"all\" (default), \"none\", or an array of module names)", "default": "all" }, "serverExternalLibraries": { "oneOf": [ { "type": "string", "enum": ["none", "all"] }, { "type": "array", "items": { "type": "string" } } ], "description": "Libraries within the mono-repo to keep external to the server bundle. (\"all\" (default), \"none\", or an array of library names.)", "default": "none" }, "statsJson": { "type": "boolean", "description": "Generates a 'stats.json' file which can be analyzed using tools such as: #webpack-bundle-analyzer' or https: //webpack.github.io/analyse.", "default": false }, "verbose": { "type": "boolean", "description": "Emits verbose output", "default": false }, "devClientBundleAnalyzer": { "type": "boolean", "description": "Start bundle analyzer for the client bundles after webpack build. Only if dev=true.", "default": false }, "extractLicenses": { "type": "boolean", "description": "Extract all licenses in a separate file, in the case of production builds only.", "default": false }, "buildCacheFolder": { "type": "string", "description": "A path relative to the root of this workspace for storing webpack and typescript caches" }, "showCircularDependencies": { "type": "boolean", "description": "Show circular dependency warnings on builds.", "default": true }, "useThreadsPlugin": { "type": "boolean", "description": "Use threads-plugin from https://github.com/andywer/threads-plugin instead of worker-plugin from https://github.com/GoogleChromeLabs/worker-plugin", "default": false }, "inlineRuntimeChunk": { "type": "boolean", "description": "Some apps do not need the benefits of saving a web request, so not inlining the chunk makes for a smoother build process.", "default": true }, "outputHashing": { "type": "string", "description": "Define the output filename cache-busting hashing mode.", "default": "all", "enum": ["none", "all", "media", "bundles"] }, "serverFileReplacements": { "description": "Replace files with other files in the build for server.", "type": "array", "items": { "type": "object", "properties": { "replace": { "type": "string" }, "with": { "type": "string" } }, "additionalProperties": false, "required": ["replace", "with"] }, "default": [] }, "clientFileReplacements": { "description": "Replace files with other files in the build for client.", "type": "array", "items": { "type": "object", "properties": { "replace": { "type": "string" }, "with": { "type": "string" } }, "additionalProperties": false, "required": ["replace", "with"] }, "default": [] }, "importTransformers": { "description": "Transform imports in Typescript code -- use this to only import a subset of modules from a package.", "type": "array", "items": { "type": "object", "properties": { "libraryName": { "type": "string", "description": "The name of the library import, e.g. 'antd' or 'lodash'." }, "subdirectory": { "type": "string", "default": "lib", "description": "Where in the module is the named import is located. For example, if you specify `import { TimePicker } from \"antd\"`, and if the value of `subdirectory` is `lib`, then it will transform to `import TimePicker from 'antd/lib/time-picker';` -- i.e. the path to require from is {moduleName}/{subdirectory}/{namedImport}." }, "transformCamel2Dash": { "type": "boolean", "default": true, "description": "Converts a named import from camelcase into one with dashes. E.g. Converts `import { TimePicker } from \"antd\"` to `import TimePicker from 'antd/lib/time-picker';` -- notice how it converted `antd/lib/TimePicker` to `antd/lib/time-picker`." }, "transformCamel2Underline": { "type": "boolean", "default": false, "description": "Converts a named import from camelcase into one with underlines. E.g. Converts `import { TimePicker } from \"antd\"` to `import TimePicker from 'antd/lib/time_picker';` -- notice how it converted `antd/lib/TimePicker` to `antd/lib/time_picker`." }, "useDefaultImports": { "type": "boolean", "default": true, "description": "Set this option to `false` if your module does not have a default export. If this is `true`, you should have `allowSyntheticDefaultImports` set to true in your tsconfig.json." }, "additionalImports": { "type": "object", "default": {}, "description": "An object where the key is a string that represents the name of the import, and the value is a list of strings that represent the paths to the additional imports relative to the transformed import directory. This is useful if you have to import any additional associated modules such as css or less files. A key \"*\" will apply to all the rest of the imports that don't match the other keys. E.g. if you specify `{\"Row\": \"[\"style/index.css\"]\", \"*\": [\"style/index.less\"]}` then an import such as `import { TimePicker } from \"antd\"` will be transformed into two import statements: (1) `import TimePicker from 'antd/lib/time-picker';`, (2) `import 'antd/lib/time-picker/style/index.less';`. The (2) import in the example will then be subject to the less loaders from webpack. Additionally, an import such as `import { Row } from \"antd\"` will be transformed into: (1) `import Row from 'antd/lib/row';`, (2) `import 'antd/lib/row/style/index.css';`. Notice how it used index.css for the row since it matched the `Row` key in the object, but for TimePicker it used index.less since it matched `*`." } }, "additionalProperties": false, "required": ["libraryName"] }, "default": [] }, "lessStyleVariables": { "type": "string", "description": "Path to a .less file that defines variables that will be loaded by less-loader. Use this to customize the theme for various frameworks like AntD." }, "serverWebpackConfig": { "type": "string", "description": "Path to a function which takes a webpack config, context and returns the resulting webpack config for the server" }, "clientWebpackConfig": { "type": "string", "description": "Path to a function which takes a webpack config, context and returns the resulting webpack config for the client" }, "inspectHost": { "type": "string", "default": "127.0.0.1", "description": "The host to inspect the process on" }, "inspectPort": { "type": "number", "default": 0, "description": "The port to inspect the process on. Setting port to 0 will assign random free ports to all forked processes." }, "inspect": { "oneOf": [ { "type": "string", "enum": ["inspect", "inspect-brk"] }, { "type": "boolean" } ], "description": "Ensures the app is starting with debugging", "default": "inspect" } }, "required": ["tsConfig", "serverMain", "clientMain", "appHtml"], "definitions": { "assetPattern": { "oneOf": [ { "type": "object", "properties": { "glob": { "type": "string", "description": "The pattern to match." }, "input": { "type": "string", "description": "The input directory path in which to apply 'glob'. Defaults to the project root." }, "ignore": { "description": "An array of globs to ignore.", "type": "array", "items": { "type": "string" } }, "output": { "type": "string", "description": "Absolute path within the output." } }, "additionalProperties": false, "required": ["glob", "input", "output"] }, { "type": "string" } ] } } }