-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
"""An extension for the NodeJS based Javascript application extension.""" | ||
import json | ||
import re | ||
from typing import Any, Dict, Tuple | ||
from typing import Any | ||
|
||
from overrides import override | ||
|
||
|
@@ -43,7 +43,7 @@ class ExpressJSFramework(Extension): | |
|
||
@staticmethod | ||
@override | ||
def get_supported_bases() -> Tuple[str, ...]: | ||
def get_supported_bases() -> tuple[str, ...]: | ||
"""Return supported bases.""" | ||
return "bare", "[email protected]", "[email protected]" | ||
|
||
|
@@ -54,7 +54,7 @@ def is_experimental(base: str | None) -> bool: | |
return True | ||
|
||
@override | ||
def get_root_snippet(self) -> Dict[str, Any]: | ||
def get_root_snippet(self) -> dict[str, Any]: | ||
"""Fill in some default root components. | ||
Default values: | ||
|
@@ -66,7 +66,7 @@ def get_root_snippet(self) -> Dict[str, Any]: | |
""" | ||
self._check_project() | ||
|
||
snippet: Dict[str, Any] = { | ||
snippet: dict[str, Any] = { | ||
"run-user": "_daemon_", | ||
"services": { | ||
"app": { | ||
|
@@ -120,7 +120,7 @@ def _gen_runtime_dependencies_part(self) -> dict: | |
} | ||
|
||
@property | ||
def _app_package_json(self): | ||
def _app_package_json(self) -> dict: | ||
"""Return the app package.json contents.""" | ||
package_json_file = self.project_root / "package.json" | ||
if not package_json_file.exists(): | ||
|
@@ -138,7 +138,7 @@ def _app_name(self) -> str: | |
return self._app_package_json["name"] | ||
|
||
@property | ||
def _app_organise(self): | ||
def _app_organise(self) -> dict: | ||
"""Return the organised mapping for the ExpressJS project. | ||
Use the paths generated by the | ||
|
@@ -150,7 +150,6 @@ def _app_organise(self): | |
.get("expressjs-framework/install-app", {}) | ||
.get("prime", []) | ||
) | ||
print(user_prime) | ||
if not all(re.match(f"-? *{self.IMAGE_BASE_DIR}/", p) for p in user_prime): | ||
raise ExtensionError( | ||
"expressjs-framework extension requires the 'prime' entry in the " | ||
|
@@ -170,7 +169,7 @@ def _app_organise(self): | |
if (self.project_root / "app" / f).exists() | ||
} | ||
|
||
def _check_project(self): | ||
def _check_project(self) -> None: | ||
"""Ensure this extension can apply to the current rockcraft project. | ||
The ExpressJS framework assumes that: | ||
|