25 lines
548 B
Python
25 lines
548 B
Python
from pathlib import Path
|
|
from typing import Optional
|
|
|
|
from ..entry import Entry
|
|
|
|
|
|
class NodejsEntry(Entry):
|
|
TYPE: str = "nodejs"
|
|
COMMANDS = {
|
|
"setup": [
|
|
["npm", "install-clean"],
|
|
],
|
|
"test": [
|
|
["npm", "test"],
|
|
],
|
|
}
|
|
|
|
def __init__(self, basepath: Path):
|
|
super().__init__(self.TYPE, self.COMMANDS, basepath)
|
|
|
|
@classmethod
|
|
def detect(cls, basepath: Path) -> Optional["NodejsEntry"]:
|
|
if (basepath / "package.json").exists():
|
|
return cls(basepath)
|