[ALOY-1597] Use babel-code-frame to provide context when failing to parse code
|Fix Version/s||CLI Release 7.0.2|
DescriptionCurrently when we are parsing files if we hit a parser error then we output an error that isn't super helpful, it contains an line/column numbers but it would be a much better dev experience if we could show the code using babel-code-frame. We could also expand this to xml/tss parsing errors if the modules we use give us the locations in an easily consumable way
[ERROR] Error generating AST for "/Users/eharris/Documents/projects/repotest/apps/hyperloop-examples/app/controllers/index.js" [ERROR] Unexpected token (1:5) [ERROR] position 5
[INFO] controller: "index.js" > 1 | x ==== foo | ^ 2 | /** 3 | * I wrap code that executes on creation in a self-executing function just to 4 | * keep it organised, not to protect global scope like it would in alloy.js [ERROR] Error generating AST for "/Users/eharris/Documents/projects/repotest/apps/hyperloop-examples/app/controllers/index.js"
- Ewan Harris 2017-12-20 Started on https://github.com/appcelerator/alloy/pull/865
- Ewan Harris 2017-12-21 Once finished in Alloy I'd like to implement this in Titanium too
- Abir Mukherjee 2018-01-19 Node Version: 8.9.1 NPM Version: 5.5.1 Mac OS: 10.13.1 Appc CLI: 7.0.2-master.5 Appc CLI NPM: 4.2.11 Titanium SDK version: 7.0.1 Validated fix on 7.0.2-master.5.