{
  "title": "Web Application Build Target",
  "description": "Web application build target options for Build Facade",
  "type": "object",
  "properties": {
    "crossOrigin": {
      "type": "string",
      "description": "The crossorigin attribute to use for generated javascript script tags.  One of 'none' | 'anonymous' | 'use-credentials'"
    },
    "main": {
      "type": "string",
      "description": "The name of the main entry-point file."
    },
    "tsConfig": {
      "type": "string",
      "description": "The name of the Typescript configuration file."
    },
    "outputPath": {
      "type": "string",
      "description": "The output path of the generated files."
    },
    "watch": {
      "type": "boolean",
      "description": "Enable re-building when files change.",
      "default": false
    },
    "baseHref": {
      "type": "string",
      "description": "Base url for the application being built.",
      "default": "/"
    },
    "deployUrl": {
      "type": "string",
      "description": "URL where the application will be deployed."
    },
    "vendorChunk": {
      "type": "boolean",
      "description": "Use a separate bundle containing only vendor libraries.",
      "default": true
    },
    "commonChunk": {
      "type": "boolean",
      "description": "Use a separate bundle containing code used across multiple bundles.",
      "default": true
    },
    "sourceMap": {
      "description": "Output sourcemaps.",
      "default": true,
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "scripts": {
              "type": "boolean",
              "description": "Output sourcemaps for all scripts.",
              "default": true
            },
            "styles": {
              "type": "boolean",
              "description": "Output sourcemaps for all styles.",
              "default": true
            },
            "hidden": {
              "type": "boolean",
              "description": "Output sourcemaps used for error reporting tools.",
              "default": false
            },
            "vendor": {
              "type": "boolean",
              "description": "Resolve vendor packages sourcemaps.",
              "default": false
            }
          },
          "additionalProperties": false
        },
        {
          "type": "boolean"
        }
      ]
    },
    "progress": {
      "type": "boolean",
      "description": "Log progress to the console while building.",
      "default": false
    },
    "assets": {
      "type": "array",
      "description": "List of static application assets.",
      "default": [],
      "items": {
        "$ref": "#/definitions/assetPattern"
      }
    },
    "index": {
      "type": "string",
      "description": "HTML File which will be contain the application"
    },
    "scripts": {
      "type": "array",
      "description": "External Scripts which will be included before the main application entry",
      "items": {
        "type": "string"
      }
    },
    "styles": {
      "type": "array",
      "description": "External Styles which will be included with the application",
      "items": {
        "type": "string"
      }
    },
    "budgets": {
      "description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/budget"
      },
      "default": []
    },
    "namedChunks": {
      "type": "boolean",
      "description": "Names the produced bundles according to their entry file",
      "default": true
    },
    "outputHashing": {
      "type": "string",
      "description": "Define the output filename cache-busting hashing mode.",
      "default": "none",
      "enum": ["none", "all", "media", "bundles"]
    },
    "stylePreprocessorOptions": {
      "description": "Options to pass to style preprocessors.",
      "type": "object",
      "properties": {
        "includePaths": {
          "description": "Paths to include. Paths will be resolved to project root.",
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        }
      },
      "additionalProperties": false
    },
    "optimization": {
      "description": "Enables optimization of the build output.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "scripts": {
              "type": "boolean",
              "description": "Enables optimization of the scripts output.",
              "default": true
            },
            "styles": {
              "type": "boolean",
              "description": "Enables optimization of the styles output.",
              "default": true
            }
          },
          "additionalProperties": false
        },
        {
          "type": "boolean"
        }
      ]
    },
    "extractCss": {
      "type": "boolean",
      "description": "Extract css into a .css file",
      "default": false
    },
    "es2015Polyfills": {
      "description": "Conditional polyfills loaded in browsers which do not support ES2015.",
      "type": "string"
    },
    "subresourceIntegrity": {
      "type": "boolean",
      "description": "Enables the use of subresource integrity validation.",
      "default": false
    },
    "polyfills": {
      "type": "string",
      "description": "Polyfills to load before application"
    },
    "verbose": {
      "type": "boolean",
      "description": "Emits verbose output",
      "default": false
    },
    "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
    },
    "extractLicenses": {
      "type": "boolean",
      "description": "Extract all licenses in a separate file, in the case of production builds only.",
      "default": false
    },
    "showCircularDependencies": {
      "type": "boolean",
      "description": "Show circular dependency warnings on builds.",
      "default": true
    },
    "memoryLimit": {
      "type": "number",
      "description": "Memory limit for type checking service process in MB. (defaults to 2048)"
    },
    "maxWorkers": {
      "type": "number",
      "description": "Number of workers to use for type checking. (defaults to # of CPUS - 2)"
    },
    "fileReplacements": {
      "description": "Replace files with other files in the build.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "replace": {
            "type": "string"
          },
          "with": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": ["replace", "with"]
      },
      "default": []
    },
    "webpackConfig": {
      "type": "string",
      "description": "Path to a function which takes a webpack config, some context and returns the resulting webpack config"
    },
    "buildLibsFromSource": {
      "type": "boolean",
      "description": "Read buildable libraries from source instead of building them separately.",
      "default": false
    }
  },
  "required": ["tsConfig", "main", "index"],

  "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"
        }
      ]
    },
    "budget": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of budget.",
          "enum": ["all", "allScript", "any", "anyScript", "bundle", "initial"]
        },
        "name": {
          "type": "string",
          "description": "The name of the bundle."
        },
        "baseline": {
          "type": "string",
          "description": "The baseline size for comparison."
        },
        "maximumWarning": {
          "type": "string",
          "description": "The maximum threshold for warning relative to the baseline."
        },
        "maximumError": {
          "type": "string",
          "description": "The maximum threshold for error relative to the baseline."
        },
        "minimumWarning": {
          "type": "string",
          "description": "The minimum threshold for warning relative to the baseline."
        },
        "minimumError": {
          "type": "string",
          "description": "The minimum threshold for error relative to the baseline."
        },
        "warning": {
          "type": "string",
          "description": "The threshold for warning relative to the baseline (min & max)."
        },
        "error": {
          "type": "string",
          "description": "The threshold for error relative to the baseline (min & max)."
        }
      },
      "additionalProperties": false,
      "required": ["type"]
    }
  }
}
