npm

package
v0.110.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PackageJsonFile string = "package.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchingRule

type MatchingRule struct {
	// Path specifies a package.json path pattern, the pattern requires to match all of name, not just a substring.
	Path string
	// Packages specifies the list of NPM packages to check
	Packages map[string]string
	// HasVersionConstraint indicates whether the matching rule should match any version constraint or not.
	HasVersionConstraint *bool
}

MatchingRule allows to specifies rules to identify manifest

type MatchingRules

type MatchingRules []MatchingRule

type Npm

type Npm struct {
	// contains filtered or unexported fields
}

Npm holds all information needed to generate npm manifest.

func New

func New(spec interface{}, rootDir, scmID, actionID string) (Npm, error)

New return a new valid object.

func (Npm) DiscoverManifests

func (n Npm) DiscoverManifests() ([][]byte, error)

type Spec

type Spec struct {
	// RootDir defines the root directory used to recursively search for npm packages.json
	RootDir string `yaml:",omitempty"`
	// Ignore allows to specify rule to ignore autodiscovery a specific NPM based on a rule
	Ignore MatchingRules `yaml:",omitempty"`
	// Only allows to specify rule to only autodiscover manifest for a specific NPM based on a rule
	Only MatchingRules `yaml:",omitempty"`
	/*
		versionfilter provides parameters to specify the version pattern used when generating manifest.

		kind - semver
			versionfilter of kind `semver` uses semantic versioning as version filtering
			pattern accepts one of:
				`patch` - patch only update patch version
				`minor` - minor only update minor version
				`major` - major only update major versions
				`a version constraint` such as `>= 1.0.0`

		kind - regex
			versionfilter of kind `regex` uses regular expression as version filtering
			pattern accepts a valid regular expression

		example:
		“`
			versionfilter:
				kind: semver
				pattern: minor
		“`

		and its type like regex, semver, or just latest.
	*/
	VersionFilter version.Filter `yaml:",omitempty"`
	// IgnoreVersionConstraints indicates whether to respect version constraints defined in package.json or not.
	// When set to true, Updatecli will ignore version constraints and update to the latest version available
	// in the registry according to the specified version filter.
	// Default is false.
	//
	// Remark:
	//  * If set to false, Updatecli will try to convert version constrains to valid semantic version
	//    so we can use versionFilter to retrieve the last Major/Minor/Patch version but in case of complex version constraints, such as ">=1.0.0 <2.0.0",
	//    Updatecli will convert it to the first version it detects such as 1.0.0 in our example
	IgnoreVersionConstraints *bool `yaml:",omitempty"`
}

Spec defines the parameters which can be provided to the NPM builder.

Jump to

Keyboard shortcuts

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