runway.module.utils module

Runway module utilities.

runway.module.utils.format_npm_command_for_logging(command: List[str]) str[source]

Convert npm command list to string for display to user.

runway.module.utils.generate_node_command(command: str, command_opts: List[str], path: Path, *, logger: Union[logging.Logger, 'logging.LoggerAdapter[Any]'] = <RunwayLogger runway.module.utils (WARNING)>, package: Optional[str] = None) List[str][source]

Return node bin command list for subprocess execution.

Parameters
  • command – Command to execute from a local node_modules/.bin.

  • command_opts – Options to include with the command.

  • path – Current working directory. Used to construct a “fall-back” command when npx is not available/included as part of npm.

  • logger – A specific logger to use when logging the constructed command.

  • package – Name of the npm package containing the binary to execute. This is recommended when the name of the binary does not match the name of the npm package.

runway.module.utils.run_module_command(cmd_list: List[str], env_vars: Dict[str, str], exit_on_error: bool = True, logger: Union[logging.Logger, 'logging.LoggerAdapter[Any]'] = <RunwayLogger runway.module.utils (WARNING)>) None[source]

Shell out to provisioner command.

Parameters
  • cmd_list – Command to run.

  • env_vars – Environment variables.

  • exit_on_error – If true, subprocess.CalledProcessError will be caught and the resulting exit code will be passed to sys.exit(). If false, the error will not be caught within this function. logger: Optionally, supply a logger to use.

  • logger – A specific logger to use when logging the constructed command.

runway.module.utils.use_npm_ci(path: pathlib.Path) bool[source]

Return true if npm ci should be used in lieu of npm install.