villebro commented on code in PR #38651:
URL: https://github.com/apache/superset/pull/38651#discussion_r2935510214


##########
superset-extensions-cli/src/superset_extensions_cli/cli.py:
##########
@@ -372,12 +375,167 @@ def validate() -> None:
             click.secho("   Convention requires: frontend/src/index.tsx", 
fg="yellow")
             sys.exit(1)
 
+    # Validate version and license consistency across extension.json, 
frontend, and backend
+    mismatches: list[str] = []
+    frontend_pkg_path = cwd / "frontend" / "package.json"
+    frontend_pkg = None
+    if frontend_pkg_path.is_file():
+        frontend_pkg = read_json(frontend_pkg_path)
+        if frontend_pkg:
+            if frontend_pkg.get("version") != extension.version:
+                mismatches.append(
+                    f"  frontend/package.json version: 
{frontend_pkg.get('version')} "
+                    f"(expected {extension.version})"
+                )
+            if extension.license and frontend_pkg.get("license") != 
extension.license:
+                mismatches.append(
+                    f"  frontend/package.json license: 
{frontend_pkg.get('license')} "
+                    f"(expected {extension.license})"
+                )
+
+    backend_pyproject_path = cwd / "backend" / "pyproject.toml"
+    if backend_pyproject_path.is_file():
+        backend_pyproject = read_toml(backend_pyproject_path)
+        if backend_pyproject:
+            project = backend_pyproject.get("project", {})
+            if project.get("version") != extension.version:
+                mismatches.append(
+                    f"  backend/pyproject.toml version: 
{project.get('version')} "
+                    f"(expected {extension.version})"
+                )
+            if extension.license and project.get("license") != 
extension.license:
+                mismatches.append(
+                    f"  backend/pyproject.toml license: 
{project.get('license')} "
+                    f"(expected {extension.license})"
+                )

Review Comment:
   For now we should only support string based licenses. If the need comes up 
for supporting custom file based licenses, we need to add that to 
`extension.json`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to