/// <summary> /// Checks if repo contains React build target projects, using treeAnalysis object. /// </summary> /// <param name="treeAnalysis"></param> /// <returns>true on React build target detection, otherwise false</returns> public override bool IsBuildTargetDetected(TreeAnalysis treeAnalysis) { PopulateReactProjectDirectories(treeAnalysis); if (ReactProjectFolders.Count > 0) { return(true); } return(false); }
internal void PopulateReactProjectDirectories(TreeAnalysis treeAnalysis) { List <FileSystemTreeNode> packageJsonNodes = new List <FileSystemTreeNode>(treeAnalysis.FilesInfo[Constants.PackageJsonFileName]); foreach (var packageJsonNode in packageJsonNodes) { if (HasReactDependency(treeAnalysis.FilesContent[packageJsonNode.Path].ToObject <PackageJsonModel>())) { ReactProjectFolders.Add(packageJsonNode.GetDirectoryPath()); } } }
/// <summary> /// Returns list of build target settings for the React build target. /// </summary> /// <param name="treeAnalysis"></param> /// <returns>List of build target settings for React</returns> public override List <BuildTargetSettings> GetBuildTargetSettings(TreeAnalysis treeAnalysis) { List <BuildTargetSettings> buildTargetSettings = new List <BuildTargetSettings>(); foreach (var reactProjectFolder in ReactProjectFolders) { buildTargetSettings.Add( new BuildTargetSettings { Name = BuildTargetName, Settings = new Dictionary <string, object> { { Constants.WorkingDirectory, reactProjectFolder }, { Constants.AppArtifactLocation, $"{reactProjectFolder}/{Constants.ReactBuildArtifactPath}" }, { Constants.PackageJsonFilePath, $"{reactProjectFolder}/{Constants.PackageJsonFileName}" } } } ); } return(buildTargetSettings); }
/// <summary> /// To be implemented by the language detector. /// Identifies if particular language is detected in the repo, based on the detection criteria involving the treeAnalysis object. /// </summary> /// <param name="treeAnalysis"></param> /// <returns>true on language detection, otherwise false</returns> public abstract bool IsLanguageDetected(TreeAnalysis treeAnalysis);
/// <summary> /// To be implemented by the build target detector. /// Returns list of build target settings for the build target already found in the repo. /// </summary> /// <param name="treeAnalysis"></param> /// <returns>List of build target settings</returns> public abstract List <BuildTargetSettings> GetBuildTargetSettings(TreeAnalysis treeAnalysis);
/// <summary> /// To be implemented by the build target detector. /// Identifies if particular build target is detected in the repo, based on the detection criteria involving the treeAnalysis object. /// </summary> /// <param name="treeAnalysis"></param> /// <returns>true on build target detection, otherwise false</returns> public abstract bool IsBuildTargetDetected(TreeAnalysis treeAnalysis);
/// <summary> /// To be implemented by the deploy target detector. /// Returns list of deploy target settings for the deploy target already found in the repo. /// </summary> /// <param name="treeAnalysis"></param> /// <returns>List of deploy target settings</returns> public abstract List <DeployTargetSettings> GetDeployTargetSettings(TreeAnalysis treeAnalysis);
/// <summary> /// To be implemented by the deploy target detector. /// Identifies if particular deploy target is detected in the repo, based on the detection criteria involving the treeAnalysis object. /// </summary> /// <param name="treeAnalysis"></param> /// <returns>true on deploy target detection, otherwise false</returns> public abstract bool IsDeployTargetDetected(TreeAnalysis treeAnalysis);