node

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package node provides plugin support for Node.js/TypeScript projects.

Index

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 Framework

type Framework string

Framework represents a detected JavaScript framework.

const (
	FrameworkReact   Framework = "react"
	FrameworkAngular Framework = "angular"
	FrameworkVue     Framework = "vue"
	FrameworkNextJS  Framework = "nextjs"
	FrameworkNuxt    Framework = "nuxt"
	FrameworkNestJS  Framework = "nestjs"
	FrameworkExpress Framework = "express"
	FrameworkNode    Framework = "node"
)

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 NewPlugin

func NewPlugin(rootDir string) *Plugin

NewPlugin creates a new Node.js plugin.

func (*Plugin) Detect

func (p *Plugin) Detect(dir string) bool

Detect checks if a directory is a Node.js project.

func (*Plugin) DetectFramework

func (p *Plugin) DetectFramework(dir string) (Framework, error)

DetectFramework detects the JavaScript framework used in a project.

func (*Plugin) DetectPackageManager

func (p *Plugin) DetectPackageManager(dir string) string

DetectPackageManager detects which package manager is used.

func (*Plugin) GetWorkspacePatterns

func (p *Plugin) GetWorkspacePatterns(dir string) ([]string, error)

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

func (p *Plugin) IsMonorepo(dir string) bool

IsMonorepo checks if the directory is a Node.js monorepo root.

func (*Plugin) IsTypeScript

func (p *Plugin) IsTypeScript(dir string) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL