ntc-dev-kit 1.0.6__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/MANIFEST.in +1 -0
- {ntc_dev_kit-1.0.6/ntc_dev_kit.egg-info → ntc_dev_kit-1.2.0}/PKG-INFO +26 -2
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/README.md +25 -1
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/__init__.py +5 -5
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/app_creator.py +118 -127
- ntc_dev_kit-1.2.0/ntc/cli_enhanced.py +421 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/composer/main.py +29 -21
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/main.py +2 -2
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/auth_app/admin.py +2 -2
- ntc_dev_kit-1.2.0/ntc/templates/auth_app/apps.py +9 -0
- ntc_dev_kit-1.2.0/ntc/templates/auth_app/migrations/0001_initial.py +50 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/auth_app/models.py +1 -1
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/auth_app/serializers.py +9 -8
- ntc_dev_kit-1.2.0/ntc/templates/auth_app/tests.py +106 -0
- ntc_dev_kit-1.2.0/ntc/templates/auth_app/views.py +218 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/main.py +108 -79
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/structure.json +202 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/.entry/start_core_backend.sh +35 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/.entry/start_tasks_backend.sh +29 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/CLAUDE.md +10 -7
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/README.md +0 -1
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/apps/app_admin.py +4 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/apps/app_models.py +6 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/apps/app_urls.py +4 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/apps/app_views.py +2 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/apps/common_models.py +15 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/config/gunicorn_config.py +22 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/config/http.conf +28 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/core/exceptions/handler.py +42 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/core/response_wrapper.py +12 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/core/services/object_storage.py +0 -2
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/core/utils/request.py +21 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/django_project/dev_settings.py +6 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/django_project/django_settings.txt +113 -29
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/django_project/prod_settings.py +34 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/django_project/project_init.py +5 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/django_project/schema.py +1 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/django_project/test_settings.py +18 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/django_project/urls.py +16 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/docker/Dockerfile +42 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/docker/captain-definition +4 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/knowledge/knowledge_description.md +1 -2
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/knowledge/knowledge_design_pattern.md +17 -35
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/knowledge/knowledge_structure.md +5 -7
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/root/README.md +5 -4
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/root/django_env.txt +108 -98
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/root/django_requirements.txt +18 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/root/django_requirements_dev.txt +4 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/root/dockerignore.txt +19 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/root/gitattributes.txt +5 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/root/gitignore.txt +14 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/root/pytest_ini.txt +5 -0
- ntc_dev_kit-1.2.0/ntc/templates/drf_structure/templates/root/ruff_toml.txt +10 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/core/config/app_config.dart +11 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/core/config/environment.dart +12 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/core/constants/app_constants.dart +6 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/core/network/dio_client.dart +65 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/features/home/presentation/home_screen.dart +57 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/l10n/app_localizations.dart +52 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/main.dart +54 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/services/api_service.dart +55 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/shared/localization/locale_provider.dart +27 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/shared/theme/app_theme.dart +59 -0
- ntc_dev_kit-1.2.0/ntc/templates/flutter/lib/shared/theme/theme_provider.dart +40 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/.env.example +1 -1
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/CLAUDE.md +8 -1
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/README.md +1 -1
- ntc_dev_kit-1.2.0/ntc/templates/nextjs/eslint.config.mjs +11 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/knowledge/knowledge_description.md +1 -1
- ntc_dev_kit-1.2.0/ntc/templates/nextjs/next.config.js +37 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/package.json +6 -6
- ntc_dev_kit-1.2.0/ntc/templates/nextjs/src/app/globals.css +30 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/src/app/layout.tsx +4 -4
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/src/app/page.tsx +1 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/src/components/Header.tsx +5 -3
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/src/services/api.ts +11 -5
- ntc_dev_kit-1.2.0/ntc/templates/nextjs/src/services/server.ts +20 -0
- ntc_dev_kit-1.2.0/ntc/templates/nextjs/src/utils/constants.ts +2 -0
- ntc_dev_kit-1.2.0/ntc/templates/nextjs/structure.json +66 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/CLAUDE.md +2 -1
- ntc_dev_kit-1.2.0/ntc/templates/react_admin/eslint.config.js +25 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/knowledge/knowledge_description.md +7 -6
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/knowledge/knowledge_design_pattern.md +0 -1
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/knowledge/knowledge_structure.md +1 -2
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/package.json +1 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/App.tsx +7 -5
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/components/Sidebar.tsx +1 -2
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/components/TopNav.tsx +1 -1
- ntc_dev_kit-1.2.0/ntc/templates/react_admin/src/context/AuthContext.tsx +115 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/context/ThemeContext.tsx +1 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/context/WorkspaceContext.tsx +1 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/hooks/useApi.ts +1 -3
- ntc_dev_kit-1.2.0/ntc/templates/react_admin/src/index.css +20 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/pages/auth/LoginPage.tsx +5 -7
- ntc_dev_kit-1.2.0/ntc/templates/react_admin/src/services/api.service.ts +42 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/services/base.service.ts +56 -3
- ntc_dev_kit-1.2.0/ntc/templates/react_admin/src/services/token.ts +14 -0
- ntc_dev_kit-1.2.0/ntc/templates/react_admin/src/vite-env.d.ts +9 -0
- ntc_dev_kit-1.2.0/ntc/templates/react_admin/structure.json +112 -0
- {ntc_dev_kit-1.0.6/ntc/templates/react_structure → ntc_dev_kit-1.2.0/ntc/templates/react_admin}/tsconfig.app.json +2 -2
- ntc_dev_kit-1.2.0/ntc/templates/react_structure/App.css +64 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/main.py +1 -0
- ntc_dev_kit-1.2.0/ntc/templates/react_structure/src/vite-env.d.ts +10 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/structure.json +6 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/utils/environment.py +34 -17
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/utils/output.py +10 -0
- ntc_dev_kit-1.2.0/ntc/utils/prompts.py +271 -0
- ntc_dev_kit-1.2.0/ntc/utils/shell.py +22 -0
- ntc_dev_kit-1.2.0/ntc/utils/validation.py +14 -0
- ntc_dev_kit-1.2.0/ntc/wizard.py +294 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0/ntc_dev_kit.egg-info}/PKG-INFO +26 -2
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc_dev_kit.egg-info/SOURCES.txt +36 -3
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/pyproject.toml +6 -1
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/setup.py +88 -88
- ntc_dev_kit-1.0.6/ntc/cli_enhanced.py +0 -947
- ntc_dev_kit-1.0.6/ntc/templates/auth_app/apps.py +0 -6
- ntc_dev_kit-1.0.6/ntc/templates/auth_app/views.py +0 -175
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/structure.json +0 -126
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/.entry/start_core_backend.sh +0 -37
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/.entry/start_tasks_backend.sh +0 -30
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/apps/app_admin.py +0 -3
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/apps/app_models.py +0 -4
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/apps/app_urls.py +0 -8
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/apps/app_views.py +0 -6
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/apps/common_models.py +0 -8
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/config/gunicorn_config.py +0 -9
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/config/http.conf +0 -33
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/core/base_model.py +0 -9
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/core/response_wrapper.py +0 -7
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/django_project/dev_settings.py +0 -2
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/django_project/management_command.py +0 -114
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/django_project/prod_settings.py +0 -3
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/django_project/urls.py +0 -6
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/root/django_requirements.txt +0 -24
- ntc_dev_kit-1.0.6/ntc/templates/drf_structure/templates/root/gitignore.txt +0 -6
- ntc_dev_kit-1.0.6/ntc/templates/nextjs/src/app/globals.css +0 -26
- ntc_dev_kit-1.0.6/ntc/templates/nextjs/src/utils/constants.ts +0 -1
- ntc_dev_kit-1.0.6/ntc/templates/nextjs/structure.json +0 -32
- ntc_dev_kit-1.0.6/ntc/templates/react_admin/src/context/AuthContext.tsx +0 -107
- ntc_dev_kit-1.0.6/ntc/templates/react_admin/src/index.css +0 -34
- ntc_dev_kit-1.0.6/ntc/templates/react_admin/src/pages/auth/RegisterPage.tsx +0 -93
- ntc_dev_kit-1.0.6/ntc/templates/react_admin/src/services/api.service.ts +0 -44
- ntc_dev_kit-1.0.6/ntc/templates/react_admin/structure.json +0 -52
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/LICENSE +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/cli.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/composer/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/deployment/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/auth_app/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/auth_app/urls.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/drf_structure.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/apps/app_apps.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/apps/common_apps.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/core/formatter.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/core/logger.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/core/pagination.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/core/services/azure/email/backend.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/core/services/azure/email/client.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/core/services/azure/email/notifier.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/django_project/asgi.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/django_project/celery.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/django_project/wsgi.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/docker/docker-compose.yml +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/drf_structure/templates/root/manage.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/.gitignore +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/.knowledge/knowledge_description.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/.knowledge/knowledge_design_pattern.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/.knowledge/knowledge_structure.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/CLAUDE.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/analysis_options.yaml +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/main.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/pubspec.yaml +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/flutter/structure.json +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/.gitignore +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/knowledge/knowledge_design_pattern.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/knowledge/knowledge_structure.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/main.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/nextjs/tsconfig.json +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/.env.example +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/.gitignore +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/README.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/index.html +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/main.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/components/ProtectedRoute.tsx +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/layouts/AuthLayout.tsx +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/layouts/DashboardLayout.tsx +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/main.tsx +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/src/pages/DashboardPage.tsx +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/tsconfig.json +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/tsconfig.node.json +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_admin/vite.config.ts +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/CLAUDE.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/index.css +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/index.html +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/knowledge/knowledge_description.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/knowledge/knowledge_design_pattern.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/knowledge/knowledge_structure.md +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/package.json +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/src/App.tsx +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/src/components/Header.tsx +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/src/main.tsx +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/src/services/api.ts +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/src/utils/constants.ts +0 -0
- {ntc_dev_kit-1.0.6/ntc/templates/react_admin → ntc_dev_kit-1.2.0/ntc/templates/react_structure}/tsconfig.app.json +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/tsconfig.json +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/tsconfig.node.json +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/templates/react_structure/vite.config.ts +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/ui/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/ui/app.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc/utils/__init__.py +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc_dev_kit.egg-info/dependency_links.txt +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc_dev_kit.egg-info/entry_points.txt +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc_dev_kit.egg-info/requires.txt +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/ntc_dev_kit.egg-info/top_level.txt +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/requirements.txt +0 -0
- {ntc_dev_kit-1.0.6 → ntc_dev_kit-1.2.0}/setup.cfg +0 -0
|
@@ -3,6 +3,7 @@ include LICENSE
|
|
|
3
3
|
include requirements.txt
|
|
4
4
|
recursive-include ntc/templates *.py *.json *.md *.txt *.html *.ts *.tsx *.css *.scss *.yml *.yaml *.sh *.conf *.cfg
|
|
5
5
|
recursive-include ntc/templates *.env.example *.gitignore
|
|
6
|
+
recursive-include ntc/templates *.js *.mjs *.dart Dockerfile captain-definition
|
|
6
7
|
|
|
7
8
|
global-exclude __pycache__
|
|
8
9
|
global-exclude *.py[co]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ntc-dev-kit
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Nexent Toolkit Console - A CLI tool for scaffolding Django REST Framework, React, Next.js, and Flutter projects
|
|
5
5
|
Home-page: https://github.com/nexent/ntc
|
|
6
6
|
Author: Nexent
|
|
@@ -97,7 +97,31 @@ ntc init --technology flutter
|
|
|
97
97
|
ntc init
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
A few questions, asked inline: project name, what you're building, where it goes, then the
|
|
101
|
+
options for that technology (sign-in and Python environment for Django; installing dependencies
|
|
102
|
+
for the others), a summary, and **Create?**. The defaults are already selected, so Enter takes
|
|
103
|
+
them; **↑/↓** move, a **number key** picks an option at once, **Esc** cancels without writing
|
|
104
|
+
anything. Each answer collapses to one line, and the only progress shown is for real work
|
|
105
|
+
(creating the environment, installing packages).
|
|
106
|
+
|
|
107
|
+
### Without questions
|
|
108
|
+
|
|
109
|
+
Every answer can be given as a flag; with `--yes` nothing is asked (scripts, CI, AI agents):
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
ntc init -t django --name shop-api --with-auth --env venv --yes
|
|
113
|
+
ntc init -t nextjs --name site --install --yes
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| Flag | Meaning |
|
|
117
|
+
|------|---------|
|
|
118
|
+
| `-t`, `--technology` | `django`, `nextjs`, `react-admin`, `react`, `flutter` |
|
|
119
|
+
| `--name` | Project name (`.` = the current folder) |
|
|
120
|
+
| `--path` | Folder to create the project in (default: current folder) |
|
|
121
|
+
| `--with-auth` / `--no-auth` | Django: include the sign-in app (custom User model, JWT, migration included) |
|
|
122
|
+
| `--env` | Django: `venv`, `conda`, `existing` (the active virtualenv) or `skip` |
|
|
123
|
+
| `--install` / `--no-install` | Others: run `npm install` / `flutter pub get` |
|
|
124
|
+
| `--yes`, `-y` | Ask nothing; needs `--name` and `--technology` |
|
|
101
125
|
|
|
102
126
|
### Technology Options
|
|
103
127
|
|
|
@@ -57,7 +57,31 @@ ntc init --technology flutter
|
|
|
57
57
|
ntc init
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
A few questions, asked inline: project name, what you're building, where it goes, then the
|
|
61
|
+
options for that technology (sign-in and Python environment for Django; installing dependencies
|
|
62
|
+
for the others), a summary, and **Create?**. The defaults are already selected, so Enter takes
|
|
63
|
+
them; **↑/↓** move, a **number key** picks an option at once, **Esc** cancels without writing
|
|
64
|
+
anything. Each answer collapses to one line, and the only progress shown is for real work
|
|
65
|
+
(creating the environment, installing packages).
|
|
66
|
+
|
|
67
|
+
### Without questions
|
|
68
|
+
|
|
69
|
+
Every answer can be given as a flag; with `--yes` nothing is asked (scripts, CI, AI agents):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
ntc init -t django --name shop-api --with-auth --env venv --yes
|
|
73
|
+
ntc init -t nextjs --name site --install --yes
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
| Flag | Meaning |
|
|
77
|
+
|------|---------|
|
|
78
|
+
| `-t`, `--technology` | `django`, `nextjs`, `react-admin`, `react`, `flutter` |
|
|
79
|
+
| `--name` | Project name (`.` = the current folder) |
|
|
80
|
+
| `--path` | Folder to create the project in (default: current folder) |
|
|
81
|
+
| `--with-auth` / `--no-auth` | Django: include the sign-in app (custom User model, JWT, migration included) |
|
|
82
|
+
| `--env` | Django: `venv`, `conda`, `existing` (the active virtualenv) or `skip` |
|
|
83
|
+
| `--install` / `--no-install` | Others: run `npm install` / `flutter pub get` |
|
|
84
|
+
| `--yes`, `-y` | Ask nothing; needs `--name` and `--technology` |
|
|
61
85
|
|
|
62
86
|
### Technology Options
|
|
63
87
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"""NTC - Nexent Toolkit Console."""
|
|
2
|
-
|
|
3
|
-
__version__ = "1.
|
|
4
|
-
__author__ = "Nexent"
|
|
5
|
-
__license__ = "MIT"
|
|
1
|
+
"""NTC - Nexent Toolkit Console."""
|
|
2
|
+
|
|
3
|
+
__version__ = "1.2.0"
|
|
4
|
+
__author__ = "Nexent"
|
|
5
|
+
__license__ = "MIT"
|
|
@@ -72,40 +72,45 @@ def hello_world(request):
|
|
|
72
72
|
}
|
|
73
73
|
return fallbacks.get(template_name, '')
|
|
74
74
|
|
|
75
|
-
def create_app_structure(app_name):
|
|
76
|
-
"""Create the NTC app directory structure.
|
|
75
|
+
def create_app_structure(app_name, add_urls=True, url_prefix=None):
|
|
76
|
+
"""Create the NTC app directory structure.
|
|
77
|
+
|
|
78
|
+
add_urls: include the app's URLs - in the project's api_v1 list (/api/v1/<app>/) by default,
|
|
79
|
+
or, with url_prefix, in the root urlpatterns under that prefix. False leaves it to you.
|
|
80
|
+
"""
|
|
77
81
|
# Sanitize app name using the same function as project names
|
|
78
82
|
original_name = app_name
|
|
79
83
|
app_name = sanitize_project_name(app_name)
|
|
80
|
-
|
|
84
|
+
|
|
81
85
|
if app_name != original_name:
|
|
82
86
|
print_info(f"App name sanitized: '{original_name}' -> '{app_name}'")
|
|
83
|
-
|
|
87
|
+
|
|
84
88
|
# Check if we're in a Django project root
|
|
85
89
|
if not os.path.exists('manage.py'):
|
|
86
90
|
print_error("Not in a Django project root directory. Please run this command from your project root.")
|
|
87
91
|
return False
|
|
88
|
-
|
|
92
|
+
|
|
89
93
|
# Check if apps directory exists
|
|
90
94
|
if not os.path.exists('apps'):
|
|
91
95
|
print_info("Creating apps directory...")
|
|
92
96
|
os.makedirs('apps', exist_ok=True)
|
|
93
97
|
# Create apps/__init__.py
|
|
94
|
-
with open('apps/__init__.py', 'w') as f:
|
|
98
|
+
with open('apps/__init__.py', 'w', encoding='utf-8') as f:
|
|
95
99
|
f.write('')
|
|
96
|
-
|
|
100
|
+
|
|
97
101
|
base_path = os.path.join('apps', app_name)
|
|
98
|
-
|
|
102
|
+
|
|
99
103
|
# Check if app already exists
|
|
100
104
|
if os.path.exists(base_path):
|
|
101
105
|
print_error(f"App '{app_name}' already exists in apps/{app_name}/")
|
|
102
106
|
return False
|
|
103
|
-
|
|
107
|
+
|
|
104
108
|
print_info(f"Creating app structure for '{app_name}'...")
|
|
105
|
-
|
|
109
|
+
|
|
106
110
|
# Create directories
|
|
107
111
|
directories = [
|
|
108
112
|
base_path,
|
|
113
|
+
os.path.join(base_path, 'migrations'),
|
|
109
114
|
os.path.join(base_path, 'permissions'),
|
|
110
115
|
os.path.join(base_path, 'serializers'),
|
|
111
116
|
os.path.join(base_path, 'selectors'),
|
|
@@ -114,14 +119,14 @@ def create_app_structure(app_name):
|
|
|
114
119
|
os.path.join(base_path, 'tasks'),
|
|
115
120
|
os.path.join(base_path, 'tests'),
|
|
116
121
|
]
|
|
117
|
-
|
|
122
|
+
|
|
118
123
|
for directory in directories:
|
|
119
124
|
os.makedirs(directory, exist_ok=True)
|
|
120
125
|
# Create __init__.py in each directory
|
|
121
126
|
init_file = os.path.join(directory, '__init__.py')
|
|
122
|
-
with open(init_file, 'w') as f:
|
|
127
|
+
with open(init_file, 'w', encoding='utf-8') as f:
|
|
123
128
|
f.write('')
|
|
124
|
-
|
|
129
|
+
|
|
125
130
|
# Create main app files
|
|
126
131
|
files_content = {
|
|
127
132
|
'admin.py': get_app_template_content('app_admin.py', app_name),
|
|
@@ -130,167 +135,153 @@ def create_app_structure(app_name):
|
|
|
130
135
|
'urls.py': get_app_template_content('app_urls.py', app_name),
|
|
131
136
|
'views.py': get_app_template_content('app_views.py', app_name),
|
|
132
137
|
}
|
|
133
|
-
|
|
138
|
+
|
|
134
139
|
for filename, content in files_content.items():
|
|
135
140
|
file_path = os.path.join(base_path, filename)
|
|
136
|
-
with open(file_path, 'w') as f:
|
|
141
|
+
with open(file_path, 'w', encoding='utf-8') as f:
|
|
137
142
|
f.write(content)
|
|
138
|
-
|
|
143
|
+
|
|
139
144
|
print_success(f"App '{app_name}' created successfully!")
|
|
140
|
-
|
|
145
|
+
|
|
141
146
|
# Add to INSTALLED_APPS
|
|
142
147
|
if add_to_installed_apps(app_name):
|
|
143
148
|
print_success(f"Added 'apps.{app_name}' to INSTALLED_APPS")
|
|
144
149
|
else:
|
|
145
150
|
print_info(f"Please manually add 'apps.{app_name}' to INSTALLED_APPS in your settings")
|
|
146
|
-
|
|
151
|
+
|
|
147
152
|
# Add to main URLs
|
|
148
|
-
if
|
|
149
|
-
|
|
153
|
+
url_line = f"path('{(url_prefix or '').strip('/') + '/' if url_prefix else ''}{app_name}/', include('apps.{app_name}.urls'))"
|
|
154
|
+
if not add_urls:
|
|
155
|
+
print_info(f"URLs not added (--no-url). Include them where you want, e.g.: {url_line}")
|
|
150
156
|
else:
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
where = add_to_main_urls(app_name, url_prefix)
|
|
158
|
+
if where:
|
|
159
|
+
print_success(f"Added the app's URLs to {where}")
|
|
160
|
+
else:
|
|
161
|
+
print_info(f"Please add the app's URLs to your urls.py, e.g.: {url_line}")
|
|
162
|
+
|
|
153
163
|
print_info("Next steps:")
|
|
154
|
-
print_info(f" 1.
|
|
155
|
-
print_info(f" 2.
|
|
156
|
-
|
|
157
|
-
|
|
164
|
+
print_info(f" 1. Add models to apps/{app_name}/models.py, then: python manage.py makemigrations {app_name}")
|
|
165
|
+
print_info(f" 2. Add views to apps/{app_name}/views.py and list them in apps/{app_name}/urls.py")
|
|
166
|
+
|
|
158
167
|
return True
|
|
159
168
|
|
|
169
|
+
|
|
170
|
+
def _project_package():
|
|
171
|
+
"""The Django project package, from manage.py's DJANGO_SETTINGS_MODULE ('shop.settings.dev'
|
|
172
|
+
-> 'shop'). None if manage.py doesn't say."""
|
|
173
|
+
try:
|
|
174
|
+
with open('manage.py', 'r', encoding='utf-8') as f:
|
|
175
|
+
manage = f.read()
|
|
176
|
+
except OSError:
|
|
177
|
+
return None
|
|
178
|
+
match = re.search(r"DJANGO_SETTINGS_MODULE['\"]\s*,\s*['\"]([\w.]+)['\"]", manage)
|
|
179
|
+
if not match:
|
|
180
|
+
return None
|
|
181
|
+
package = match.group(1).split('.')[0]
|
|
182
|
+
return package if os.path.isdir(package) else None
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def _settings_file():
|
|
186
|
+
"""The settings module that declares INSTALLED_APPS: <project>/settings/base.py in an NTC
|
|
187
|
+
project, else <project>/settings.py. (This used to walk the tree and stop after the first
|
|
188
|
+
folder, so it never found either and INSTALLED_APPS was never updated.)"""
|
|
189
|
+
package = _project_package()
|
|
190
|
+
if not package:
|
|
191
|
+
return None
|
|
192
|
+
for candidate in (os.path.join(package, 'settings', 'base.py'), os.path.join(package, 'settings.py')):
|
|
193
|
+
if os.path.exists(candidate):
|
|
194
|
+
return candidate
|
|
195
|
+
return None
|
|
196
|
+
|
|
197
|
+
|
|
160
198
|
def add_to_installed_apps(app_name):
|
|
161
199
|
"""Add the new app to INSTALLED_APPS in settings."""
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
# Look for settings in common locations
|
|
166
|
-
possible_settings = [
|
|
167
|
-
'settings.py',
|
|
168
|
-
'settings/base.py',
|
|
169
|
-
'settings/dev.py',
|
|
170
|
-
]
|
|
171
|
-
|
|
172
|
-
# Find project directory (should contain settings)
|
|
173
|
-
for root, dirs, files in os.walk('.'):
|
|
174
|
-
if 'settings.py' in files or 'settings' in dirs:
|
|
175
|
-
for settings_file in possible_settings:
|
|
176
|
-
settings_path = os.path.join(root, settings_file)
|
|
177
|
-
if os.path.exists(settings_path):
|
|
178
|
-
settings_files.append(settings_path)
|
|
179
|
-
break
|
|
180
|
-
|
|
181
|
-
if not settings_files:
|
|
200
|
+
settings_file = _settings_file()
|
|
201
|
+
if not settings_file:
|
|
182
202
|
return False
|
|
183
|
-
|
|
184
|
-
# Use the first settings file found (usually base.py or settings.py)
|
|
185
|
-
settings_file = settings_files[0]
|
|
186
|
-
|
|
203
|
+
|
|
187
204
|
try:
|
|
188
205
|
with open(settings_file, 'r', encoding='utf-8') as f:
|
|
189
206
|
content = f.read()
|
|
190
|
-
|
|
207
|
+
|
|
191
208
|
# Check if app is already in INSTALLED_APPS
|
|
192
209
|
if f"'apps.{app_name}'" in content or f'"apps.{app_name}"' in content:
|
|
193
210
|
return True # Already added
|
|
194
|
-
|
|
195
|
-
# Find INSTALLED_APPS and add the new app
|
|
196
|
-
import re
|
|
197
|
-
|
|
211
|
+
|
|
198
212
|
# Pattern to match INSTALLED_APPS
|
|
199
213
|
pattern = r'(INSTALLED_APPS\s*=\s*\[)(.*?)(\])'
|
|
200
214
|
match = re.search(pattern, content, re.DOTALL)
|
|
201
|
-
|
|
215
|
+
|
|
202
216
|
if match:
|
|
203
217
|
start, apps_content, end = match.groups()
|
|
204
|
-
|
|
218
|
+
|
|
205
219
|
# Add the new app to the end of the list
|
|
206
220
|
new_app_line = f" 'apps.{app_name}',\n"
|
|
207
|
-
|
|
221
|
+
|
|
208
222
|
# Insert before the closing bracket
|
|
209
223
|
new_content = content.replace(
|
|
210
224
|
match.group(0),
|
|
211
225
|
f"{start}{apps_content.rstrip()}\n{new_app_line}{end}"
|
|
212
226
|
)
|
|
213
|
-
|
|
227
|
+
|
|
214
228
|
with open(settings_file, 'w', encoding='utf-8') as f:
|
|
215
229
|
f.write(new_content)
|
|
216
|
-
|
|
230
|
+
|
|
217
231
|
return True
|
|
218
|
-
|
|
232
|
+
|
|
219
233
|
except Exception as e:
|
|
220
234
|
print_error(f"Failed to update INSTALLED_APPS: {e}")
|
|
221
235
|
return False
|
|
222
|
-
|
|
236
|
+
|
|
223
237
|
return False
|
|
224
238
|
|
|
225
|
-
def add_to_main_urls(app_name):
|
|
226
|
-
"""
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if not urls_files:
|
|
239
|
-
return False
|
|
240
|
-
|
|
241
|
-
# Use the first main urls.py found
|
|
242
|
-
urls_file = urls_files[0]
|
|
243
|
-
|
|
239
|
+
def add_to_main_urls(app_name, url_prefix=None):
|
|
240
|
+
"""Include the app's URLs in the project's urls.py. Returns a description of where, or None.
|
|
241
|
+
|
|
242
|
+
Without url_prefix: into the `api_v1 = [...]` list NTC projects version their API with
|
|
243
|
+
(/api/v1/<app>/). With url_prefix: into the root `urlpatterns` under that prefix. Only the
|
|
244
|
+
project's own urls.py is edited (found through manage.py) - the old tree walk could pick up
|
|
245
|
+
a urls.py inside the virtualenv.
|
|
246
|
+
"""
|
|
247
|
+
package = _project_package()
|
|
248
|
+
urls_file = os.path.join(package, 'urls.py') if package else None
|
|
249
|
+
if not urls_file or not os.path.exists(urls_file):
|
|
250
|
+
return None
|
|
251
|
+
|
|
244
252
|
try:
|
|
245
253
|
with open(urls_file, 'r', encoding='utf-8') as f:
|
|
246
254
|
content = f.read()
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
# Add include to existing import
|
|
256
|
-
content = content.replace(
|
|
257
|
-
'from django.urls import',
|
|
258
|
-
'from django.urls import include,'
|
|
259
|
-
).replace('include,', 'include, ')
|
|
255
|
+
|
|
256
|
+
if f"include('apps.{app_name}.urls')" in content:
|
|
257
|
+
return urls_file # Already added
|
|
258
|
+
|
|
259
|
+
if url_prefix is None:
|
|
260
|
+
list_name, route = 'api_v1', f'{app_name}/'
|
|
261
|
+
if not re.search(r'api_v1\s*=\s*\[', content):
|
|
262
|
+
return None # not an NTC project layout: say what to add rather than guess
|
|
260
263
|
else:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
pattern = r'(urlpatterns\s*=\s*\[)(.*?)(\])'
|
|
264
|
+
list_name, route = 'urlpatterns', f"{url_prefix.strip('/')}/{app_name}/" if url_prefix.strip('/') else f'{app_name}/'
|
|
265
|
+
|
|
266
|
+
# Make sure include is imported
|
|
267
|
+
if not re.search(r'from django\.urls import [^\n]*\binclude\b', content):
|
|
268
|
+
if 'from django.urls import' in content:
|
|
269
|
+
content = content.replace('from django.urls import ', 'from django.urls import include, ', 1)
|
|
270
|
+
else:
|
|
271
|
+
content = 'from django.urls import include, path\n' + content
|
|
272
|
+
|
|
273
|
+
pattern = rf'({list_name}\s*=\s*\[)(.*?)(\n\])'
|
|
273
274
|
match = re.search(pattern, content, re.DOTALL)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
f"{start}{urls_content.rstrip()}\n{new_url_line}{end}"
|
|
285
|
-
)
|
|
286
|
-
|
|
287
|
-
with open(urls_file, 'w', encoding='utf-8') as f:
|
|
288
|
-
f.write(new_content)
|
|
289
|
-
|
|
290
|
-
return True
|
|
291
|
-
|
|
275
|
+
if not match:
|
|
276
|
+
return None
|
|
277
|
+
start, urls_content, end = match.groups()
|
|
278
|
+
new_url_line = f"\n path('{route}', include('apps.{app_name}.urls')),"
|
|
279
|
+
content = content.replace(match.group(0), f"{start}{urls_content.rstrip()}{new_url_line}{end}", 1)
|
|
280
|
+
|
|
281
|
+
with open(urls_file, 'w', encoding='utf-8') as f:
|
|
282
|
+
f.write(content)
|
|
283
|
+
return f"{urls_file} ({list_name}: /{'api/v1/' if list_name == 'api_v1' else ''}{route})"
|
|
284
|
+
|
|
292
285
|
except Exception as e:
|
|
293
286
|
print_error(f"Failed to update main urls.py: {e}")
|
|
294
|
-
return
|
|
295
|
-
|
|
296
|
-
return False
|
|
287
|
+
return None
|