public static LoadTasks ( string configPath, string cliCommandName ) : string>.SortedList |
||
configPath | string | |
cliCommandName | string | |
리턴 | string>.SortedList |
private ITaskRunnerNode LoadHierarchy(string configPath) { ITaskRunnerNode root = new TaskRunnerNode(Constants.TASK_CATEGORY); string workingDirectory = Path.GetDirectoryName(configPath); var scripts = TaskParser.LoadTasks(configPath); Telemetry.TrackEvent("Tasks loaded"); if (scripts == null) { return(root); } TaskRunnerNode tasks = new TaskRunnerNode("Scripts"); tasks.Description = "Scripts specified in the \"scripts\" JSON element."; root.Children.Add(tasks); foreach (string script in scripts) { TaskRunnerNode task = new TaskRunnerNode(script, true) { Command = new TaskRunnerCommand(workingDirectory, "cmd.exe", $"/c npm run {script} --color=always"), Description = $"Runs the '{script}' script", }; tasks.Children.Add(task); } return(root); }
private ITaskRunnerNode LoadHierarchy(string configPath) { ITaskRunnerNode root = new TaskRunnerNode(Constants.TASK_CATEGORY); var scripts = TaskParser.LoadTasks(configPath); var hierarchy = GetHierarchy(scripts.Keys); if (hierarchy == null) { return(root); } var defaults = hierarchy.Where(h => Constants.ALL_DEFAULT_TASKS.Contains(h.Key)); TaskRunnerNode defaultTasks = new TaskRunnerNode("Defaults"); defaultTasks.Description = "Default predefined npm commands."; root.Children.Add(defaultTasks); AddCommands(configPath, scripts, defaults, defaultTasks); if (hierarchy.Count != defaults.Count()) { var customs = hierarchy.Except(defaults); TaskRunnerNode customTasks = new TaskRunnerNode("Custom"); customTasks.Description = "Custom npm commands."; root.Children.Add(customTasks); AddCommands(configPath, scripts, customs, customTasks); } Telemetry.TrackEvent("Tasks loaded"); return(root); }
private ITaskRunnerNode LoadHierarchy(string configPath) { ITaskRunnerNode root = new TaskRunnerNode(Constants.TASK_CATEGORY); string workingDirectory = Path.GetDirectoryName(configPath); Dictionary <string, string> scripts = TaskParser.LoadTasks(configPath); if (scripts == null) { return(root); } TaskRunnerNode tasks = new TaskRunnerNode("Scripts"); tasks.Description = "Scripts specified in the \"scripts\" JSON element."; root.Children.Add(tasks); foreach (var key in scripts.Keys.OrderBy(k => k)) { TaskRunnerNode task = new TaskRunnerNode(key, true) { Command = new TaskRunnerCommand(workingDirectory, "cmd.exe", "/c " + scripts[key]), Description = scripts[key], }; tasks.Children.Add(task); } return(root); }
private ITaskRunnerNode LoadHierarchy(string configPath) { var cliCommandName = GetCliCommandName(configPath); SetRootNodeIcon(cliCommandName); bool isNpm = (cliCommandName == Constants.NPM_CLI_COMMAND); ITaskRunnerNode root = new TaskNode(Vsix.Name, false, isNpm); var scripts = TaskParser.LoadTasks(configPath, cliCommandName); var hierarchy = GetHierarchy(scripts.Keys); IEnumerable <string> allDefaultTasks = (isNpm ? Constants.NPM_ALL_DEFAULT_TASKS : Constants.YARN_ALL_DEFAULT_TASKS); var defaults = hierarchy.Where(h => allDefaultTasks.Contains(h.Key)); TaskNode defaultTasks = new TaskNode("Defaults", false, isNpm); defaultTasks.Description = $"Default predefined {cliCommandName} commands."; root.Children.Add(defaultTasks); AddCommands(configPath, scripts, defaults, defaultTasks, isNpm); if (hierarchy.Count != defaults.Count()) { var customs = hierarchy.Except(defaults); TaskNode customTasks = new TaskNode("Custom", false, isNpm); customTasks.Description = $"Custom {cliCommandName} commands."; root.Children.Add(customTasks); AddCommands(configPath, scripts, customs, customTasks, isNpm); } return(root); }