|
11 | 11 | from . import GLOBALS, PROPERTIES
|
12 | 12 | from .base_config import BaseConfig
|
13 | 13 | from .hglob import glob
|
14 |
| -from .utils import ensure_directory, ensure_file_directory |
| 14 | +from .utils import ensure_directory, ensure_file_directory, request_typescript |
15 | 15 |
|
16 | 16 | # The TypeScript Compiler - Version 4.8.3
|
17 | 17 | TSCONFIG: Dict[str, Any] = {
|
@@ -291,17 +291,23 @@ def flush(self, **kwargs: Any) -> None:
|
291 | 291 | tsconfig.write(json.dumps(template, indent="\t") + "\n")
|
292 | 292 |
|
293 | 293 | def build(self, *args: str) -> int:
|
| 294 | + tsc = request_typescript() |
| 295 | + if not tsc: |
| 296 | + raise RuntimeError("A tsc is required to build project, make sure it is present before calling this function.") |
294 | 297 | return subprocess.call([
|
295 |
| - "tsc", |
| 298 | + tsc, |
296 | 299 | "--build", self.get_tsconfig(),
|
297 | 300 | *GLOBALS.MAKE_CONFIG.get_value("development.tsc", list()),
|
298 | 301 | *args
|
299 | 302 | ], shell=platform.system() == "Windows")
|
300 | 303 |
|
301 | 304 | def watch(self, *args: str) -> int:
|
| 305 | + tsc = request_typescript() |
| 306 | + if not tsc: |
| 307 | + raise RuntimeError("A tsc is required to watch project, make sure it is present before calling this function.") |
302 | 308 | try:
|
303 | 309 | return subprocess.call([
|
304 |
| - "tsc", |
| 310 | + tsc, |
305 | 311 | "--watch",
|
306 | 312 | *GLOBALS.MAKE_CONFIG.get_value("development.watch", list()),
|
307 | 313 | *args
|
|
0 commit comments