craft_parts.plugins.npm_plugin module¶
The npm plugin.
- class craft_parts.plugins.npm_plugin.NpmPlugin(*, properties, part_info)[source]¶
Bases:
Plugin
A plugin for npm projects.
This plugin uses the common plugin keywords as well as those for “sources”. For more information check the ‘plugins’ topic for the former and the ‘sources’ topic for the latter.
- Additionally, this plugin uses the following plugin-specific keywords:
npm-include-node (bool; default: False) If true, download and include the node binary and its dependencies. If npm-include-node is true, then npm-node-version must be defined.
npm-node-version (str: default: None) Which version of node to download (e.g. “16.14.2”)
- Parameters:
properties (
PluginProperties
) –part_info (
PartInfo
) –
- get_build_commands()[source]¶
Return a list of commands to run during the build step.
- Return type:
List
[str
]
- get_build_environment()[source]¶
Return a dictionary with the environment to use in the build step.
- Return type:
Dict
[str
,str
]
- get_build_packages()[source]¶
Return a set of required packages to install in the build environment.
- Return type:
Set
[str
]
- get_build_snaps()[source]¶
Return a set of required snaps to install in the build environment.
- Return type:
Set
[str
]
- properties_class¶
alias of
NpmPluginProperties
- validator_class¶
alias of
NpmPluginEnvironmentValidator
- class craft_parts.plugins.npm_plugin.NpmPluginEnvironmentValidator(*, part_name, env, properties)[source]¶
Bases:
PluginEnvironmentValidator
Check the execution environment for the npm plugin.
- Parameters:
part_name (
str
) – The part whose build environment is being validated.env (
str
) – A string containing the build step environment setup.properties (
PluginProperties
) –
- class craft_parts.plugins.npm_plugin.NpmPluginProperties(**data)[source]¶
Bases:
PluginProperties
,PluginModel
The part properties used by the npm plugin.
- Parameters:
data (
Any
) –
- classmethod node_version_defined(values)[source]¶
If npm-include-node is true, then npm-node-version must be defined.
- Parameters:
values (
Dict
[str
,Any
]) –- Return type:
Dict
[str
,Any
]
- npm_include_node: bool¶
- npm_node_version: Optional[str]¶
- source: str¶