Documentation ¶
Overview ¶
Package appdetect allows for detection of application projects.
Projects are detected based on criteria such as: 1. Presence of project files. 2. Source code language file extensions
To determine dependencies, a project file might also be read for dependent packages.
- `Detect()` to detect all projects under a root directory. - `DetectDirectory` to detect a project under a given directory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var WebUIFrameworks = map[Dependency]struct{}{ JsReact: {}, JsAngular: {}, JsJQuery: {}, JsVite: {}, }
Functions ¶
func PyFastApiLaunch ¶
PyFastApiLaunch returns the launch argument for a python FastAPI project to be served by a python web server. An empty string is returned if the project is not a FastAPI project. An error is returned only if the project path cannot be walked.
Types ¶
type DatabaseDep ¶
type DatabaseDep string
A type of database that is inferred through heuristics while scanning project information.
const ( // Database dependencies DbPostgres DatabaseDep = "postgres" DbMongo DatabaseDep = "mongo" DbMySql DatabaseDep = "mysql" DbSqlServer DatabaseDep = "sqlserver" DbRedis DatabaseDep = "redis" )
func (DatabaseDep) Display ¶
func (db DatabaseDep) Display() string
type Dependency ¶
type Dependency string
const ( JsReact Dependency = "react" JsAngular Dependency = "angular" JsJQuery Dependency = "jquery" JsVite Dependency = "vite" JsNext Dependency = "next" PyFlask Dependency = "flask" PyDjango Dependency = "django" PyFastApi Dependency = "fastapi" )
func (Dependency) Display ¶
func (f Dependency) Display() string
func (Dependency) IsWebUIFramework ¶
func (f Dependency) IsWebUIFramework() bool
func (Dependency) Language ¶
func (f Dependency) Language() Language
type DetectDirectoryOption ¶
type DetectDirectoryOption interface {
// contains filtered or unexported methods
}
type DetectOption ¶
type DetectOption interface {
// contains filtered or unexported methods
}
func WithExcludePatterns ¶
func WithExcludePatterns(patterns []string, overrideDefaults bool) DetectOption
type Docker ¶
func AnalyzeDocker ¶
AnalyzeDocker analyzes the Dockerfile and returns the Docker result.
type LanguageOption ¶
type LanguageOption interface { DetectOption DetectDirectoryOption }
func WithDotNet ¶
func WithDotNet() LanguageOption
func WithJava ¶
func WithJava() LanguageOption
func WithJavaScript ¶
func WithJavaScript() LanguageOption
func WithPython ¶
func WithPython() LanguageOption
func WithoutDotNet ¶
func WithoutDotNet() LanguageOption
func WithoutJava ¶
func WithoutJava() LanguageOption
func WithoutJavaScript ¶
func WithoutJavaScript() LanguageOption
func WithoutPython ¶
func WithoutPython() LanguageOption
type PackagesJson ¶
type Project ¶
type Project struct { // The language associated with the project. Language Language // Dependencies scanned in the project. Dependencies []Dependency // Experimental: Database dependencies inferred through heuristics while scanning dependencies in the project. DatabaseDeps []DatabaseDep // The path to the project directory. Path string // A short description of the detection rule applied. DetectionRule string // If true, the project uses Docker for packaging. This is inferred through the presence of a Dockerfile. Docker *Docker }
func DetectDirectory ¶
func DetectDirectory(ctx context.Context, directory string, options ...DetectDirectoryOption) (*Project, error)
DetectDirectory detects the project located in a directory.