from pathlib import Path from typing import Optional from project_manager.nodejs.command import NpmCommand from ..entry import Entry class NodejsEntry(Entry): TYPE: str = "nodejs" def __init__(self, basepath: Path): super().__init__(self.TYPE, basepath) def setup(self): self._logger.info(f"setup:{self}") NpmCommand.install_clean().run(self._basepath) @classmethod def detect(cls, basepath: Path) -> Optional["NodejsEntry"]: if (basepath / "package.json").exists(): return cls(basepath)