conditional

Execute a set of operations based on whether a specified condition evaluates to true or false.

Example

{
  "op": "conditional",
  "condition": "$useTypescript === 'true'",
  "then": [
    {
      "op": "add",
      "remoteSrc": "/templates/tsconfig.json",
      "targetSrc": "./tsconfig.json"
    }
  ],
  "else": [
    {
      "op": "add",
      "remoteSrc": "/templates/jsconfig.json",
      "targetSrc": "./jsconfig.json"
    }
  ]
}

Fields

FieldsTypeDescription
op'conditional'Specifies the type of operation. For ConditionalOperation, this field must be 'conditional'.
conditionstringAn expression that evaluates to a boolean value. This can include variables .
thenOperation[]An array of operations to execute if the condition evaluates to true.
elseOperation[] (optional)An array of operations to execute if the condition evaluates to false.