diff --git a/CHANGELOG.md b/CHANGELOG.md index da5a1b1c..92133075 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Add support for Node.js platform on Javascript / Typescript templates. ([bug 1728982](https://bugzilla.mozilla.org/show_bug.cgi?id=1728982)) + ## 4.0.0 (2021-08-20) - Add support for Text metric type ([#374](https://github.com/mozilla/glean_parser/pull/374)) diff --git a/glean_parser/javascript.py b/glean_parser/javascript.py index 8d88a96f..09bfb8f9 100644 --- a/glean_parser/javascript.py +++ b/glean_parser/javascript.py @@ -11,7 +11,7 @@ Outputter to generate Javascript code for metrics. import enum import json from pathlib import Path -from typing import Any, Dict, List, Optional, Union, Callable # noqa +from typing import Any, Dict, Optional, Callable from . import metrics from . import util @@ -123,9 +123,10 @@ def output( options = {} platform = options.get("platform", "webext") - if platform not in ["qt", "webext"]: + accepted_platforms = ["qt", "webext", "node"] + if platform not in accepted_platforms: raise ValueError( - f"Unknown platform: {platform}. Accepted platforms are qt and webext." + f"Unknown platform: {platform}. Accepted platforms are: {accepted_platforms}." # noqa ) version = options.get("version") if platform == "qt" and version is None: