Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fluid-build): Parse build-cli tasks properly in fluid-build #12988

Merged
merged 2 commits into from
Nov 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion build-tools/packages/build-tools/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ import * as path from "path";
import * as util from "util";

export function getExecutableFromCommand(command: string) {
return command.split(" ")[0];
let toReturn: string;
const commands = command.split(" ");
if (commands[0] === "flub") {
// Find the first flag argument, and filter them out. Assumes flags come at the end of the command, and that all
// subsequent arguments are flags.
const flagsStartIndex = commands.findIndex((c) => c.startsWith("-"));
toReturn = commands.slice(0, flagsStartIndex).join(" ");
} else {
toReturn = commands[0];
}
return toReturn;
Comment on lines +19 to +23
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
toReturn = commands.slice(0, flagsStartIndex).join(" ");
} else {
toReturn = commands[0];
}
return toReturn;
return commands.slice(0, flagsStartIndex).join(" ");
} else {
return commands[0];
}

Is this "better" in some objective way? Or is it just stylistic preferences?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the modified way as it eliminates variable declaration 😄

}

export function toPosixPath(s: string) {
Expand Down