Documentation ¶
Index ¶
- type ExecRunner
- type Execute
- func (exec *Execute) CreateBOM(packageJSONFiles []string) error
- func (exec *Execute) FindPackageJSONFiles() []string
- func (exec *Execute) FindPackageJSONFilesWithExcludes(excludeList []string) ([]string, error)
- func (exec *Execute) FindPackageJSONFilesWithScript(packageJSONFiles []string, script string) ([]string, error)
- func (exec *Execute) InstallAllDependencies(packageJSONFiles []string) error
- func (exec *Execute) PublishAllPackages(packageJSONFiles []string, registry, username, password string) error
- func (exec *Execute) RunScriptsInAllPackages(runScripts []string, runOptions []string, scriptOptions []string, ...) error
- func (exec *Execute) SetNpmRegistries() error
- type Executor
- type ExecutorOptions
- type NPMIgnore
- type NPMRC
- type NpmConfig
- type NpmExecutorMock
- func (n *NpmExecutorMock) CreateBOM(packageJSONFiles []string) error
- func (n *NpmExecutorMock) FindPackageJSONFiles() []string
- func (n *NpmExecutorMock) FindPackageJSONFilesWithExcludes(excludeList []string) ([]string, error)
- func (n *NpmExecutorMock) FindPackageJSONFilesWithScript(packageJSONFiles []string, script string) ([]string, error)
- func (n *NpmExecutorMock) InstallAllDependencies(packageJSONFiles []string) error
- func (n *NpmExecutorMock) PublishAllPackages(packageJSONFiles []string, registry, username, password string) error
- func (n *NpmExecutorMock) RunScriptsInAllPackages(runScripts []string, runOptions []string, scriptOptions []string, ...) error
- func (n *NpmExecutorMock) SetNpmRegistries() error
- type NpmMockUtilsBundle
- type Utils
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecRunner ¶ added in v1.46.0
type ExecRunner interface { SetEnv(e []string) Stdout(out io.Writer) Stderr(out io.Writer) RunExecutable(executable string, params ...string) error RunExecutableInBackground(executable string, params ...string) (command.Execution, error) }
ExecRunner interface to enable mocking for testing
type Execute ¶ added in v1.46.0
type Execute struct { Utils Utils Options ExecutorOptions }
Execute struct holds utils to enable mocking and common parameters
func (*Execute) CreateBOM ¶ added in v1.127.0
CreateBOM generates BOM file using CycloneDX from all package.json files
func (*Execute) FindPackageJSONFiles ¶ added in v1.46.0
FindPackageJSONFiles returns a list of all package.json files of the project excluding node_modules and gen/ directories
func (*Execute) FindPackageJSONFilesWithExcludes ¶ added in v1.57.0
FindPackageJSONFilesWithExcludes returns a list of all package.json files of the project excluding node_modules, gen/ and directories/patterns defined by excludeList
func (*Execute) FindPackageJSONFilesWithScript ¶ added in v1.46.0
func (exec *Execute) FindPackageJSONFilesWithScript(packageJSONFiles []string, script string) ([]string, error)
FindPackageJSONFilesWithScript returns a list of package.json fileUtils that contain the script
func (*Execute) InstallAllDependencies ¶ added in v1.46.0
InstallAllDependencies executes npm or yarn Install for all package.json fileUtils defined in packageJSONFiles
func (*Execute) PublishAllPackages ¶ added in v1.153.0
func (exec *Execute) PublishAllPackages(packageJSONFiles []string, registry, username, password string) error
PublishAllPackages executes npm publish for all package.json files defined in packageJSONFiles list
func (*Execute) RunScriptsInAllPackages ¶ added in v1.46.0
func (exec *Execute) RunScriptsInAllPackages(runScripts []string, runOptions []string, scriptOptions []string, virtualFrameBuffer bool, excludeList []string, packagesList []string) error
RunScriptsInAllPackages runs all scripts defined in ExecuteOptions.RunScripts
func (*Execute) SetNpmRegistries ¶ added in v1.46.0
SetNpmRegistries configures the given npm registries. CAUTION: This will change the npm configuration in the user's home directory.
type Executor ¶ added in v1.46.0
type Executor interface { FindPackageJSONFiles() []string FindPackageJSONFilesWithExcludes(excludeList []string) ([]string, error) FindPackageJSONFilesWithScript(packageJSONFiles []string, script string) ([]string, error) RunScriptsInAllPackages(runScripts []string, runOptions []string, scriptOptions []string, virtualFrameBuffer bool, excludeList []string, packagesList []string) error InstallAllDependencies(packageJSONFiles []string) error PublishAllPackages(packageJSONFiles []string, registry, username, password string) error SetNpmRegistries() error CreateBOM(packageJSONFiles []string) error }
Executor interface to enable mocking for testing
func NewExecutor ¶ added in v1.46.0
func NewExecutor(executorOptions ExecutorOptions) Executor
NewExecutor instantiates Execute struct and sets executeOptions
type ExecutorOptions ¶ added in v1.46.0
type ExecutorOptions struct { DefaultNpmRegistry string ExecRunner ExecRunner }
ExecutorOptions holds common parameters for functions of Executor
type NPMIgnore ¶ added in v1.153.0
type NPMIgnore struct {
// contains filtered or unexported fields
}
func NewNPMIgnore ¶ added in v1.153.0
type NpmConfig ¶ added in v1.118.0
type NpmConfig struct { Install bool RunScripts []string RunOptions []string ScriptOptions []string VirtualFrameBuffer bool ExcludeList []string PackagesList []string }
NpmConfig holds the config parameters needed for checking if the function is called with correct parameters
type NpmExecutorMock ¶ added in v1.118.0
type NpmExecutorMock struct { Utils NpmMockUtilsBundle Config NpmConfig }
NpmExecutorMock mocking struct
func (*NpmExecutorMock) CreateBOM ¶ added in v1.127.0
func (n *NpmExecutorMock) CreateBOM(packageJSONFiles []string) error
CreateBOM mock implementation
func (*NpmExecutorMock) FindPackageJSONFiles ¶ added in v1.118.0
func (n *NpmExecutorMock) FindPackageJSONFiles() []string
FindPackageJSONFiles mock implementation
func (*NpmExecutorMock) FindPackageJSONFilesWithExcludes ¶ added in v1.118.0
func (n *NpmExecutorMock) FindPackageJSONFilesWithExcludes(excludeList []string) ([]string, error)
FindPackageJSONFiles mock implementation
func (*NpmExecutorMock) FindPackageJSONFilesWithScript ¶ added in v1.118.0
func (n *NpmExecutorMock) FindPackageJSONFilesWithScript(packageJSONFiles []string, script string) ([]string, error)
FindPackageJSONFilesWithScript mock implementation
func (*NpmExecutorMock) InstallAllDependencies ¶ added in v1.118.0
func (n *NpmExecutorMock) InstallAllDependencies(packageJSONFiles []string) error
InstallAllDependencies mock implementation
func (*NpmExecutorMock) PublishAllPackages ¶ added in v1.153.0
func (n *NpmExecutorMock) PublishAllPackages(packageJSONFiles []string, registry, username, password string) error
CreateBOM mock implementation
func (*NpmExecutorMock) RunScriptsInAllPackages ¶ added in v1.118.0
func (n *NpmExecutorMock) RunScriptsInAllPackages(runScripts []string, runOptions []string, scriptOptions []string, virtualFrameBuffer bool, excludeList []string, packagesList []string) error
RunScriptsInAllPackages mock implementation
func (*NpmExecutorMock) SetNpmRegistries ¶ added in v1.118.0
func (n *NpmExecutorMock) SetNpmRegistries() error
SetNpmRegistries mock implementation
type NpmMockUtilsBundle ¶ added in v1.118.0
type NpmMockUtilsBundle struct { *mock.FilesMock ExecRunner *mock.ExecMockRunner }
NpmMockUtilsBundle for mocking
func NewNpmMockUtilsBundle ¶ added in v1.118.0
func NewNpmMockUtilsBundle() NpmMockUtilsBundle
NewNpmMockUtilsBundle creates an instance of NpmMockUtilsBundle
func (*NpmMockUtilsBundle) GetExecRunner ¶ added in v1.118.0
func (u *NpmMockUtilsBundle) GetExecRunner() ExecRunner
GetExecRunner return the execRunner mock