diff --git a/copier.yml b/copier.yml index f7e9d8190..d5ce85933 100644 --- a/copier.yml +++ b/copier.yml @@ -276,7 +276,8 @@ frontend_deployed_port_number: frontend_uses_zod: type: bool help: Will the frontend use the zod library for form validation? - default: false + default: "{{ is_circuit_python_driver }}" + when: "{{ not is_circuit_python_driver }}" frontend_nodeport_number: type: int diff --git a/extensions/context.py b/extensions/context.py index b09cd5b6f..be3c06334 100644 --- a/extensions/context.py +++ b/extensions/context.py @@ -86,6 +86,8 @@ def hook( # noqa: PLR0915 # yes, this is a lot of statements, but it's all just context["vue_eslint_parser_version"] = "^10.4.0" context["happy_dom_version"] = "^20.9.0" context["node_kiota_bundle_version"] = "1.0.0-preview.100" + context["labsync_nuxt_common_version"] = "^0.1.0" + context["tanstack_vue_table_version"] = "^8.21.3" context["gha_checkout"] = "v6.0.2" context["gha_setup_python"] = "v6.2.0" diff --git a/template/frontend/nuxt.config.ts.jinja b/template/frontend/nuxt.config.ts.jinja index d50a22462..c47cb8ed7 100644 --- a/template/frontend/nuxt.config.ts.jinja +++ b/template/frontend/nuxt.config.ts.jinja @@ -13,7 +13,8 @@ export default defineNuxtConfig({ // the conditional modules added in by the template make it complicated to format consistently...at least with only 3 'always included' modules // prettier-ignore modules: [ - "@nuxt/ui"{% endraw %}{% if frontend_uses_graphql %}{% raw %}, + {% endraw %}{% if is_circuit_python_driver %}{% raw %}"@lab-sync/nuxt-common", + {% endraw %}{% endif %}{% raw %}"@nuxt/ui"{% endraw %}{% if frontend_uses_graphql %}{% raw %}, "@nuxtjs/apollo"{% endraw %}{% endif %}{% raw %}, ["@nuxt/eslint", { devOnly: true }], ["@nuxt/test-utils/module", { devOnly: true }], diff --git a/template/frontend/package.json.jinja b/template/frontend/package.json.jinja index 71ec37b07..5b47dea32 100644 --- a/template/frontend/package.json.jinja +++ b/template/frontend/package.json.jinja @@ -25,18 +25,20 @@ }, "dependencies": { "@iconify-json/lucide": "{% endraw %}{{ iconify_json_lucide_version }}{% raw %}", - "@iconify/vue": "{% endraw %}{{ iconify_vue_version }}{% raw %}", + "@iconify/vue": "{% endraw %}{{ iconify_vue_version }}{% raw %}",{% endraw %}{% if is_circuit_python_driver %}{% raw %} + "@lab-sync/nuxt-common": "{% endraw %}{{ labsync_nuxt_common_version }}{% raw %}",{% endraw %}{% endif %}{% raw %} "@microsoft/kiota-abstractions": "{% endraw %}{{ node_kiota_bundle_version }}{% raw %}", "@microsoft/kiota-bundle": "{% endraw %}{{ node_kiota_bundle_version }}{% raw %}", "@microsoft/kiota-http-fetchlibrary": "{% endraw %}{{ node_kiota_bundle_version }}{% raw %}", "@nuxt/fonts": "{% endraw %}{{ nuxt_fonts_version }}{% raw %}", "@nuxt/icon": "{% endraw %}{{ nuxt_icon_version }}{% raw %}", "@nuxt/ui": "{% endraw %}{{ nuxt_ui_version }}{% raw %}", - "@nuxtjs/color-mode": "{% endraw %}{{ nuxtjs_color_mode_version }}{% raw %}", + "@nuxtjs/color-mode": "{% endraw %}{{ nuxtjs_color_mode_version }}{% raw %}"{% endraw %}{% if is_circuit_python_driver %}{% raw %}, + "@tanstack/vue-table": "{% endraw %}{{ tanstack_vue_table_version }}{% raw %}"{% endraw %}{% endif %}{% raw %}, "nuxt": "{% endraw %}{{ nuxt_version }}{% raw %}", "vue": "{% endraw %}{{ vue_version }}{% raw %}", - "vue-router": "{% endraw %}{{ vue_router_version }}{% raw %}"{% endraw %}{% if frontend_uses_zod %}{% raw %}, - "zod": "{% endraw %}{{ zod_version }}{% raw %}", + "vue-router": "{% endraw %}{{ vue_router_version }}{% raw %}"{% endraw %}{% if is_circuit_python_driver or frontend_uses_zod %}{% raw %}, + "zod": "{% endraw %}{{ zod_version }}{% raw %}"{% endraw %}{% endif %}{% if frontend_uses_zod %}{% raw %}, "zod-from-json-schema": "{% endraw %}{{ zod_from_json_schema_version }}{% raw %}"{% endraw %}{% endif %}{% raw %} }, "devDependencies": { diff --git a/template/{% if has_backend %}backend{% endif %}/src/backend_api/{% if backend_uses_graphql %}schema_def.py{% endif %} b/template/{% if has_backend %}backend{% endif %}/src/backend_api/{% if backend_uses_graphql %}schema_def.py{% endif %} index 93510abb0..cf1b74379 100644 --- a/template/{% if has_backend %}backend{% endif %}/src/backend_api/{% if backend_uses_graphql %}schema_def.py{% endif %} +++ b/template/{% if has_backend %}backend{% endif %}/src/backend_api/{% if backend_uses_graphql %}schema_def.py{% endif %} @@ -7,6 +7,6 @@ from .strawberry_router import AddErrorTrace logger = logging.getLogger(__name__) -schema = strawberry.Schema(query=int, extensions=[AddErrorTrace()]) +schema = strawberry.Schema(query=int, extensions=[AddErrorTrace]) sdl_path = Path(__file__).parent / "schema.graphql" _ = sdl_path.write_text(f"{schema.as_str()}\n") diff --git a/template/{% if has_backend %}backend{% endif %}/tests/unit/{% if backend_uses_graphql %}test_strawberry_exception_handler.py{% endif %} b/template/{% if has_backend %}backend{% endif %}/tests/unit/{% if backend_uses_graphql %}test_strawberry_exception_handler.py{% endif %} index 1b803ba2b..0fce87da5 100644 --- a/template/{% if has_backend %}backend{% endif %}/tests/unit/{% if backend_uses_graphql %}test_strawberry_exception_handler.py{% endif %} +++ b/template/{% if has_backend %}backend{% endif %}/tests/unit/{% if backend_uses_graphql %}test_strawberry_exception_handler.py{% endif %} @@ -31,7 +31,7 @@ class Query: return _run_other_logic(value) -schema = strawberry.Schema(query=Query, extensions=[AddErrorTrace()]) +schema = strawberry.Schema(query=Query, extensions=[AddErrorTrace]) GQL = """query ($value: String!) { doSomething(value: $value)