Skip to content

Commit

Permalink
Support for Angular CLI 1.5. See
Browse files Browse the repository at this point in the history
  • Loading branch information
angelozerr committed Nov 6, 2017
1 parent 73b8245 commit 08b8900
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public class CLIProcessHelper {

public static final String NG_FILENAME = "ng";

private static final String ANGULAR_CLI = "@angular/cli:";
private static final String OLD_ANGULAR_CLI = "@angular/cli:";
private static final String NEW_ANGULAR_CLI = "Angular CLI:";

public static File findNg() {
return findNg(OSHelper.getOs());
Expand Down Expand Up @@ -86,9 +87,13 @@ public static String getNgVersion(File ngFile, File nodeFile) throws IOException
reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
int index = line.indexOf(ANGULAR_CLI);
int index = line.indexOf(OLD_ANGULAR_CLI);
if (index != -1) {
return line.substring(index + ANGULAR_CLI.length()).trim();
return line.substring(index + OLD_ANGULAR_CLI.length()).trim();
} else
index = line.indexOf(NEW_ANGULAR_CLI);
if (index != -1) {
return line.substring(index + NEW_ANGULAR_CLI.length()).trim();
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ public void onTrace(String line) {
fileNames.add("");
} else {
if (!fileNames.isEmpty()) {
int index = fileNames.size() - 1;
fileNames.set(index, fileNames.get(index) + line.trim());
int index = fileNames.size() - 1;
String name = fileNames.get(index) + line.trim();
// in angular cli 1.5, we have
// create src/app/y.ts (19 bytes), we need to remove the (
int bracket = name.indexOf("(");
if (bracket != -1) {
name = name.substring(0, bracket).trim();
}
fileNames.set(index, name);
}
}
}
Expand Down

2 comments on commit 08b8900

@bentheadset
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@angelozerr Thank you for the fix. I assume this is what's causing my angular-eclipse to reject my ng (not a ng file...). Is there a target for when this will make it to a release? Regards.

@angelozerr
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a target for when this will make it to a release? Regards.

Waitng for ts 2.7 to fix #112

Please sign in to comment.