| 40 | boolean first = false; |
| 41 | |
| 42 | public Translate(String congifurationDirectory) throws IOException, InterruptedException { |
| 43 | File error = File.createTempFile("field", ".error"); |
| 44 | error.deleteOnExit(); |
| 45 | |
| 46 | this.congifurationDirectory = congifurationDirectory; |
| 47 | new File(congifurationDirectory).mkdirs(); |
| 48 | int success = new ProcessBuilder().directory(new File(congifurationDirectory)).command("npm install --save babel-plugin-transform-regenerator".split(" ")) |
| 49 | .redirectError(error) |
| 50 | .start() |
| 51 | .waitFor(); |
| 52 | |
| 53 | if (success != 0) { |
| 54 | throw new IOException("Failed to install babel: command 'npm install --save babel-plugin-transform-regenerator' failed with message :" + new String(Files.readAllBytes(error.toPath()))); |
| 55 | } |
| 56 | first = true; |
| 57 | } |
| 58 | |
| 59 | static public String preamble; |
| 60 | |