fix(build): make dart formatter errors more readable

Truncates the output to just the interesting parts
This commit is contained in:
Brian Ford 2015-05-27 18:53:49 -07:00
parent 381d4cb30a
commit 31b6687894
4 changed files with 64 additions and 345 deletions

View File

@ -228,14 +228,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -461,12 +453,7 @@
"version": "0.0.4" "version": "0.0.4"
}, },
"readline2": { "readline2": {
"version": "0.1.1", "version": "0.1.1"
"dependencies": {
"strip-ansi": {
"version": "2.0.1"
}
}
}, },
"through": { "through": {
"version": "2.3.7" "version": "2.3.7"
@ -905,17 +892,7 @@
} }
}, },
"string-length": { "string-length": {
"version": "1.0.0", "version": "1.0.0"
"dependencies": {
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
}
}
} }
} }
}, },
@ -2406,14 +2383,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -3176,14 +3145,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -3407,14 +3368,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -3778,14 +3731,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -3968,14 +3913,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -4126,14 +4063,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -4322,14 +4251,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -5055,14 +4976,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -5526,14 +5439,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -5862,14 +5767,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -6028,14 +5925,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -6189,14 +6078,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -6411,14 +6292,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -8480,14 +8353,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1" "version": "1.3.1"
} }
@ -8584,6 +8449,14 @@
"string": { "string": {
"version": "3.1.1" "version": "3.1.1"
}, },
"strip-ansi": {
"version": "2.0.1",
"dependencies": {
"ansi-regex": {
"version": "1.1.1"
}
}
},
"symlink-or-copy": { "symlink-or-copy": {
"version": "1.0.1", "version": "1.0.1",
"dependencies": { "dependencies": {

223
npm-shrinkwrap.json generated
View File

@ -362,18 +362,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -721,14 +709,7 @@
"readline2": { "readline2": {
"version": "0.1.1", "version": "0.1.1",
"from": "https://registry.npmjs.org/readline2/-/readline2-0.1.1.tgz", "from": "https://registry.npmjs.org/readline2/-/readline2-0.1.1.tgz",
"resolved": "https://registry.npmjs.org/readline2/-/readline2-0.1.1.tgz", "resolved": "https://registry.npmjs.org/readline2/-/readline2-0.1.1.tgz"
"dependencies": {
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz"
}
}
}, },
"through": { "through": {
"version": "2.3.7", "version": "2.3.7",
@ -1409,21 +1390,7 @@
"string-length": { "string-length": {
"version": "1.0.0", "version": "1.0.0",
"from": "https://registry.npmjs.org/string-length/-/string-length-1.0.0.tgz", "from": "https://registry.npmjs.org/string-length/-/string-length-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/string-length/-/string-length-1.0.0.tgz", "resolved": "https://registry.npmjs.org/string-length/-/string-length-1.0.0.tgz"
"dependencies": {
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
}
}
} }
} }
}, },
@ -3715,18 +3682,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -4905,18 +4860,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -5262,18 +5205,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -5831,18 +5762,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -6125,18 +6044,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -6371,18 +6278,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -6675,18 +6570,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -7810,18 +7693,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -8543,18 +8414,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -9059,18 +8918,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -9317,18 +9164,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -9568,18 +9403,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -9910,18 +9733,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -11051,7 +10862,7 @@
"dependencies": { "dependencies": {
"lodash": { "lodash": {
"version": "2.4.1", "version": "2.4.1",
"from": "lodash@2.4.1", "from": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz"
}, },
"when": { "when": {
@ -13101,18 +12912,6 @@
} }
} }
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": { "supports-color": {
"version": "1.3.1", "version": "1.3.1",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
@ -13231,7 +13030,7 @@
}, },
"shelljs": { "shelljs": {
"version": "0.5.0", "version": "0.5.0",
"from": "shelljs@*", "from": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.0.tgz",
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.0.tgz" "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.0.tgz"
}, },
"sorted-object": { "sorted-object": {
@ -13261,6 +13060,18 @@
"from": "https://registry.npmjs.org/string/-/string-3.1.1.tgz", "from": "https://registry.npmjs.org/string/-/string-3.1.1.tgz",
"resolved": "https://registry.npmjs.org/string/-/string-3.1.1.tgz" "resolved": "https://registry.npmjs.org/string/-/string-3.1.1.tgz"
}, },
"strip-ansi": {
"version": "2.0.1",
"from": "strip-ansi@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "ansi-regex@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"symlink-or-copy": { "symlink-or-copy": {
"version": "1.0.1", "version": "1.0.1",
"from": "https://registry.npmjs.org/symlink-or-copy/-/symlink-or-copy-1.0.1.tgz", "from": "https://registry.npmjs.org/symlink-or-copy/-/symlink-or-copy-1.0.1.tgz",
@ -14299,7 +14110,7 @@
}, },
"minichain": { "minichain": {
"version": "0.0.1", "version": "0.0.1",
"from": "https://registry.npmjs.org/minichain/-/minichain-0.0.1.tgz", "from": "minichain@0.0.1",
"resolved": "https://registry.npmjs.org/minichain/-/minichain-0.0.1.tgz" "resolved": "https://registry.npmjs.org/minichain/-/minichain-0.0.1.tgz"
} }
} }

