Documentation
¶
Index ¶
- func IsRuntimeForProject(ctx context.Context, fs afero.Fs, dirPath string, sdkConfig hooks.SDKCLIConfig) bool
- type NPM
- type NPMClient
- func (n *NPMClient) InstallAllPackages(ctx context.Context, dirPath string, hookExecutor hooks.HookExecutor, ...) (string, error)
- func (n *NPMClient) InstallDevPackage(ctx context.Context, pkgName string, dirPath string, ...) (string, error)
- func (n *NPMClient) ListPackage(ctx context.Context, pkgName string, dirPath string, ...) (pkgNameVersion string, exists bool)
- type NPMMock
- func (n *NPMMock) InstallAllPackages(ctx context.Context, dirPath string, hookExecutor hooks.HookExecutor, ...) (string, error)
- func (n *NPMMock) InstallDevPackage(ctx context.Context, pkgName string, dirPath string, ...) (string, error)
- func (n *NPMMock) ListPackage(ctx context.Context, pkgName string, dirPath string, ...) (pkgNameVersion string, exists bool)
- type Node
- func (n *Node) HooksJSONTemplate() []byte
- func (n *Node) IgnoreDirectories() []string
- func (n *Node) InstallProjectDependencies(ctx context.Context, dirPath string, hookExecutor hooks.HookExecutor, ...) (string, error)
- func (n *Node) Name() string
- func (n *Node) PreparePackage(ctx context.Context, sdkConfig hooks.SDKCLIConfig, ...) error
- func (n *Node) SetVersion(version string)
- func (n *Node) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRuntimeForProject ¶
func IsRuntimeForProject(ctx context.Context, fs afero.Fs, dirPath string, sdkConfig hooks.SDKCLIConfig) bool
IsRuntimeForProject returns true if dirPath is a Node.js project
Types ¶
type NPM ¶
type NPM interface {
InstallAllPackages(ctx context.Context, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (string, error)
InstallDevPackage(ctx context.Context, pkgName string, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (string, error)
ListPackage(ctx context.Context, pkgName string, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (pkgNameVersion string, exists bool)
}
NPM defines the npm commands to interact with a node project
type NPMClient ¶
type NPMClient struct {
}
NPMClient implements the NPM interface and executes real npm commands
func (*NPMClient) InstallAllPackages ¶
func (n *NPMClient) InstallAllPackages(ctx context.Context, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (string, error)
InstallAllPackages installs all packages by running a command similar to `npm install .`
func (*NPMClient) InstallDevPackage ¶
func (n *NPMClient) InstallDevPackage(ctx context.Context, pkgName string, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (string, error)
InstallDevPackage installs the specified package and saves it as a "devDependency" by running a command similar to `npm install --save-dev <package>`
func (*NPMClient) ListPackage ¶
func (n *NPMClient) ListPackage(ctx context.Context, pkgName string, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (pkgNameVersion string, exists bool)
ListPackage lists the installed version of a provided package
type NPMMock ¶
NPMMock mocks the NPM interface.
func (*NPMMock) InstallAllPackages ¶
func (n *NPMMock) InstallAllPackages(ctx context.Context, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (string, error)
InstallAllPackages mocks the `npm install .` command
func (*NPMMock) InstallDevPackage ¶
func (n *NPMMock) InstallDevPackage(ctx context.Context, pkgName string, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (string, error)
InstallDevPackage mocks the `npm install --save-dev <package>` command
func (*NPMMock) ListPackage ¶
func (n *NPMMock) ListPackage(ctx context.Context, pkgName string, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer) (pkgNameVersion string, exists bool)
ListPackage mocks the `npm list` command
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node runtime type
func (*Node) HooksJSONTemplate ¶
HooksJSONTemplate returns the default hooks.json template
func (*Node) IgnoreDirectories ¶
IgnoreDirectories is a list of directories to ignore when packaging the runtime for deployment.
func (*Node) InstallProjectDependencies ¶
func (n *Node) InstallProjectDependencies( ctx context.Context, dirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer, fs afero.Fs, os types.Os, ) (string, error)
InstallProjectDependencies runs `npm install` in the dirPath
func (*Node) PreparePackage ¶
func (n *Node) PreparePackage(ctx context.Context, sdkConfig hooks.SDKCLIConfig, hookExecutor hooks.HookExecutor, opts types.PreparePackageOpts) error
PreparePackage will prepare and copy the app in projectDirPath to tmpDirPath as a release-ready bundle.
func (*Node) SetVersion ¶
SetVersion sets the Version value