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
Fields | Type | Description |
---|---|---|
op | 'readJSON' | Specifies the type of operation. For ReadJSONOperation, this field must be 'readJSON'. |
targetSrc | string | The path to the JSON file to read. |
path | string | The JSON path to the value within the file. |
value | string? (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. |