readJSON

Read a value from a JSON file and execute operations based on the value found.

Example

{
  "op": "readJSON",
  "targetSrc": "./package.json",
  "path": "scripts.start",
  "value": "$startScript",
  "values": {
    "react-scripts start": [
      // Do something
    ],
    "next start": [
      // Do something
    ]
  }
}

Fields

FieldsTypeDescription
op'readJSON'Specifies the type of operation. For ReadJSONOperation, this field must be 'readJSON'.
targetSrcstringThe path to the JSON file to read.
pathstringThe JSON path to the value within the file.
valuestring? (optional)The name of the variable where the read value will be stored.
values{ [key: string]: Operation[] }An object mapping possible values to arrays of operations to execute based on the read value.