craft_parts.utils.npm_utils module

Utility functions for NPM plugin.

craft_parts.utils.npm_utils.find_tarballs(dependencies, cache_dir)[source]

Find tarballs in cache directory.

Returns a list of (dependency, specified_version, available_versions)

Parameters:
  • dependencies (dict[str, str])

  • cache_dir (Path)

Return type:

list[tuple[str, str, list[str]]]

craft_parts.utils.npm_utils.read_pkg(pkg_path)[source]

Read and return contents of json file.

Parameters:

pkg_path (Path)

Return type:

dict[str, Any]

craft_parts.utils.npm_utils.write_pkg(pkg_path, pkg)[source]

Write json file.

Parameters:
  • pkg_path (Path)

  • pkg (dict[str, Any])

Return type:

None