View File

@ -111,6 +111,7 @@
"source-map": "^0.3.0", "source-map": "^0.3.0",
"sprintf-js": "1.0.*", "sprintf-js": "1.0.*",
"string": "^3.1.1", "string": "^3.1.1",
"strip-ansi": "^2.0.1",
"symlink-or-copy": "^1.0.1", "symlink-or-copy": "^1.0.1",
"systemjs-builder": "^0.10.3", "systemjs-builder": "^0.10.3",
"temp": "^0.8.1", "temp": "^0.8.1",

View File

@ -4,6 +4,7 @@ import fse = require('fs-extra');
import path = require('path'); import path = require('path');
import {wrapDiffingPlugin, DiffingBroccoliPlugin, DiffResult} from './diffing-broccoli-plugin'; import {wrapDiffingPlugin, DiffingBroccoliPlugin, DiffResult} from './diffing-broccoli-plugin';
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
function processToPromise(process) { function processToPromise(process) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
@ -39,9 +40,42 @@ class DartFormatter implements DiffingBroccoliPlugin {
let destPath = path.join(this.cachePath, removedFile); let destPath = path.join(this.cachePath, removedFile);
fse.removeSync(destPath); fse.removeSync(destPath);
}); });
return processToPromise(spawn(
this.DARTFMT, args, {stdio: this.verbose ? 'inherit' : ['ignore', 'ignore', 'inherit']})); if (args.length < 1) {
return Promise.resolve();
}
return new Promise((resolve, reject) => {
exec(this.DARTFMT + ' ' + args.join(' '), (err, stdout, stderr) => {
if (this.verbose) {
console.log(stdout);
}
if (err) {
console.error(shortenFormatterOutput(stderr));
reject('Formatting failed.');
} else {
resolve();
}
});
});
} }
} }
export default wrapDiffingPlugin(DartFormatter); export default wrapDiffingPlugin(DartFormatter);
var ARROW_LINE = /^(\s+)\^+/;
var BEFORE_CHARS = 15;
var stripAnsi = require('strip-ansi');
function shortenFormatterOutput(formatterOutput) {
var lines = formatterOutput.split('\n');
var match, line;
for (var i = 0; i < lines.length; i += 1) {
line = lines[i];
if (match = stripAnsi(line).match(ARROW_LINE)) {
let leadingWhitespace = match[1].length;
let leadingCodeChars = Math.min(leadingWhitespace, BEFORE_CHARS);
lines[i] = line.substr(leadingWhitespace - leadingCodeChars);
lines[i - 1] = lines[i - 1].substr(leadingWhitespace - leadingCodeChars, 80) + '…';
}
}
return lines.join('\n');
}