{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "definitions": {
    "compilerArguments": {
      "type": "object",
      "help": "Compiler arguments are applied to all compilers, unless explicitly modified in post processing",
      "properties": {
        "entry": {
          "type": "string",
          "help": "main entry point for your program, across all contexts"
        },
        "out": {
          "type": "string",
          "help": "destination for compiled bundle. If there are multiple, the destination of specific bundles will be decided by the --combinator"
        },

        "watch": {
          "help": "monitor source files for changes and recompile.",
          "type": "boolean"
        },
        "chunkFilename": {
          "help": "If provided, enables code splitting with webpack.require. Examples patterns include  '[id].chunk.js', '[name].chunk.js'",
          "type": "string"
        },

        "babelPresets": {
          "type": "array",
          "items": { "type": "string" },
          "help": "add a preset to the babel loader, between es2015 and stage-0"
        },

        "outCombinator": {
          "type": "string",
          "help": "string to combine arguments that \"define\" a compiler (environment, environment)",
          "default": "_"
        },
        "outPrefix": {
          "type": "string",
          "help": "prefix for generated contextual modules. Appended to `out` directory"
        },
        "modules": {
          "type": "string",
          "help": "where to look for modules"
        }
      }
    },
    "cartesianArguments": {
      "type": "object",
      "help": "Cartesian arguments are array arguments that generate compilers equal to the unorderd cartesian product between them",
      "properties": {
        "environments": {
          "type": "array",
          "items": { "type": "string" },
          "default": [],
          "help": "an application lifecycle environment {DEVELOPMENT, PRODUCTION, etc} this distribution will run in"
        },
        "contexts": {
          "type": "array",
          "items": { "type": "string" },
          "default": [],
          "help": "a context {NODE, BROWSER, etc} this distribution will run in. "
        }
      }
    },
    "managerArguments": {
      "type": "object",
      "help": "Task arguments are arguments that are fed to the task manager ",
      "properties": {
        "task": {
          "help": "the task to run. If non is specified, it will be inferred from other arguments.",
          "type": "string"
        },
        "run": {
          "help": "Which context to run on compilation, if any",
          "type": "string"
        },
        "runner": {
          "help": "Which runner to run the selected compiler with, if any",
          "type": "string"
        },
        "logLevel": {
          "default": "ERROR",
          "help": "VERBOSE will output webpack stats and warnings"
        }
      }
    },
    "presets": {
      "type": "object",
      "help": "Presets are functions that apply default or derived arguments at various stages of parsing, loaded from the module given as an argument from the export of the given preset.",
      "properties": {
        "preset": {
          "help": "module from which to import ALL of the potential presets (any missing presets will be identities)",
          "type": "string"
        }
      }
    }
  },
  "type": "object",
  "allOf": [
    {
      "allOf": [
        { "$ref": "#/definitions/compilerArguments" },
        { "$ref": "#/definitions/cartesianArguments" }
      ]
    },
    { "$ref": "#/definitions/managerArguments" },
    { "$ref": "#/definitions/presets" }
  ]
}
