Open daniel-statsig opened 4 months ago
with: script: "npm run my-script"
is resulting in an output that starts with some preamble before the JSON array is printed.
This preamble is resulting in the JSON.parse failing.
Example
> package@0.0.1 size /path/to/repo > size-limit "--json" [ { "name": "bundle-one", "passed": true, "size": 9319, "sizeLimit": 10000, "running": 0.23261666666666667, "loading": 0.18201171875 }, { "name": "bundle-two", "passed": true, "size": 11037, "sizeLimit": 12000, "running": 0.26038333333333336, "loading": 0.21556640625 }, { "name": "bundle-three", "passed": true, "size": 29620, "sizeLimit": 35000, "running": 0.25188333333333335, "loading": 0.578515625 } ]
By finding the first '[' and last ']', we ensure we only try parse the JSON array part of the string
Description
is resulting in an output that starts with some preamble before the JSON array is printed.
This preamble is resulting in the JSON.parse failing.
Example
Fix
By finding the first '[' and last ']', we ensure we only try parse the JSON array part of the string