Documentation
¶
Overview ¶
Package node provides plugin support for Node.js/TypeScript projects.
Index ¶
- type Dependency
- type Framework
- type InferredTask
- type PackageJSON
- type Plugin
- func (p *Plugin) Detect(dir string) bool
- func (p *Plugin) DetectFramework(dir string) (Framework, error)
- func (p *Plugin) DetectPackageManager(dir string) string
- func (p *Plugin) GetWorkspacePatterns(dir string) ([]string, error)
- func (p *Plugin) InferDependencies(dir string, workspaceProjects map[string]string) ([]string, error)
- func (p *Plugin) InferTasks(dir string) ([]InferredTask, error)
- func (p *Plugin) IsMonorepo(dir string) bool
- func (p *Plugin) IsTypeScript(dir string) bool
- func (p *Plugin) ReadPackageJSON(dir string) (*PackageJSON, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency struct {
Name string
Version string
Type string // dependencies, devDependencies, peerDependencies
}
Dependency represents a project dependency.
type InferredTask ¶
type InferredTask struct {
Name string
Command string
Args []string
Inputs []string
Outputs []string
Cache bool
DependOn []string
}
InferredTask represents a task inferred from package.json.
type PackageJSON ¶
type PackageJSON struct {
Name string `json:"name"`
Version string `json:"version"`
Main string `json:"main"`
Module string `json:"module"`
Types string `json:"types"`
Scripts map[string]string `json:"scripts"`
Dependencies map[string]string `json:"dependencies"`
DevDependencies map[string]string `json:"devDependencies"`
PeerDeps map[string]string `json:"peerDependencies"`
Workspaces interface{} `json:"workspaces"`
}
PackageJSON represents the package.json structure.
type Plugin ¶
type Plugin struct {
RootDir string
}
Plugin provides Node.js/TypeScript project support.
func (*Plugin) DetectFramework ¶
DetectFramework detects the JavaScript framework used in a project.
func (*Plugin) DetectPackageManager ¶
DetectPackageManager detects which package manager is used.
func (*Plugin) GetWorkspacePatterns ¶
GetWorkspacePatterns returns workspace patterns from package.json.
func (*Plugin) InferDependencies ¶
func (p *Plugin) InferDependencies(dir string, workspaceProjects map[string]string) ([]string, error)
InferDependencies infers local workspace dependencies.
func (*Plugin) InferTasks ¶
func (p *Plugin) InferTasks(dir string) ([]InferredTask, error)
InferTasks infers tasks from a package.json file.
func (*Plugin) IsMonorepo ¶
IsMonorepo checks if the directory is a Node.js monorepo root.
func (*Plugin) IsTypeScript ¶
IsTypeScript checks if the project uses TypeScript.
func (*Plugin) ReadPackageJSON ¶
func (p *Plugin) ReadPackageJSON(dir string) (*PackageJSON, error)
ReadPackageJSON reads and parses a package.json file.