create-businessdash 0.0.0-stage → 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +125 -2
- package/dist/index.mjs +3672 -0
- package/index.js +2 -0
- package/package.json +40 -5
- package/templates/angular/.claude/CLAUDE.md +54 -0
- package/templates/angular/.cursor/rules/cursor.mdc +60 -0
- package/templates/angular/.editorconfig +17 -0
- package/templates/angular/.env.example +62 -0
- package/templates/angular/.prettierrc +12 -0
- package/templates/angular/.vscode/extensions.json +4 -0
- package/templates/angular/.vscode/launch.json +20 -0
- package/templates/angular/.vscode/mcp.json +9 -0
- package/templates/angular/.vscode/tasks.json +42 -0
- package/templates/angular/AGENTS.md +54 -0
- package/templates/angular/README.md +382 -0
- package/templates/angular/_gitignore +49 -0
- package/templates/angular/angular.json +93 -0
- package/templates/angular/bd.config.ts +331 -0
- package/templates/angular/bd.data-model.config.ts +89 -0
- package/templates/angular/package.json +60 -0
- package/templates/angular/pnpm-lock.yaml +5506 -0
- package/templates/angular/public/favicon.ico +0 -0
- package/templates/angular/src/app/app.config.server.ts +10 -0
- package/templates/angular/src/app/app.config.ts +48 -0
- package/templates/angular/src/app/app.html +7 -0
- package/templates/angular/src/app/app.routes.server.ts +14 -0
- package/templates/angular/src/app/app.routes.ts +69 -0
- package/templates/angular/src/app/app.scss +5 -0
- package/templates/angular/src/app/app.spec.ts +25 -0
- package/templates/angular/src/app/app.ts +27 -0
- package/templates/angular/src/app/lib/bd-api.client.ts +416 -0
- package/templates/angular/src/app/lib/bd-forms.client.ts +107 -0
- package/templates/angular/src/app/lib/bd.service.ts +145 -0
- package/templates/angular/src/app/lib/followers.service.ts +143 -0
- package/templates/angular/src/app/pages/booking.page.ts +142 -0
- package/templates/angular/src/app/pages/cart.page.ts +131 -0
- package/templates/angular/src/app/pages/home.page.ts +37 -0
- package/templates/angular/src/app/pages/my-account.page.ts +197 -0
- package/templates/angular/src/app/pages/product-detail.page.ts +217 -0
- package/templates/angular/src/app/pages/reviews.page.ts +89 -0
- package/templates/angular/src/app/pages/service-area.page.ts +86 -0
- package/templates/angular/src/app/pages/services-index.page.ts +49 -0
- package/templates/angular/src/app/pages/store.page.ts +422 -0
- package/templates/angular/src/app/pages/subscriptions.page.ts +102 -0
- package/templates/angular/src/app/pages/todos.page.ts +194 -0
- package/templates/angular/src/app/pages/updates.page.ts +45 -0
- package/templates/angular/src/app/sections/about.component.ts +24 -0
- package/templates/angular/src/app/sections/blog.component.ts +33 -0
- package/templates/angular/src/app/sections/contact-form.component.ts +51 -0
- package/templates/angular/src/app/sections/footer.component.ts +14 -0
- package/templates/angular/src/app/sections/header.component.ts +36 -0
- package/templates/angular/src/app/sections/hero.component.ts +21 -0
- package/templates/angular/src/app/sections/news-banner.component.ts +50 -0
- package/templates/angular/src/app/sections/reviews-summary.component.ts +41 -0
- package/templates/angular/src/app/sections/sdk-setup-banner.component.ts +125 -0
- package/templates/angular/src/app/sections/services.component.ts +27 -0
- package/templates/angular/src/app/sections/subscribe.component.ts +140 -0
- package/templates/angular/src/app/sections/updates.component.ts +38 -0
- package/templates/angular/src/environments/environment.prod.ts +13 -0
- package/templates/angular/src/environments/environment.ts +23 -0
- package/templates/angular/src/index.html +13 -0
- package/templates/angular/src/main.server.ts +7 -0
- package/templates/angular/src/main.ts +5 -0
- package/templates/angular/src/server/bd-api.ts +1098 -0
- package/templates/angular/src/server/bd-seo.ts +55 -0
- package/templates/angular/src/server/bd-server.ts +293 -0
- package/templates/angular/src/server.ts +94 -0
- package/templates/angular/src/styles.scss +1102 -0
- package/templates/angular/tsconfig.app.json +11 -0
- package/templates/angular/tsconfig.json +33 -0
- package/templates/angular/tsconfig.spec.json +10 -0
- package/templates/astro/.env.example +48 -0
- package/templates/astro/.vscode/extensions.json +4 -0
- package/templates/astro/.vscode/launch.json +11 -0
- package/templates/astro/README.md +432 -0
- package/templates/astro/_gitignore +25 -0
- package/templates/astro/astro.config.mjs +13 -0
- package/templates/astro/bd.config.ts +331 -0
- package/templates/astro/bd.data-model.config.ts +90 -0
- package/templates/astro/package.json +40 -0
- package/templates/astro/pnpm-lock.yaml +3788 -0
- package/templates/astro/public/favicon.ico +0 -0
- package/templates/astro/public/favicon.svg +9 -0
- package/templates/astro/src/components/About.astro +59 -0
- package/templates/astro/src/components/Banner.astro +78 -0
- package/templates/astro/src/components/Blog.astro +62 -0
- package/templates/astro/src/components/Booking.astro +285 -0
- package/templates/astro/src/components/ContactForm.astro +89 -0
- package/templates/astro/src/components/ContactForm.tsx +80 -0
- package/templates/astro/src/components/Footer.astro +39 -0
- package/templates/astro/src/components/Gallery.astro +77 -0
- package/templates/astro/src/components/Header.astro +65 -0
- package/templates/astro/src/components/Hero.astro +45 -0
- package/templates/astro/src/components/NotFound.astro +22 -0
- package/templates/astro/src/components/Reviews.astro +169 -0
- package/templates/astro/src/components/SdkSetupBanner.astro +83 -0
- package/templates/astro/src/components/Services.astro +87 -0
- package/templates/astro/src/components/Subscribe.astro +196 -0
- package/templates/astro/src/components/Subscribe.tsx +171 -0
- package/templates/astro/src/layouts/Layout.astro +89 -0
- package/templates/astro/src/lib/bd-bundle.ts +113 -0
- package/templates/astro/src/lib/bd-distribution.ts +36 -0
- package/templates/astro/src/lib/bd-portal.ts +158 -0
- package/templates/astro/src/lib/bd-seo.ts +81 -0
- package/templates/astro/src/lib/bd-store.ts +185 -0
- package/templates/astro/src/lib/bd-suspension.ts +67 -0
- package/templates/astro/src/lib/bd-todos.ts +124 -0
- package/templates/astro/src/lib/bd.ts +73 -0
- package/templates/astro/src/pages/.well-known/mcp.json.ts +22 -0
- package/templates/astro/src/pages/404.astro +15 -0
- package/templates/astro/src/pages/[...slug].astro +50 -0
- package/templates/astro/src/pages/ai/product-feed.ts +25 -0
- package/templates/astro/src/pages/api/bd/cart/add.ts +41 -0
- package/templates/astro/src/pages/api/bd/cart/clear.ts +29 -0
- package/templates/astro/src/pages/api/bd/cart/coupon.ts +35 -0
- package/templates/astro/src/pages/api/bd/cart/get.ts +28 -0
- package/templates/astro/src/pages/api/bd/cart/remove.ts +33 -0
- package/templates/astro/src/pages/api/bd/cart/update.ts +41 -0
- package/templates/astro/src/pages/api/bd/checkout/start.ts +37 -0
- package/templates/astro/src/pages/api/bd/forms/[slug].ts +75 -0
- package/templates/astro/src/pages/api/bd/portal/plan.ts +31 -0
- package/templates/astro/src/pages/api/bd/portal/submit-review.ts +56 -0
- package/templates/astro/src/pages/api/bd/revalidate.ts +49 -0
- package/templates/astro/src/pages/api/bd/reviews.ts +39 -0
- package/templates/astro/src/pages/api/bd/scheduling/bookings.ts +44 -0
- package/templates/astro/src/pages/api/bd/scheduling/slots.ts +40 -0
- package/templates/astro/src/pages/api/bd/subscriptions/checkout.ts +29 -0
- package/templates/astro/src/pages/api/bd-auth/[...slug].ts +61 -0
- package/templates/astro/src/pages/api/mcp.ts +40 -0
- package/templates/astro/src/pages/index.astro +47 -0
- package/templates/astro/src/pages/llms.txt.ts +25 -0
- package/templates/astro/src/pages/my-account.astro +388 -0
- package/templates/astro/src/pages/reviews.astro +18 -0
- package/templates/astro/src/pages/robots.txt.ts +46 -0
- package/templates/astro/src/pages/services/[service]/[area].astro +103 -0
- package/templates/astro/src/pages/services/index.astro +104 -0
- package/templates/astro/src/pages/sitemap.xml.ts +89 -0
- package/templates/astro/src/pages/store/[id].astro +208 -0
- package/templates/astro/src/pages/store/cart.astro +458 -0
- package/templates/astro/src/pages/store/index.astro +567 -0
- package/templates/astro/src/pages/store/subscriptions.astro +155 -0
- package/templates/astro/src/pages/todos.astro +199 -0
- package/templates/astro/src/pages/updates.astro +135 -0
- package/templates/astro/src/styles/global.css +631 -0
- package/templates/astro/tsconfig.json +8 -0
- package/templates/elixir/.env.example +58 -0
- package/templates/elixir/README.md +293 -0
- package/templates/elixir/_gitignore +16 -0
- package/templates/elixir/assets/js/app.js +16 -0
- package/templates/elixir/bd-records/README.md +50 -0
- package/templates/elixir/bd-records/todo-images.json +14 -0
- package/templates/elixir/bd-records/todos.json +20 -0
- package/templates/elixir/bd.config.ts +331 -0
- package/templates/elixir/bd.data-model.config.ts +89 -0
- package/templates/elixir/config/config.exs +30 -0
- package/templates/elixir/config/dev.exs +20 -0
- package/templates/elixir/config/prod.exs +6 -0
- package/templates/elixir/config/runtime.exs +68 -0
- package/templates/elixir/config/test.exs +9 -0
- package/templates/elixir/lib/bd_starter/application.ex +29 -0
- package/templates/elixir/lib/bd_starter/bd/auth.ex +126 -0
- package/templates/elixir/lib/bd_starter/bd/cache.ex +148 -0
- package/templates/elixir/lib/bd_starter/bd/chat_session.ex +214 -0
- package/templates/elixir/lib/bd_starter/bd/client.ex +203 -0
- package/templates/elixir/lib/bd_starter/bd/customer_auth.ex +116 -0
- package/templates/elixir/lib/bd_starter/bd/resources/blog.ex +18 -0
- package/templates/elixir/lib/bd_starter/bd/resources/cart.ex +40 -0
- package/templates/elixir/lib/bd_starter/bd/resources/checkout.ex +22 -0
- package/templates/elixir/lib/bd_starter/bd/resources/data_model.ex +53 -0
- package/templates/elixir/lib/bd_starter/bd/resources/donations.ex +50 -0
- package/templates/elixir/lib/bd_starter/bd/resources/followers.ex +25 -0
- package/templates/elixir/lib/bd_starter/bd/resources/forms.ex +29 -0
- package/templates/elixir/lib/bd_starter/bd/resources/marketing.ex +20 -0
- package/templates/elixir/lib/bd_starter/bd/resources/notifications.ex +87 -0
- package/templates/elixir/lib/bd_starter/bd/resources/parallel_pages.ex +21 -0
- package/templates/elixir/lib/bd_starter/bd/resources/portal.ex +153 -0
- package/templates/elixir/lib/bd_starter/bd/resources/reviews.ex +8 -0
- package/templates/elixir/lib/bd_starter/bd/resources/scheduling.ex +122 -0
- package/templates/elixir/lib/bd_starter/bd/resources/storefront.ex +47 -0
- package/templates/elixir/lib/bd_starter/bd/resources/subscriptions.ex +13 -0
- package/templates/elixir/lib/bd_starter/bd/seo.ex +148 -0
- package/templates/elixir/lib/bd_starter/bd/sign_in_core.ex +258 -0
- package/templates/elixir/lib/bd_starter/bd/social_platforms.ex +46 -0
- package/templates/elixir/lib/bd_starter/bd/socials.ex +99 -0
- package/templates/elixir/lib/bd_starter/bd/webhook.ex +89 -0
- package/templates/elixir/lib/bd_starter/bd.ex +156 -0
- package/templates/elixir/lib/bd_starter/forms/backend.ex +74 -0
- package/templates/elixir/lib/bd_starter/forms/calculation.ex +158 -0
- package/templates/elixir/lib/bd_starter/forms/dates.ex +151 -0
- package/templates/elixir/lib/bd_starter/forms/field.ex +211 -0
- package/templates/elixir/lib/bd_starter/forms/field_path.ex +18 -0
- package/templates/elixir/lib/bd_starter/forms/form_controller.ex +615 -0
- package/templates/elixir/lib/bd_starter/forms/form_view.ex +339 -0
- package/templates/elixir/lib/bd_starter/forms/forms.ex +37 -0
- package/templates/elixir/lib/bd_starter/forms/forms_data.ex +298 -0
- package/templates/elixir/lib/bd_starter/forms/formula.ex +602 -0
- package/templates/elixir/lib/bd_starter/forms/formula_parser.ex +197 -0
- package/templates/elixir/lib/bd_starter/forms/js.ex +501 -0
- package/templates/elixir/lib/bd_starter/forms/json.ex +103 -0
- package/templates/elixir/lib/bd_starter/forms/messages.ex +95 -0
- package/templates/elixir/lib/bd_starter/forms/package_backend.ex +175 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_arrange.ex +120 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_backend.ex +14 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_config.ex +51 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_controller.ex +188 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_engine.ex +682 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_options.ex +99 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_page.ex +93 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_runs.ex +44 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_scoring.ex +397 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_state.ex +68 -0
- package/templates/elixir/lib/bd_starter/forms/quiz_words.ex +101 -0
- package/templates/elixir/lib/bd_starter/forms/quizzes.ex +98 -0
- package/templates/elixir/lib/bd_starter/forms/re.ex +22 -0
- package/templates/elixir/lib/bd_starter/forms/rules.ex +1355 -0
- package/templates/elixir/lib/bd_starter/forms/sample_backend.ex +44 -0
- package/templates/elixir/lib/bd_starter/forms/schema.ex +50 -0
- package/templates/elixir/lib/bd_starter/forms/submit_result.ex +60 -0
- package/templates/elixir/lib/bd_starter/forms/units.ex +75 -0
- package/templates/elixir/lib/bd_starter_web/bundle.ex +27 -0
- package/templates/elixir/lib/bd_starter_web/components/form_components.ex +779 -0
- package/templates/elixir/lib/bd_starter_web/components/layouts/app.html.heex +50 -0
- package/templates/elixir/lib/bd_starter_web/components/layouts/root.html.heex +24 -0
- package/templates/elixir/lib/bd_starter_web/components/layouts.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/bd_auth_controller.ex +144 -0
- package/templates/elixir/lib/bd_starter_web/controllers/bd_customer_auth_controller.ex +224 -0
- package/templates/elixir/lib/bd_starter_web/controllers/blog_controller.ex +28 -0
- package/templates/elixir/lib/bd_starter_web/controllers/blog_html/index.html.heex +10 -0
- package/templates/elixir/lib/bd_starter_web/controllers/blog_html/show.html.heex +20 -0
- package/templates/elixir/lib/bd_starter_web/controllers/blog_html.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/cart_controller.ex +140 -0
- package/templates/elixir/lib/bd_starter_web/controllers/cart_html/show.html.heex +42 -0
- package/templates/elixir/lib/bd_starter_web/controllers/cart_html.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/error_html.ex +8 -0
- package/templates/elixir/lib/bd_starter_web/controllers/form_page_controller.ex +77 -0
- package/templates/elixir/lib/bd_starter_web/controllers/form_page_html/form.html.heex +2 -0
- package/templates/elixir/lib/bd_starter_web/controllers/form_page_html/quiz.html.heex +4 -0
- package/templates/elixir/lib/bd_starter_web/controllers/form_page_html.ex +5 -0
- package/templates/elixir/lib/bd_starter_web/controllers/page_controller.ex +56 -0
- package/templates/elixir/lib/bd_starter_web/controllers/page_html/home.html.heex +53 -0
- package/templates/elixir/lib/bd_starter_web/controllers/page_html/reviews.html.heex +10 -0
- package/templates/elixir/lib/bd_starter_web/controllers/page_html/updates.html.heex +8 -0
- package/templates/elixir/lib/bd_starter_web/controllers/page_html.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/portal_controller.ex +109 -0
- package/templates/elixir/lib/bd_starter_web/controllers/portal_html/delete_account.html.heex +31 -0
- package/templates/elixir/lib/bd_starter_web/controllers/portal_html/index.html.heex +29 -0
- package/templates/elixir/lib/bd_starter_web/controllers/portal_html/sign_in.html.heex +18 -0
- package/templates/elixir/lib/bd_starter_web/controllers/portal_html.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/seo_controller.ex +87 -0
- package/templates/elixir/lib/bd_starter_web/controllers/service_area_controller.ex +14 -0
- package/templates/elixir/lib/bd_starter_web/controllers/service_area_html/index.html.heex +12 -0
- package/templates/elixir/lib/bd_starter_web/controllers/service_area_html/show.html.heex +4 -0
- package/templates/elixir/lib/bd_starter_web/controllers/service_area_html.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/store_controller.ex +34 -0
- package/templates/elixir/lib/bd_starter_web/controllers/store_html/index.html.heex +31 -0
- package/templates/elixir/lib/bd_starter_web/controllers/store_html/show.html.heex +29 -0
- package/templates/elixir/lib/bd_starter_web/controllers/store_html.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/subscription_controller.ex +31 -0
- package/templates/elixir/lib/bd_starter_web/controllers/subscription_html/index.html.heex +14 -0
- package/templates/elixir/lib/bd_starter_web/controllers/subscription_html.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/todos_controller.ex +58 -0
- package/templates/elixir/lib/bd_starter_web/controllers/todos_html/index.html.heex +38 -0
- package/templates/elixir/lib/bd_starter_web/controllers/todos_html.ex +6 -0
- package/templates/elixir/lib/bd_starter_web/controllers/webhook_controller.ex +30 -0
- package/templates/elixir/lib/bd_starter_web/endpoint.ex +40 -0
- package/templates/elixir/lib/bd_starter_web/live/chat_live.ex +113 -0
- package/templates/elixir/lib/bd_starter_web/live/form_live.ex +431 -0
- package/templates/elixir/lib/bd_starter_web/live/quiz_live.ex +532 -0
- package/templates/elixir/lib/bd_starter_web/live/sign_in_live.ex +533 -0
- package/templates/elixir/lib/bd_starter_web/money.ex +50 -0
- package/templates/elixir/lib/bd_starter_web/plugs/cache_body_reader.ex +33 -0
- package/templates/elixir/lib/bd_starter_web/router.ex +110 -0
- package/templates/elixir/lib/bd_starter_web.ex +75 -0
- package/templates/elixir/mix.exs +42 -0
- package/templates/elixir/package.json +20 -0
- package/templates/elixir/pnpm-lock.yaml +347 -0
- package/templates/elixir/priv/forms/demo-form.json +283 -0
- package/templates/elixir/priv/forms/demo-quiz.json +97 -0
- package/templates/elixir/priv/static/assets/app.css +113 -0
- package/templates/elixir/priv/static/bd-sign-in.css +51 -0
- package/templates/elixir/priv/static/forms.css +1153 -0
- package/templates/elixir/test/fixtures/forms-parity.json +3806 -0
- package/templates/elixir/test/fixtures/quiz-parity.json +9937 -0
- package/templates/elixir/test/form_controller_test.exs +314 -0
- package/templates/elixir/test/forms_parity_test.exs +206 -0
- package/templates/elixir/test/quiz_parity_test.exs +243 -0
- package/templates/elixir/test/support/parity.ex +46 -0
- package/templates/elixir/test/test_helper.exs +1 -0
- package/templates/elixir/tsconfig.json +19 -0
- package/templates/flutter/README.md +321 -0
- package/templates/flutter/_gitignore +9 -0
- package/templates/flutter/analysis_options.yaml +8 -0
- package/templates/flutter/bd-records/README.md +50 -0
- package/templates/flutter/bd-records/todo-images.json +14 -0
- package/templates/flutter/bd-records/todos.json +20 -0
- package/templates/flutter/bd.config.ts +331 -0
- package/templates/flutter/bd.data-model.config.ts +89 -0
- package/templates/flutter/lib/forms/demo_form.dart +289 -0
- package/templates/flutter/lib/forms/demo_quiz.dart +104 -0
- package/templates/flutter/lib/forms/form_hooks.dart +147 -0
- package/templates/flutter/lib/main.dart +120 -0
- package/templates/flutter/lib/ui/account_page.dart +153 -0
- package/templates/flutter/lib/ui/bd_scope.dart +39 -0
- package/templates/flutter/lib/ui/cart_page.dart +102 -0
- package/templates/flutter/lib/ui/chat_page.dart +111 -0
- package/templates/flutter/lib/ui/form_page.dart +50 -0
- package/templates/flutter/lib/ui/load_state.dart +62 -0
- package/templates/flutter/lib/ui/product_page.dart +71 -0
- package/templates/flutter/lib/ui/quiz_page.dart +83 -0
- package/templates/flutter/lib/ui/storefront_page.dart +85 -0
- package/templates/flutter/package.json +20 -0
- package/templates/flutter/packages/businessdash_forms/analysis_options.yaml +8 -0
- package/templates/flutter/packages/businessdash_forms/lib/businessdash_forms.dart +47 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/controls/choice.dart +865 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/controls/dates.dart +527 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/controls/media.dart +507 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/controls/static.dart +302 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/controls/text.dart +537 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/form.dart +781 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/icons.dart +398 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/logic.dart +719 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/primitives.dart +1223 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/quiz.dart +1225 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/sign_in.dart +570 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/sign_in_core.dart +1069 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/style.dart +497 -0
- package/templates/flutter/packages/businessdash_forms/lib/src/tree.dart +491 -0
- package/templates/flutter/packages/businessdash_forms/pubspec.yaml +34 -0
- package/templates/flutter/packages/businessdash_forms/test/form_widget_test.dart +358 -0
- package/templates/flutter/packages/businessdash_forms/test/logic_test.dart +207 -0
- package/templates/flutter/packages/businessdash_forms/test/quiz_widget_test.dart +221 -0
- package/templates/flutter/packages/businessdash_forms/test/sign_in_test.dart +279 -0
- package/templates/flutter/packages/businessdash_sdk/CHANGELOG.md +66 -0
- package/templates/flutter/packages/businessdash_sdk/LICENSE +21 -0
- package/templates/flutter/packages/businessdash_sdk/analysis_options.yaml +6 -0
- package/templates/flutter/packages/businessdash_sdk/lib/businessdash_sdk.dart +21 -0
- package/templates/flutter/packages/businessdash_sdk/lib/forms.dart +29 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/bundle.dart +34 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/chat.dart +122 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/client.dart +161 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/customer_account.dart +31 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/donations.dart +179 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/errors.dart +82 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/backend.dart +488 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/calculation.dart +172 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/controller.dart +1004 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/dates.dart +173 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/forms_data.generated.dart +405 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/formula.dart +920 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/json.dart +462 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz.dart +1185 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_backend.dart +382 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_controller.dart +277 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_page.dart +148 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_scoring.dart +550 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_screen.dart +388 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_words.dart +280 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/rules.dart +1268 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/schema.dart +1114 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/forms/units.dart +105 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/models.dart +311 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/money.dart +38 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/portal.dart +227 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/resources.dart +164 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/scheduling.dart +135 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/seo.dart +144 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/social_platforms.generated.dart +45 -0
- package/templates/flutter/packages/businessdash_sdk/lib/src/socials.dart +88 -0
- package/templates/flutter/packages/businessdash_sdk/pubspec.yaml +23 -0
- package/templates/flutter/packages/businessdash_sdk/test/bd_test.dart +335 -0
- package/templates/flutter/packages/businessdash_sdk/test/fixtures/forms-parity.json +3806 -0
- package/templates/flutter/packages/businessdash_sdk/test/fixtures/quiz-parity.json +9937 -0
- package/templates/flutter/packages/businessdash_sdk/test/form_controller_test.dart +449 -0
- package/templates/flutter/packages/businessdash_sdk/test/forms_parity_test.dart +254 -0
- package/templates/flutter/packages/businessdash_sdk/test/quiz_controller_test.dart +390 -0
- package/templates/flutter/packages/businessdash_sdk/test/quiz_parity_test.dart +269 -0
- package/templates/flutter/pnpm-lock.yaml +347 -0
- package/templates/flutter/pubspec.yaml +33 -0
- package/templates/flutter/tsconfig.json +19 -0
- package/templates/htmx/.env.example +59 -0
- package/templates/htmx/README.md +446 -0
- package/templates/htmx/_gitignore +7 -0
- package/templates/htmx/bd.config.ts +331 -0
- package/templates/htmx/bd.data-model.config.ts +89 -0
- package/templates/htmx/package.json +27 -0
- package/templates/htmx/pnpm-lock.yaml +97 -0
- package/templates/htmx/public/forms.css +1134 -0
- package/templates/htmx/public/index.html +68 -0
- package/templates/htmx/public/styles.css +1078 -0
- package/templates/htmx/server.ts +387 -0
- package/templates/htmx/src/bd.ts +142 -0
- package/templates/htmx/src/cache.ts +45 -0
- package/templates/htmx/src/form-pages.ts +35 -0
- package/templates/htmx/src/form.ts +955 -0
- package/templates/htmx/src/forms/demo-form.json +283 -0
- package/templates/htmx/src/forms/demo-quiz.json +97 -0
- package/templates/htmx/src/html.ts +55 -0
- package/templates/htmx/src/layout.ts +232 -0
- package/templates/htmx/src/pages.ts +975 -0
- package/templates/htmx/src/quiz.ts +582 -0
- package/templates/htmx/src/sections/about.ts +63 -0
- package/templates/htmx/src/sections/blog.ts +53 -0
- package/templates/htmx/src/sections/header.ts +42 -0
- package/templates/htmx/src/sections/hero.ts +48 -0
- package/templates/htmx/src/sections/services.ts +71 -0
- package/templates/htmx/src/sections/subscribe.ts +141 -0
- package/templates/htmx/src/sign-in.ts +636 -0
- package/templates/htmx/tsconfig.json +19 -0
- package/templates/kotlin/README.md +318 -0
- package/templates/kotlin/_gitignore +12 -0
- package/templates/kotlin/app/build.gradle.kts +70 -0
- package/templates/kotlin/app/src/main/AndroidManifest.xml +21 -0
- package/templates/kotlin/app/src/main/assets/bd-demo-form.json +283 -0
- package/templates/kotlin/app/src/main/assets/bd-demo-quiz.json +97 -0
- package/templates/kotlin/app/src/main/kotlin/app/bdstarter/AccountScreen.kt +209 -0
- package/templates/kotlin/app/src/main/kotlin/app/bdstarter/BdApp.kt +68 -0
- package/templates/kotlin/app/src/main/kotlin/app/bdstarter/DemoFormsBackend.kt +52 -0
- package/templates/kotlin/app/src/main/kotlin/app/bdstarter/FormScreen.kt +37 -0
- package/templates/kotlin/app/src/main/kotlin/app/bdstarter/MainActivity.kt +186 -0
- package/templates/kotlin/app/src/main/kotlin/app/bdstarter/QuizScreen.kt +75 -0
- package/templates/kotlin/app/src/main/kotlin/app/bdstarter/SessionStore.kt +68 -0
- package/templates/kotlin/app/src/main/kotlin/app/bdstarter/ShopViewModel.kt +73 -0
- package/templates/kotlin/app/src/main/res/values/strings.xml +4 -0
- package/templates/kotlin/app/src/main/res/values/themes.xml +5 -0
- package/templates/kotlin/app/src/main/res/values-night/themes.xml +4 -0
- package/templates/kotlin/bd/LICENSE +21 -0
- package/templates/kotlin/bd/README.md +31 -0
- package/templates/kotlin/bd/build.gradle.kts +126 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Auth.kt +58 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/BdClient.kt +166 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/BdError.kt +62 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Bundle.kt +52 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/ChatFeed.kt +82 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/DataModel.kt +95 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Donations.kt +111 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Models.kt +271 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Money.kt +48 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Portal.kt +250 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Resources.kt +129 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Scheduling.kt +134 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Seo.kt +120 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/SocialPlatforms.generated.kt +46 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/Socials.kt +79 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdCalculation.kt +157 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdDates.kt +108 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormController.kt +770 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormRules.kt +1149 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormSchema.kt +528 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormsBackend.kt +392 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormula.kt +767 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdJson.kt +294 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizBackend.kt +310 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizController.kt +281 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizEngine.kt +578 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizPage.kt +128 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizScoring.kt +386 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizScreen.kt +477 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizWords.kt +196 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdUnits.kt +84 -0
- package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/FormsData.generated.kt +292 -0
- package/templates/kotlin/bd/src/test/kotlin/app/bd/BdClientTest.kt +278 -0
- package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/FormControllerTest.kt +294 -0
- package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/FormsBackendPathTest.kt +27 -0
- package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/FormsParityTest.kt +233 -0
- package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/PackageFormsBackendTest.kt +123 -0
- package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/QuizControllerTest.kt +359 -0
- package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/QuizParityTest.kt +260 -0
- package/templates/kotlin/bd/src/test/resources/forms-parity.json +3806 -0
- package/templates/kotlin/bd/src/test/resources/quiz-parity.json +9937 -0
- package/templates/kotlin/bd-forms/build.gradle.kts +51 -0
- package/templates/kotlin/bd-forms/src/main/AndroidManifest.xml +5 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdChoiceControls.kt +651 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdDateControls.kt +470 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdFieldControl.kt +520 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdFieldTree.kt +328 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdForm.kt +573 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdFormStyle.kt +279 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdHtml.kt +438 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdIcon.kt +282 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdMediaControls.kt +412 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdQuiz.kt +896 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdStaticViews.kt +250 -0
- package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdTextControls.kt +409 -0
- package/templates/kotlin/bd-forms/src/test/kotlin/app/bd/forms/ui/RendererLogicTest.kt +177 -0
- package/templates/kotlin/bd-records/README.md +50 -0
- package/templates/kotlin/bd-records/todo-images.json +14 -0
- package/templates/kotlin/bd-records/todos.json +20 -0
- package/templates/kotlin/bd-sign-in/build.gradle.kts +49 -0
- package/templates/kotlin/bd-sign-in/src/main/AndroidManifest.xml +27 -0
- package/templates/kotlin/bd-sign-in/src/main/kotlin/app/bd/signin/BdSignIn.kt +713 -0
- package/templates/kotlin/bd-sign-in/src/main/kotlin/app/bd/signin/BdSignInBackend.kt +291 -0
- package/templates/kotlin/bd-sign-in/src/main/kotlin/app/bd/signin/BdSignInChecks.kt +162 -0
- package/templates/kotlin/bd-sign-in/src/main/kotlin/app/bd/signin/BdSignInOAuth.kt +95 -0
- package/templates/kotlin/bd-sign-in/src/test/kotlin/app/bd/signin/BdSignInChecksTest.kt +64 -0
- package/templates/kotlin/bd.config.ts +331 -0
- package/templates/kotlin/bd.data-model.config.ts +89 -0
- package/templates/kotlin/build.gradle.kts +8 -0
- package/templates/kotlin/gradle/libs.versions.toml +38 -0
- package/templates/kotlin/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/templates/kotlin/gradle/wrapper/gradle-wrapper.properties +10 -0
- package/templates/kotlin/gradle.properties +8 -0
- package/templates/kotlin/gradlew +248 -0
- package/templates/kotlin/gradlew.bat +112 -0
- package/templates/kotlin/local.properties.example +30 -0
- package/templates/kotlin/package.json +20 -0
- package/templates/kotlin/pnpm-lock.yaml +347 -0
- package/templates/kotlin/settings.gradle.kts +39 -0
- package/templates/kotlin/tsconfig.json +19 -0
- package/templates/laravel/.env.example +76 -0
- package/templates/laravel/README.md +316 -0
- package/templates/laravel/_gitignore +28 -0
- package/templates/laravel/app/Bd/Auth.php +181 -0
- package/templates/laravel/app/Bd/Bd.php +131 -0
- package/templates/laravel/app/Bd/BdAccessRejectedException.php +29 -0
- package/templates/laravel/app/Bd/BdApiException.php +18 -0
- package/templates/laravel/app/Bd/Client.php +358 -0
- package/templates/laravel/app/Bd/CustomerAnswer.php +58 -0
- package/templates/laravel/app/Bd/CustomerAuth.php +93 -0
- package/templates/laravel/app/Bd/Forms/Backend.php +35 -0
- package/templates/laravel/app/Bd/Forms/Calculation.php +179 -0
- package/templates/laravel/app/Bd/Forms/Dates.php +91 -0
- package/templates/laravel/app/Bd/Forms/Field.php +274 -0
- package/templates/laravel/app/Bd/Forms/FieldPath.php +36 -0
- package/templates/laravel/app/Bd/Forms/FormController.php +730 -0
- package/templates/laravel/app/Bd/Forms/FormView.php +307 -0
- package/templates/laravel/app/Bd/Forms/Forms.php +39 -0
- package/templates/laravel/app/Bd/Forms/FormsData.php +298 -0
- package/templates/laravel/app/Bd/Forms/FormsError.php +12 -0
- package/templates/laravel/app/Bd/Forms/Formula.php +696 -0
- package/templates/laravel/app/Bd/Forms/FormulaError.php +6 -0
- package/templates/laravel/app/Bd/Forms/FormulaParser.php +223 -0
- package/templates/laravel/app/Bd/Forms/Js.php +300 -0
- package/templates/laravel/app/Bd/Forms/Json.php +254 -0
- package/templates/laravel/app/Bd/Forms/Messages.php +89 -0
- package/templates/laravel/app/Bd/Forms/PackageBackend.php +181 -0
- package/templates/laravel/app/Bd/Forms/PickedFile.php +25 -0
- package/templates/laravel/app/Bd/Forms/QuizArrange.php +144 -0
- package/templates/laravel/app/Bd/Forms/QuizBackend.php +26 -0
- package/templates/laravel/app/Bd/Forms/QuizConfig.php +65 -0
- package/templates/laravel/app/Bd/Forms/QuizController.php +232 -0
- package/templates/laravel/app/Bd/Forms/QuizEngine.php +712 -0
- package/templates/laravel/app/Bd/Forms/QuizOptions.php +109 -0
- package/templates/laravel/app/Bd/Forms/QuizPage.php +99 -0
- package/templates/laravel/app/Bd/Forms/QuizScoring.php +459 -0
- package/templates/laravel/app/Bd/Forms/QuizState.php +96 -0
- package/templates/laravel/app/Bd/Forms/QuizWords.php +188 -0
- package/templates/laravel/app/Bd/Forms/Quizzes.php +123 -0
- package/templates/laravel/app/Bd/Forms/Rules.php +1593 -0
- package/templates/laravel/app/Bd/Forms/SampleBackend.php +48 -0
- package/templates/laravel/app/Bd/Forms/Schema.php +76 -0
- package/templates/laravel/app/Bd/Forms/Submission.php +33 -0
- package/templates/laravel/app/Bd/Forms/SubmitOptions.php +19 -0
- package/templates/laravel/app/Bd/Forms/SubmitResult.php +69 -0
- package/templates/laravel/app/Bd/Forms/Undefined.php +28 -0
- package/templates/laravel/app/Bd/Forms/Units.php +113 -0
- package/templates/laravel/app/Bd/Resources/Blog.php +50 -0
- package/templates/laravel/app/Bd/Resources/Cart.php +81 -0
- package/templates/laravel/app/Bd/Resources/Chatbot.php +117 -0
- package/templates/laravel/app/Bd/Resources/Checkout.php +51 -0
- package/templates/laravel/app/Bd/Resources/DataModel.php +61 -0
- package/templates/laravel/app/Bd/Resources/Donations.php +74 -0
- package/templates/laravel/app/Bd/Resources/Followers.php +48 -0
- package/templates/laravel/app/Bd/Resources/Forms.php +52 -0
- package/templates/laravel/app/Bd/Resources/Marketing.php +47 -0
- package/templates/laravel/app/Bd/Resources/Notifications.php +130 -0
- package/templates/laravel/app/Bd/Resources/ParallelPages.php +45 -0
- package/templates/laravel/app/Bd/Resources/Portal.php +241 -0
- package/templates/laravel/app/Bd/Resources/Reviews.php +22 -0
- package/templates/laravel/app/Bd/Resources/Scheduling.php +170 -0
- package/templates/laravel/app/Bd/Resources/Storefront.php +89 -0
- package/templates/laravel/app/Bd/Resources/Subscriptions.php +34 -0
- package/templates/laravel/app/Bd/Seo.php +167 -0
- package/templates/laravel/app/Bd/SignInCore.php +276 -0
- package/templates/laravel/app/Bd/SocialPlatforms.php +45 -0
- package/templates/laravel/app/Bd/Socials.php +118 -0
- package/templates/laravel/app/Bd/Webhook.php +93 -0
- package/templates/laravel/app/Http/Controllers/BdAuthController.php +146 -0
- package/templates/laravel/app/Http/Controllers/BdCustomerAuthController.php +214 -0
- package/templates/laravel/app/Http/Controllers/BlogController.php +49 -0
- package/templates/laravel/app/Http/Controllers/CartController.php +183 -0
- package/templates/laravel/app/Http/Controllers/Controller.php +8 -0
- package/templates/laravel/app/Http/Controllers/FormPageController.php +55 -0
- package/templates/laravel/app/Http/Controllers/HomeController.php +104 -0
- package/templates/laravel/app/Http/Controllers/PortalController.php +95 -0
- package/templates/laravel/app/Http/Controllers/SeoController.php +103 -0
- package/templates/laravel/app/Http/Controllers/ServiceAreaController.php +56 -0
- package/templates/laravel/app/Http/Controllers/StoreController.php +78 -0
- package/templates/laravel/app/Http/Controllers/SubscriptionController.php +40 -0
- package/templates/laravel/app/Http/Controllers/TodosController.php +87 -0
- package/templates/laravel/app/Http/Controllers/WebhookController.php +44 -0
- package/templates/laravel/app/Livewire/BdForm.php +508 -0
- package/templates/laravel/app/Livewire/BdQuiz.php +429 -0
- package/templates/laravel/app/Livewire/SignIn.php +449 -0
- package/templates/laravel/app/Support/Money.php +54 -0
- package/templates/laravel/app/Support/PhpSecurity.php +94 -0
- package/templates/laravel/artisan +16 -0
- package/templates/laravel/bd-records/README.md +50 -0
- package/templates/laravel/bd-records/todo-images.json +14 -0
- package/templates/laravel/bd-records/todos.json +20 -0
- package/templates/laravel/bd.config.ts +331 -0
- package/templates/laravel/bd.data-model.config.ts +89 -0
- package/templates/laravel/bootstrap/app.php +33 -0
- package/templates/laravel/bootstrap/cache/.gitkeep +0 -0
- package/templates/laravel/composer.json +47 -0
- package/templates/laravel/config/bd.php +75 -0
- package/templates/laravel/package.json +20 -0
- package/templates/laravel/phpunit.xml +22 -0
- package/templates/laravel/pnpm-lock.yaml +347 -0
- package/templates/laravel/public/bd-sign-in.css +48 -0
- package/templates/laravel/public/forms.css +1153 -0
- package/templates/laravel/public/index.php +17 -0
- package/templates/laravel/public/styles.css +100 -0
- package/templates/laravel/resources/forms/demo-form.json +283 -0
- package/templates/laravel/resources/forms/demo-quiz.json +97 -0
- package/templates/laravel/resources/views/forms/control.blade.php +238 -0
- package/templates/laravel/resources/views/forms/field.blade.php +39 -0
- package/templates/laravel/resources/views/forms/files.blade.php +36 -0
- package/templates/laravel/resources/views/forms/pair.blade.php +6 -0
- package/templates/laravel/resources/views/forms/repeater.blade.php +16 -0
- package/templates/laravel/resources/views/forms/styles.blade.php +8 -0
- package/templates/laravel/resources/views/forms/tree.blade.php +58 -0
- package/templates/laravel/resources/views/layout.blade.php +94 -0
- package/templates/laravel/resources/views/livewire/bd-form.blade.php +103 -0
- package/templates/laravel/resources/views/livewire/bd-quiz.blade.php +101 -0
- package/templates/laravel/resources/views/livewire/sign-in.blade.php +82 -0
- package/templates/laravel/resources/views/pages/blog-post.blade.php +24 -0
- package/templates/laravel/resources/views/pages/blog.blade.php +15 -0
- package/templates/laravel/resources/views/pages/cart.blade.php +41 -0
- package/templates/laravel/resources/views/pages/delete-account.blade.php +26 -0
- package/templates/laravel/resources/views/pages/form.blade.php +10 -0
- package/templates/laravel/resources/views/pages/home.blade.php +73 -0
- package/templates/laravel/resources/views/pages/my-account.blade.php +40 -0
- package/templates/laravel/resources/views/pages/product.blade.php +39 -0
- package/templates/laravel/resources/views/pages/quiz.blade.php +12 -0
- package/templates/laravel/resources/views/pages/reviews.blade.php +17 -0
- package/templates/laravel/resources/views/pages/service-area.blade.php +14 -0
- package/templates/laravel/resources/views/pages/services.blade.php +20 -0
- package/templates/laravel/resources/views/pages/sign-in.blade.php +30 -0
- package/templates/laravel/resources/views/pages/store.blade.php +35 -0
- package/templates/laravel/resources/views/pages/subscriptions.blade.php +19 -0
- package/templates/laravel/resources/views/pages/todos.blade.php +45 -0
- package/templates/laravel/resources/views/pages/updates.blade.php +13 -0
- package/templates/laravel/resources/views/quiz/actions.blade.php +14 -0
- package/templates/laravel/resources/views/quiz/error.blade.php +3 -0
- package/templates/laravel/resources/views/quiz/feedback.blade.php +19 -0
- package/templates/laravel/resources/views/quiz/header.blade.php +10 -0
- package/templates/laravel/resources/views/quiz/question.blade.php +55 -0
- package/templates/laravel/routes/web.php +97 -0
- package/templates/laravel/storage/framework/cache/.gitkeep +0 -0
- package/templates/laravel/storage/framework/sessions/.gitkeep +0 -0
- package/templates/laravel/storage/framework/views/.gitkeep +0 -0
- package/templates/laravel/storage/logs/.gitkeep +0 -0
- package/templates/laravel/tests/Fixtures/forms-parity.json +3806 -0
- package/templates/laravel/tests/Fixtures/quiz-parity.json +9937 -0
- package/templates/laravel/tests/Unit/FormControllerTest.php +310 -0
- package/templates/laravel/tests/Unit/FormsParityTest.php +314 -0
- package/templates/laravel/tests/Unit/PhpSecurityTest.php +38 -0
- package/templates/laravel/tests/Unit/QuizParityTest.php +303 -0
- package/templates/laravel/tsconfig.json +19 -0
- package/templates/nuxt/.env.example +47 -0
- package/templates/nuxt/README.md +446 -0
- package/templates/nuxt/_gitignore +10 -0
- package/templates/nuxt/app/app.vue +28 -0
- package/templates/nuxt/app/assets/css/bd-tokens.css +944 -0
- package/templates/nuxt/app/components/bd/About.vue +34 -0
- package/templates/nuxt/app/components/bd/BdFooter.vue +22 -0
- package/templates/nuxt/app/components/bd/BdHeader.vue +25 -0
- package/templates/nuxt/app/components/bd/Blog.vue +43 -0
- package/templates/nuxt/app/components/bd/Booking.vue +235 -0
- package/templates/nuxt/app/components/bd/ContactForm.vue +111 -0
- package/templates/nuxt/app/components/bd/Gallery.vue +46 -0
- package/templates/nuxt/app/components/bd/Hero.vue +14 -0
- package/templates/nuxt/app/components/bd/NewsBanner.vue +44 -0
- package/templates/nuxt/app/components/bd/NotFoundBody.vue +22 -0
- package/templates/nuxt/app/components/bd/ReviewForm.vue +106 -0
- package/templates/nuxt/app/components/bd/SdkSetupBanner.vue +111 -0
- package/templates/nuxt/app/components/bd/Services.vue +34 -0
- package/templates/nuxt/app/components/bd/Subscribe.vue +205 -0
- package/templates/nuxt/app/composables/useCart.ts +83 -0
- package/templates/nuxt/app/pages/[...slug].vue +52 -0
- package/templates/nuxt/app/pages/cart.vue +194 -0
- package/templates/nuxt/app/pages/index.vue +58 -0
- package/templates/nuxt/app/pages/my-account.vue +207 -0
- package/templates/nuxt/app/pages/reviews.vue +104 -0
- package/templates/nuxt/app/pages/services/[service]/[area].vue +85 -0
- package/templates/nuxt/app/pages/services/index.vue +57 -0
- package/templates/nuxt/app/pages/store/[id].vue +128 -0
- package/templates/nuxt/app/pages/store/index.vue +73 -0
- package/templates/nuxt/app/pages/subscriptions.vue +117 -0
- package/templates/nuxt/app/pages/todos.vue +222 -0
- package/templates/nuxt/app/pages/updates.vue +78 -0
- package/templates/nuxt/bd.config.ts +331 -0
- package/templates/nuxt/bd.data-model.config.ts +89 -0
- package/templates/nuxt/nuxt.config.ts +78 -0
- package/templates/nuxt/package.json +35 -0
- package/templates/nuxt/pnpm-lock.yaml +6211 -0
- package/templates/nuxt/public/favicon.ico +0 -0
- package/templates/nuxt/server/api/bd/cart/add.post.ts +21 -0
- package/templates/nuxt/server/api/bd/cart/clear.post.ts +10 -0
- package/templates/nuxt/server/api/bd/cart/coupon.post.ts +15 -0
- package/templates/nuxt/server/api/bd/cart/index.get.ts +25 -0
- package/templates/nuxt/server/api/bd/cart/remove.post.ts +10 -0
- package/templates/nuxt/server/api/bd/cart/update.post.ts +13 -0
- package/templates/nuxt/server/api/bd/checkout/start.post.ts +35 -0
- package/templates/nuxt/server/api/bd/forms/[slug].post.ts +37 -0
- package/templates/nuxt/server/api/bd/home.get.ts +284 -0
- package/templates/nuxt/server/api/bd/jsonld.get.ts +42 -0
- package/templates/nuxt/server/api/bd/legal.get.ts +30 -0
- package/templates/nuxt/server/api/bd/parallel/render.get.ts +53 -0
- package/templates/nuxt/server/api/bd/parallel/variants.get.ts +27 -0
- package/templates/nuxt/server/api/bd/portal/context.get.ts +76 -0
- package/templates/nuxt/server/api/bd/portal/plan.post.ts +27 -0
- package/templates/nuxt/server/api/bd/portal/submit-review.post.ts +53 -0
- package/templates/nuxt/server/api/bd/revalidate.post.ts +38 -0
- package/templates/nuxt/server/api/bd/reviews.get.ts +44 -0
- package/templates/nuxt/server/api/bd/scheduling/bookings.post.ts +40 -0
- package/templates/nuxt/server/api/bd/scheduling/slots.get.ts +37 -0
- package/templates/nuxt/server/api/bd/store/product/[id].get.ts +39 -0
- package/templates/nuxt/server/api/bd/store/products-meta.get.ts +101 -0
- package/templates/nuxt/server/api/bd/store/products.get.ts +53 -0
- package/templates/nuxt/server/api/bd/store/subscriptions/[id]/checkout.post.ts +36 -0
- package/templates/nuxt/server/api/bd/store/subscriptions.get.ts +42 -0
- package/templates/nuxt/server/api/bd/todos.get.ts +111 -0
- package/templates/nuxt/server/api/bd-auth/[...slug].ts +57 -0
- package/templates/nuxt/server/api/mcp.get.ts +14 -0
- package/templates/nuxt/server/api/mcp.post.ts +37 -0
- package/templates/nuxt/server/routes/.well-known/mcp.json.ts +31 -0
- package/templates/nuxt/server/routes/llms.txt.ts +43 -0
- package/templates/nuxt/server/routes/robots.txt.ts +38 -0
- package/templates/nuxt/server/routes/sitemap.xml.ts +60 -0
- package/templates/nuxt/server/utils/bd-cart.ts +73 -0
- package/templates/nuxt/server/utils/bd-env.ts +54 -0
- package/templates/nuxt/server/utils/bd-portal.ts +151 -0
- package/templates/nuxt/server/utils/bd.ts +36 -0
- package/templates/nuxt/tsconfig.json +18 -0
- package/templates/qwik/.env.example +48 -0
- package/templates/qwik/.prettierignore +37 -0
- package/templates/qwik/.vscode/launch.json +24 -0
- package/templates/qwik/.vscode/qwik-city.code-snippets +36 -0
- package/templates/qwik/.vscode/qwik.code-snippets +78 -0
- package/templates/qwik/README.md +436 -0
- package/templates/qwik/_gitignore +42 -0
- package/templates/qwik/bd.config.ts +331 -0
- package/templates/qwik/bd.data-model.config.ts +90 -0
- package/templates/qwik/eslint.config.js +76 -0
- package/templates/qwik/package.json +58 -0
- package/templates/qwik/pnpm-lock.yaml +4928 -0
- package/templates/qwik/public/favicon.svg +1 -0
- package/templates/qwik/public/manifest.json +9 -0
- package/templates/qwik/public/robots.txt +0 -0
- package/templates/qwik/qwik.env.d.ts +4 -0
- package/templates/qwik/src/components/bd/About.tsx +26 -0
- package/templates/qwik/src/components/bd/Banner.tsx +46 -0
- package/templates/qwik/src/components/bd/Blog.tsx +53 -0
- package/templates/qwik/src/components/bd/Booking.tsx +296 -0
- package/templates/qwik/src/components/bd/ContactForm.tsx +100 -0
- package/templates/qwik/src/components/bd/Footer.tsx +28 -0
- package/templates/qwik/src/components/bd/Gallery.tsx +53 -0
- package/templates/qwik/src/components/bd/Header.tsx +18 -0
- package/templates/qwik/src/components/bd/Hero.tsx +21 -0
- package/templates/qwik/src/components/bd/SdkSetupBanner.tsx +115 -0
- package/templates/qwik/src/components/bd/Services.tsx +38 -0
- package/templates/qwik/src/components/bd/SiteHeader.tsx +49 -0
- package/templates/qwik/src/components/bd/Stars.tsx +46 -0
- package/templates/qwik/src/components/bd/Subscribe.tsx +175 -0
- package/templates/qwik/src/components/router-head/router-head.tsx +48 -0
- package/templates/qwik/src/entry.dev.tsx +17 -0
- package/templates/qwik/src/entry.preview.tsx +21 -0
- package/templates/qwik/src/entry.ssr.tsx +31 -0
- package/templates/qwik/src/global.css +875 -0
- package/templates/qwik/src/lib/bd-content.ts +143 -0
- package/templates/qwik/src/lib/bd-distribution.ts +25 -0
- package/templates/qwik/src/lib/bd-portal.ts +181 -0
- package/templates/qwik/src/lib/bd-store.ts +308 -0
- package/templates/qwik/src/lib/bd-todos.ts +137 -0
- package/templates/qwik/src/lib/bd.ts +42 -0
- package/templates/qwik/src/root.tsx +38 -0
- package/templates/qwik/src/routes/.well-known/mcp.json/index.ts +19 -0
- package/templates/qwik/src/routes/[...slug]/index.tsx +85 -0
- package/templates/qwik/src/routes/ai/product-feed/index.ts +24 -0
- package/templates/qwik/src/routes/api/bd/revalidate/index.ts +45 -0
- package/templates/qwik/src/routes/api/bd-auth/[...slug]/index.ts +77 -0
- package/templates/qwik/src/routes/api/mcp/index.ts +38 -0
- package/templates/qwik/src/routes/cart/index.tsx +254 -0
- package/templates/qwik/src/routes/index.tsx +239 -0
- package/templates/qwik/src/routes/llms.txt/index.ts +23 -0
- package/templates/qwik/src/routes/my-account/index.tsx +370 -0
- package/templates/qwik/src/routes/reviews/index.tsx +147 -0
- package/templates/qwik/src/routes/robots.txt/index.ts +70 -0
- package/templates/qwik/src/routes/services/[service]/[area]/index.tsx +115 -0
- package/templates/qwik/src/routes/services/index.tsx +99 -0
- package/templates/qwik/src/routes/sitemap.xml/index.ts +62 -0
- package/templates/qwik/src/routes/store/[id]/index.tsx +362 -0
- package/templates/qwik/src/routes/store/index.tsx +436 -0
- package/templates/qwik/src/routes/store/order/index.tsx +74 -0
- package/templates/qwik/src/routes/subscriptions/index.tsx +164 -0
- package/templates/qwik/src/routes/todos/index.tsx +202 -0
- package/templates/qwik/src/routes/updates/index.tsx +106 -0
- package/templates/qwik/tsconfig.json +26 -0
- package/templates/qwik/vite.config.ts +115 -0
- package/templates/react-bun/.env.example +65 -0
- package/templates/react-bun/README.md +354 -0
- package/templates/react-bun/_gitignore +24 -0
- package/templates/react-bun/bd.config.ts +331 -0
- package/templates/react-bun/bd.data-model.config.ts +90 -0
- package/templates/react-bun/eslint.config.js +22 -0
- package/templates/react-bun/index.html +13 -0
- package/templates/react-bun/package.json +46 -0
- package/templates/react-bun/pnpm-lock.yaml +2060 -0
- package/templates/react-bun/public/favicon.svg +1 -0
- package/templates/react-bun/public/icons.svg +24 -0
- package/templates/react-bun/server.ts +978 -0
- package/templates/react-bun/src/App.css +910 -0
- package/templates/react-bun/src/App.tsx +104 -0
- package/templates/react-bun/src/assets/hero.png +0 -0
- package/templates/react-bun/src/assets/react.svg +1 -0
- package/templates/react-bun/src/assets/vite.svg +1 -0
- package/templates/react-bun/src/components/About.tsx +46 -0
- package/templates/react-bun/src/components/Banner.tsx +53 -0
- package/templates/react-bun/src/components/Blog.tsx +84 -0
- package/templates/react-bun/src/components/Booking.tsx +278 -0
- package/templates/react-bun/src/components/ContactForm.tsx +47 -0
- package/templates/react-bun/src/components/Footer.tsx +24 -0
- package/templates/react-bun/src/components/Gallery.tsx +83 -0
- package/templates/react-bun/src/components/Header.tsx +27 -0
- package/templates/react-bun/src/components/Hero.tsx +65 -0
- package/templates/react-bun/src/components/SdkSetupBanner.tsx +102 -0
- package/templates/react-bun/src/components/Services.tsx +92 -0
- package/templates/react-bun/src/components/Subscribe.tsx +169 -0
- package/templates/react-bun/src/index.css +302 -0
- package/templates/react-bun/src/lib/bd.ts +370 -0
- package/templates/react-bun/src/lib/router.tsx +54 -0
- package/templates/react-bun/src/main.tsx +14 -0
- package/templates/react-bun/src/pages/Cart.tsx +144 -0
- package/templates/react-bun/src/pages/MyAccount.tsx +207 -0
- package/templates/react-bun/src/pages/Product.tsx +220 -0
- package/templates/react-bun/src/pages/Reviews.tsx +73 -0
- package/templates/react-bun/src/pages/ServiceArea.tsx +41 -0
- package/templates/react-bun/src/pages/ServiceAreas.tsx +31 -0
- package/templates/react-bun/src/pages/Store.tsx +274 -0
- package/templates/react-bun/src/pages/Subscriptions.tsx +70 -0
- package/templates/react-bun/src/pages/Todos.tsx +147 -0
- package/templates/react-bun/src/pages/Updates.tsx +53 -0
- package/templates/react-bun/src/pages/ui.tsx +52 -0
- package/templates/react-bun/tsconfig.app.json +25 -0
- package/templates/react-bun/tsconfig.json +7 -0
- package/templates/react-bun/tsconfig.node.json +24 -0
- package/templates/react-bun/vite.config.ts +41 -0
- package/templates/react-native/.env.example +32 -0
- package/templates/react-native/README.md +299 -0
- package/templates/react-native/SECURITY-NOTES.md +22 -0
- package/templates/react-native/_gitignore +21 -0
- package/templates/react-native/app/(tabs)/_layout.tsx +13 -0
- package/templates/react-native/app/(tabs)/account.tsx +116 -0
- package/templates/react-native/app/(tabs)/cart.tsx +79 -0
- package/templates/react-native/app/(tabs)/chat.tsx +58 -0
- package/templates/react-native/app/(tabs)/form.tsx +41 -0
- package/templates/react-native/app/(tabs)/index.tsx +74 -0
- package/templates/react-native/app/_layout.tsx +19 -0
- package/templates/react-native/app/product/[id].tsx +78 -0
- package/templates/react-native/app.json +15 -0
- package/templates/react-native/bd-records/README.md +50 -0
- package/templates/react-native/bd-records/todo-images.json +14 -0
- package/templates/react-native/bd-records/todos.json +20 -0
- package/templates/react-native/bd.config.ts +331 -0
- package/templates/react-native/bd.data-model.config.ts +89 -0
- package/templates/react-native/metro.config.js +16 -0
- package/templates/react-native/package.json +51 -0
- package/templates/react-native/pnpm-lock.yaml +5967 -0
- package/templates/react-native/src/bd/auth.ts +152 -0
- package/templates/react-native/src/bd/client.ts +103 -0
- package/templates/react-native/src/bd/demo-form.json +283 -0
- package/templates/react-native/src/bd/forms.tsx +148 -0
- package/templates/react-native/src/bd/money.ts +29 -0
- package/templates/react-native/src/bd/session.ts +53 -0
- package/templates/react-native/src/bd/useBd.ts +63 -0
- package/templates/react-native/src/bd/useChat.ts +116 -0
- package/templates/react-native/src/bd-forms/BdForm.tsx +973 -0
- package/templates/react-native/src/bd-forms/__tests__/logic.test.ts +195 -0
- package/templates/react-native/src/bd-forms/controls.tsx +1966 -0
- package/templates/react-native/src/bd-forms/index.ts +34 -0
- package/templates/react-native/src/bd-forms/keyboard.ts +139 -0
- package/templates/react-native/src/bd-forms/logic.ts +737 -0
- package/templates/react-native/src/bd-forms/pickers.tsx +487 -0
- package/templates/react-native/src/bd-forms/primitives.tsx +1162 -0
- package/templates/react-native/src/bd-forms/runtime.ts +95 -0
- package/templates/react-native/src/bd-forms/static.tsx +304 -0
- package/templates/react-native/src/bd-forms/theme.ts +385 -0
- package/templates/react-native/src/components/LoadState.tsx +53 -0
- package/templates/react-native/src/components/SignInScreen.tsx +399 -0
- package/templates/react-native/tsconfig.json +19 -0
- package/templates/remix/.env.example +63 -0
- package/templates/remix/README.md +392 -0
- package/templates/remix/_gitignore +10 -0
- package/templates/remix/app/components/ContactForm.tsx +55 -0
- package/templates/remix/app/components/NewsBanner.tsx +43 -0
- package/templates/remix/app/components/SdkSetupBanner.tsx +96 -0
- package/templates/remix/app/components/SiteHeader.tsx +37 -0
- package/templates/remix/app/components/Subscribe.tsx +138 -0
- package/templates/remix/app/lib/bd-booking.server.ts +90 -0
- package/templates/remix/app/lib/bd-bundle.server.ts +143 -0
- package/templates/remix/app/lib/bd-cache.server.ts +71 -0
- package/templates/remix/app/lib/bd-distribution.server.ts +26 -0
- package/templates/remix/app/lib/bd-pages.server.ts +84 -0
- package/templates/remix/app/lib/bd-portal.server.ts +170 -0
- package/templates/remix/app/lib/bd-seo.server.ts +56 -0
- package/templates/remix/app/lib/bd-store.server.ts +320 -0
- package/templates/remix/app/lib/bd-todos.server.ts +124 -0
- package/templates/remix/app/lib/bd.server.ts +112 -0
- package/templates/remix/app/lib/format.ts +17 -0
- package/templates/remix/app/lib/sdk-sections.server.ts +217 -0
- package/templates/remix/app/root.tsx +73 -0
- package/templates/remix/app/routes/$.tsx +85 -0
- package/templates/remix/app/routes/[.well-known].[mcp.json].ts +19 -0
- package/templates/remix/app/routes/[llms.txt].ts +22 -0
- package/templates/remix/app/routes/[robots.txt].ts +45 -0
- package/templates/remix/app/routes/[sitemap.xml].ts +57 -0
- package/templates/remix/app/routes/_index.tsx +210 -0
- package/templates/remix/app/routes/ai.product-feed.ts +24 -0
- package/templates/remix/app/routes/api.bd-auth.$.ts +47 -0
- package/templates/remix/app/routes/api.bd.forms.ts +53 -0
- package/templates/remix/app/routes/api.bd.revalidate.ts +46 -0
- package/templates/remix/app/routes/api.mcp.ts +38 -0
- package/templates/remix/app/routes/api.reviews.ts +44 -0
- package/templates/remix/app/routes/book.tsx +155 -0
- package/templates/remix/app/routes/my-account.tsx +349 -0
- package/templates/remix/app/routes/reviews.tsx +129 -0
- package/templates/remix/app/routes/services.$service.$area.tsx +80 -0
- package/templates/remix/app/routes/services._index.tsx +51 -0
- package/templates/remix/app/routes/store.$id.tsx +287 -0
- package/templates/remix/app/routes/store._index.tsx +318 -0
- package/templates/remix/app/routes/store.cart.tsx +196 -0
- package/templates/remix/app/routes/store.subscriptions.tsx +122 -0
- package/templates/remix/app/routes/todos.tsx +163 -0
- package/templates/remix/app/routes/updates._index.tsx +70 -0
- package/templates/remix/app/routes.ts +9 -0
- package/templates/remix/app/styles.css +699 -0
- package/templates/remix/bd.config.ts +331 -0
- package/templates/remix/bd.data-model.config.ts +90 -0
- package/templates/remix/package.json +52 -0
- package/templates/remix/pnpm-lock.yaml +2368 -0
- package/templates/remix/react-router.config.ts +5 -0
- package/templates/remix/tsconfig.json +22 -0
- package/templates/remix/vite.config.ts +16 -0
- package/templates/solid/.cta.json +24 -0
- package/templates/solid/.cursorrules +35 -0
- package/templates/solid/.env.example +56 -0
- package/templates/solid/.vscode/settings.json +35 -0
- package/templates/solid/README.md +421 -0
- package/templates/solid/VERCEL.md +50 -0
- package/templates/solid/_gitignore +12 -0
- package/templates/solid/bd.config.ts +331 -0
- package/templates/solid/bd.data-model.config.ts +90 -0
- package/templates/solid/biome.json +39 -0
- package/templates/solid/package.json +63 -0
- package/templates/solid/pnpm-lock.yaml +4086 -0
- package/templates/solid/public/favicon.ico +0 -0
- package/templates/solid/public/logo192.png +0 -0
- package/templates/solid/public/logo512.png +0 -0
- package/templates/solid/public/manifest.json +25 -0
- package/templates/solid/public/robots.txt +3 -0
- package/templates/solid/src/components/Header.tsx +58 -0
- package/templates/solid/src/components/bd/About.tsx +22 -0
- package/templates/solid/src/components/bd/Blog.tsx +52 -0
- package/templates/solid/src/components/bd/Booking.tsx +286 -0
- package/templates/solid/src/components/bd/ContactForm.tsx +102 -0
- package/templates/solid/src/components/bd/Footer.tsx +23 -0
- package/templates/solid/src/components/bd/Gallery.tsx +52 -0
- package/templates/solid/src/components/bd/Header.tsx +25 -0
- package/templates/solid/src/components/bd/Hero.tsx +14 -0
- package/templates/solid/src/components/bd/NewsBanner.tsx +47 -0
- package/templates/solid/src/components/bd/SdkSetupBanner.tsx +111 -0
- package/templates/solid/src/components/bd/Services.tsx +34 -0
- package/templates/solid/src/components/bd/Stars.tsx +32 -0
- package/templates/solid/src/components/bd/Subscribe.tsx +217 -0
- package/templates/solid/src/components/bd/money.ts +38 -0
- package/templates/solid/src/env.ts +48 -0
- package/templates/solid/src/integrations/tanstack-query/header-user.tsx +5 -0
- package/templates/solid/src/integrations/tanstack-query/provider.tsx +8 -0
- package/templates/solid/src/lib/bd-distribution.ts +26 -0
- package/templates/solid/src/lib/bd-server-fns.ts +1346 -0
- package/templates/solid/src/lib/bd-todos.ts +122 -0
- package/templates/solid/src/lib/bd.ts +169 -0
- package/templates/solid/src/lib/utils.ts +6 -0
- package/templates/solid/src/routeTree.gen.ts +513 -0
- package/templates/solid/src/router.tsx +23 -0
- package/templates/solid/src/routes/$.tsx +63 -0
- package/templates/solid/src/routes/[.]well-known.mcp[.]json.tsx +16 -0
- package/templates/solid/src/routes/__root.tsx +64 -0
- package/templates/solid/src/routes/about.tsx +23 -0
- package/templates/solid/src/routes/ai.product-feed.tsx +18 -0
- package/templates/solid/src/routes/api/bd/revalidate.tsx +48 -0
- package/templates/solid/src/routes/api/bd-auth.$.tsx +63 -0
- package/templates/solid/src/routes/api/mcp.tsx +23 -0
- package/templates/solid/src/routes/demo.tanstack-query.tsx +28 -0
- package/templates/solid/src/routes/index.tsx +65 -0
- package/templates/solid/src/routes/llms[.]txt.tsx +18 -0
- package/templates/solid/src/routes/my-account.tsx +365 -0
- package/templates/solid/src/routes/reviews.tsx +124 -0
- package/templates/solid/src/routes/robots[.]txt.tsx +17 -0
- package/templates/solid/src/routes/services.$service.$area.tsx +107 -0
- package/templates/solid/src/routes/services.index.tsx +68 -0
- package/templates/solid/src/routes/sitemap[.]xml.tsx +16 -0
- package/templates/solid/src/routes/store.$id.tsx +253 -0
- package/templates/solid/src/routes/store.cart.tsx +242 -0
- package/templates/solid/src/routes/store.index.tsx +392 -0
- package/templates/solid/src/routes/subscriptions.tsx +155 -0
- package/templates/solid/src/routes/todos.tsx +214 -0
- package/templates/solid/src/routes/updates.tsx +92 -0
- package/templates/solid/src/styles.css +1571 -0
- package/templates/solid/tsconfig.json +29 -0
- package/templates/solid/ui.config.json +13 -0
- package/templates/solid/vercel.json +7 -0
- package/templates/solid/vite.config.ts +23 -0
- package/templates/solid-1/.cta.json +24 -0
- package/templates/solid-1/.cursorrules +35 -0
- package/templates/solid-1/.env.example +56 -0
- package/templates/solid-1/.vscode/settings.json +35 -0
- package/templates/solid-1/README.md +385 -0
- package/templates/solid-1/VERCEL.md +50 -0
- package/templates/solid-1/_gitignore +12 -0
- package/templates/solid-1/bd.config.ts +331 -0
- package/templates/solid-1/bd.data-model.config.ts +90 -0
- package/templates/solid-1/biome.json +39 -0
- package/templates/solid-1/package.json +99 -0
- package/templates/solid-1/pnpm-lock.yaml +3937 -0
- package/templates/solid-1/public/favicon.ico +0 -0
- package/templates/solid-1/public/logo192.png +0 -0
- package/templates/solid-1/public/logo512.png +0 -0
- package/templates/solid-1/public/manifest.json +25 -0
- package/templates/solid-1/public/robots.txt +3 -0
- package/templates/solid-1/src/components/Header.tsx +70 -0
- package/templates/solid-1/src/components/bd/About.tsx +22 -0
- package/templates/solid-1/src/components/bd/Blog.tsx +52 -0
- package/templates/solid-1/src/components/bd/Booking.tsx +271 -0
- package/templates/solid-1/src/components/bd/ContactForm.tsx +102 -0
- package/templates/solid-1/src/components/bd/Footer.tsx +23 -0
- package/templates/solid-1/src/components/bd/Gallery.tsx +52 -0
- package/templates/solid-1/src/components/bd/Header.tsx +25 -0
- package/templates/solid-1/src/components/bd/Hero.tsx +14 -0
- package/templates/solid-1/src/components/bd/NewsBanner.tsx +47 -0
- package/templates/solid-1/src/components/bd/SdkSetupBanner.tsx +111 -0
- package/templates/solid-1/src/components/bd/Services.tsx +34 -0
- package/templates/solid-1/src/components/bd/Stars.tsx +30 -0
- package/templates/solid-1/src/components/bd/Subscribe.tsx +215 -0
- package/templates/solid-1/src/components/bd/money.ts +38 -0
- package/templates/solid-1/src/env.ts +48 -0
- package/templates/solid-1/src/integrations/tanstack-query/header-user.tsx +5 -0
- package/templates/solid-1/src/integrations/tanstack-query/provider.tsx +8 -0
- package/templates/solid-1/src/lib/bd-distribution.ts +26 -0
- package/templates/solid-1/src/lib/bd-server-fns.ts +1346 -0
- package/templates/solid-1/src/lib/bd-todos.ts +122 -0
- package/templates/solid-1/src/lib/bd.ts +169 -0
- package/templates/solid-1/src/lib/demo-store.ts +14 -0
- package/templates/solid-1/src/lib/utils.ts +6 -0
- package/templates/solid-1/src/routeTree.gen.ts +555 -0
- package/templates/solid-1/src/router.tsx +23 -0
- package/templates/solid-1/src/routes/$.tsx +63 -0
- package/templates/solid-1/src/routes/[.]well-known.mcp[.]json.tsx +16 -0
- package/templates/solid-1/src/routes/__root.tsx +62 -0
- package/templates/solid-1/src/routes/about.tsx +23 -0
- package/templates/solid-1/src/routes/ai.product-feed.tsx +18 -0
- package/templates/solid-1/src/routes/api/bd/revalidate.tsx +48 -0
- package/templates/solid-1/src/routes/api/bd-auth.$.tsx +63 -0
- package/templates/solid-1/src/routes/api/mcp.tsx +23 -0
- package/templates/solid-1/src/routes/demo.form.tsx +339 -0
- package/templates/solid-1/src/routes/demo.store.tsx +62 -0
- package/templates/solid-1/src/routes/demo.tanstack-query.tsx +28 -0
- package/templates/solid-1/src/routes/index.tsx +65 -0
- package/templates/solid-1/src/routes/llms[.]txt.tsx +18 -0
- package/templates/solid-1/src/routes/my-account.tsx +365 -0
- package/templates/solid-1/src/routes/reviews.tsx +124 -0
- package/templates/solid-1/src/routes/robots[.]txt.tsx +17 -0
- package/templates/solid-1/src/routes/services.$service.$area.tsx +107 -0
- package/templates/solid-1/src/routes/services.index.tsx +68 -0
- package/templates/solid-1/src/routes/sitemap[.]xml.tsx +16 -0
- package/templates/solid-1/src/routes/store.$id.tsx +253 -0
- package/templates/solid-1/src/routes/store.cart.tsx +242 -0
- package/templates/solid-1/src/routes/store.index.tsx +384 -0
- package/templates/solid-1/src/routes/subscriptions.tsx +155 -0
- package/templates/solid-1/src/routes/todos.tsx +214 -0
- package/templates/solid-1/src/routes/updates.tsx +92 -0
- package/templates/solid-1/src/styles.css +1571 -0
- package/templates/solid-1/tsconfig.json +29 -0
- package/templates/solid-1/ui.config.json +13 -0
- package/templates/solid-1/vercel.json +7 -0
- package/templates/solid-1/vite.config.ts +22 -0
- package/templates/svelte/.cursor/mcp.json +11 -0
- package/templates/svelte/.env.example +61 -0
- package/templates/svelte/.mcp.json +15 -0
- package/templates/svelte/.opencode/opencode.json +6 -0
- package/templates/svelte/.opencode/svelte.json +3 -0
- package/templates/svelte/.prettierignore +10 -0
- package/templates/svelte/.prettierrc +19 -0
- package/templates/svelte/.storybook/main.ts +17 -0
- package/templates/svelte/.storybook/preview.ts +21 -0
- package/templates/svelte/.vscode/extensions.json +7 -0
- package/templates/svelte/.vscode/settings.json +5 -0
- package/templates/svelte/AGENTS.md +23 -0
- package/templates/svelte/CLAUDE.md +23 -0
- package/templates/svelte/README.md +416 -0
- package/templates/svelte/_gitignore +30 -0
- package/templates/svelte/_npmrc +1 -0
- package/templates/svelte/bd.config.ts +331 -0
- package/templates/svelte/bd.data-model.config.ts +89 -0
- package/templates/svelte/drizzle.config.ts +11 -0
- package/templates/svelte/messages/en.json +4 -0
- package/templates/svelte/messages/es.json +4 -0
- package/templates/svelte/package.json +80 -0
- package/templates/svelte/playwright.config.ts +6 -0
- package/templates/svelte/pnpm-lock.yaml +4332 -0
- package/templates/svelte/project.inlang/settings.json +15 -0
- package/templates/svelte/src/app.d.ts +13 -0
- package/templates/svelte/src/app.html +17 -0
- package/templates/svelte/src/env.ts +22 -0
- package/templates/svelte/src/hooks.server.ts +17 -0
- package/templates/svelte/src/hooks.ts +4 -0
- package/templates/svelte/src/lib/assets/favicon.svg +1 -0
- package/templates/svelte/src/lib/bd/cart-client.ts +111 -0
- package/templates/svelte/src/lib/components/bd/About.svelte +31 -0
- package/templates/svelte/src/lib/components/bd/Banner.svelte +79 -0
- package/templates/svelte/src/lib/components/bd/Blog.svelte +47 -0
- package/templates/svelte/src/lib/components/bd/Booking.svelte +243 -0
- package/templates/svelte/src/lib/components/bd/ContactForm.svelte +69 -0
- package/templates/svelte/src/lib/components/bd/Footer.svelte +35 -0
- package/templates/svelte/src/lib/components/bd/Gallery.svelte +54 -0
- package/templates/svelte/src/lib/components/bd/Header.svelte +51 -0
- package/templates/svelte/src/lib/components/bd/Hero.svelte +19 -0
- package/templates/svelte/src/lib/components/bd/SdkSetupBanner.svelte +107 -0
- package/templates/svelte/src/lib/components/bd/Services.svelte +36 -0
- package/templates/svelte/src/lib/components/bd/StoreNav.svelte +65 -0
- package/templates/svelte/src/lib/components/bd/Subscribe.svelte +180 -0
- package/templates/svelte/src/lib/index.ts +1 -0
- package/templates/svelte/src/lib/server/bd-ai.ts +21 -0
- package/templates/svelte/src/lib/server/bd-bundle.ts +142 -0
- package/templates/svelte/src/lib/server/bd-parallel.ts +94 -0
- package/templates/svelte/src/lib/server/bd-portal.ts +187 -0
- package/templates/svelte/src/lib/server/bd-seo.ts +40 -0
- package/templates/svelte/src/lib/server/bd-store.ts +262 -0
- package/templates/svelte/src/lib/server/bd.ts +45 -0
- package/templates/svelte/src/lib/server/db/index.ts +30 -0
- package/templates/svelte/src/lib/server/db/schema.ts +7 -0
- package/templates/svelte/src/lib/vitest-examples/Welcome.svelte +8 -0
- package/templates/svelte/src/lib/vitest-examples/Welcome.svelte.spec.ts +13 -0
- package/templates/svelte/src/lib/vitest-examples/greet.spec.ts +8 -0
- package/templates/svelte/src/lib/vitest-examples/greet.ts +3 -0
- package/templates/svelte/src/routes/+error.svelte +30 -0
- package/templates/svelte/src/routes/+layout.svelte +33 -0
- package/templates/svelte/src/routes/+page.server.ts +167 -0
- package/templates/svelte/src/routes/+page.svelte +45 -0
- package/templates/svelte/src/routes/.well-known/mcp.json/+server.ts +34 -0
- package/templates/svelte/src/routes/[...slug]/+page.server.ts +30 -0
- package/templates/svelte/src/routes/[...slug]/+page.svelte +19 -0
- package/templates/svelte/src/routes/api/bd/cart/+server.ts +19 -0
- package/templates/svelte/src/routes/api/bd/cart/clear/+server.ts +13 -0
- package/templates/svelte/src/routes/api/bd/cart/coupon/+server.ts +29 -0
- package/templates/svelte/src/routes/api/bd/cart/items/+server.ts +28 -0
- package/templates/svelte/src/routes/api/bd/cart/items/[itemId]/+server.ts +31 -0
- package/templates/svelte/src/routes/api/bd/checkout/start/+server.ts +15 -0
- package/templates/svelte/src/routes/api/bd/forms/[slug]/+server.ts +36 -0
- package/templates/svelte/src/routes/api/bd/revalidate/+server.ts +40 -0
- package/templates/svelte/src/routes/api/bd/reviews/+server.ts +37 -0
- package/templates/svelte/src/routes/api/bd/scheduling/bookings/+server.ts +41 -0
- package/templates/svelte/src/routes/api/bd/scheduling/slots/+server.ts +33 -0
- package/templates/svelte/src/routes/api/bd/subscriptions/[id]/checkout/+server.ts +43 -0
- package/templates/svelte/src/routes/api/bd-auth/[...slug]/+server.ts +63 -0
- package/templates/svelte/src/routes/api/mcp/+server.ts +40 -0
- package/templates/svelte/src/routes/bd-tokens.css +518 -0
- package/templates/svelte/src/routes/demo/+page.svelte +6 -0
- package/templates/svelte/src/routes/demo/paraglide/+page.svelte +22 -0
- package/templates/svelte/src/routes/demo/playwright/+page.svelte +1 -0
- package/templates/svelte/src/routes/demo/playwright/page.svelte.e2e.ts +6 -0
- package/templates/svelte/src/routes/layout.css +10 -0
- package/templates/svelte/src/routes/llms.txt/+server.ts +42 -0
- package/templates/svelte/src/routes/my-account/+page.server.ts +165 -0
- package/templates/svelte/src/routes/my-account/+page.svelte +291 -0
- package/templates/svelte/src/routes/reviews/+page.server.ts +40 -0
- package/templates/svelte/src/routes/reviews/+page.svelte +137 -0
- package/templates/svelte/src/routes/robots.txt/+server.ts +52 -0
- package/templates/svelte/src/routes/services/+page.server.ts +15 -0
- package/templates/svelte/src/routes/services/+page.svelte +70 -0
- package/templates/svelte/src/routes/services/[service]/[area]/+page.server.ts +41 -0
- package/templates/svelte/src/routes/services/[service]/[area]/+page.svelte +67 -0
- package/templates/svelte/src/routes/sitemap.xml/+server.ts +63 -0
- package/templates/svelte/src/routes/store/+page.server.ts +98 -0
- package/templates/svelte/src/routes/store/+page.svelte +514 -0
- package/templates/svelte/src/routes/store/[id]/+page.server.ts +54 -0
- package/templates/svelte/src/routes/store/[id]/+page.svelte +511 -0
- package/templates/svelte/src/routes/store/cart/+page.server.ts +17 -0
- package/templates/svelte/src/routes/store/cart/+page.svelte +237 -0
- package/templates/svelte/src/routes/store/order/+page.server.ts +24 -0
- package/templates/svelte/src/routes/store/order/+page.svelte +68 -0
- package/templates/svelte/src/routes/store/subscriptions/+page.server.ts +35 -0
- package/templates/svelte/src/routes/store/subscriptions/+page.svelte +136 -0
- package/templates/svelte/src/routes/todos/+page.server.ts +153 -0
- package/templates/svelte/src/routes/todos/+page.svelte +175 -0
- package/templates/svelte/src/routes/updates/+page.server.ts +20 -0
- package/templates/svelte/src/routes/updates/+page.svelte +94 -0
- package/templates/svelte/src/stories/Button.stories.svelte +31 -0
- package/templates/svelte/src/stories/Button.svelte +30 -0
- package/templates/svelte/src/stories/Configure.mdx +388 -0
- package/templates/svelte/src/stories/Header.stories.svelte +26 -0
- package/templates/svelte/src/stories/Header.svelte +45 -0
- package/templates/svelte/src/stories/Page.stories.svelte +30 -0
- package/templates/svelte/src/stories/Page.svelte +70 -0
- package/templates/svelte/src/stories/assets/accessibility.png +0 -0
- package/templates/svelte/src/stories/assets/accessibility.svg +1 -0
- package/templates/svelte/src/stories/assets/addon-library.png +0 -0
- package/templates/svelte/src/stories/assets/assets.png +0 -0
- package/templates/svelte/src/stories/assets/avif-test-image.avif +0 -0
- package/templates/svelte/src/stories/assets/context.png +0 -0
- package/templates/svelte/src/stories/assets/discord.svg +1 -0
- package/templates/svelte/src/stories/assets/docs.png +0 -0
- package/templates/svelte/src/stories/assets/figma-plugin.png +0 -0
- package/templates/svelte/src/stories/assets/github.svg +1 -0
- package/templates/svelte/src/stories/assets/share.png +0 -0
- package/templates/svelte/src/stories/assets/styling.png +0 -0
- package/templates/svelte/src/stories/assets/testing.png +0 -0
- package/templates/svelte/src/stories/assets/theming.png +0 -0
- package/templates/svelte/src/stories/assets/tutorials.svg +1 -0
- package/templates/svelte/src/stories/assets/youtube.svg +1 -0
- package/templates/svelte/src/stories/button.css +30 -0
- package/templates/svelte/src/stories/header.css +32 -0
- package/templates/svelte/src/stories/page.css +68 -0
- package/templates/svelte/tsconfig.json +8 -0
- package/templates/svelte/vite.config.ts +88 -0
- package/templates/svelte/vitest.shims.d.ts +1 -0
- package/templates/swift/BdStarter.xcconfig +30 -0
- package/templates/swift/LICENSE +21 -0
- package/templates/swift/Package.swift +62 -0
- package/templates/swift/README.md +334 -0
- package/templates/swift/Sources/BdForms/Backend/BdFormsBackend.swift +441 -0
- package/templates/swift/Sources/BdForms/Controller/BdFormController.swift +717 -0
- package/templates/swift/Sources/BdForms/Engine/BdCalculation.swift +173 -0
- package/templates/swift/Sources/BdForms/Engine/BdFormRules+Client.swift +200 -0
- package/templates/swift/Sources/BdForms/Engine/BdFormRules.swift +949 -0
- package/templates/swift/Sources/BdForms/Engine/BdFormula.swift +783 -0
- package/templates/swift/Sources/BdForms/Engine/BdUnits.swift +171 -0
- package/templates/swift/Sources/BdForms/Generated/BdFormsData.generated.swift +294 -0
- package/templates/swift/Sources/BdForms/Model/BdFormSchema.swift +509 -0
- package/templates/swift/Sources/BdForms/Model/BdJSON.swift +302 -0
- package/templates/swift/Sources/BdForms/Quiz/BdQuizBackend.swift +313 -0
- package/templates/swift/Sources/BdForms/Quiz/BdQuizController.swift +271 -0
- package/templates/swift/Sources/BdForms/Quiz/BdQuizEngine.swift +757 -0
- package/templates/swift/Sources/BdForms/Quiz/BdQuizPage.swift +124 -0
- package/templates/swift/Sources/BdForms/Quiz/BdQuizScoring.swift +445 -0
- package/templates/swift/Sources/BdForms/Quiz/BdQuizScreen.swift +461 -0
- package/templates/swift/Sources/BdForms/Quiz/BdQuizWords.swift +110 -0
- package/templates/swift/Sources/BdForms/UI/BdFieldTree.swift +352 -0
- package/templates/swift/Sources/BdForms/UI/BdForm.swift +346 -0
- package/templates/swift/Sources/BdForms/UI/BdFormStyle.swift +247 -0
- package/templates/swift/Sources/BdForms/UI/BdHTML.swift +304 -0
- package/templates/swift/Sources/BdForms/UI/BdIcon.swift +351 -0
- package/templates/swift/Sources/BdForms/UI/Controls/BdChoiceControls.swift +677 -0
- package/templates/swift/Sources/BdForms/UI/Controls/BdDateControls.swift +360 -0
- package/templates/swift/Sources/BdForms/UI/Controls/BdFieldControl.swift +338 -0
- package/templates/swift/Sources/BdForms/UI/Controls/BdMediaControls.swift +412 -0
- package/templates/swift/Sources/BdForms/UI/Controls/BdStaticViews.swift +183 -0
- package/templates/swift/Sources/BdForms/UI/Controls/BdTextControls.swift +388 -0
- package/templates/swift/Sources/BdForms/UI/Quiz/BdQuiz.swift +696 -0
- package/templates/swift/Sources/BdSignIn/BdSignInBackend.swift +299 -0
- package/templates/swift/Sources/BdSignIn/BdSignInChecks.swift +158 -0
- package/templates/swift/Sources/BdSignIn/BdSignInView.swift +806 -0
- package/templates/swift/Sources/BdStarterApp/BdEnvironment.swift +138 -0
- package/templates/swift/Sources/BdStarterApp/ViewModels/CartViewModel.swift +74 -0
- package/templates/swift/Sources/BdStarterApp/ViewModels/ChatViewModel.swift +87 -0
- package/templates/swift/Sources/BdStarterApp/ViewModels/StorefrontViewModel.swift +73 -0
- package/templates/swift/Sources/BdStarterApp/ViewModels/ViewModel.swift +53 -0
- package/templates/swift/Sources/BdStarterApp/Views/AccountView.swift +163 -0
- package/templates/swift/Sources/BdStarterApp/Views/BdFormView.swift +50 -0
- package/templates/swift/Sources/BdStarterApp/Views/BdQuizView.swift +59 -0
- package/templates/swift/Sources/BdStarterApp/Views/BlogView.swift +33 -0
- package/templates/swift/Sources/BdStarterApp/Views/CartView.swift +73 -0
- package/templates/swift/Sources/BdStarterApp/Views/ChatView.swift +57 -0
- package/templates/swift/Sources/BdStarterApp/Views/LoadState.swift +50 -0
- package/templates/swift/Sources/BdStarterApp/Views/ProductDetailView.swift +57 -0
- package/templates/swift/Sources/BdStarterApp/Views/RootView.swift +60 -0
- package/templates/swift/Sources/BdStarterApp/Views/StorefrontView.swift +68 -0
- package/templates/swift/Sources/BusinessDashKit/BdAuth.swift +113 -0
- package/templates/swift/Sources/BusinessDashKit/BdClient.swift +223 -0
- package/templates/swift/Sources/BusinessDashKit/BdConfiguration.swift +59 -0
- package/templates/swift/Sources/BusinessDashKit/BdError.swift +71 -0
- package/templates/swift/Sources/BusinessDashKit/BdSessionStore.swift +83 -0
- package/templates/swift/Sources/BusinessDashKit/ChatFeed.swift +145 -0
- package/templates/swift/Sources/BusinessDashKit/Donations.swift +144 -0
- package/templates/swift/Sources/BusinessDashKit/JSONValue.swift +118 -0
- package/templates/swift/Sources/BusinessDashKit/Models.swift +447 -0
- package/templates/swift/Sources/BusinessDashKit/Money.swift +33 -0
- package/templates/swift/Sources/BusinessDashKit/Resources.swift +439 -0
- package/templates/swift/Sources/BusinessDashKit/Scheduling.swift +128 -0
- package/templates/swift/Sources/BusinessDashKit/Seo.swift +169 -0
- package/templates/swift/Sources/BusinessDashKit/SocialPlatforms.generated.swift +48 -0
- package/templates/swift/Sources/BusinessDashKit/Socials.swift +160 -0
- package/templates/swift/Tests/BdFormsTests/ControllerTests.swift +356 -0
- package/templates/swift/Tests/BdFormsTests/Fixtures/forms-parity.json +3806 -0
- package/templates/swift/Tests/BdFormsTests/Fixtures/quiz-parity.json +9937 -0
- package/templates/swift/Tests/BdFormsTests/FormsBackendPathTests.swift +17 -0
- package/templates/swift/Tests/BdFormsTests/ParityTests.swift +192 -0
- package/templates/swift/Tests/BdFormsTests/QuizControllerTests.swift +342 -0
- package/templates/swift/Tests/BdFormsTests/QuizParityTests.swift +230 -0
- package/templates/swift/Tests/BdSignInTests/BdSignInChecksTests.swift +49 -0
- package/templates/swift/Tests/BusinessDashKitTests/BusinessDashKitTests.swift +367 -0
- package/templates/swift/_gitignore +9 -0
- package/templates/swift/bd-records/README.md +50 -0
- package/templates/swift/bd-records/todo-images.json +14 -0
- package/templates/swift/bd-records/todos.json +20 -0
- package/templates/swift/bd.config.ts +331 -0
- package/templates/swift/bd.data-model.config.ts +89 -0
- package/templates/swift/package.json +20 -0
- package/templates/swift/pnpm-lock.yaml +347 -0
- package/templates/swift/tsconfig.json +19 -0
- package/templates/t3/.env.example +62 -0
- package/templates/t3/README.md +428 -0
- package/templates/t3/_gitignore +46 -0
- package/templates/t3/bd.config.ts +331 -0
- package/templates/t3/bd.data-model.config.ts +90 -0
- package/templates/t3/biome.jsonc +69 -0
- package/templates/t3/drizzle.config.ts +15 -0
- package/templates/t3/next.config.js +17 -0
- package/templates/t3/package.json +64 -0
- package/templates/t3/pnpm-lock.yaml +1843 -0
- package/templates/t3/postcss.config.js +5 -0
- package/templates/t3/public/favicon.ico +0 -0
- package/templates/t3/src/app/.well-known/mcp.json/route.ts +17 -0
- package/templates/t3/src/app/[...slug]/page.tsx +71 -0
- package/templates/t3/src/app/_actions/plans.ts +60 -0
- package/templates/t3/src/app/_actions/review.ts +88 -0
- package/templates/t3/src/app/_actions/store.ts +119 -0
- package/templates/t3/src/app/_components/bd/About.tsx +25 -0
- package/templates/t3/src/app/_components/bd/AuthButtons.tsx +49 -0
- package/templates/t3/src/app/_components/bd/Blog.tsx +47 -0
- package/templates/t3/src/app/_components/bd/Booking.tsx +257 -0
- package/templates/t3/src/app/_components/bd/ContactForm.tsx +82 -0
- package/templates/t3/src/app/_components/bd/Footer.tsx +25 -0
- package/templates/t3/src/app/_components/bd/Gallery.tsx +49 -0
- package/templates/t3/src/app/_components/bd/Header.tsx +27 -0
- package/templates/t3/src/app/_components/bd/Hero.tsx +14 -0
- package/templates/t3/src/app/_components/bd/NewsBanner.tsx +57 -0
- package/templates/t3/src/app/_components/bd/ReviewForm.tsx +95 -0
- package/templates/t3/src/app/_components/bd/Reviews.tsx +83 -0
- package/templates/t3/src/app/_components/bd/ReviewsLoadMore.tsx +107 -0
- package/templates/t3/src/app/_components/bd/SdkSetupBanner.tsx +97 -0
- package/templates/t3/src/app/_components/bd/Services.tsx +30 -0
- package/templates/t3/src/app/_components/bd/SignInScreen.tsx +32 -0
- package/templates/t3/src/app/_components/bd/Subscribe.tsx +157 -0
- package/templates/t3/src/app/_components/bd/Updates.tsx +90 -0
- package/templates/t3/src/app/_components/post.tsx +50 -0
- package/templates/t3/src/app/ai/product-feed/route.ts +21 -0
- package/templates/t3/src/app/api/bd/revalidate/route.ts +16 -0
- package/templates/t3/src/app/api/bd-auth/[...slug]/route.ts +39 -0
- package/templates/t3/src/app/api/mcp/route.ts +36 -0
- package/templates/t3/src/app/api/trpc/[trpc]/route.ts +34 -0
- package/templates/t3/src/app/layout.tsx +55 -0
- package/templates/t3/src/app/llms.txt/route.ts +21 -0
- package/templates/t3/src/app/my-account/page.tsx +259 -0
- package/templates/t3/src/app/not-found.tsx +26 -0
- package/templates/t3/src/app/page.tsx +89 -0
- package/templates/t3/src/app/robots.txt/route.ts +51 -0
- package/templates/t3/src/app/services/[service]/[area]/page.tsx +114 -0
- package/templates/t3/src/app/sitemap.xml/route.ts +75 -0
- package/templates/t3/src/app/store/[id]/page.tsx +69 -0
- package/templates/t3/src/app/store/_components/AddToCart.tsx +117 -0
- package/templates/t3/src/app/store/_components/CartClient.tsx +198 -0
- package/templates/t3/src/app/store/_components/Notice.tsx +11 -0
- package/templates/t3/src/app/store/_components/StoreView.tsx +372 -0
- package/templates/t3/src/app/store/_components/store-utils.ts +63 -0
- package/templates/t3/src/app/store/cart/page.tsx +28 -0
- package/templates/t3/src/app/store/layout.tsx +38 -0
- package/templates/t3/src/app/store/order/page.tsx +88 -0
- package/templates/t3/src/app/store/page.tsx +104 -0
- package/templates/t3/src/app/store/subscriptions/page.tsx +110 -0
- package/templates/t3/src/app/todos/TodoCreateForm.tsx +68 -0
- package/templates/t3/src/app/todos/page.tsx +134 -0
- package/templates/t3/src/env.js +78 -0
- package/templates/t3/src/server/api/root.ts +25 -0
- package/templates/t3/src/server/api/routers/bd.ts +359 -0
- package/templates/t3/src/server/api/routers/post.ts +30 -0
- package/templates/t3/src/server/api/trpc.ts +106 -0
- package/templates/t3/src/server/db/index.ts +40 -0
- package/templates/t3/src/server/db/schema.ts +26 -0
- package/templates/t3/src/server/lib/bd-distribution.ts +28 -0
- package/templates/t3/src/server/lib/bd-portal.ts +163 -0
- package/templates/t3/src/server/lib/bd-seo.ts +55 -0
- package/templates/t3/src/server/lib/bd-store.ts +177 -0
- package/templates/t3/src/server/lib/bd-todos.ts +138 -0
- package/templates/t3/src/server/lib/bd.ts +260 -0
- package/templates/t3/src/styles/globals.css +1088 -0
- package/templates/t3/src/trpc/query-client.ts +25 -0
- package/templates/t3/src/trpc/react.tsx +78 -0
- package/templates/t3/src/trpc/server.ts +30 -0
- package/templates/t3/start-database.sh +88 -0
- package/templates/t3/tsconfig.json +42 -0
- package/templates/vanilla/.env.example +51 -0
- package/templates/vanilla/README.md +345 -0
- package/templates/vanilla/_gitignore +7 -0
- package/templates/vanilla/bd.config.ts +331 -0
- package/templates/vanilla/bd.data-model.config.ts +89 -0
- package/templates/vanilla/lib/cache.ts +58 -0
- package/templates/vanilla/package.json +23 -0
- package/templates/vanilla/pnpm-lock.yaml +97 -0
- package/templates/vanilla/public/banner.js +75 -0
- package/templates/vanilla/public/bd.js +435 -0
- package/templates/vanilla/public/index.html +74 -0
- package/templates/vanilla/public/main.js +59 -0
- package/templates/vanilla/public/pages/_ui.js +24 -0
- package/templates/vanilla/public/pages/cart.js +143 -0
- package/templates/vanilla/public/pages/my-account.js +182 -0
- package/templates/vanilla/public/pages/product.js +211 -0
- package/templates/vanilla/public/pages/reviews.js +56 -0
- package/templates/vanilla/public/pages/services-area.js +33 -0
- package/templates/vanilla/public/pages/services.js +26 -0
- package/templates/vanilla/public/pages/store.js +271 -0
- package/templates/vanilla/public/pages/subscriptions.js +80 -0
- package/templates/vanilla/public/pages/todos.js +160 -0
- package/templates/vanilla/public/pages/updates.js +46 -0
- package/templates/vanilla/public/sections/about.js +47 -0
- package/templates/vanilla/public/sections/blog.js +66 -0
- package/templates/vanilla/public/sections/booking.js +304 -0
- package/templates/vanilla/public/sections/contact-form.js +104 -0
- package/templates/vanilla/public/sections/gallery.js +70 -0
- package/templates/vanilla/public/sections/hero.js +43 -0
- package/templates/vanilla/public/sections/services.js +70 -0
- package/templates/vanilla/public/sections/subscribe.js +160 -0
- package/templates/vanilla/public/setup-banner.js +81 -0
- package/templates/vanilla/public/styles.css +1720 -0
- package/templates/vanilla/server.ts +1192 -0
- package/templates/vanilla/src/content/en/home/about.json +4 -0
- package/templates/vanilla/src/content/en/home/hero.json +6 -0
- package/templates/vanilla/src/content/en/shared/brand.json +5 -0
- package/templates/vanilla/src/content/en/shared/companyInfo.json +11 -0
- package/templates/vanilla/tsconfig.json +14 -0
- package/templates/vapor/.env.example +38 -0
- package/templates/vapor/Package.resolved +285 -0
- package/templates/vapor/Package.swift +33 -0
- package/templates/vapor/Public/bd-sign-in.css +53 -0
- package/templates/vapor/Public/forms.css +1158 -0
- package/templates/vapor/Public/styles.css +100 -0
- package/templates/vapor/README.md +280 -0
- package/templates/vapor/Resources/Forms/demo-form.json +283 -0
- package/templates/vapor/Resources/Forms/demo-quiz.json +97 -0
- package/templates/vapor/Resources/Views/account.leaf +23 -0
- package/templates/vapor/Resources/Views/base.leaf +51 -0
- package/templates/vapor/Resources/Views/blog.leaf +18 -0
- package/templates/vapor/Resources/Views/cart.leaf +30 -0
- package/templates/vapor/Resources/Views/delete-account.leaf +26 -0
- package/templates/vapor/Resources/Views/form.leaf +6 -0
- package/templates/vapor/Resources/Views/home.leaf +37 -0
- package/templates/vapor/Resources/Views/post.leaf +15 -0
- package/templates/vapor/Resources/Views/product.leaf +28 -0
- package/templates/vapor/Resources/Views/quiz.leaf +6 -0
- package/templates/vapor/Resources/Views/reviews.leaf +16 -0
- package/templates/vapor/Resources/Views/service-area.leaf +9 -0
- package/templates/vapor/Resources/Views/services.leaf +15 -0
- package/templates/vapor/Resources/Views/store.leaf +37 -0
- package/templates/vapor/Resources/Views/subscriptions.leaf +18 -0
- package/templates/vapor/Resources/Views/todos.leaf +28 -0
- package/templates/vapor/Sources/App/Bd/BdCache.swift +99 -0
- package/templates/vapor/Sources/App/Bd/BdClient.swift +178 -0
- package/templates/vapor/Sources/App/Bd/BdWebhook.swift +92 -0
- package/templates/vapor/Sources/App/Bd/Donations.swift +95 -0
- package/templates/vapor/Sources/App/Bd/JSONValue.swift +66 -0
- package/templates/vapor/Sources/App/Bd/Models.swift +153 -0
- package/templates/vapor/Sources/App/Bd/Money.swift +29 -0
- package/templates/vapor/Sources/App/Bd/PortalResources.swift +372 -0
- package/templates/vapor/Sources/App/Bd/Resources.swift +115 -0
- package/templates/vapor/Sources/App/Bd/Scheduling.swift +135 -0
- package/templates/vapor/Sources/App/Bd/Seo.swift +169 -0
- package/templates/vapor/Sources/App/Bd/SignInCore.swift +232 -0
- package/templates/vapor/Sources/App/Bd/SocialPlatforms.generated.swift +48 -0
- package/templates/vapor/Sources/App/Bd/Socials.swift +96 -0
- package/templates/vapor/Sources/App/Controllers/AccountController.swift +435 -0
- package/templates/vapor/Sources/App/Controllers/CartController.swift +107 -0
- package/templates/vapor/Sources/App/Controllers/Contexts.swift +124 -0
- package/templates/vapor/Sources/App/Controllers/PageController.swift +151 -0
- package/templates/vapor/Sources/App/Controllers/SeoController.swift +83 -0
- package/templates/vapor/Sources/App/Controllers/SignInController.swift +583 -0
- package/templates/vapor/Sources/App/Controllers/StoreController.swift +48 -0
- package/templates/vapor/Sources/App/Controllers/WebhookController.swift +34 -0
- package/templates/vapor/Sources/App/Forms/FormPage.swift +900 -0
- package/templates/vapor/Sources/App/Forms/FormPost.swift +125 -0
- package/templates/vapor/Sources/App/Forms/FormRoutes.swift +36 -0
- package/templates/vapor/Sources/App/Forms/FormSamples.swift +45 -0
- package/templates/vapor/Sources/App/Forms/QuizPage.swift +481 -0
- package/templates/vapor/Sources/App/Forms/QuizRoutes.swift +77 -0
- package/templates/vapor/Sources/App/configure.swift +18 -0
- package/templates/vapor/Sources/App/entrypoint.swift +20 -0
- package/templates/vapor/Sources/App/routes.swift +62 -0
- package/templates/vapor/Sources/BdForms/Backend/BdFormsBackend.swift +445 -0
- package/templates/vapor/Sources/BdForms/Controller/BdFormController.swift +721 -0
- package/templates/vapor/Sources/BdForms/Engine/BdCalculation.swift +177 -0
- package/templates/vapor/Sources/BdForms/Engine/BdFormRules+Client.swift +204 -0
- package/templates/vapor/Sources/BdForms/Engine/BdFormRules.swift +953 -0
- package/templates/vapor/Sources/BdForms/Engine/BdFormula.swift +787 -0
- package/templates/vapor/Sources/BdForms/Engine/BdUnits.swift +175 -0
- package/templates/vapor/Sources/BdForms/Generated/BdFormsData.generated.swift +298 -0
- package/templates/vapor/Sources/BdForms/Model/BdFormSchema.swift +513 -0
- package/templates/vapor/Sources/BdForms/Model/BdJSON.swift +306 -0
- package/templates/vapor/Sources/BdForms/Quiz/BdQuizBackend.swift +317 -0
- package/templates/vapor/Sources/BdForms/Quiz/BdQuizController.swift +275 -0
- package/templates/vapor/Sources/BdForms/Quiz/BdQuizEngine.swift +761 -0
- package/templates/vapor/Sources/BdForms/Quiz/BdQuizPage.swift +128 -0
- package/templates/vapor/Sources/BdForms/Quiz/BdQuizScoring.swift +449 -0
- package/templates/vapor/Sources/BdForms/Quiz/BdQuizScreen.swift +465 -0
- package/templates/vapor/Sources/BdForms/Quiz/BdQuizWords.swift +114 -0
- package/templates/vapor/_gitignore +9 -0
- package/templates/vapor/bd-records/README.md +50 -0
- package/templates/vapor/bd-records/todo-images.json +14 -0
- package/templates/vapor/bd-records/todos.json +20 -0
- package/templates/vapor/bd.config.ts +331 -0
- package/templates/vapor/bd.data-model.config.ts +89 -0
- package/templates/vapor/package.json +20 -0
- package/templates/vapor/pnpm-lock.yaml +347 -0
- package/templates/vapor/tsconfig.json +19 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3672 @@
|
|
|
1
|
+
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
try {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw mod = 0, e;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
|
|
32
|
+
// ../../node_modules/.pnpm/mri@1.2.0/node_modules/mri/lib/index.js
|
|
33
|
+
var require_lib = __commonJS({
|
|
34
|
+
"../../node_modules/.pnpm/mri@1.2.0/node_modules/mri/lib/index.js"(exports, module) {
|
|
35
|
+
function toArr(any) {
|
|
36
|
+
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
37
|
+
}
|
|
38
|
+
function toVal(out, key, val, opts) {
|
|
39
|
+
var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
|
|
40
|
+
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
41
|
+
}
|
|
42
|
+
module.exports = function(args, opts) {
|
|
43
|
+
args = args || [];
|
|
44
|
+
opts = opts || {};
|
|
45
|
+
var k, arr, arg, name, val, out = { _: [] };
|
|
46
|
+
var i2 = 0, j = 0, idx = 0, len = args.length;
|
|
47
|
+
const alibi = opts.alias !== void 0;
|
|
48
|
+
const strict = opts.unknown !== void 0;
|
|
49
|
+
const defaults = opts.default !== void 0;
|
|
50
|
+
opts.alias = opts.alias || {};
|
|
51
|
+
opts.string = toArr(opts.string);
|
|
52
|
+
opts.boolean = toArr(opts.boolean);
|
|
53
|
+
if (alibi) {
|
|
54
|
+
for (k in opts.alias) {
|
|
55
|
+
arr = opts.alias[k] = toArr(opts.alias[k]);
|
|
56
|
+
for (i2 = 0; i2 < arr.length; i2++) {
|
|
57
|
+
(opts.alias[arr[i2]] = arr.concat(k)).splice(i2, 1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (i2 = opts.boolean.length; i2-- > 0; ) {
|
|
62
|
+
arr = opts.alias[opts.boolean[i2]] || [];
|
|
63
|
+
for (j = arr.length; j-- > 0; ) opts.boolean.push(arr[j]);
|
|
64
|
+
}
|
|
65
|
+
for (i2 = opts.string.length; i2-- > 0; ) {
|
|
66
|
+
arr = opts.alias[opts.string[i2]] || [];
|
|
67
|
+
for (j = arr.length; j-- > 0; ) opts.string.push(arr[j]);
|
|
68
|
+
}
|
|
69
|
+
if (defaults) {
|
|
70
|
+
for (k in opts.default) {
|
|
71
|
+
name = typeof opts.default[k];
|
|
72
|
+
arr = opts.alias[k] = opts.alias[k] || [];
|
|
73
|
+
if (opts[name] !== void 0) {
|
|
74
|
+
opts[name].push(k);
|
|
75
|
+
for (i2 = 0; i2 < arr.length; i2++) {
|
|
76
|
+
opts[name].push(arr[i2]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const keys = strict ? Object.keys(opts.alias) : [];
|
|
82
|
+
for (i2 = 0; i2 < len; i2++) {
|
|
83
|
+
arg = args[i2];
|
|
84
|
+
if (arg === "--") {
|
|
85
|
+
out._ = out._.concat(args.slice(++i2));
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
for (j = 0; j < arg.length; j++) {
|
|
89
|
+
if (arg.charCodeAt(j) !== 45) break;
|
|
90
|
+
}
|
|
91
|
+
if (j === 0) {
|
|
92
|
+
out._.push(arg);
|
|
93
|
+
} else if (arg.substring(j, j + 3) === "no-") {
|
|
94
|
+
name = arg.substring(j + 3);
|
|
95
|
+
if (strict && !~keys.indexOf(name)) {
|
|
96
|
+
return opts.unknown(arg);
|
|
97
|
+
}
|
|
98
|
+
out[name] = false;
|
|
99
|
+
} else {
|
|
100
|
+
for (idx = j + 1; idx < arg.length; idx++) {
|
|
101
|
+
if (arg.charCodeAt(idx) === 61) break;
|
|
102
|
+
}
|
|
103
|
+
name = arg.substring(j, idx);
|
|
104
|
+
val = arg.substring(++idx) || (i2 + 1 === len || ("" + args[i2 + 1]).charCodeAt(0) === 45 || args[++i2]);
|
|
105
|
+
arr = j === 2 ? [name] : name;
|
|
106
|
+
for (idx = 0; idx < arr.length; idx++) {
|
|
107
|
+
name = arr[idx];
|
|
108
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
|
109
|
+
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (defaults) {
|
|
114
|
+
for (k in opts.default) {
|
|
115
|
+
if (out[k] === void 0) {
|
|
116
|
+
out[k] = opts.default[k];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (alibi) {
|
|
121
|
+
for (k in out) {
|
|
122
|
+
arr = opts.alias[k] || [];
|
|
123
|
+
while (arr.length > 0) {
|
|
124
|
+
out[arr.shift()] = out[k];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
134
|
+
var require_picocolors = __commonJS({
|
|
135
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
136
|
+
var p = process || {};
|
|
137
|
+
var argv2 = p.argv || [];
|
|
138
|
+
var env = p.env || {};
|
|
139
|
+
var isColorSupported = !(!!env.NO_COLOR || argv2.includes("--no-color")) && (!!env.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
140
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
141
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
142
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
143
|
+
};
|
|
144
|
+
var replaceClose = (string, close, replace, index) => {
|
|
145
|
+
let result = "", cursor2 = 0;
|
|
146
|
+
do {
|
|
147
|
+
result += string.substring(cursor2, index) + replace;
|
|
148
|
+
cursor2 = index + close.length;
|
|
149
|
+
index = string.indexOf(close, cursor2);
|
|
150
|
+
} while (~index);
|
|
151
|
+
return result + string.substring(cursor2);
|
|
152
|
+
};
|
|
153
|
+
var createColors = (enabled = isColorSupported) => {
|
|
154
|
+
let f = enabled ? formatter : () => String;
|
|
155
|
+
return {
|
|
156
|
+
isColorSupported: enabled,
|
|
157
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
158
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
159
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
160
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
161
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
162
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
163
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
164
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
165
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
166
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
167
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
168
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
169
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
170
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
171
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
172
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
173
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
174
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
175
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
176
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
177
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
178
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
179
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
180
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
181
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
182
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
183
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
184
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
185
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
186
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
187
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
188
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
189
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
190
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
191
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
192
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
193
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
194
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
195
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
196
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
197
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
module.exports = createColors();
|
|
201
|
+
module.exports.createColors = createColors;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// src/index.ts
|
|
206
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
207
|
+
import { existsSync as existsSync3, statSync as statSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
208
|
+
import { basename, join as join5, relative, resolve } from "node:path";
|
|
209
|
+
import { fileURLToPath } from "node:url";
|
|
210
|
+
|
|
211
|
+
// ../../node_modules/.pnpm/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
|
|
212
|
+
import { styleText } from "node:util";
|
|
213
|
+
import { stdout, stdin } from "node:process";
|
|
214
|
+
import f__default from "node:readline";
|
|
215
|
+
|
|
216
|
+
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
217
|
+
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
218
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
219
|
+
return (input) => {
|
|
220
|
+
let surrogatePairsNr = 0;
|
|
221
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
222
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
223
|
+
surrogatePairsNr += 1;
|
|
224
|
+
}
|
|
225
|
+
return input.length - surrogatePairsNr;
|
|
226
|
+
};
|
|
227
|
+
})();
|
|
228
|
+
var isFullWidth = (x) => {
|
|
229
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
230
|
+
};
|
|
231
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
232
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
236
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
237
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
238
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
239
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
240
|
+
var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
241
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
242
|
+
var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
|
|
243
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
244
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
245
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
246
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
247
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
248
|
+
const ANSI_WIDTH = 0;
|
|
249
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
250
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
251
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
252
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
253
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
254
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
255
|
+
const PARSE_BLOCKS = [
|
|
256
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
257
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
258
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
259
|
+
[TAB_RE, TAB_WIDTH],
|
|
260
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
261
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
262
|
+
];
|
|
263
|
+
let indexPrev = 0;
|
|
264
|
+
let index = 0;
|
|
265
|
+
let length = input.length;
|
|
266
|
+
let lengthExtra = 0;
|
|
267
|
+
let truncationEnabled = false;
|
|
268
|
+
let truncationIndex = length;
|
|
269
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
270
|
+
let unmatchedStart = 0;
|
|
271
|
+
let unmatchedEnd = 0;
|
|
272
|
+
let width2 = 0;
|
|
273
|
+
let widthExtra = 0;
|
|
274
|
+
outer: while (true) {
|
|
275
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
276
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
277
|
+
lengthExtra = 0;
|
|
278
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
279
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
280
|
+
if (isFullWidth(codePoint)) {
|
|
281
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
282
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
283
|
+
widthExtra = WIDE_WIDTH;
|
|
284
|
+
} else {
|
|
285
|
+
widthExtra = REGULAR_WIDTH;
|
|
286
|
+
}
|
|
287
|
+
if (width2 + widthExtra > truncationLimit) {
|
|
288
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
289
|
+
}
|
|
290
|
+
if (width2 + widthExtra > LIMIT) {
|
|
291
|
+
truncationEnabled = true;
|
|
292
|
+
break outer;
|
|
293
|
+
}
|
|
294
|
+
lengthExtra += char.length;
|
|
295
|
+
width2 += widthExtra;
|
|
296
|
+
}
|
|
297
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
298
|
+
}
|
|
299
|
+
if (index >= length) {
|
|
300
|
+
break outer;
|
|
301
|
+
}
|
|
302
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
|
|
303
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
304
|
+
BLOCK_RE.lastIndex = index;
|
|
305
|
+
if (BLOCK_RE.test(input)) {
|
|
306
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
307
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
308
|
+
if (width2 + widthExtra > truncationLimit) {
|
|
309
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width2) / BLOCK_WIDTH));
|
|
310
|
+
}
|
|
311
|
+
if (width2 + widthExtra > LIMIT) {
|
|
312
|
+
truncationEnabled = true;
|
|
313
|
+
break outer;
|
|
314
|
+
}
|
|
315
|
+
width2 += widthExtra;
|
|
316
|
+
unmatchedStart = indexPrev;
|
|
317
|
+
unmatchedEnd = index;
|
|
318
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
319
|
+
continue outer;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
index += 1;
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
width: truncationEnabled ? truncationLimit : width2,
|
|
326
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
327
|
+
truncated: truncationEnabled,
|
|
328
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
var dist_default = getStringTruncatedWidth;
|
|
332
|
+
|
|
333
|
+
// ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
334
|
+
var NO_TRUNCATION2 = {
|
|
335
|
+
limit: Infinity,
|
|
336
|
+
ellipsis: "",
|
|
337
|
+
ellipsisWidth: 0
|
|
338
|
+
};
|
|
339
|
+
var fastStringWidth = (input, options = {}) => {
|
|
340
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
341
|
+
};
|
|
342
|
+
var dist_default2 = fastStringWidth;
|
|
343
|
+
|
|
344
|
+
// ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
345
|
+
var ESC = "\x1B";
|
|
346
|
+
var CSI = "\x9B";
|
|
347
|
+
var END_CODE = 39;
|
|
348
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
349
|
+
var ANSI_CSI = "[";
|
|
350
|
+
var ANSI_OSC = "]";
|
|
351
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
352
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
353
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
354
|
+
var getClosingCode = (openingCode) => {
|
|
355
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
356
|
+
return 39;
|
|
357
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
358
|
+
return 39;
|
|
359
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
360
|
+
return 49;
|
|
361
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
362
|
+
return 49;
|
|
363
|
+
if (openingCode === 1 || openingCode === 2)
|
|
364
|
+
return 22;
|
|
365
|
+
if (openingCode === 3)
|
|
366
|
+
return 23;
|
|
367
|
+
if (openingCode === 4)
|
|
368
|
+
return 24;
|
|
369
|
+
if (openingCode === 7)
|
|
370
|
+
return 27;
|
|
371
|
+
if (openingCode === 8)
|
|
372
|
+
return 28;
|
|
373
|
+
if (openingCode === 9)
|
|
374
|
+
return 29;
|
|
375
|
+
if (openingCode === 0)
|
|
376
|
+
return 0;
|
|
377
|
+
return void 0;
|
|
378
|
+
};
|
|
379
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
380
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
381
|
+
var wrapWord = (rows, word, columns) => {
|
|
382
|
+
const characters = word[Symbol.iterator]();
|
|
383
|
+
let isInsideEscape = false;
|
|
384
|
+
let isInsideLinkEscape = false;
|
|
385
|
+
let lastRow = rows.at(-1);
|
|
386
|
+
let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
|
|
387
|
+
let currentCharacter = characters.next();
|
|
388
|
+
let nextCharacter = characters.next();
|
|
389
|
+
let rawCharacterIndex = 0;
|
|
390
|
+
while (!currentCharacter.done) {
|
|
391
|
+
const character = currentCharacter.value;
|
|
392
|
+
const characterLength = dist_default2(character);
|
|
393
|
+
if (visible + characterLength <= columns) {
|
|
394
|
+
rows[rows.length - 1] += character;
|
|
395
|
+
} else {
|
|
396
|
+
rows.push(character);
|
|
397
|
+
visible = 0;
|
|
398
|
+
}
|
|
399
|
+
if (character === ESC || character === CSI) {
|
|
400
|
+
isInsideEscape = true;
|
|
401
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
402
|
+
}
|
|
403
|
+
if (isInsideEscape) {
|
|
404
|
+
if (isInsideLinkEscape) {
|
|
405
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
406
|
+
isInsideEscape = false;
|
|
407
|
+
isInsideLinkEscape = false;
|
|
408
|
+
}
|
|
409
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
410
|
+
isInsideEscape = false;
|
|
411
|
+
}
|
|
412
|
+
} else {
|
|
413
|
+
visible += characterLength;
|
|
414
|
+
if (visible === columns && !nextCharacter.done) {
|
|
415
|
+
rows.push("");
|
|
416
|
+
visible = 0;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
currentCharacter = nextCharacter;
|
|
420
|
+
nextCharacter = characters.next();
|
|
421
|
+
rawCharacterIndex += character.length;
|
|
422
|
+
}
|
|
423
|
+
lastRow = rows.at(-1);
|
|
424
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
425
|
+
rows[rows.length - 2] += rows.pop();
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
429
|
+
const words = string.split(" ");
|
|
430
|
+
let last = words.length;
|
|
431
|
+
while (last) {
|
|
432
|
+
if (dist_default2(words[last - 1])) {
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
last--;
|
|
436
|
+
}
|
|
437
|
+
if (last === words.length) {
|
|
438
|
+
return string;
|
|
439
|
+
}
|
|
440
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
441
|
+
};
|
|
442
|
+
var exec = (string, columns, options = {}) => {
|
|
443
|
+
if (options.trim !== false && string.trim() === "") {
|
|
444
|
+
return "";
|
|
445
|
+
}
|
|
446
|
+
let returnValue = "";
|
|
447
|
+
let escapeCode;
|
|
448
|
+
let escapeUrl;
|
|
449
|
+
const words = string.split(" ");
|
|
450
|
+
let rows = [""];
|
|
451
|
+
let rowLength = 0;
|
|
452
|
+
for (let index = 0; index < words.length; index++) {
|
|
453
|
+
const word = words[index];
|
|
454
|
+
if (options.trim !== false) {
|
|
455
|
+
const row = rows.at(-1) ?? "";
|
|
456
|
+
const trimmed = row.trimStart();
|
|
457
|
+
if (row.length !== trimmed.length) {
|
|
458
|
+
rows[rows.length - 1] = trimmed;
|
|
459
|
+
rowLength = dist_default2(trimmed);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (index !== 0) {
|
|
463
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
464
|
+
rows.push("");
|
|
465
|
+
rowLength = 0;
|
|
466
|
+
}
|
|
467
|
+
if (rowLength || options.trim === false) {
|
|
468
|
+
rows[rows.length - 1] += " ";
|
|
469
|
+
rowLength++;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
const wordLength = dist_default2(word);
|
|
473
|
+
if (options.hard && wordLength > columns) {
|
|
474
|
+
const remainingColumns = columns - rowLength;
|
|
475
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
476
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
477
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
478
|
+
rows.push("");
|
|
479
|
+
}
|
|
480
|
+
wrapWord(rows, word, columns);
|
|
481
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
485
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
486
|
+
wrapWord(rows, word, columns);
|
|
487
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
rows.push("");
|
|
491
|
+
rowLength = 0;
|
|
492
|
+
}
|
|
493
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
494
|
+
wrapWord(rows, word, columns);
|
|
495
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
rows[rows.length - 1] += word;
|
|
499
|
+
rowLength += wordLength;
|
|
500
|
+
}
|
|
501
|
+
if (options.trim !== false) {
|
|
502
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
503
|
+
}
|
|
504
|
+
const preString = rows.join("\n");
|
|
505
|
+
let inSurrogate = false;
|
|
506
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
507
|
+
const character = preString[i2];
|
|
508
|
+
returnValue += character;
|
|
509
|
+
if (!inSurrogate) {
|
|
510
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
511
|
+
if (inSurrogate) {
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
} else {
|
|
515
|
+
inSurrogate = false;
|
|
516
|
+
}
|
|
517
|
+
if (character === ESC || character === CSI) {
|
|
518
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
519
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
520
|
+
const groups = groupsResult?.groups;
|
|
521
|
+
if (groups?.code !== void 0) {
|
|
522
|
+
const code = Number.parseFloat(groups.code);
|
|
523
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
524
|
+
} else if (groups?.uri !== void 0) {
|
|
525
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (preString[i2 + 1] === "\n") {
|
|
529
|
+
if (escapeUrl) {
|
|
530
|
+
returnValue += wrapAnsiHyperlink("");
|
|
531
|
+
}
|
|
532
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
533
|
+
if (escapeCode && closingCode) {
|
|
534
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
535
|
+
}
|
|
536
|
+
} else if (character === "\n") {
|
|
537
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
538
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
539
|
+
}
|
|
540
|
+
if (escapeUrl) {
|
|
541
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return returnValue;
|
|
546
|
+
};
|
|
547
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
548
|
+
function wrapAnsi(string, columns, options) {
|
|
549
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// ../../node_modules/.pnpm/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
|
|
553
|
+
var ESC2 = "\x1B";
|
|
554
|
+
var CSI2 = `${ESC2}[`;
|
|
555
|
+
var cursor = {
|
|
556
|
+
to(x, y) {
|
|
557
|
+
if (!y)
|
|
558
|
+
return `${CSI2}${x + 1}G`;
|
|
559
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
560
|
+
},
|
|
561
|
+
move(x, y) {
|
|
562
|
+
let ret = "";
|
|
563
|
+
if (x < 0)
|
|
564
|
+
ret += `${CSI2}${-x}D`;
|
|
565
|
+
else if (x > 0)
|
|
566
|
+
ret += `${CSI2}${x}C`;
|
|
567
|
+
if (y < 0)
|
|
568
|
+
ret += `${CSI2}${-y}A`;
|
|
569
|
+
else if (y > 0)
|
|
570
|
+
ret += `${CSI2}${y}B`;
|
|
571
|
+
return ret;
|
|
572
|
+
},
|
|
573
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
574
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
575
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
576
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
577
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
578
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
579
|
+
left: `${CSI2}G`,
|
|
580
|
+
hide: `${CSI2}?25l`,
|
|
581
|
+
show: `${CSI2}?25h`,
|
|
582
|
+
save: `${ESC2}7`,
|
|
583
|
+
restore: `${ESC2}8`
|
|
584
|
+
};
|
|
585
|
+
var erase = {
|
|
586
|
+
screen: `${CSI2}2J`,
|
|
587
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
588
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
589
|
+
line: `${CSI2}2K`,
|
|
590
|
+
lineEnd: `${CSI2}K`,
|
|
591
|
+
lineStart: `${CSI2}1K`,
|
|
592
|
+
lines(count) {
|
|
593
|
+
let clear2 = "";
|
|
594
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
595
|
+
clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
|
|
596
|
+
if (count)
|
|
597
|
+
clear2 += cursor.left;
|
|
598
|
+
return clear2;
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
var clear = {
|
|
602
|
+
screen: `${ESC2}c`
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
// ../../node_modules/.pnpm/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
|
|
606
|
+
function findCursor(o, s, l) {
|
|
607
|
+
if (!l.some((r2) => !r2.disabled))
|
|
608
|
+
return o;
|
|
609
|
+
const t2 = o + s, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
610
|
+
return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
|
|
611
|
+
}
|
|
612
|
+
var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
613
|
+
var t = [
|
|
614
|
+
"January",
|
|
615
|
+
"February",
|
|
616
|
+
"March",
|
|
617
|
+
"April",
|
|
618
|
+
"May",
|
|
619
|
+
"June",
|
|
620
|
+
"July",
|
|
621
|
+
"August",
|
|
622
|
+
"September",
|
|
623
|
+
"October",
|
|
624
|
+
"November",
|
|
625
|
+
"December"
|
|
626
|
+
];
|
|
627
|
+
var settings = {
|
|
628
|
+
actions: new Set(a$1),
|
|
629
|
+
aliases: /* @__PURE__ */ new Map([
|
|
630
|
+
// vim support
|
|
631
|
+
["k", "up"],
|
|
632
|
+
["j", "down"],
|
|
633
|
+
["h", "left"],
|
|
634
|
+
["l", "right"],
|
|
635
|
+
["", "cancel"],
|
|
636
|
+
// opinionated defaults!
|
|
637
|
+
["escape", "cancel"]
|
|
638
|
+
]),
|
|
639
|
+
messages: {
|
|
640
|
+
cancel: "Canceled",
|
|
641
|
+
error: "Something went wrong"
|
|
642
|
+
},
|
|
643
|
+
withGuide: true,
|
|
644
|
+
accessible: void 0,
|
|
645
|
+
date: {
|
|
646
|
+
monthNames: [...t],
|
|
647
|
+
messages: {
|
|
648
|
+
required: "Please enter a valid date",
|
|
649
|
+
invalidMonth: "There are only 12 months in a year",
|
|
650
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
651
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
652
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
function isAccessible(n3) {
|
|
657
|
+
if (n3 !== void 0) return n3;
|
|
658
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
659
|
+
const e = process.env.ACCESSIBLE;
|
|
660
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
661
|
+
}
|
|
662
|
+
function isActionKey(n3, e) {
|
|
663
|
+
if (typeof n3 == "string")
|
|
664
|
+
return settings.aliases.get(n3) === e;
|
|
665
|
+
for (const s of n3)
|
|
666
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
667
|
+
return true;
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
function diffLines(i2, s) {
|
|
671
|
+
if (i2 === s) return;
|
|
672
|
+
const e = i2.split(`
|
|
673
|
+
`), t2 = s.split(`
|
|
674
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
675
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
676
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
677
|
+
return {
|
|
678
|
+
lines: f,
|
|
679
|
+
numLinesBefore: e.length,
|
|
680
|
+
numLinesAfter: t2.length,
|
|
681
|
+
numLines: r2
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
var R = globalThis.process.platform.startsWith("win");
|
|
685
|
+
var CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
686
|
+
function isCancel(e) {
|
|
687
|
+
return e === CANCEL_SYMBOL;
|
|
688
|
+
}
|
|
689
|
+
function setRawMode(e, r2) {
|
|
690
|
+
const o = e;
|
|
691
|
+
o.isTTY && o.setRawMode(r2);
|
|
692
|
+
}
|
|
693
|
+
var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
694
|
+
var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
695
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
696
|
+
const l = getColumns(e ?? stdout), i2 = dist_default2(o);
|
|
697
|
+
return wrapAnsi(r2, l - i2, {
|
|
698
|
+
hard: true,
|
|
699
|
+
trim: false
|
|
700
|
+
}).split(`
|
|
701
|
+
`).map((c3, a2, g) => {
|
|
702
|
+
const m2 = t2 ? t2(c3, a2) : c3;
|
|
703
|
+
return a2 === 0 ? `${n3}${m2}` : a2 === g.length - 1 ? `${s}${m2}` : `${o}${m2}`;
|
|
704
|
+
}).join(`
|
|
705
|
+
`);
|
|
706
|
+
}
|
|
707
|
+
function runValidation(e, a2) {
|
|
708
|
+
if ("~standard" in e) {
|
|
709
|
+
const n3 = e["~standard"].validate(a2);
|
|
710
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
711
|
+
}
|
|
712
|
+
return e(a2);
|
|
713
|
+
}
|
|
714
|
+
var C$1 = class C {
|
|
715
|
+
input;
|
|
716
|
+
output;
|
|
717
|
+
_abortSignal;
|
|
718
|
+
rl;
|
|
719
|
+
opts;
|
|
720
|
+
_render;
|
|
721
|
+
_track = false;
|
|
722
|
+
_prevFrame = "";
|
|
723
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
724
|
+
_cursor = 0;
|
|
725
|
+
state = "initial";
|
|
726
|
+
error = "";
|
|
727
|
+
value;
|
|
728
|
+
userInput = "";
|
|
729
|
+
/**
|
|
730
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
731
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
732
|
+
* and the `ACCESSIBLE` env var.
|
|
733
|
+
*/
|
|
734
|
+
get accessible() {
|
|
735
|
+
return isAccessible(this.opts.accessible);
|
|
736
|
+
}
|
|
737
|
+
constructor(t2, e = true) {
|
|
738
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
739
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Unsubscribe all listeners
|
|
743
|
+
*/
|
|
744
|
+
unsubscribe() {
|
|
745
|
+
this._subscribers.clear();
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Set a subscriber with opts
|
|
749
|
+
* @param event - The event name
|
|
750
|
+
*/
|
|
751
|
+
setSubscriber(t2, e) {
|
|
752
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
753
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Subscribe to an event
|
|
757
|
+
* @param event - The event name
|
|
758
|
+
* @param cb - The callback
|
|
759
|
+
*/
|
|
760
|
+
on(t2, e) {
|
|
761
|
+
this.setSubscriber(t2, { cb: e });
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Subscribe to an event once
|
|
765
|
+
* @param event - The event name
|
|
766
|
+
* @param cb - The callback
|
|
767
|
+
*/
|
|
768
|
+
once(t2, e) {
|
|
769
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Emit an event with data
|
|
773
|
+
* @param event - The event name
|
|
774
|
+
* @param data - The data to pass to the callback
|
|
775
|
+
*/
|
|
776
|
+
emit(t2, ...e) {
|
|
777
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
778
|
+
for (const r2 of i2)
|
|
779
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
780
|
+
for (const r2 of s)
|
|
781
|
+
r2();
|
|
782
|
+
}
|
|
783
|
+
prompt() {
|
|
784
|
+
return new Promise((t2) => {
|
|
785
|
+
if (this._abortSignal) {
|
|
786
|
+
if (this._abortSignal.aborted)
|
|
787
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
788
|
+
this._abortSignal.addEventListener(
|
|
789
|
+
"abort",
|
|
790
|
+
() => {
|
|
791
|
+
this.state = "cancel", this.close();
|
|
792
|
+
},
|
|
793
|
+
{ once: true }
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
this.rl = f__default.createInterface({
|
|
797
|
+
input: this.input,
|
|
798
|
+
tabSize: 2,
|
|
799
|
+
prompt: "",
|
|
800
|
+
escapeCodeTimeout: 50,
|
|
801
|
+
terminal: true
|
|
802
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
803
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
804
|
+
}), this.once("cancel", () => {
|
|
805
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
_isActionKey(t2, e) {
|
|
810
|
+
return t2 === " ";
|
|
811
|
+
}
|
|
812
|
+
_shouldSubmit(t2, e) {
|
|
813
|
+
return true;
|
|
814
|
+
}
|
|
815
|
+
_setValue(t2) {
|
|
816
|
+
this.value = t2, this.emit("value", this.value);
|
|
817
|
+
}
|
|
818
|
+
_setUserInput(t2, e) {
|
|
819
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
820
|
+
}
|
|
821
|
+
_clearUserInput() {
|
|
822
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
823
|
+
}
|
|
824
|
+
async onKeypress(t2, e) {
|
|
825
|
+
if (this.state !== "validating") {
|
|
826
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
827
|
+
if (this.opts.validate) {
|
|
828
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
829
|
+
let s;
|
|
830
|
+
i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
831
|
+
}
|
|
832
|
+
this.state !== "error" && (this.state = "submit");
|
|
833
|
+
}
|
|
834
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
close() {
|
|
838
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
839
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
840
|
+
}
|
|
841
|
+
restoreCursor() {
|
|
842
|
+
const t2 = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
|
|
843
|
+
`).length - 1;
|
|
844
|
+
this.output.write(cursor.move(-999, t2 * -1));
|
|
845
|
+
}
|
|
846
|
+
render() {
|
|
847
|
+
const t2 = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
|
|
848
|
+
hard: true,
|
|
849
|
+
trim: false
|
|
850
|
+
});
|
|
851
|
+
if (t2 !== this._prevFrame) {
|
|
852
|
+
if (this.state === "initial")
|
|
853
|
+
this.output.write(cursor.hide);
|
|
854
|
+
else {
|
|
855
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
856
|
+
if (this.restoreCursor(), e) {
|
|
857
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
858
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
859
|
+
if (n3 === void 0) {
|
|
860
|
+
this._prevFrame = t2;
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
if (e.lines.length === 1) {
|
|
864
|
+
this.output.write(cursor.move(0, n3 - r2)), this.output.write(erase.lines(1));
|
|
865
|
+
const o = t2.split(`
|
|
866
|
+
`);
|
|
867
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(cursor.move(0, o.length - n3 - 1));
|
|
868
|
+
return;
|
|
869
|
+
} else if (e.lines.length > 1) {
|
|
870
|
+
if (s < r2)
|
|
871
|
+
n3 = s;
|
|
872
|
+
else {
|
|
873
|
+
const h2 = n3 - r2;
|
|
874
|
+
h2 > 0 && this.output.write(cursor.move(0, h2));
|
|
875
|
+
}
|
|
876
|
+
this.output.write(erase.down());
|
|
877
|
+
const m2 = t2.split(`
|
|
878
|
+
`).slice(n3);
|
|
879
|
+
this.output.write(m2.join(`
|
|
880
|
+
`)), this._prevFrame = t2;
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
this.output.write(erase.down());
|
|
885
|
+
}
|
|
886
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
var r = class extends C$1 {
|
|
891
|
+
get cursor() {
|
|
892
|
+
return this.value ? 0 : 1;
|
|
893
|
+
}
|
|
894
|
+
get _value() {
|
|
895
|
+
return this.cursor === 0;
|
|
896
|
+
}
|
|
897
|
+
constructor(t2) {
|
|
898
|
+
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
899
|
+
this.value = this._value;
|
|
900
|
+
}), this.on("confirm", (i2) => {
|
|
901
|
+
this.output.write(cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
902
|
+
}), this.on("cursor", () => {
|
|
903
|
+
this.value = !this.value;
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
var a = class extends C$1 {
|
|
908
|
+
options;
|
|
909
|
+
cursor = 0;
|
|
910
|
+
get _value() {
|
|
911
|
+
return this.options[this.cursor]?.value;
|
|
912
|
+
}
|
|
913
|
+
get _enabledOptions() {
|
|
914
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
915
|
+
}
|
|
916
|
+
toggleAll() {
|
|
917
|
+
const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
|
|
918
|
+
this.value = i2 ? [] : e.map((t2) => t2.value);
|
|
919
|
+
}
|
|
920
|
+
toggleInvert() {
|
|
921
|
+
const e = this.value;
|
|
922
|
+
if (!e)
|
|
923
|
+
return;
|
|
924
|
+
const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
|
|
925
|
+
this.value = i2.map((t2) => t2.value);
|
|
926
|
+
}
|
|
927
|
+
toggleValue() {
|
|
928
|
+
this.value === void 0 && (this.value = []);
|
|
929
|
+
const e = this.value.includes(this._value);
|
|
930
|
+
this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
|
|
931
|
+
}
|
|
932
|
+
constructor(e) {
|
|
933
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
934
|
+
const i2 = Math.max(
|
|
935
|
+
this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
|
|
936
|
+
0
|
|
937
|
+
);
|
|
938
|
+
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, s) => {
|
|
939
|
+
s.name === "a" && this.toggleAll(), s.name === "i" && this.toggleInvert(), s.name === void 0 && t2 === "\u3000" && this.toggleValue();
|
|
940
|
+
}), this.on("cursor", (t2) => {
|
|
941
|
+
switch (t2) {
|
|
942
|
+
case "left":
|
|
943
|
+
case "up":
|
|
944
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
945
|
+
break;
|
|
946
|
+
case "down":
|
|
947
|
+
case "right":
|
|
948
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
949
|
+
break;
|
|
950
|
+
case "space":
|
|
951
|
+
this.toggleValue();
|
|
952
|
+
break;
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
var u = class extends C$1 {
|
|
958
|
+
_mask = "\u2022";
|
|
959
|
+
get cursor() {
|
|
960
|
+
return this._cursor;
|
|
961
|
+
}
|
|
962
|
+
get masked() {
|
|
963
|
+
return this.userInput.replaceAll(/./g, this._mask);
|
|
964
|
+
}
|
|
965
|
+
get userInputWithCursor() {
|
|
966
|
+
if (this.state === "submit" || this.state === "cancel")
|
|
967
|
+
return this.masked;
|
|
968
|
+
const t2 = this.userInput;
|
|
969
|
+
if (this.cursor >= t2.length)
|
|
970
|
+
return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
|
|
971
|
+
const s = this.masked, r2 = s.slice(0, this.cursor), i2 = s.slice(this.cursor, this.cursor + 1), o = s.slice(this.cursor + 1);
|
|
972
|
+
return `${r2}${styleText("inverse", i2)}${o}`;
|
|
973
|
+
}
|
|
974
|
+
clear() {
|
|
975
|
+
this._clearUserInput();
|
|
976
|
+
}
|
|
977
|
+
constructor({ mask: t2, ...s }) {
|
|
978
|
+
super(s), this._mask = t2 ?? "\u2022", this.on("userInput", (r2) => {
|
|
979
|
+
this._setValue(r2);
|
|
980
|
+
}), this.on("finalize", () => {
|
|
981
|
+
this.value === void 0 && (this.value = "");
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
var n$1 = class n extends C$1 {
|
|
986
|
+
options;
|
|
987
|
+
cursor = 0;
|
|
988
|
+
get _selectedValue() {
|
|
989
|
+
return this.options[this.cursor];
|
|
990
|
+
}
|
|
991
|
+
changeValue() {
|
|
992
|
+
const e = this._selectedValue;
|
|
993
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
994
|
+
}
|
|
995
|
+
constructor(e) {
|
|
996
|
+
super(e, false), this.options = e.options;
|
|
997
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
998
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
999
|
+
switch (s) {
|
|
1000
|
+
case "left":
|
|
1001
|
+
case "up":
|
|
1002
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
1003
|
+
break;
|
|
1004
|
+
case "down":
|
|
1005
|
+
case "right":
|
|
1006
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
1007
|
+
break;
|
|
1008
|
+
}
|
|
1009
|
+
this.changeValue();
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
var n2 = class extends C$1 {
|
|
1014
|
+
get userInputWithCursor() {
|
|
1015
|
+
if (this.state === "submit")
|
|
1016
|
+
return this.userInput;
|
|
1017
|
+
const t2 = this.userInput;
|
|
1018
|
+
if (this.cursor >= t2.length)
|
|
1019
|
+
return `${this.userInput}\u2588`;
|
|
1020
|
+
const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
|
|
1021
|
+
return `${r2}${styleText("inverse", s)}${e}`;
|
|
1022
|
+
}
|
|
1023
|
+
get cursor() {
|
|
1024
|
+
return this._cursor;
|
|
1025
|
+
}
|
|
1026
|
+
constructor(t2) {
|
|
1027
|
+
super({
|
|
1028
|
+
...t2,
|
|
1029
|
+
initialUserInput: t2.initialUserInput ?? t2.initialValue
|
|
1030
|
+
}), this.on("userInput", (r2) => {
|
|
1031
|
+
this._setValue(r2);
|
|
1032
|
+
}), this.on("finalize", () => {
|
|
1033
|
+
this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
// ../../node_modules/.pnpm/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
|
|
1039
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
1040
|
+
import process$1 from "node:process";
|
|
1041
|
+
function isUnicodeSupported() {
|
|
1042
|
+
if (process$1.platform !== "win32") {
|
|
1043
|
+
return process$1.env.TERM !== "linux";
|
|
1044
|
+
}
|
|
1045
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1046
|
+
}
|
|
1047
|
+
var unicode = isUnicodeSupported();
|
|
1048
|
+
var unicodeOr = (e, o) => unicode ? e : o;
|
|
1049
|
+
var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
1050
|
+
var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
1051
|
+
var S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
1052
|
+
var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
1053
|
+
var S_BAR_START = unicodeOr("\u250C", "T");
|
|
1054
|
+
var S_BAR = unicodeOr("\u2502", "|");
|
|
1055
|
+
var S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
1056
|
+
var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
1057
|
+
var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
1058
|
+
var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
1059
|
+
var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
1060
|
+
var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
1061
|
+
var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
1062
|
+
var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
1063
|
+
var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
1064
|
+
var S_BAR_H = unicodeOr("\u2500", "-");
|
|
1065
|
+
var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
1066
|
+
var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
1067
|
+
var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
1068
|
+
var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
1069
|
+
var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
1070
|
+
var S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
1071
|
+
var S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
1072
|
+
var S_WARN = unicodeOr("\u25B2", "!");
|
|
1073
|
+
var S_ERROR = unicodeOr("\u25A0", "x");
|
|
1074
|
+
var symbol = (e) => {
|
|
1075
|
+
switch (e) {
|
|
1076
|
+
case "initial":
|
|
1077
|
+
case "active":
|
|
1078
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
1079
|
+
case "cancel":
|
|
1080
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
1081
|
+
case "error":
|
|
1082
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
1083
|
+
case "submit":
|
|
1084
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
1085
|
+
case "validating":
|
|
1086
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
var symbolBar = (e) => {
|
|
1090
|
+
switch (e) {
|
|
1091
|
+
case "initial":
|
|
1092
|
+
case "active":
|
|
1093
|
+
return styleText2("cyan", S_BAR);
|
|
1094
|
+
case "cancel":
|
|
1095
|
+
return styleText2("red", S_BAR);
|
|
1096
|
+
case "error":
|
|
1097
|
+
return styleText2("yellow", S_BAR);
|
|
1098
|
+
case "submit":
|
|
1099
|
+
return styleText2("green", S_BAR);
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1102
|
+
function formatInstructionFooter(e, o, r2) {
|
|
1103
|
+
const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
|
|
1104
|
+
`);
|
|
1105
|
+
return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
|
|
1106
|
+
}
|
|
1107
|
+
var E$1 = (l, e, w, p, b, C3 = false) => {
|
|
1108
|
+
let r2 = e, O = 0;
|
|
1109
|
+
if (C3)
|
|
1110
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
1111
|
+
const m2 = l[i2];
|
|
1112
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
1113
|
+
}
|
|
1114
|
+
else
|
|
1115
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
1116
|
+
const m2 = l[i2];
|
|
1117
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
1118
|
+
}
|
|
1119
|
+
return { lineCount: r2, removals: O };
|
|
1120
|
+
};
|
|
1121
|
+
var limitOptions = ({
|
|
1122
|
+
cursor: l,
|
|
1123
|
+
options: e,
|
|
1124
|
+
style: w,
|
|
1125
|
+
output: p = process.stdout,
|
|
1126
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
1127
|
+
columnPadding: C3 = 0,
|
|
1128
|
+
rowPadding: r2 = 4
|
|
1129
|
+
}) => {
|
|
1130
|
+
const i2 = getColumns(p) - C3, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
1131
|
+
let f = 0;
|
|
1132
|
+
l >= a2 - 3 && (f = Math.max(
|
|
1133
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
1134
|
+
0
|
|
1135
|
+
));
|
|
1136
|
+
let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
|
|
1137
|
+
const I = Math.min(
|
|
1138
|
+
f + a2,
|
|
1139
|
+
e.length
|
|
1140
|
+
), s = [];
|
|
1141
|
+
let g = 0;
|
|
1142
|
+
d && g++, c3 && g++;
|
|
1143
|
+
const T = f + (d ? 1 : 0), W2 = I - (c3 ? 1 : 0);
|
|
1144
|
+
for (let t2 = T; t2 < W2; t2++) {
|
|
1145
|
+
const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
1146
|
+
hard: true,
|
|
1147
|
+
trim: false
|
|
1148
|
+
}).split(`
|
|
1149
|
+
`);
|
|
1150
|
+
s.push(h2), g += h2.length;
|
|
1151
|
+
}
|
|
1152
|
+
if (g > v) {
|
|
1153
|
+
let t2 = 0, n3 = 0, o = g;
|
|
1154
|
+
const h2 = l - T;
|
|
1155
|
+
let u3 = v;
|
|
1156
|
+
const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
|
|
1157
|
+
s,
|
|
1158
|
+
o,
|
|
1159
|
+
h2 + 1,
|
|
1160
|
+
s.length,
|
|
1161
|
+
u3,
|
|
1162
|
+
true
|
|
1163
|
+
);
|
|
1164
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y())) : (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c3 = true, s.splice(s.length - n3, n3));
|
|
1165
|
+
}
|
|
1166
|
+
const x = [];
|
|
1167
|
+
d && x.push(M);
|
|
1168
|
+
for (const t2 of s)
|
|
1169
|
+
for (const n3 of t2)
|
|
1170
|
+
x.push(n3);
|
|
1171
|
+
return c3 && x.push(M), x;
|
|
1172
|
+
};
|
|
1173
|
+
var confirm = (e) => {
|
|
1174
|
+
const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
1175
|
+
return new r({
|
|
1176
|
+
active: a2,
|
|
1177
|
+
inactive: o,
|
|
1178
|
+
signal: e.signal,
|
|
1179
|
+
input: e.input,
|
|
1180
|
+
output: e.output,
|
|
1181
|
+
initialValue: e.initialValue ?? true,
|
|
1182
|
+
render() {
|
|
1183
|
+
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
1184
|
+
e.output,
|
|
1185
|
+
e.message,
|
|
1186
|
+
l,
|
|
1187
|
+
u3
|
|
1188
|
+
), s = `${i2 ? `${styleText2("gray", S_BAR)}
|
|
1189
|
+
` : ""}${f}
|
|
1190
|
+
`, c3 = this.value ? a2 : o;
|
|
1191
|
+
switch (this.state) {
|
|
1192
|
+
case "submit": {
|
|
1193
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1194
|
+
return `${s}${r2}${styleText2("dim", c3)}`;
|
|
1195
|
+
}
|
|
1196
|
+
case "cancel": {
|
|
1197
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1198
|
+
return `${s}${r2}${styleText2(["strikethrough", "dim"], c3)}${i2 ? `
|
|
1199
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1200
|
+
}
|
|
1201
|
+
default: {
|
|
1202
|
+
const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1203
|
+
return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
|
|
1204
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
1205
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
|
|
1206
|
+
${g}
|
|
1207
|
+
`;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}).prompt();
|
|
1212
|
+
};
|
|
1213
|
+
var MULTISELECT_INSTRUCTIONS = [
|
|
1214
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1215
|
+
`${styleText2("dim", "Space:")} select`,
|
|
1216
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1217
|
+
];
|
|
1218
|
+
var m = (n3, u3) => n3.split(`
|
|
1219
|
+
`).map((d) => u3(d)).join(`
|
|
1220
|
+
`);
|
|
1221
|
+
var multiselect = (n3) => {
|
|
1222
|
+
const u3 = (t2, a2) => {
|
|
1223
|
+
const r2 = t2.label ?? String(t2.value);
|
|
1224
|
+
return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
|
|
1225
|
+
}, d = n3.required ?? true, x = n3.showInstructions ?? true;
|
|
1226
|
+
return new a({
|
|
1227
|
+
options: n3.options,
|
|
1228
|
+
signal: n3.signal,
|
|
1229
|
+
input: n3.input,
|
|
1230
|
+
output: n3.output,
|
|
1231
|
+
initialValues: n3.initialValues,
|
|
1232
|
+
required: d,
|
|
1233
|
+
cursorAt: n3.cursorAt,
|
|
1234
|
+
validate(t2) {
|
|
1235
|
+
if (d && (t2 === void 0 || t2.length === 0))
|
|
1236
|
+
return `Please select at least one option.
|
|
1237
|
+
${styleText2(
|
|
1238
|
+
"reset",
|
|
1239
|
+
styleText2(
|
|
1240
|
+
"dim",
|
|
1241
|
+
`Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
|
|
1242
|
+
"gray",
|
|
1243
|
+
styleText2("bgWhite", styleText2("inverse", " enter "))
|
|
1244
|
+
)} to submit`
|
|
1245
|
+
)
|
|
1246
|
+
)}`;
|
|
1247
|
+
},
|
|
1248
|
+
render() {
|
|
1249
|
+
const t2 = n3.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
|
|
1250
|
+
n3.output,
|
|
1251
|
+
n3.message,
|
|
1252
|
+
t2 ? `${symbolBar(this.state)} ` : "",
|
|
1253
|
+
`${symbol(this.state)} `
|
|
1254
|
+
), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
1255
|
+
` : ""}${a2}
|
|
1256
|
+
`, o = this.value ?? [], g = (i2, l) => {
|
|
1257
|
+
if (i2.disabled)
|
|
1258
|
+
return u3(i2, "disabled");
|
|
1259
|
+
const s = o.includes(i2.value);
|
|
1260
|
+
return l && s ? u3(i2, "active-selected") : s ? u3(i2, "selected") : u3(i2, l ? "active" : "inactive");
|
|
1261
|
+
};
|
|
1262
|
+
switch (this.state) {
|
|
1263
|
+
case "submit": {
|
|
1264
|
+
const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
|
|
1265
|
+
n3.output,
|
|
1266
|
+
i2,
|
|
1267
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1268
|
+
);
|
|
1269
|
+
return `${r2}${l}`;
|
|
1270
|
+
}
|
|
1271
|
+
case "cancel": {
|
|
1272
|
+
const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
|
|
1273
|
+
if (i2.trim() === "")
|
|
1274
|
+
return `${r2}${styleText2("gray", S_BAR)}`;
|
|
1275
|
+
const l = wrapTextWithPrefix(
|
|
1276
|
+
n3.output,
|
|
1277
|
+
i2,
|
|
1278
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1279
|
+
);
|
|
1280
|
+
return `${r2}${l}${t2 ? `
|
|
1281
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1282
|
+
}
|
|
1283
|
+
case "error": {
|
|
1284
|
+
const i2 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
1285
|
+
`).map(
|
|
1286
|
+
($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
|
|
1287
|
+
).join(`
|
|
1288
|
+
`), s = r2.split(`
|
|
1289
|
+
`).length, h2 = l.split(`
|
|
1290
|
+
`).length + 1;
|
|
1291
|
+
return `${r2}${i2}${limitOptions({
|
|
1292
|
+
output: n3.output,
|
|
1293
|
+
options: this.options,
|
|
1294
|
+
cursor: this.cursor,
|
|
1295
|
+
maxItems: n3.maxItems,
|
|
1296
|
+
columnPadding: i2.length,
|
|
1297
|
+
rowPadding: s + h2,
|
|
1298
|
+
style: g
|
|
1299
|
+
}).join(`
|
|
1300
|
+
${i2}`)}
|
|
1301
|
+
${l}
|
|
1302
|
+
`;
|
|
1303
|
+
}
|
|
1304
|
+
default: {
|
|
1305
|
+
const i2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
|
|
1306
|
+
`).length, s = x ? formatInstructionFooter(n3.output, MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1307
|
+
`), $ = s.length + 1;
|
|
1308
|
+
return `${r2}${i2}${limitOptions({
|
|
1309
|
+
output: n3.output,
|
|
1310
|
+
options: this.options,
|
|
1311
|
+
cursor: this.cursor,
|
|
1312
|
+
maxItems: n3.maxItems,
|
|
1313
|
+
columnPadding: i2.length,
|
|
1314
|
+
rowPadding: l + $,
|
|
1315
|
+
style: g
|
|
1316
|
+
}).join(`
|
|
1317
|
+
${i2}`)}
|
|
1318
|
+
${h2}
|
|
1319
|
+
`;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}).prompt();
|
|
1324
|
+
};
|
|
1325
|
+
var log = {
|
|
1326
|
+
message: (s = [], {
|
|
1327
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1328
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1329
|
+
output: m2 = process.stdout,
|
|
1330
|
+
spacing: l = 1,
|
|
1331
|
+
withGuide: c3
|
|
1332
|
+
} = {}) => {
|
|
1333
|
+
const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1334
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
1335
|
+
t2.push(f);
|
|
1336
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
1337
|
+
`);
|
|
1338
|
+
if (g.length > 0) {
|
|
1339
|
+
const [i2, ...y] = g;
|
|
1340
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1341
|
+
for (const p of y)
|
|
1342
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1343
|
+
}
|
|
1344
|
+
m2.write(`${t2.join(`
|
|
1345
|
+
`)}
|
|
1346
|
+
`);
|
|
1347
|
+
},
|
|
1348
|
+
info: (s, e) => {
|
|
1349
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1350
|
+
},
|
|
1351
|
+
success: (s, e) => {
|
|
1352
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1353
|
+
},
|
|
1354
|
+
step: (s, e) => {
|
|
1355
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1356
|
+
},
|
|
1357
|
+
warn: (s, e) => {
|
|
1358
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1359
|
+
},
|
|
1360
|
+
/** alias for `log.warn()`. */
|
|
1361
|
+
warning: (s, e) => {
|
|
1362
|
+
log.warn(s, e);
|
|
1363
|
+
},
|
|
1364
|
+
error: (s, e) => {
|
|
1365
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
var cancel = (o = "", t2) => {
|
|
1369
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1370
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
1371
|
+
|
|
1372
|
+
`);
|
|
1373
|
+
};
|
|
1374
|
+
var intro = (o = "", t2) => {
|
|
1375
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
1376
|
+
i2.write(`${e}${o}
|
|
1377
|
+
`);
|
|
1378
|
+
};
|
|
1379
|
+
var outro = (o = "", t2) => {
|
|
1380
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
1381
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
1382
|
+
i2.write(`${e}${o}
|
|
1383
|
+
|
|
1384
|
+
`);
|
|
1385
|
+
};
|
|
1386
|
+
var W = (o) => o;
|
|
1387
|
+
var C2 = (o, e, s) => {
|
|
1388
|
+
const a2 = {
|
|
1389
|
+
hard: true,
|
|
1390
|
+
trim: false
|
|
1391
|
+
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
1392
|
+
`), c3 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g = e - (u3 - c3);
|
|
1393
|
+
return wrapAnsi(o, g, a2);
|
|
1394
|
+
};
|
|
1395
|
+
var note = (o = "", e = "", s) => {
|
|
1396
|
+
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
|
|
1397
|
+
`).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1398
|
+
g.reduce((m2, F) => {
|
|
1399
|
+
const O = dist_default2(F);
|
|
1400
|
+
return O > m2 ? O : m2;
|
|
1401
|
+
}, 0),
|
|
1402
|
+
n3
|
|
1403
|
+
) + 2, h2 = g.map(
|
|
1404
|
+
(m2) => `${styleText2("gray", S_BAR)} ${m2}${" ".repeat(t2 - dist_default2(m2))}${styleText2("gray", S_BAR)}`
|
|
1405
|
+
).join(`
|
|
1406
|
+
`), T = i2 ? `${styleText2("gray", S_BAR)}
|
|
1407
|
+
` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
1408
|
+
a2.write(
|
|
1409
|
+
`${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
|
|
1410
|
+
"gray",
|
|
1411
|
+
S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
|
|
1412
|
+
)}
|
|
1413
|
+
${h2}
|
|
1414
|
+
${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
1415
|
+
`
|
|
1416
|
+
);
|
|
1417
|
+
};
|
|
1418
|
+
var password = (e) => new u({
|
|
1419
|
+
validate: e.validate,
|
|
1420
|
+
mask: e.mask ?? S_PASSWORD_MASK,
|
|
1421
|
+
signal: e.signal,
|
|
1422
|
+
input: e.input,
|
|
1423
|
+
output: e.output,
|
|
1424
|
+
render() {
|
|
1425
|
+
const r2 = e.withGuide ?? settings.withGuide, o = `${r2 ? `${styleText2("gray", S_BAR)}
|
|
1426
|
+
` : ""}${symbol(this.state)} ${e.message}
|
|
1427
|
+
`, m2 = this.userInputWithCursor, i2 = this.masked;
|
|
1428
|
+
switch (this.state) {
|
|
1429
|
+
case "error": {
|
|
1430
|
+
const s = r2 ? `${styleText2("yellow", S_BAR)} ` : "", n3 = r2 ? `${styleText2("yellow", S_BAR_END)} ` : "", d = i2 ?? "";
|
|
1431
|
+
return e.clearOnError && this.clear(), `${o.trim()}
|
|
1432
|
+
${s}${d}
|
|
1433
|
+
${n3}${styleText2("yellow", this.error)}
|
|
1434
|
+
`;
|
|
1435
|
+
}
|
|
1436
|
+
case "submit": {
|
|
1437
|
+
const s = r2 ? `${styleText2("gray", S_BAR)} ` : "", n3 = i2 ? styleText2("dim", i2) : "";
|
|
1438
|
+
return `${o}${s}${n3}`;
|
|
1439
|
+
}
|
|
1440
|
+
case "cancel": {
|
|
1441
|
+
const s = r2 ? `${styleText2("gray", S_BAR)} ` : "", n3 = i2 ? styleText2(["strikethrough", "dim"], i2) : "";
|
|
1442
|
+
return `${o}${s}${n3}${i2 && r2 ? `
|
|
1443
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1444
|
+
}
|
|
1445
|
+
default: {
|
|
1446
|
+
const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1447
|
+
return `${o}${s}${m2}
|
|
1448
|
+
${n3}
|
|
1449
|
+
`;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}).prompt();
|
|
1454
|
+
var u2 = {
|
|
1455
|
+
light: unicodeOr("\u2500", "-"),
|
|
1456
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1457
|
+
block: unicodeOr("\u2588", "#")
|
|
1458
|
+
};
|
|
1459
|
+
var SELECT_INSTRUCTIONS = [
|
|
1460
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1461
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1462
|
+
];
|
|
1463
|
+
var c2 = (t2, o) => t2.includes(`
|
|
1464
|
+
`) ? t2.split(`
|
|
1465
|
+
`).map((d) => o(d)).join(`
|
|
1466
|
+
`) : o(t2);
|
|
1467
|
+
var select = (t2) => {
|
|
1468
|
+
const o = (n3, m2) => {
|
|
1469
|
+
if (n3 === void 0)
|
|
1470
|
+
return "";
|
|
1471
|
+
const s = n3.label ?? String(n3.value);
|
|
1472
|
+
switch (m2) {
|
|
1473
|
+
case "disabled":
|
|
1474
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1475
|
+
case "selected":
|
|
1476
|
+
return `${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1477
|
+
case "active":
|
|
1478
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1479
|
+
case "cancelled":
|
|
1480
|
+
return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1481
|
+
default:
|
|
1482
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1483
|
+
}
|
|
1484
|
+
}, d = t2.showInstructions ?? true;
|
|
1485
|
+
return new n$1({
|
|
1486
|
+
options: t2.options,
|
|
1487
|
+
signal: t2.signal,
|
|
1488
|
+
input: t2.input,
|
|
1489
|
+
output: t2.output,
|
|
1490
|
+
initialValue: t2.initialValue,
|
|
1491
|
+
render() {
|
|
1492
|
+
const n3 = t2.withGuide ?? settings.withGuide, m2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1493
|
+
t2.output,
|
|
1494
|
+
t2.message,
|
|
1495
|
+
s,
|
|
1496
|
+
m2
|
|
1497
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1498
|
+
` : ""}${i2}
|
|
1499
|
+
`;
|
|
1500
|
+
switch (this.state) {
|
|
1501
|
+
case "submit": {
|
|
1502
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1503
|
+
t2.output,
|
|
1504
|
+
o(this.options[this.cursor], "selected"),
|
|
1505
|
+
r2
|
|
1506
|
+
);
|
|
1507
|
+
return `${u3}${a2}`;
|
|
1508
|
+
}
|
|
1509
|
+
case "cancel": {
|
|
1510
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1511
|
+
t2.output,
|
|
1512
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1513
|
+
r2
|
|
1514
|
+
);
|
|
1515
|
+
return `${u3}${a2}${n3 ? `
|
|
1516
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1517
|
+
}
|
|
1518
|
+
default: {
|
|
1519
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1520
|
+
`).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1521
|
+
`), b = p.length + 1;
|
|
1522
|
+
return `${u3}${r2}${limitOptions({
|
|
1523
|
+
output: t2.output,
|
|
1524
|
+
cursor: this.cursor,
|
|
1525
|
+
options: this.options,
|
|
1526
|
+
maxItems: t2.maxItems,
|
|
1527
|
+
columnPadding: r2.length,
|
|
1528
|
+
rowPadding: a2 + b,
|
|
1529
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1530
|
+
}).join(`
|
|
1531
|
+
${r2}`)}
|
|
1532
|
+
${f}
|
|
1533
|
+
`;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}).prompt();
|
|
1538
|
+
};
|
|
1539
|
+
var i = `${styleText2("gray", S_BAR)} `;
|
|
1540
|
+
var text = (t2) => new n2({
|
|
1541
|
+
validate: t2.validate,
|
|
1542
|
+
placeholder: t2.placeholder,
|
|
1543
|
+
defaultValue: t2.defaultValue,
|
|
1544
|
+
initialValue: t2.initialValue,
|
|
1545
|
+
output: t2.output,
|
|
1546
|
+
signal: t2.signal,
|
|
1547
|
+
input: t2.input,
|
|
1548
|
+
render() {
|
|
1549
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
1550
|
+
` : ""}${symbol(this.state)} `}${t2.message}
|
|
1551
|
+
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
1552
|
+
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
1553
|
+
styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1))
|
|
1554
|
+
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
1555
|
+
switch (this.state) {
|
|
1556
|
+
case "validating": {
|
|
1557
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c3 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
1558
|
+
return `${l}${n3}${c3}
|
|
1559
|
+
${i2} ${$}
|
|
1560
|
+
`;
|
|
1561
|
+
}
|
|
1562
|
+
case "error": {
|
|
1563
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c3 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
1564
|
+
return `${l.trim()}
|
|
1565
|
+
${i2}${o}
|
|
1566
|
+
${c3}${n3}
|
|
1567
|
+
`;
|
|
1568
|
+
}
|
|
1569
|
+
case "submit": {
|
|
1570
|
+
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1571
|
+
return `${l}${i2}${n3}`;
|
|
1572
|
+
}
|
|
1573
|
+
case "cancel": {
|
|
1574
|
+
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1575
|
+
return `${l}${i2}${n3}${s.trim() ? `
|
|
1576
|
+
${i2}` : ""}`;
|
|
1577
|
+
}
|
|
1578
|
+
default: {
|
|
1579
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1580
|
+
return `${l}${n3}${o}
|
|
1581
|
+
${i2}
|
|
1582
|
+
`;
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
}).prompt();
|
|
1587
|
+
|
|
1588
|
+
// src/index.ts
|
|
1589
|
+
var import_mri = __toESM(require_lib(), 1);
|
|
1590
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
1591
|
+
|
|
1592
|
+
// src/apple.ts
|
|
1593
|
+
import { spawnSync } from "node:child_process";
|
|
1594
|
+
import { X509Certificate } from "node:crypto";
|
|
1595
|
+
import { homedir } from "node:os";
|
|
1596
|
+
import { join } from "node:path";
|
|
1597
|
+
var TEAM_ID = /^[A-Z0-9]{10}$/;
|
|
1598
|
+
function teamsFromXcodeJson(value) {
|
|
1599
|
+
if (Array.isArray(value)) return value.flatMap(teamsFromXcodeJson);
|
|
1600
|
+
if (typeof value !== "object" || value === null) return [];
|
|
1601
|
+
const record = Object.fromEntries(Object.entries(value));
|
|
1602
|
+
const id = record.teamID;
|
|
1603
|
+
if (typeof id === "string" && TEAM_ID.test(id)) {
|
|
1604
|
+
const name = typeof record.teamName === "string" ? record.teamName : id;
|
|
1605
|
+
return [{ id, name }];
|
|
1606
|
+
}
|
|
1607
|
+
return Object.values(record).flatMap(teamsFromXcodeJson);
|
|
1608
|
+
}
|
|
1609
|
+
function teamFromCertificateSubject(subject) {
|
|
1610
|
+
const fields = /* @__PURE__ */ new Map();
|
|
1611
|
+
for (const line of subject.split("\n")) {
|
|
1612
|
+
const eq = line.indexOf("=");
|
|
1613
|
+
if (eq > 0) fields.set(line.slice(0, eq).trim(), line.slice(eq + 1).trim());
|
|
1614
|
+
}
|
|
1615
|
+
const id = fields.get("OU");
|
|
1616
|
+
if (!id || !TEAM_ID.test(id)) return void 0;
|
|
1617
|
+
return { id, name: fields.get("O") ?? id };
|
|
1618
|
+
}
|
|
1619
|
+
function teamsFromXcode() {
|
|
1620
|
+
const plist = join(homedir(), "Library/Preferences/com.apple.dt.Xcode.plist");
|
|
1621
|
+
return ["IDEProvisioningTeamByIdentifier", "IDEProvisioningTeams"].flatMap(
|
|
1622
|
+
(key) => {
|
|
1623
|
+
const result = spawnSync(
|
|
1624
|
+
"plutil",
|
|
1625
|
+
["-extract", key, "json", "-o", "-", plist],
|
|
1626
|
+
{
|
|
1627
|
+
encoding: "utf8",
|
|
1628
|
+
timeout: 3e3
|
|
1629
|
+
}
|
|
1630
|
+
);
|
|
1631
|
+
if (result.status !== 0) return [];
|
|
1632
|
+
try {
|
|
1633
|
+
return teamsFromXcodeJson(JSON.parse(result.stdout));
|
|
1634
|
+
} catch {
|
|
1635
|
+
return [];
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
function teamsFromKeychain() {
|
|
1641
|
+
const now = Date.now();
|
|
1642
|
+
return [
|
|
1643
|
+
"Apple Development",
|
|
1644
|
+
"Apple Distribution",
|
|
1645
|
+
"iPhone Developer"
|
|
1646
|
+
].flatMap((prefix) => {
|
|
1647
|
+
const result = spawnSync(
|
|
1648
|
+
"security",
|
|
1649
|
+
["find-certificate", "-a", "-p", "-c", prefix],
|
|
1650
|
+
{
|
|
1651
|
+
encoding: "utf8",
|
|
1652
|
+
timeout: 3e3
|
|
1653
|
+
}
|
|
1654
|
+
);
|
|
1655
|
+
if (result.status !== 0) return [];
|
|
1656
|
+
const pems = result.stdout.match(
|
|
1657
|
+
/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/g
|
|
1658
|
+
) ?? [];
|
|
1659
|
+
return pems.flatMap((pem) => {
|
|
1660
|
+
try {
|
|
1661
|
+
const cert = new X509Certificate(pem);
|
|
1662
|
+
if (Date.parse(cert.validTo) < now) return [];
|
|
1663
|
+
const team = teamFromCertificateSubject(cert.subject);
|
|
1664
|
+
return team ? [team] : [];
|
|
1665
|
+
} catch {
|
|
1666
|
+
return [];
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
function detectAppleTeams() {
|
|
1672
|
+
if (process.platform !== "darwin") return [];
|
|
1673
|
+
const byId = /* @__PURE__ */ new Map();
|
|
1674
|
+
for (const team of [...teamsFromXcode(), ...teamsFromKeychain()]) {
|
|
1675
|
+
if (!byId.has(team.id)) byId.set(team.id, team);
|
|
1676
|
+
}
|
|
1677
|
+
return [...byId.values()];
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
// src/banner.ts
|
|
1681
|
+
var LOGO = [
|
|
1682
|
+
" +++++",
|
|
1683
|
+
" +++-------+++",
|
|
1684
|
+
" +++----\xF7\xF7\xF7\xF7\xF7----++",
|
|
1685
|
+
" +++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7---+",
|
|
1686
|
+
" +++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7--+-++++",
|
|
1687
|
+
" ++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+---\xD7-----++",
|
|
1688
|
+
" ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+---\u2248\u221E\u221E\u221E\u221E\u2248\u2260---+++",
|
|
1689
|
+
" ++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2248\xF7\xF7\xF7----\xD7\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248=---+++",
|
|
1690
|
+
" ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248=-----=\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\xF7---++",
|
|
1691
|
+
" ++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2248\u2260----+=\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260----++",
|
|
1692
|
+
" ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2248\u2248\u2260\u2260\u2248\u2260\u2248\u2260----+\u2260\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260----++",
|
|
1693
|
+
" +++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7\xF7--\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2260\u2260\u2260\u2248\u2260\xF7----\u2260\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260\u2260\u2260----++",
|
|
1694
|
+
" ++---\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+--+\xD7\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2248\u2260\u2248\u2248\u2260=----\u2260\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260\u2260\u2260\u2260\u2260\xF7---++",
|
|
1695
|
+
" ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+------+=\u2260\u2260\u2260\u2248\u2260\u2248\u2248\u2248\u2260\u2248\u2248\u2248\u2260\u2260----\u2260\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260----++",
|
|
1696
|
+
" +++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+-----------\u2260\u2260\u2248\u2260\u2248\u2260\u2248\u2248\u2248\u2248\u2248\u2248\u2248\u2248=---\xD7\u2248\u221E\u221E\u221E\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260=====\xF7---+",
|
|
1697
|
+
" ++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7+-------------+\u2260\u2260\u2248\u2248\u2248\u2248\u2248\u2248\u2248\u2260\u2248\u2248\u2248\u2248\u2248\xF7---\xF7\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260=====\xF7\xF7\xF7\xF7\xD7--+",
|
|
1698
|
+
" ++---\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+-----------------\u2260\u2248\u2248\u2248\u2248\u2260\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2248\xF7----=\u2260\u2260\u2260\u2260\u2260====\xF7\xF7\xF7\xF7\xF7\xF7=--+",
|
|
1699
|
+
" ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+-----------------+\u2248\u2260\u2260\u2260\u2248\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2260+---\u2260\xF7\xD7\u2260\u2260=====\xF7\xF7\xF7\xF7\xF7\xF7=+-++",
|
|
1700
|
+
" +----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+------------------\xD7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248\u2248\xF7+--\xF7=\xF7\xF7\xF7\xD7====\xF7\xF7\xF7\xF7\xF7\xF7=+--++",
|
|
1701
|
+
" ++--\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+-------------------\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260+---\u2260\u2260\u2260\u2260\u2260\xF7\xF7\xD7\xF7=\xF7\xF7\xF7\xF7\xF7=+--++",
|
|
1702
|
+
" +---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7+------------------+\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248\xD7---=\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7\xF7=\xF7\xF7\xF7\xF7+--++",
|
|
1703
|
+
"++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7=\xF7+-------------------=\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260+---\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260=\xF7\xF7\xF7\xD7+--++",
|
|
1704
|
+
"+---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7=======-------------------\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248+---\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7=-+--+",
|
|
1705
|
+
" +--\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7====\xD7----------------\xD7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248----\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260---++",
|
|
1706
|
+
" +--+\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7===\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260========\xF7\u2260\u2260\u2260\u2260\u2260======\u2260==\u2260\u2260\u2248\xF7+---\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7+--++",
|
|
1707
|
+
" ++----\xD7\xF7\xF7\xF7\xF7\xF7\xF7====\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248\u2248\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2260\u2260===\u2260=\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248-+---\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xD7+--++",
|
|
1708
|
+
" +++-----++---\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7--++---+--\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7-+--++",
|
|
1709
|
+
" ++++++++++---------------------------+++++++++ ++------------+++",
|
|
1710
|
+
" +++++++++"
|
|
1711
|
+
];
|
|
1712
|
+
var LOGO_SMALL = [
|
|
1713
|
+
" +++++",
|
|
1714
|
+
" ++---\xF7\xF7\xF7--++",
|
|
1715
|
+
" ++++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7--++++",
|
|
1716
|
+
" +---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+------+",
|
|
1717
|
+
" ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7---\u2248\u221E\u221E\u221E\u2260--++++",
|
|
1718
|
+
" ++--\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2248---\xD7\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\xF7--+",
|
|
1719
|
+
" ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260---=\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u221E--+-+",
|
|
1720
|
+
" ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\xF7--\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260\u2260---+",
|
|
1721
|
+
" ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7----\u2260\u2260\u2260\u2260\u2248\u2248\u2260\u2248\u2260=--\u2260\u221E\u221E\u221E\u221E\u221E\u2248\u2260\u2260\u2260\u2260\u2260--++",
|
|
1722
|
+
" ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+-------\u2260\u2248\u2260\u2248\u2248\u2248\u2248\u2248\u2248=--\xD7\u221E\u221E\u221E\u2260\u2260\u2260\u2260\u2260===--+",
|
|
1723
|
+
" ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7----------+\u2260\u2248\u2248\u2248\u2248\u2248\u2260\u2248\u2248\u2248\xF7--\u2260\u2260\u2260\u2260\u2260===\xF7\xF7\xF7\xD7-+",
|
|
1724
|
+
" ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+-----------+\u2260\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7--\u2260\xD7\u2260\u2260===\xF7\xF7\xF7\xF7=-+",
|
|
1725
|
+
" +---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-------------\xD7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248--\u2260=\xF7\xF7\xD7==\xF7\xF7\xF7\xF7=+-+",
|
|
1726
|
+
" +--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+-------------\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\xD7--\u2260\u2260\u2260\u2260\u2260\xF7\xF7=\xF7\xF7\xF7-+++",
|
|
1727
|
+
"+--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7=--------------\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248+--\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7\xF7\xD7+-+",
|
|
1728
|
+
"+--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7===------------\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248---\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260--+-",
|
|
1729
|
+
" +-+\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7==\u2260\u2260\u2260\u2260\u2260\u2260=====\xF7\u2260\u2260\u2260====\u2260=\u2260\u2260\xF7--\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260+-++",
|
|
1730
|
+
" +++----+--\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7-+--+-\xF7\u2260\u2260\u2260\u2260\u2260\u2260---++",
|
|
1731
|
+
" +++++++------------------++++++++--------++",
|
|
1732
|
+
" +++++++"
|
|
1733
|
+
];
|
|
1734
|
+
var width = (logo) => Math.max(...logo.map((line) => [...line].length));
|
|
1735
|
+
var LOGO_WIDTH = width(LOGO);
|
|
1736
|
+
var LOGO_SMALL_WIDTH = width(LOGO_SMALL);
|
|
1737
|
+
function logoLines(columns) {
|
|
1738
|
+
if (!columns) return null;
|
|
1739
|
+
if (columns >= LOGO_WIDTH) return LOGO;
|
|
1740
|
+
if (columns >= LOGO_SMALL_WIDTH) return LOGO_SMALL;
|
|
1741
|
+
return null;
|
|
1742
|
+
}
|
|
1743
|
+
function colorDepth(env) {
|
|
1744
|
+
if (env.NO_COLOR || env.FORCE_COLOR === "0" || env.TERM === "dumb")
|
|
1745
|
+
return "none";
|
|
1746
|
+
if (env.COLORTERM === "truecolor" || env.COLORTERM === "24bit")
|
|
1747
|
+
return "truecolor";
|
|
1748
|
+
return "256";
|
|
1749
|
+
}
|
|
1750
|
+
function hueToRgb(hue) {
|
|
1751
|
+
const h2 = (hue % 360 + 360) % 360 / 60;
|
|
1752
|
+
const s = 0.8;
|
|
1753
|
+
const x = s * (1 - Math.abs(h2 % 2 - 1));
|
|
1754
|
+
const [r2, g, b] = h2 < 1 ? [s, x, 0] : h2 < 2 ? [x, s, 0] : h2 < 3 ? [0, s, x] : h2 < 4 ? [0, x, s] : h2 < 5 ? [x, 0, s] : [s, 0, x];
|
|
1755
|
+
const m2 = 1 - s;
|
|
1756
|
+
return [r2, g, b].map((c3) => Math.round((c3 + m2) * 255));
|
|
1757
|
+
}
|
|
1758
|
+
function foreground(hue, depth) {
|
|
1759
|
+
const [r2, g, b] = hueToRgb(hue);
|
|
1760
|
+
if (depth === "truecolor") return `\x1B[38;2;${r2};${g};${b}m`;
|
|
1761
|
+
const level = (c3) => Math.round(c3 / 255 * 5);
|
|
1762
|
+
return `\x1B[38;5;${16 + 36 * level(r2) + 6 * level(g) + level(b)}m`;
|
|
1763
|
+
}
|
|
1764
|
+
var HUE_STEP = 10;
|
|
1765
|
+
function rainbow(lines, phase, depth) {
|
|
1766
|
+
return lines.map((line, y) => {
|
|
1767
|
+
let out = "";
|
|
1768
|
+
let current = "";
|
|
1769
|
+
[...line].forEach((char, x) => {
|
|
1770
|
+
if (char === " ") {
|
|
1771
|
+
out += char;
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
const hue = Math.round((x * 3 + y * 6 - phase) / HUE_STEP) * HUE_STEP;
|
|
1775
|
+
const code = foreground(hue, depth);
|
|
1776
|
+
if (code !== current) out += code;
|
|
1777
|
+
current = code;
|
|
1778
|
+
out += char;
|
|
1779
|
+
});
|
|
1780
|
+
return current ? `${out}\x1B[39m` : out;
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
var FRAMES = 30;
|
|
1784
|
+
var FRAME_MS = 40;
|
|
1785
|
+
var HIDE_CURSOR = "\x1B[?25l";
|
|
1786
|
+
var SHOW_CURSOR = "\x1B[?25h";
|
|
1787
|
+
var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
1788
|
+
async function showLogo(out, env = process.env, wait = sleep) {
|
|
1789
|
+
const lines = out.isTTY ? logoLines(out.columns) : null;
|
|
1790
|
+
if (!lines) return;
|
|
1791
|
+
const depth = colorDepth(env);
|
|
1792
|
+
if (depth === "none") {
|
|
1793
|
+
out.write(`
|
|
1794
|
+
${lines.join("\n")}
|
|
1795
|
+
|
|
1796
|
+
`);
|
|
1797
|
+
return;
|
|
1798
|
+
}
|
|
1799
|
+
const frame = (n3) => rainbow(lines, n3 * 360 / FRAMES, depth).join("\n");
|
|
1800
|
+
out.write(`
|
|
1801
|
+
${frame(0)}
|
|
1802
|
+
`);
|
|
1803
|
+
if (!env.CI && (out.rows ?? 0) > lines.length + 1) {
|
|
1804
|
+
const interrupted = () => {
|
|
1805
|
+
out.write(`${SHOW_CURSOR}
|
|
1806
|
+
`);
|
|
1807
|
+
process.exit(130);
|
|
1808
|
+
};
|
|
1809
|
+
process.once("SIGINT", interrupted);
|
|
1810
|
+
out.write(HIDE_CURSOR);
|
|
1811
|
+
try {
|
|
1812
|
+
for (let n3 = 1; n3 <= FRAMES; n3++) {
|
|
1813
|
+
await wait(FRAME_MS);
|
|
1814
|
+
out.write(`\x1B[${lines.length}A\r${frame(n3)}
|
|
1815
|
+
`);
|
|
1816
|
+
}
|
|
1817
|
+
} finally {
|
|
1818
|
+
out.write(SHOW_CURSOR);
|
|
1819
|
+
process.removeListener("SIGINT", interrupted);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
out.write("\n");
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
// src/keys.ts
|
|
1826
|
+
var SLOT_ORDER = ["siteId", "pk", "sk"];
|
|
1827
|
+
var SLOT_LABEL = {
|
|
1828
|
+
siteId: "Site ID",
|
|
1829
|
+
pk: "Publishable token",
|
|
1830
|
+
sk: "Secret key"
|
|
1831
|
+
};
|
|
1832
|
+
var SLOT_NAMES = {
|
|
1833
|
+
siteId: /^(?:[A-Z]+_)*BD_SITE_ID$|^bd\.siteId$/,
|
|
1834
|
+
pk: /^(?:[A-Z]+_)*BD_PK$|^BD_PUBLISHABLE_KEY$|^bd\.publishableKey$/,
|
|
1835
|
+
sk: /^BD_API_KEY$/
|
|
1836
|
+
};
|
|
1837
|
+
var ASSIGNMENT = /^([A-Za-z_][A-Za-z0-9_.]*)(\s*=\s*)(.*)$/;
|
|
1838
|
+
function slotFor(name) {
|
|
1839
|
+
return SLOT_ORDER.find((slot) => SLOT_NAMES[slot].test(name));
|
|
1840
|
+
}
|
|
1841
|
+
function slotsIn(envText) {
|
|
1842
|
+
const found = /* @__PURE__ */ new Set();
|
|
1843
|
+
for (const line of envText.split("\n")) {
|
|
1844
|
+
const match = ASSIGNMENT.exec(line);
|
|
1845
|
+
const slot = match?.[1] ? slotFor(match[1]) : void 0;
|
|
1846
|
+
if (slot) found.add(slot);
|
|
1847
|
+
}
|
|
1848
|
+
return SLOT_ORDER.filter((slot) => found.has(slot));
|
|
1849
|
+
}
|
|
1850
|
+
function slotLinesOnly(text2) {
|
|
1851
|
+
return text2.split("\n").filter((line) => {
|
|
1852
|
+
const name = ASSIGNMENT.exec(line)?.[1];
|
|
1853
|
+
return name !== void 0 && slotFor(name) !== void 0;
|
|
1854
|
+
}).join("\n");
|
|
1855
|
+
}
|
|
1856
|
+
function fillEnv(envText, keys) {
|
|
1857
|
+
const placed = /* @__PURE__ */ new Set();
|
|
1858
|
+
const lines = envText.split("\n").map((line) => {
|
|
1859
|
+
const match = ASSIGNMENT.exec(line);
|
|
1860
|
+
if (!match?.[1]) return line;
|
|
1861
|
+
const slot = slotFor(match[1]);
|
|
1862
|
+
const value = slot ? keys[slot] : void 0;
|
|
1863
|
+
if (!slot || !value) return line;
|
|
1864
|
+
placed.add(slot);
|
|
1865
|
+
const separator = /\s=/.test(match[2] ?? "") ? " = " : "=";
|
|
1866
|
+
return `${match[1]}${separator}${value}`;
|
|
1867
|
+
});
|
|
1868
|
+
return {
|
|
1869
|
+
text: lines.join("\n"),
|
|
1870
|
+
placed: SLOT_ORDER.filter((s) => placed.has(s))
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1874
|
+
var TOKEN_BODY = /^[A-Za-z0-9_-]+$/;
|
|
1875
|
+
function keyProblem(slot, raw) {
|
|
1876
|
+
const value = raw.trim();
|
|
1877
|
+
switch (slot) {
|
|
1878
|
+
case "siteId":
|
|
1879
|
+
return UUID.test(value) ? void 0 : "A site ID is a UUID: Site Builder > Developer > Site ID.";
|
|
1880
|
+
case "pk":
|
|
1881
|
+
if (!value.startsWith("pk_")) {
|
|
1882
|
+
return "A publishable token starts with pk_ (Site Builder > Developer > Publishable tokens). Never put a secret key here.";
|
|
1883
|
+
}
|
|
1884
|
+
return TOKEN_BODY.test(value) ? void 0 : "That token has characters a key never has. Paste it again?";
|
|
1885
|
+
case "sk":
|
|
1886
|
+
if (value.startsWith("pk_")) {
|
|
1887
|
+
return "That's a publishable token. The secret key is under Site Builder > Developer > Secret keys.";
|
|
1888
|
+
}
|
|
1889
|
+
return TOKEN_BODY.test(value) ? void 0 : "That key has characters a key never has. Paste it again?";
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
// src/package-manager.ts
|
|
1894
|
+
import { existsSync } from "node:fs";
|
|
1895
|
+
import { dirname, join as join2 } from "node:path";
|
|
1896
|
+
var PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
|
|
1897
|
+
function isPackageManager(value) {
|
|
1898
|
+
return PACKAGE_MANAGERS.some((pm) => pm === value);
|
|
1899
|
+
}
|
|
1900
|
+
function detectPackageManager(userAgent) {
|
|
1901
|
+
const name = userAgent?.split(" ")[0]?.split("/")[0];
|
|
1902
|
+
return isPackageManager(name) ? name : "npm";
|
|
1903
|
+
}
|
|
1904
|
+
function installCommand(pm, options = {}) {
|
|
1905
|
+
switch (pm) {
|
|
1906
|
+
case "npm":
|
|
1907
|
+
return ["npm", "install"];
|
|
1908
|
+
case "pnpm":
|
|
1909
|
+
return options.ignoreWorkspace ? ["pnpm", "install", "--ignore-workspace"] : ["pnpm", "install"];
|
|
1910
|
+
case "yarn":
|
|
1911
|
+
return ["yarn"];
|
|
1912
|
+
case "bun":
|
|
1913
|
+
return ["bun", "install"];
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
function runCommand(pm, script) {
|
|
1917
|
+
switch (pm) {
|
|
1918
|
+
case "npm":
|
|
1919
|
+
return ["npm", "run", script];
|
|
1920
|
+
case "pnpm":
|
|
1921
|
+
return ["pnpm", script];
|
|
1922
|
+
case "yarn":
|
|
1923
|
+
return ["yarn", script];
|
|
1924
|
+
case "bun":
|
|
1925
|
+
return ["bun", "run", script];
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
function enclosingPnpmWorkspace(projectDir) {
|
|
1929
|
+
let dir = dirname(projectDir);
|
|
1930
|
+
while (true) {
|
|
1931
|
+
if (existsSync(join2(dir, "pnpm-workspace.yaml"))) return dir;
|
|
1932
|
+
const parent = dirname(dir);
|
|
1933
|
+
if (parent === dir) return void 0;
|
|
1934
|
+
dir = parent;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
// src/payments.ts
|
|
1939
|
+
import {
|
|
1940
|
+
readdirSync,
|
|
1941
|
+
readFileSync,
|
|
1942
|
+
rmdirSync,
|
|
1943
|
+
rmSync,
|
|
1944
|
+
writeFileSync
|
|
1945
|
+
} from "node:fs";
|
|
1946
|
+
import { join as join3 } from "node:path";
|
|
1947
|
+
var PAYMENT_FEATURES = ["store", "donations", "saas"];
|
|
1948
|
+
var PAYMENT_CHOICES = {
|
|
1949
|
+
store: {
|
|
1950
|
+
label: "Store",
|
|
1951
|
+
hint: "products, cart and checkout"
|
|
1952
|
+
},
|
|
1953
|
+
donations: {
|
|
1954
|
+
label: "Donations",
|
|
1955
|
+
hint: "one-time and monthly gifts"
|
|
1956
|
+
},
|
|
1957
|
+
saas: {
|
|
1958
|
+
label: "SaaS",
|
|
1959
|
+
hint: "subscription plans and billing in the customer's account"
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
function isPaymentFeature(value) {
|
|
1963
|
+
return PAYMENT_FEATURES.includes(value);
|
|
1964
|
+
}
|
|
1965
|
+
function parsePayments(value) {
|
|
1966
|
+
const names = value.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean);
|
|
1967
|
+
const valid = `${PAYMENT_FEATURES.join(", ")}, or none`;
|
|
1968
|
+
if (names.length === 0) return { error: `--payments takes ${valid}.` };
|
|
1969
|
+
if (names.includes("none")) {
|
|
1970
|
+
return names.length === 1 ? { features: [] } : { error: "--payments none can't be combined with anything else." };
|
|
1971
|
+
}
|
|
1972
|
+
const unknown = names.filter((name) => !isPaymentFeature(name));
|
|
1973
|
+
if (unknown.length > 0) {
|
|
1974
|
+
return {
|
|
1975
|
+
error: `--payments: ${unknown.join(", ")} isn't one of ${valid}.`
|
|
1976
|
+
};
|
|
1977
|
+
}
|
|
1978
|
+
return {
|
|
1979
|
+
features: PAYMENT_FEATURES.filter((feature) => names.includes(feature))
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
var FILE_MARKER = /\[bd-file:([a-z!,]+)\]/;
|
|
1983
|
+
var START_MARKER = /\[bd:([a-z!,]+)\]/;
|
|
1984
|
+
var END_MARKER = /\[\/bd:([a-z!,]+)\]/;
|
|
1985
|
+
var LINE_MARKER = /\s*(?:<!--|\/\/|#|\{\/\*|\/\*)\s*\[bd-line:([a-z!,]+)\]\s*(?:-->|\*\/\}|\*\/)?\s*$/;
|
|
1986
|
+
var FILE_MARKER_LINES = 5;
|
|
1987
|
+
function holds(condition, chosen) {
|
|
1988
|
+
return condition.split(",").some((token) => {
|
|
1989
|
+
if (token === "none") return chosen.size === 0;
|
|
1990
|
+
const negated = token.startsWith("!");
|
|
1991
|
+
const name = negated ? token.slice(1) : token;
|
|
1992
|
+
if (!isPaymentFeature(name)) {
|
|
1993
|
+
throw new Error(`Unknown payment feature "${name}" in a [bd:\u2026] marker.`);
|
|
1994
|
+
}
|
|
1995
|
+
return chosen.has(name) !== negated;
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
var MarkerError = class extends Error {
|
|
1999
|
+
};
|
|
2000
|
+
function pruneText(text2, chosen, file = "a file") {
|
|
2001
|
+
if (!text2.includes("bd:") && !text2.includes("bd-line:")) return null;
|
|
2002
|
+
const lines = text2.split("\n");
|
|
2003
|
+
const out = [];
|
|
2004
|
+
const open = [];
|
|
2005
|
+
let touched = false;
|
|
2006
|
+
let dropped = false;
|
|
2007
|
+
lines.forEach((line, index) => {
|
|
2008
|
+
const end = END_MARKER.exec(line);
|
|
2009
|
+
if (end) {
|
|
2010
|
+
const top = open.pop();
|
|
2011
|
+
if (!top || top.condition !== end[1]) {
|
|
2012
|
+
throw new MarkerError(
|
|
2013
|
+
`${file}:${index + 1}: [/bd:${end[1]}] closes ${top ? `[bd:${top.condition}] from line ${top.line}` : "nothing"}.`
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
touched = true;
|
|
2017
|
+
dropped = !top.keep;
|
|
2018
|
+
return;
|
|
2019
|
+
}
|
|
2020
|
+
const start = START_MARKER.exec(line);
|
|
2021
|
+
if (start?.[1] && !FILE_MARKER.test(line)) {
|
|
2022
|
+
const parentKeeps = open.every((region) => region.keep);
|
|
2023
|
+
open.push({
|
|
2024
|
+
condition: start[1],
|
|
2025
|
+
keep: parentKeeps && holds(start[1], chosen),
|
|
2026
|
+
line: index + 1
|
|
2027
|
+
});
|
|
2028
|
+
touched = true;
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
2031
|
+
if (!open.every((region) => region.keep)) return;
|
|
2032
|
+
const single = LINE_MARKER.exec(line);
|
|
2033
|
+
if (single?.[1]) {
|
|
2034
|
+
touched = true;
|
|
2035
|
+
if (!holds(single[1], chosen)) {
|
|
2036
|
+
dropped = true;
|
|
2037
|
+
return;
|
|
2038
|
+
}
|
|
2039
|
+
line = line.slice(0, single.index);
|
|
2040
|
+
}
|
|
2041
|
+
if (dropped && line.trim() === "" && out.at(-1)?.trim() === "") return;
|
|
2042
|
+
dropped = false;
|
|
2043
|
+
out.push(line);
|
|
2044
|
+
});
|
|
2045
|
+
const unclosed = open.at(-1);
|
|
2046
|
+
if (unclosed) {
|
|
2047
|
+
throw new MarkerError(
|
|
2048
|
+
`${file}:${unclosed.line}: [bd:${unclosed.condition}] is never closed.`
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2051
|
+
return touched ? out.join("\n") : null;
|
|
2052
|
+
}
|
|
2053
|
+
function fileCondition(text2) {
|
|
2054
|
+
const head = text2.split("\n", FILE_MARKER_LINES).join("\n");
|
|
2055
|
+
return FILE_MARKER.exec(head)?.[1];
|
|
2056
|
+
}
|
|
2057
|
+
function isText(buffer) {
|
|
2058
|
+
return !buffer.subarray(0, 8e3).includes(0);
|
|
2059
|
+
}
|
|
2060
|
+
function prunePayments(root, chosen) {
|
|
2061
|
+
const result = { removed: [], edited: [] };
|
|
2062
|
+
const walk = (dir, prefix) => {
|
|
2063
|
+
let empty = true;
|
|
2064
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
2065
|
+
const path = join3(dir, entry.name);
|
|
2066
|
+
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
2067
|
+
if (entry.isSymbolicLink()) {
|
|
2068
|
+
empty = false;
|
|
2069
|
+
continue;
|
|
2070
|
+
}
|
|
2071
|
+
if (entry.isDirectory()) {
|
|
2072
|
+
if (entry.name === ".git" || entry.name === "node_modules") {
|
|
2073
|
+
empty = false;
|
|
2074
|
+
continue;
|
|
2075
|
+
}
|
|
2076
|
+
if (walk(path, relativePath)) rmdirSync(path);
|
|
2077
|
+
else empty = false;
|
|
2078
|
+
continue;
|
|
2079
|
+
}
|
|
2080
|
+
const buffer = readFileSync(path);
|
|
2081
|
+
if (!isText(buffer)) {
|
|
2082
|
+
empty = false;
|
|
2083
|
+
continue;
|
|
2084
|
+
}
|
|
2085
|
+
const text2 = buffer.toString("utf8");
|
|
2086
|
+
const condition = fileCondition(text2);
|
|
2087
|
+
if (condition !== void 0 && !holds(condition, chosen)) {
|
|
2088
|
+
rmSync(path);
|
|
2089
|
+
result.removed.push(relativePath);
|
|
2090
|
+
continue;
|
|
2091
|
+
}
|
|
2092
|
+
empty = false;
|
|
2093
|
+
let next = text2;
|
|
2094
|
+
if (condition !== void 0) {
|
|
2095
|
+
next = next.split("\n").filter(
|
|
2096
|
+
(line, index) => index >= FILE_MARKER_LINES || !FILE_MARKER.test(line)
|
|
2097
|
+
).join("\n");
|
|
2098
|
+
}
|
|
2099
|
+
next = pruneText(next, chosen, relativePath) ?? next;
|
|
2100
|
+
if (next !== text2) {
|
|
2101
|
+
writeFileSync(path, next);
|
|
2102
|
+
result.edited.push(relativePath);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return empty;
|
|
2106
|
+
};
|
|
2107
|
+
walk(root, "");
|
|
2108
|
+
return result;
|
|
2109
|
+
}
|
|
2110
|
+
var APPLE_RULES = "https://developer.apple.com/app-store/review/guidelines/#payments";
|
|
2111
|
+
var GOOGLE_RULES = "https://support.google.com/googleplay/android-developer/answer/9858738";
|
|
2112
|
+
var GOOGLE_FEES = "https://support.google.com/googleplay/android-developer/answer/16954621";
|
|
2113
|
+
function appStoreTitle(stores) {
|
|
2114
|
+
const names = [
|
|
2115
|
+
stores.has("apple") ? "the App Store" : void 0,
|
|
2116
|
+
stores.has("google") ? "Google Play" : void 0
|
|
2117
|
+
].filter(Boolean);
|
|
2118
|
+
return `Selling in ${names.join(" and ")}`;
|
|
2119
|
+
}
|
|
2120
|
+
function appStoreNotice(features, stores) {
|
|
2121
|
+
if (features.length === 0 || stores.size === 0) return [];
|
|
2122
|
+
const apple = stores.has("apple");
|
|
2123
|
+
const google = stores.has("google");
|
|
2124
|
+
const lines = [];
|
|
2125
|
+
if (features.includes("store")) {
|
|
2126
|
+
lines.push(
|
|
2127
|
+
"Store: physical goods and services used outside the app (shipping, bookings, food) can be paid with Stripe inside the app. Digital goods can't: the stores require their own billing for those."
|
|
2128
|
+
);
|
|
2129
|
+
}
|
|
2130
|
+
if (features.includes("saas")) {
|
|
2131
|
+
const cuts = [
|
|
2132
|
+
apple ? "Apple keeps 30%, or 15% in its Small Business Program (under $1M a year) and after a subscriber's first year" : void 0,
|
|
2133
|
+
google ? "Google keeps 15% (in the US, UK and EEA: a 10% service fee plus a 5% billing fee)" : void 0
|
|
2134
|
+
].filter(Boolean);
|
|
2135
|
+
lines.push(
|
|
2136
|
+
`SaaS plans: subscriptions to digital features or content have to be sold through ${[apple ? "Apple's In-App Purchase" : void 0, google ? "Google Play Billing" : void 0].filter(Boolean).join(" and ")}, so the app's plans use ${apple && google ? "them" : "it"}. ${cuts.join(". ")}.`
|
|
2137
|
+
);
|
|
2138
|
+
}
|
|
2139
|
+
if (features.includes("donations")) {
|
|
2140
|
+
if (apple) {
|
|
2141
|
+
lines.push(
|
|
2142
|
+
"Donations on iPhone: only nonprofits Apple has approved may take donations inside the app, and they must offer Apple Pay. Anyone else collects on the web, outside the app."
|
|
2143
|
+
);
|
|
2144
|
+
}
|
|
2145
|
+
if (google) {
|
|
2146
|
+
lines.push(
|
|
2147
|
+
"Donations on Android: gifts to a tax-exempt organization must not go through Google Play Billing, and Google asks for proof of tax-exempt status first. Anyone else uses Play Billing or leaves donations out."
|
|
2148
|
+
);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
const links = [
|
|
2152
|
+
apple ? `Apple: ${APPLE_RULES}` : void 0,
|
|
2153
|
+
google ? `Google: ${GOOGLE_RULES} (fees: ${GOOGLE_FEES})` : void 0
|
|
2154
|
+
].filter(Boolean);
|
|
2155
|
+
lines.push(
|
|
2156
|
+
`Rules as of November 2026. Check them before you ship: ${links.join(" ")}`
|
|
2157
|
+
);
|
|
2158
|
+
return lines;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
// src/templates.ts
|
|
2162
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
2163
|
+
var envAt = (file) => ({ example: ".env.example", file });
|
|
2164
|
+
var FRAMEWORKS = [
|
|
2165
|
+
// ── Web ────────────────────────────────────────────────────────────
|
|
2166
|
+
{
|
|
2167
|
+
name: "vanilla",
|
|
2168
|
+
display: "Vanilla JS",
|
|
2169
|
+
color: import_picocolors.default.yellow,
|
|
2170
|
+
shape: "web",
|
|
2171
|
+
hint: "no framework, Bun server",
|
|
2172
|
+
variants: [
|
|
2173
|
+
{
|
|
2174
|
+
id: "vanilla",
|
|
2175
|
+
display: "Vanilla JS",
|
|
2176
|
+
aliases: ["vanilla-js", "js"],
|
|
2177
|
+
source: "Vanilla-JS",
|
|
2178
|
+
env: envAt(".env.local"),
|
|
2179
|
+
dev: "dev",
|
|
2180
|
+
needsBun: true
|
|
2181
|
+
}
|
|
2182
|
+
]
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
name: "react",
|
|
2186
|
+
display: "React",
|
|
2187
|
+
color: import_picocolors.default.cyan,
|
|
2188
|
+
shape: "web",
|
|
2189
|
+
hint: "Vite, Bun API server",
|
|
2190
|
+
variants: [
|
|
2191
|
+
{
|
|
2192
|
+
id: "react-bun",
|
|
2193
|
+
display: "React + Bun",
|
|
2194
|
+
aliases: ["react"],
|
|
2195
|
+
source: "React-Bun",
|
|
2196
|
+
env: envAt(".env.local"),
|
|
2197
|
+
dev: "dev",
|
|
2198
|
+
needsBun: true
|
|
2199
|
+
}
|
|
2200
|
+
]
|
|
2201
|
+
},
|
|
2202
|
+
{
|
|
2203
|
+
name: "remix",
|
|
2204
|
+
display: "Remix",
|
|
2205
|
+
color: import_picocolors.default.blue,
|
|
2206
|
+
shape: "web",
|
|
2207
|
+
hint: "React Router 7",
|
|
2208
|
+
variants: [
|
|
2209
|
+
{
|
|
2210
|
+
id: "remix",
|
|
2211
|
+
display: "Remix",
|
|
2212
|
+
aliases: ["react-router"],
|
|
2213
|
+
source: "Remix",
|
|
2214
|
+
env: envAt(".env.local"),
|
|
2215
|
+
dev: "dev"
|
|
2216
|
+
}
|
|
2217
|
+
]
|
|
2218
|
+
},
|
|
2219
|
+
{
|
|
2220
|
+
name: "t3",
|
|
2221
|
+
display: "T3-App",
|
|
2222
|
+
color: import_picocolors.default.magenta,
|
|
2223
|
+
shape: "web",
|
|
2224
|
+
hint: "Next.js, tRPC, Drizzle",
|
|
2225
|
+
variants: [
|
|
2226
|
+
{
|
|
2227
|
+
id: "t3",
|
|
2228
|
+
display: "T3-App",
|
|
2229
|
+
aliases: ["t3-app"],
|
|
2230
|
+
source: "T3-App",
|
|
2231
|
+
env: envAt(".env"),
|
|
2232
|
+
dev: "dev"
|
|
2233
|
+
}
|
|
2234
|
+
]
|
|
2235
|
+
},
|
|
2236
|
+
{
|
|
2237
|
+
name: "nuxt",
|
|
2238
|
+
display: "Nuxt",
|
|
2239
|
+
color: import_picocolors.default.green,
|
|
2240
|
+
shape: "web",
|
|
2241
|
+
hint: "Vue",
|
|
2242
|
+
variants: [
|
|
2243
|
+
{
|
|
2244
|
+
id: "nuxt",
|
|
2245
|
+
display: "Nuxt",
|
|
2246
|
+
aliases: ["vue"],
|
|
2247
|
+
source: "Nuxt",
|
|
2248
|
+
env: envAt(".env"),
|
|
2249
|
+
dev: "dev"
|
|
2250
|
+
}
|
|
2251
|
+
]
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
name: "svelte",
|
|
2255
|
+
display: "SvelteKit",
|
|
2256
|
+
color: import_picocolors.default.red,
|
|
2257
|
+
shape: "web",
|
|
2258
|
+
variants: [
|
|
2259
|
+
{
|
|
2260
|
+
id: "svelte",
|
|
2261
|
+
display: "SvelteKit",
|
|
2262
|
+
aliases: ["sveltekit"],
|
|
2263
|
+
source: "Svelte",
|
|
2264
|
+
env: envAt(".env"),
|
|
2265
|
+
dev: "dev"
|
|
2266
|
+
}
|
|
2267
|
+
]
|
|
2268
|
+
},
|
|
2269
|
+
{
|
|
2270
|
+
name: "solid",
|
|
2271
|
+
display: "Solid",
|
|
2272
|
+
color: import_picocolors.default.blueBright,
|
|
2273
|
+
shape: "web",
|
|
2274
|
+
hint: "TanStack Start",
|
|
2275
|
+
variants: [
|
|
2276
|
+
{
|
|
2277
|
+
id: "solid",
|
|
2278
|
+
display: "Solid 2",
|
|
2279
|
+
hint: "TanStack Start 2.0 release candidate",
|
|
2280
|
+
aliases: ["tanstack-start", "tanstack-start-solid", "solid-2"],
|
|
2281
|
+
source: "Tanstack-Start-Solid/solid",
|
|
2282
|
+
env: envAt(".env.local"),
|
|
2283
|
+
dev: "dev"
|
|
2284
|
+
},
|
|
2285
|
+
{
|
|
2286
|
+
id: "solid-1",
|
|
2287
|
+
display: "Solid 1.9",
|
|
2288
|
+
hint: "TanStack Start 1.x, keeps the Form and Store demos",
|
|
2289
|
+
source: "Tanstack-Start-Solid/solid-1",
|
|
2290
|
+
env: envAt(".env.local"),
|
|
2291
|
+
dev: "dev"
|
|
2292
|
+
}
|
|
2293
|
+
]
|
|
2294
|
+
},
|
|
2295
|
+
{
|
|
2296
|
+
name: "angular",
|
|
2297
|
+
display: "Angular",
|
|
2298
|
+
color: import_picocolors.default.redBright,
|
|
2299
|
+
shape: "web",
|
|
2300
|
+
hint: "SSR",
|
|
2301
|
+
variants: [
|
|
2302
|
+
{
|
|
2303
|
+
id: "angular",
|
|
2304
|
+
display: "Angular",
|
|
2305
|
+
source: "Angular/Angular",
|
|
2306
|
+
env: envAt(".env"),
|
|
2307
|
+
dev: "start",
|
|
2308
|
+
notes: [
|
|
2309
|
+
"Angular takes the publishable token in src/environments/environment.ts (bdPk), not in .env."
|
|
2310
|
+
]
|
|
2311
|
+
}
|
|
2312
|
+
]
|
|
2313
|
+
},
|
|
2314
|
+
{
|
|
2315
|
+
name: "qwik",
|
|
2316
|
+
display: "Qwik",
|
|
2317
|
+
color: import_picocolors.default.magentaBright,
|
|
2318
|
+
shape: "web",
|
|
2319
|
+
variants: [
|
|
2320
|
+
{
|
|
2321
|
+
id: "qwik",
|
|
2322
|
+
display: "Qwik",
|
|
2323
|
+
source: "Qwik",
|
|
2324
|
+
env: envAt(".env.local"),
|
|
2325
|
+
dev: "dev"
|
|
2326
|
+
}
|
|
2327
|
+
]
|
|
2328
|
+
},
|
|
2329
|
+
{
|
|
2330
|
+
name: "astro",
|
|
2331
|
+
display: "Astro",
|
|
2332
|
+
color: import_picocolors.default.yellowBright,
|
|
2333
|
+
shape: "web",
|
|
2334
|
+
variants: [
|
|
2335
|
+
{
|
|
2336
|
+
id: "astro",
|
|
2337
|
+
display: "Astro",
|
|
2338
|
+
source: "Astro",
|
|
2339
|
+
env: envAt(".env"),
|
|
2340
|
+
dev: "dev"
|
|
2341
|
+
}
|
|
2342
|
+
]
|
|
2343
|
+
},
|
|
2344
|
+
{
|
|
2345
|
+
name: "htmx",
|
|
2346
|
+
display: "HTMX",
|
|
2347
|
+
color: import_picocolors.default.cyanBright,
|
|
2348
|
+
shape: "web",
|
|
2349
|
+
hint: "server-rendered, Bun",
|
|
2350
|
+
variants: [
|
|
2351
|
+
{
|
|
2352
|
+
id: "htmx",
|
|
2353
|
+
display: "HTMX",
|
|
2354
|
+
source: "HTMX",
|
|
2355
|
+
env: envAt(".env.local"),
|
|
2356
|
+
dev: "dev",
|
|
2357
|
+
needsBun: true
|
|
2358
|
+
}
|
|
2359
|
+
]
|
|
2360
|
+
},
|
|
2361
|
+
// ── Server ─────────────────────────────────────────────────────────
|
|
2362
|
+
{
|
|
2363
|
+
name: "laravel",
|
|
2364
|
+
display: "Laravel",
|
|
2365
|
+
color: import_picocolors.default.red,
|
|
2366
|
+
shape: "server",
|
|
2367
|
+
hint: "PHP",
|
|
2368
|
+
variants: [
|
|
2369
|
+
{
|
|
2370
|
+
id: "laravel",
|
|
2371
|
+
display: "Laravel",
|
|
2372
|
+
aliases: ["php"],
|
|
2373
|
+
source: "Laravel",
|
|
2374
|
+
env: envAt(".env"),
|
|
2375
|
+
steps: () => [
|
|
2376
|
+
"composer install",
|
|
2377
|
+
"php artisan key:generate",
|
|
2378
|
+
"php artisan serve"
|
|
2379
|
+
]
|
|
2380
|
+
}
|
|
2381
|
+
]
|
|
2382
|
+
},
|
|
2383
|
+
{
|
|
2384
|
+
name: "phoenix",
|
|
2385
|
+
display: "Phoenix",
|
|
2386
|
+
color: import_picocolors.default.yellow,
|
|
2387
|
+
shape: "server",
|
|
2388
|
+
hint: "Elixir",
|
|
2389
|
+
variants: [
|
|
2390
|
+
{
|
|
2391
|
+
id: "elixir",
|
|
2392
|
+
display: "Phoenix",
|
|
2393
|
+
aliases: ["phoenix"],
|
|
2394
|
+
source: "Phoenix",
|
|
2395
|
+
env: envAt(".env"),
|
|
2396
|
+
// config/runtime.exs loads .env (then .env.local) in dev itself.
|
|
2397
|
+
steps: () => ["mix deps.get", "mix phx.server"]
|
|
2398
|
+
}
|
|
2399
|
+
]
|
|
2400
|
+
},
|
|
2401
|
+
{
|
|
2402
|
+
name: "vapor",
|
|
2403
|
+
display: "Vapor",
|
|
2404
|
+
color: import_picocolors.default.green,
|
|
2405
|
+
shape: "server",
|
|
2406
|
+
hint: "Swift on the server",
|
|
2407
|
+
variants: [
|
|
2408
|
+
{
|
|
2409
|
+
id: "vapor",
|
|
2410
|
+
display: "Vapor",
|
|
2411
|
+
aliases: ["vapor-server"],
|
|
2412
|
+
source: "Vapor-Server",
|
|
2413
|
+
env: envAt(".env"),
|
|
2414
|
+
steps: () => ["swift run App serve --port 8080"]
|
|
2415
|
+
}
|
|
2416
|
+
]
|
|
2417
|
+
},
|
|
2418
|
+
// ── Mobile: publishable token only ─────────────────────────────────
|
|
2419
|
+
{
|
|
2420
|
+
name: "react-native",
|
|
2421
|
+
display: "React Native",
|
|
2422
|
+
color: import_picocolors.default.cyan,
|
|
2423
|
+
shape: "mobile",
|
|
2424
|
+
hint: "Expo",
|
|
2425
|
+
variants: [
|
|
2426
|
+
{
|
|
2427
|
+
id: "react-native",
|
|
2428
|
+
display: "React Native",
|
|
2429
|
+
aliases: ["expo"],
|
|
2430
|
+
source: "React-Native",
|
|
2431
|
+
folder: "mobile",
|
|
2432
|
+
appleTeam: "app.json",
|
|
2433
|
+
stores: ["apple", "google"],
|
|
2434
|
+
env: envAt(".env"),
|
|
2435
|
+
dev: "start"
|
|
2436
|
+
}
|
|
2437
|
+
]
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
name: "swift",
|
|
2441
|
+
display: "Swift",
|
|
2442
|
+
color: import_picocolors.default.redBright,
|
|
2443
|
+
shape: "mobile",
|
|
2444
|
+
hint: "iOS and macOS, SwiftUI",
|
|
2445
|
+
variants: [
|
|
2446
|
+
{
|
|
2447
|
+
id: "swift",
|
|
2448
|
+
display: "Swift",
|
|
2449
|
+
aliases: ["ios", "swiftui"],
|
|
2450
|
+
source: "Swift",
|
|
2451
|
+
folder: "ios",
|
|
2452
|
+
appleTeam: "xcconfig",
|
|
2453
|
+
stores: ["apple"],
|
|
2454
|
+
// The starter's own comment asks for exactly this: real values in a
|
|
2455
|
+
// gitignored BdStarter.local.xcconfig that BdStarter.xcconfig includes.
|
|
2456
|
+
env: {
|
|
2457
|
+
example: "BdStarter.xcconfig",
|
|
2458
|
+
file: "BdStarter.local.xcconfig",
|
|
2459
|
+
format: "xcconfig"
|
|
2460
|
+
},
|
|
2461
|
+
steps: () => [
|
|
2462
|
+
"swift build",
|
|
2463
|
+
"# In Xcode: File > Add Package Dependencies > Add Local, pick this folder"
|
|
2464
|
+
],
|
|
2465
|
+
notes: [
|
|
2466
|
+
"In your app target, set the configuration to BdStarter.xcconfig (Project > Info > Configurations) and add BDHost, BDPublishableKey and BDSiteID to Info.plist as $(BD_HOST), $(BD_PUBLISHABLE_KEY) and $(BD_SITE_ID). README > Setup has the table."
|
|
2467
|
+
]
|
|
2468
|
+
}
|
|
2469
|
+
]
|
|
2470
|
+
},
|
|
2471
|
+
{
|
|
2472
|
+
name: "kotlin",
|
|
2473
|
+
display: "Kotlin",
|
|
2474
|
+
color: import_picocolors.default.magenta,
|
|
2475
|
+
shape: "mobile",
|
|
2476
|
+
hint: "Android, Jetpack Compose",
|
|
2477
|
+
variants: [
|
|
2478
|
+
{
|
|
2479
|
+
id: "kotlin",
|
|
2480
|
+
display: "Kotlin",
|
|
2481
|
+
aliases: ["android"],
|
|
2482
|
+
source: "Kotlin",
|
|
2483
|
+
folder: "android",
|
|
2484
|
+
stores: ["google"],
|
|
2485
|
+
env: { example: "local.properties.example", file: "local.properties" },
|
|
2486
|
+
steps: () => [
|
|
2487
|
+
"./gradlew :app:installDebug # with an emulator or device attached",
|
|
2488
|
+
"# or open this folder in Android Studio and run the app configuration"
|
|
2489
|
+
]
|
|
2490
|
+
}
|
|
2491
|
+
]
|
|
2492
|
+
},
|
|
2493
|
+
{
|
|
2494
|
+
name: "flutter",
|
|
2495
|
+
display: "Flutter",
|
|
2496
|
+
color: import_picocolors.default.blue,
|
|
2497
|
+
shape: "mobile",
|
|
2498
|
+
hint: "iOS and Android",
|
|
2499
|
+
variants: [
|
|
2500
|
+
{
|
|
2501
|
+
id: "flutter",
|
|
2502
|
+
display: "Flutter",
|
|
2503
|
+
aliases: ["dart"],
|
|
2504
|
+
source: "Flutter",
|
|
2505
|
+
folder: "mobile",
|
|
2506
|
+
stores: ["apple", "google"],
|
|
2507
|
+
// Dart-defines are compiled in; there is no env file to write.
|
|
2508
|
+
keys: ["siteId", "pk"],
|
|
2509
|
+
notes: [
|
|
2510
|
+
"flutter create signs the iOS app with your own certificate: it reads your keychain, asks if you have more than one, and writes your Apple team into the Xcode project."
|
|
2511
|
+
],
|
|
2512
|
+
steps: ({ keys }) => [
|
|
2513
|
+
"flutter create --platforms=ios,android .",
|
|
2514
|
+
"flutter pub get",
|
|
2515
|
+
`flutter run --dart-define=BD_SITE_ID=${keys.siteId ?? "<site id>"} --dart-define=BD_PK=${keys.pk ?? "pk_\u2026"}`
|
|
2516
|
+
]
|
|
2517
|
+
}
|
|
2518
|
+
]
|
|
2519
|
+
}
|
|
2520
|
+
];
|
|
2521
|
+
var TEMPLATES = FRAMEWORKS.flatMap((f) => f.variants);
|
|
2522
|
+
function findTemplate(name) {
|
|
2523
|
+
const wanted = name.trim().toLowerCase();
|
|
2524
|
+
return TEMPLATES.find(
|
|
2525
|
+
(t2) => t2.id === wanted || (t2.aliases ?? []).includes(wanted)
|
|
2526
|
+
);
|
|
2527
|
+
}
|
|
2528
|
+
function frameworkOf(template) {
|
|
2529
|
+
const framework = FRAMEWORKS.find((f) => f.variants.includes(template));
|
|
2530
|
+
if (!framework) throw new Error(`No framework lists ${template.id}`);
|
|
2531
|
+
return framework;
|
|
2532
|
+
}
|
|
2533
|
+
function templateById(id) {
|
|
2534
|
+
const template = TEMPLATES.find((t2) => t2.id === id);
|
|
2535
|
+
if (!template) throw new Error(`No template has the id ${id}`);
|
|
2536
|
+
return template;
|
|
2537
|
+
}
|
|
2538
|
+
function defaultFolder(template) {
|
|
2539
|
+
return template.folder ?? frameworkOf(template).shape;
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
// src/plan.ts
|
|
2543
|
+
function templateNames(raw) {
|
|
2544
|
+
if (raw === void 0) return [];
|
|
2545
|
+
return [raw].flat().flatMap((value) => String(value).split(",")).map((name) => name.trim()).filter(Boolean);
|
|
2546
|
+
}
|
|
2547
|
+
function uniqueTemplates(templates) {
|
|
2548
|
+
return templates.filter((t2, i2) => templates.indexOf(t2) === i2);
|
|
2549
|
+
}
|
|
2550
|
+
function planApps(templates) {
|
|
2551
|
+
const [only] = templates;
|
|
2552
|
+
if (only && templates.length === 1) return [{ template: only, folder: "" }];
|
|
2553
|
+
const wanted = templates.map(defaultFolder);
|
|
2554
|
+
return templates.map((template, i2) => {
|
|
2555
|
+
const folder = wanted[i2] ?? template.id;
|
|
2556
|
+
const taken = wanted.filter((f) => f === folder).length > 1;
|
|
2557
|
+
return { template, folder: taken ? template.id : folder };
|
|
2558
|
+
});
|
|
2559
|
+
}
|
|
2560
|
+
function rootReadme(name, apps, keysUrl) {
|
|
2561
|
+
const rows = apps.map(
|
|
2562
|
+
({ template, folder }) => `| [\`${folder}/\`](./${folder}/README.md) | ${template.display} |`
|
|
2563
|
+
);
|
|
2564
|
+
const hasMobile = apps.some(
|
|
2565
|
+
({ template }) => frameworkOf(template).shape === "mobile"
|
|
2566
|
+
);
|
|
2567
|
+
const sections = apps.map(
|
|
2568
|
+
({ template, folder, steps }) => `### ${folder}: ${template.display}
|
|
2569
|
+
|
|
2570
|
+
\`\`\`sh
|
|
2571
|
+
${steps.join("\n")}
|
|
2572
|
+
\`\`\``
|
|
2573
|
+
);
|
|
2574
|
+
return [
|
|
2575
|
+
`# ${name}`,
|
|
2576
|
+
"",
|
|
2577
|
+
"Created with [create-businessdash](https://www.npmjs.com/package/create-businessdash). Each folder is a complete BusinessDash starter that runs on its own, with its own dependencies and its own README.",
|
|
2578
|
+
"",
|
|
2579
|
+
"| Folder | Starter |",
|
|
2580
|
+
"| --- | --- |",
|
|
2581
|
+
...rows,
|
|
2582
|
+
"",
|
|
2583
|
+
`They all read the same site. Your keys are in the dashboard under Settings > Web Content SDK: ${keysUrl}`,
|
|
2584
|
+
...hasMobile ? [
|
|
2585
|
+
"",
|
|
2586
|
+
"The mobile apps take the publishable token only. The secret key stays in the web and server apps, never in an app binary."
|
|
2587
|
+
] : [],
|
|
2588
|
+
"",
|
|
2589
|
+
"## Running each app",
|
|
2590
|
+
"",
|
|
2591
|
+
sections.join("\n\n"),
|
|
2592
|
+
""
|
|
2593
|
+
].join("\n");
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
// src/scaffold.ts
|
|
2597
|
+
import {
|
|
2598
|
+
appendFileSync,
|
|
2599
|
+
chmodSync,
|
|
2600
|
+
copyFileSync,
|
|
2601
|
+
existsSync as existsSync2,
|
|
2602
|
+
mkdirSync,
|
|
2603
|
+
readdirSync as readdirSync2,
|
|
2604
|
+
readFileSync as readFileSync2,
|
|
2605
|
+
rmSync as rmSync2,
|
|
2606
|
+
statSync,
|
|
2607
|
+
writeFileSync as writeFileSync2
|
|
2608
|
+
} from "node:fs";
|
|
2609
|
+
import { join as join4 } from "node:path";
|
|
2610
|
+
var STORED_NAMES = {
|
|
2611
|
+
".gitignore": "_gitignore",
|
|
2612
|
+
".npmrc": "_npmrc"
|
|
2613
|
+
};
|
|
2614
|
+
var RESTORED_NAMES = Object.fromEntries(
|
|
2615
|
+
Object.entries(STORED_NAMES).map(([real, stored]) => [stored, real])
|
|
2616
|
+
);
|
|
2617
|
+
var DEFAULT_PROJECT_NAME = "businessdash-app";
|
|
2618
|
+
function formatTargetDir(dir) {
|
|
2619
|
+
return dir.trim().replace(/[/\\]+$/, "");
|
|
2620
|
+
}
|
|
2621
|
+
function isEmptyDir(path) {
|
|
2622
|
+
if (!existsSync2(path)) return true;
|
|
2623
|
+
const files = readdirSync2(path);
|
|
2624
|
+
return files.length === 0 || files.length === 1 && files[0] === ".git";
|
|
2625
|
+
}
|
|
2626
|
+
function emptyDir(dir) {
|
|
2627
|
+
if (!existsSync2(dir)) return;
|
|
2628
|
+
for (const name of readdirSync2(dir)) {
|
|
2629
|
+
if (name === ".git" || name.endsWith(".DSBookmark")) continue;
|
|
2630
|
+
rmSync2(join4(dir, name), { recursive: true, force: true });
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
function isValidPackageName(name) {
|
|
2634
|
+
return /^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(
|
|
2635
|
+
name
|
|
2636
|
+
);
|
|
2637
|
+
}
|
|
2638
|
+
function toValidPackageName(name) {
|
|
2639
|
+
return name.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]+/, "").replace(/[^a-z\d\-~]+/g, "-");
|
|
2640
|
+
}
|
|
2641
|
+
function templateSlots(templatesDir, template) {
|
|
2642
|
+
if (!template.env) return template.keys ?? [];
|
|
2643
|
+
const example = join4(templatesDir, template.id, template.env.example);
|
|
2644
|
+
return existsSync2(example) ? slotsIn(readFileSync2(example, "utf8")) : [];
|
|
2645
|
+
}
|
|
2646
|
+
function copyTree(from, to, skip, prefix = "") {
|
|
2647
|
+
mkdirSync(to, { recursive: true });
|
|
2648
|
+
for (const entry of readdirSync2(from, { withFileTypes: true })) {
|
|
2649
|
+
const source = join4(from, entry.name);
|
|
2650
|
+
const name = RESTORED_NAMES[entry.name] ?? entry.name;
|
|
2651
|
+
const relativePath = prefix ? `${prefix}/${name}` : name;
|
|
2652
|
+
const target = join4(to, name);
|
|
2653
|
+
if (entry.isDirectory()) {
|
|
2654
|
+
copyTree(source, target, skip, relativePath);
|
|
2655
|
+
} else if (!skip(relativePath)) {
|
|
2656
|
+
copyFileSync(source, target);
|
|
2657
|
+
chmodSync(target, statSync(source).mode & 511);
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
function isRecord(value) {
|
|
2662
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2663
|
+
}
|
|
2664
|
+
function rewriteJson(path, edit) {
|
|
2665
|
+
const text2 = readFileSync2(path, "utf8");
|
|
2666
|
+
const parsed = JSON.parse(text2);
|
|
2667
|
+
if (!isRecord(parsed)) throw new Error(`${path} is not a JSON object`);
|
|
2668
|
+
edit(parsed);
|
|
2669
|
+
const indent = /^([ \t]+)"/m.exec(text2)?.[1] ?? " ";
|
|
2670
|
+
writeFileSync2(path, `${JSON.stringify(parsed, null, indent)}
|
|
2671
|
+
`);
|
|
2672
|
+
}
|
|
2673
|
+
function rewritePackageJson(path, name, pm) {
|
|
2674
|
+
if (!existsSync2(path)) return;
|
|
2675
|
+
rewriteJson(path, (pkg) => {
|
|
2676
|
+
pkg.name = name;
|
|
2677
|
+
const pinned = pkg.packageManager;
|
|
2678
|
+
if (typeof pinned === "string" && !pinned.startsWith(`${pm}@`)) {
|
|
2679
|
+
delete pkg.packageManager;
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
}
|
|
2683
|
+
function writeAppleTeam(root, template, team, env) {
|
|
2684
|
+
if (template.appleTeam === "xcconfig") {
|
|
2685
|
+
if (!env?.written) return void 0;
|
|
2686
|
+
appendFileSync(join4(root, env.file), `DEVELOPMENT_TEAM = ${team}
|
|
2687
|
+
`);
|
|
2688
|
+
return env.file;
|
|
2689
|
+
}
|
|
2690
|
+
if (template.appleTeam === "app.json") {
|
|
2691
|
+
const path = join4(root, "app.json");
|
|
2692
|
+
if (!existsSync2(path)) return void 0;
|
|
2693
|
+
rewriteJson(path, (json) => {
|
|
2694
|
+
const expo = isRecord(json.expo) ? json.expo : {};
|
|
2695
|
+
const ios = isRecord(expo.ios) ? expo.ios : {};
|
|
2696
|
+
ios.appleTeamId = team;
|
|
2697
|
+
expo.ios = ios;
|
|
2698
|
+
json.expo = expo;
|
|
2699
|
+
});
|
|
2700
|
+
return "app.json";
|
|
2701
|
+
}
|
|
2702
|
+
return void 0;
|
|
2703
|
+
}
|
|
2704
|
+
function globToRegExp(glob) {
|
|
2705
|
+
let source = "";
|
|
2706
|
+
for (const char of glob) {
|
|
2707
|
+
if (char === "*") source += "[^/]*";
|
|
2708
|
+
else if (char === "?") source += "[^/]";
|
|
2709
|
+
else source += char.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
2710
|
+
}
|
|
2711
|
+
return new RegExp(`^${source}$`);
|
|
2712
|
+
}
|
|
2713
|
+
function isIgnored(gitignore, file) {
|
|
2714
|
+
let ignored = false;
|
|
2715
|
+
for (const raw of gitignore.split("\n")) {
|
|
2716
|
+
const line = raw.trim();
|
|
2717
|
+
if (!line || line.startsWith("#")) continue;
|
|
2718
|
+
const negated = line.startsWith("!");
|
|
2719
|
+
let pattern = negated ? line.slice(1) : line;
|
|
2720
|
+
if (pattern.endsWith("/")) continue;
|
|
2721
|
+
if (pattern.startsWith("/")) pattern = pattern.slice(1);
|
|
2722
|
+
else if (pattern.startsWith("**/")) pattern = pattern.slice(3);
|
|
2723
|
+
if (pattern.includes("/")) continue;
|
|
2724
|
+
if (globToRegExp(pattern).test(file)) ignored = !negated;
|
|
2725
|
+
}
|
|
2726
|
+
return ignored;
|
|
2727
|
+
}
|
|
2728
|
+
function ensureIgnored(root, file) {
|
|
2729
|
+
const path = join4(root, ".gitignore");
|
|
2730
|
+
const text2 = existsSync2(path) ? readFileSync2(path, "utf8") : "";
|
|
2731
|
+
if (isIgnored(text2, file)) return false;
|
|
2732
|
+
const lead = text2 === "" ? "" : text2.endsWith("\n") ? `${text2}
|
|
2733
|
+
` : `${text2}
|
|
2734
|
+
|
|
2735
|
+
`;
|
|
2736
|
+
writeFileSync2(path, `${lead}# Holds your BusinessDash keys
|
|
2737
|
+
${file}
|
|
2738
|
+
`);
|
|
2739
|
+
return true;
|
|
2740
|
+
}
|
|
2741
|
+
function includeFromXcconfig(path, file) {
|
|
2742
|
+
const text2 = readFileSync2(path, "utf8");
|
|
2743
|
+
const include = `#include? "${file}"`;
|
|
2744
|
+
if (text2.includes(include)) return;
|
|
2745
|
+
const body = text2.replace(/\n*$/, "\n");
|
|
2746
|
+
writeFileSync2(
|
|
2747
|
+
path,
|
|
2748
|
+
`${body}
|
|
2749
|
+
// Your keys, kept out of git (added by create-businessdash).
|
|
2750
|
+
${include}
|
|
2751
|
+
`
|
|
2752
|
+
);
|
|
2753
|
+
}
|
|
2754
|
+
function writeEnv(root, env, keys) {
|
|
2755
|
+
const examplePath = join4(root, env.example);
|
|
2756
|
+
const example = readFileSync2(examplePath, "utf8");
|
|
2757
|
+
const target = join4(root, env.file);
|
|
2758
|
+
const slots = slotsIn(example);
|
|
2759
|
+
let written = false;
|
|
2760
|
+
let placed = [];
|
|
2761
|
+
if (!existsSync2(target)) {
|
|
2762
|
+
const source = env.format === "xcconfig" ? `// Your BusinessDash keys. Gitignored; ${env.example} includes this file.
|
|
2763
|
+
${slotLinesOnly(example)}
|
|
2764
|
+
` : example;
|
|
2765
|
+
const filled = fillEnv(source, keys);
|
|
2766
|
+
writeFileSync2(target, filled.text, { mode: 384 });
|
|
2767
|
+
written = true;
|
|
2768
|
+
placed = filled.placed;
|
|
2769
|
+
}
|
|
2770
|
+
if (env.format === "xcconfig") includeFromXcconfig(examplePath, env.file);
|
|
2771
|
+
const addedToGitignore = ensureIgnored(root, env.file);
|
|
2772
|
+
return { file: env.file, written, slots, placed, addedToGitignore };
|
|
2773
|
+
}
|
|
2774
|
+
function scaffold(options) {
|
|
2775
|
+
const from = join4(options.templatesDir, options.template.id);
|
|
2776
|
+
if (!existsSync2(from)) {
|
|
2777
|
+
throw new Error(
|
|
2778
|
+
`The ${options.template.id} template is missing from this install (${from}).`
|
|
2779
|
+
);
|
|
2780
|
+
}
|
|
2781
|
+
copyTree(
|
|
2782
|
+
from,
|
|
2783
|
+
options.targetDir,
|
|
2784
|
+
(path) => options.pm !== "pnpm" ? path === "pnpm-lock.yaml" : false
|
|
2785
|
+
);
|
|
2786
|
+
const payments = prunePayments(options.targetDir, options.payments);
|
|
2787
|
+
rewritePackageJson(
|
|
2788
|
+
join4(options.targetDir, "package.json"),
|
|
2789
|
+
options.packageName,
|
|
2790
|
+
options.pm
|
|
2791
|
+
);
|
|
2792
|
+
const env = options.template.env ? writeEnv(options.targetDir, options.template.env, options.keys) : void 0;
|
|
2793
|
+
const appleTeamFile = options.appleTeam ? writeAppleTeam(
|
|
2794
|
+
options.targetDir,
|
|
2795
|
+
options.template,
|
|
2796
|
+
options.appleTeam,
|
|
2797
|
+
env
|
|
2798
|
+
) : void 0;
|
|
2799
|
+
return { env, appleTeamFile, payments };
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
// src/sign-in.ts
|
|
2803
|
+
import { spawn } from "node:child_process";
|
|
2804
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2805
|
+
import { createServer } from "node:http";
|
|
2806
|
+
import { hostname } from "node:os";
|
|
2807
|
+
var DEFAULT_HOST = "https://businessdash.us";
|
|
2808
|
+
var WAIT_MS = 5 * 6e4;
|
|
2809
|
+
function sha256(value) {
|
|
2810
|
+
return createHash("sha256").update(value).digest("base64url");
|
|
2811
|
+
}
|
|
2812
|
+
function machineName(raw = hostname()) {
|
|
2813
|
+
return raw.replace(/[^A-Za-z0-9._-]+/g, "").slice(0, 64) || "a computer";
|
|
2814
|
+
}
|
|
2815
|
+
function authorizeLink(host, params) {
|
|
2816
|
+
const query = new URLSearchParams({
|
|
2817
|
+
redirect_uri: params.redirectUri,
|
|
2818
|
+
code_challenge: params.challenge,
|
|
2819
|
+
state: params.state,
|
|
2820
|
+
machine: params.machine,
|
|
2821
|
+
secret: params.withSecret ? "1" : "0"
|
|
2822
|
+
});
|
|
2823
|
+
return `${host}/login?returnTo=${encodeURIComponent(`/cli/authorize?${query}`)}`;
|
|
2824
|
+
}
|
|
2825
|
+
function openInBrowser(url) {
|
|
2826
|
+
if (process.env.BROWSER === "none") return;
|
|
2827
|
+
const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? (
|
|
2828
|
+
// Not `cmd /c start`: cmd would split the URL at every `&`.
|
|
2829
|
+
["rundll32", ["url.dll,FileProtocolHandler", url]]
|
|
2830
|
+
) : ["xdg-open", [url]];
|
|
2831
|
+
try {
|
|
2832
|
+
const child = spawn(command, args, { detached: true, stdio: "ignore" });
|
|
2833
|
+
child.on("error", () => void 0);
|
|
2834
|
+
child.unref();
|
|
2835
|
+
} catch {
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
function page(res, status, message) {
|
|
2839
|
+
res.writeHead(status, {
|
|
2840
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
2841
|
+
Connection: "close"
|
|
2842
|
+
});
|
|
2843
|
+
res.end(
|
|
2844
|
+
`<!doctype html><meta charset="utf-8"><title>create-businessdash</title><body style="font:16px system-ui;margin:4rem auto;max-width:32rem;padding:0 1rem"><p>${message}</p></body>`
|
|
2845
|
+
);
|
|
2846
|
+
}
|
|
2847
|
+
async function redeem(host, body) {
|
|
2848
|
+
let response;
|
|
2849
|
+
try {
|
|
2850
|
+
response = await fetch(`${host}/api/cli/keys`, {
|
|
2851
|
+
method: "POST",
|
|
2852
|
+
headers: { "Content-Type": "application/json" },
|
|
2853
|
+
body: JSON.stringify(body),
|
|
2854
|
+
redirect: "error"
|
|
2855
|
+
});
|
|
2856
|
+
} catch (error) {
|
|
2857
|
+
const why = error instanceof Error ? error.message : String(error);
|
|
2858
|
+
return {
|
|
2859
|
+
ok: false,
|
|
2860
|
+
reason: "failed",
|
|
2861
|
+
message: `Couldn't reach BusinessDash (${why}).`
|
|
2862
|
+
};
|
|
2863
|
+
}
|
|
2864
|
+
let json = {};
|
|
2865
|
+
try {
|
|
2866
|
+
json = await response.json();
|
|
2867
|
+
} catch {
|
|
2868
|
+
}
|
|
2869
|
+
if (!response.ok) {
|
|
2870
|
+
const message = typeof json.message === "string" ? json.message : `BusinessDash answered ${response.status}.`;
|
|
2871
|
+
return { ok: false, reason: "failed", message };
|
|
2872
|
+
}
|
|
2873
|
+
const keys = {};
|
|
2874
|
+
const candidates = [
|
|
2875
|
+
["siteId", json.siteId],
|
|
2876
|
+
["pk", json.publishableKey],
|
|
2877
|
+
["sk", json.secretKey]
|
|
2878
|
+
];
|
|
2879
|
+
for (const [slot, value] of candidates) {
|
|
2880
|
+
if (value === void 0 && slot === "sk") continue;
|
|
2881
|
+
if (typeof value !== "string" || keyProblem(slot, value)) {
|
|
2882
|
+
return {
|
|
2883
|
+
ok: false,
|
|
2884
|
+
reason: "failed",
|
|
2885
|
+
message: "BusinessDash sent back keys this version doesn't recognize."
|
|
2886
|
+
};
|
|
2887
|
+
}
|
|
2888
|
+
keys[slot] = value;
|
|
2889
|
+
}
|
|
2890
|
+
return {
|
|
2891
|
+
ok: true,
|
|
2892
|
+
keys,
|
|
2893
|
+
siteName: typeof json.siteName === "string" ? json.siteName : "your site",
|
|
2894
|
+
publishableHost: typeof json.publishableHost === "string" ? json.publishableHost : "localhost"
|
|
2895
|
+
};
|
|
2896
|
+
}
|
|
2897
|
+
async function signIn(options) {
|
|
2898
|
+
const verifier = randomBytes(32).toString("base64url");
|
|
2899
|
+
const state = randomBytes(16).toString("base64url");
|
|
2900
|
+
let settle = () => void 0;
|
|
2901
|
+
const callback = new Promise((resolve2) => {
|
|
2902
|
+
settle = resolve2;
|
|
2903
|
+
});
|
|
2904
|
+
const server = createServer((req, res) => {
|
|
2905
|
+
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
2906
|
+
if (url.pathname !== "/callback") {
|
|
2907
|
+
res.writeHead(404, { Connection: "close" }).end();
|
|
2908
|
+
return;
|
|
2909
|
+
}
|
|
2910
|
+
if (url.searchParams.get("state") !== state) {
|
|
2911
|
+
page(
|
|
2912
|
+
res,
|
|
2913
|
+
400,
|
|
2914
|
+
"This link belongs to another run of create-businessdash."
|
|
2915
|
+
);
|
|
2916
|
+
return;
|
|
2917
|
+
}
|
|
2918
|
+
if (url.searchParams.get("error")) {
|
|
2919
|
+
page(res, 200, "Cancelled. Your project is being created without keys.");
|
|
2920
|
+
settle({ kind: "cancelled" });
|
|
2921
|
+
return;
|
|
2922
|
+
}
|
|
2923
|
+
const code = url.searchParams.get("code");
|
|
2924
|
+
if (!code) {
|
|
2925
|
+
page(res, 400, "This sign-in came back without a code.");
|
|
2926
|
+
return;
|
|
2927
|
+
}
|
|
2928
|
+
page(
|
|
2929
|
+
res,
|
|
2930
|
+
200,
|
|
2931
|
+
"Signed in. Go back to your terminal; you can close this tab."
|
|
2932
|
+
);
|
|
2933
|
+
settle({ kind: "code", code });
|
|
2934
|
+
});
|
|
2935
|
+
await new Promise((resolve2, reject) => {
|
|
2936
|
+
server.once("error", reject);
|
|
2937
|
+
server.listen(0, "127.0.0.1", () => resolve2());
|
|
2938
|
+
});
|
|
2939
|
+
const { port } = server.address();
|
|
2940
|
+
const redirectUri = `http://127.0.0.1:${port}/callback`;
|
|
2941
|
+
const link = authorizeLink(options.host, {
|
|
2942
|
+
redirectUri,
|
|
2943
|
+
challenge: sha256(verifier),
|
|
2944
|
+
state,
|
|
2945
|
+
machine: options.machine ?? machineName(),
|
|
2946
|
+
withSecret: options.withSecret
|
|
2947
|
+
});
|
|
2948
|
+
options.onLink(link);
|
|
2949
|
+
(options.openUrl ?? openInBrowser)(link);
|
|
2950
|
+
let timer;
|
|
2951
|
+
const timeout = new Promise((resolve2) => {
|
|
2952
|
+
timer = setTimeout(
|
|
2953
|
+
() => resolve2({ kind: "timeout" }),
|
|
2954
|
+
options.timeoutMs ?? WAIT_MS
|
|
2955
|
+
);
|
|
2956
|
+
});
|
|
2957
|
+
const skipped = (options.skip ?? new Promise(() => void 0)).then(
|
|
2958
|
+
() => ({ kind: "skipped" })
|
|
2959
|
+
);
|
|
2960
|
+
try {
|
|
2961
|
+
const outcome = await Promise.race([callback, timeout, skipped]);
|
|
2962
|
+
switch (outcome.kind) {
|
|
2963
|
+
case "cancelled":
|
|
2964
|
+
return {
|
|
2965
|
+
ok: false,
|
|
2966
|
+
reason: "cancelled",
|
|
2967
|
+
message: "Sign-in was cancelled in the browser."
|
|
2968
|
+
};
|
|
2969
|
+
case "skipped":
|
|
2970
|
+
return { ok: false, reason: "skipped", message: "Skipped sign-in." };
|
|
2971
|
+
case "timeout":
|
|
2972
|
+
return {
|
|
2973
|
+
ok: false,
|
|
2974
|
+
reason: "timeout",
|
|
2975
|
+
message: "No approval arrived from the browser."
|
|
2976
|
+
};
|
|
2977
|
+
case "code":
|
|
2978
|
+
return await redeem(options.host, {
|
|
2979
|
+
code: outcome.code,
|
|
2980
|
+
code_verifier: verifier,
|
|
2981
|
+
redirect_uri: redirectUri
|
|
2982
|
+
});
|
|
2983
|
+
}
|
|
2984
|
+
} finally {
|
|
2985
|
+
clearTimeout(timer);
|
|
2986
|
+
server.close();
|
|
2987
|
+
server.closeAllConnections();
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
// src/index.ts
|
|
2992
|
+
var TEMPLATES_DIR = fileURLToPath(new URL("../templates", import.meta.url));
|
|
2993
|
+
var KEYS_URL = "https://www.businessdash.us/login?returnTo=/dashboard/settings/web-content";
|
|
2994
|
+
var DOCS_URL = "https://www.businessdash.us/docs/developer/starters";
|
|
2995
|
+
var KEY_FLAGS = {
|
|
2996
|
+
siteId: "site-id",
|
|
2997
|
+
pk: "pk",
|
|
2998
|
+
sk: "sk"
|
|
2999
|
+
};
|
|
3000
|
+
var argv = (0, import_mri.default)(process.argv.slice(2), {
|
|
3001
|
+
alias: { h: "help", t: "template", i: "immediate", v: "version" },
|
|
3002
|
+
boolean: [
|
|
3003
|
+
"help",
|
|
3004
|
+
"version",
|
|
3005
|
+
"overwrite",
|
|
3006
|
+
"immediate",
|
|
3007
|
+
"interactive",
|
|
3008
|
+
"sign-in"
|
|
3009
|
+
],
|
|
3010
|
+
string: [
|
|
3011
|
+
"template",
|
|
3012
|
+
"pm",
|
|
3013
|
+
"site-id",
|
|
3014
|
+
"pk",
|
|
3015
|
+
"sk",
|
|
3016
|
+
"apple-team",
|
|
3017
|
+
"host",
|
|
3018
|
+
"payments"
|
|
3019
|
+
]
|
|
3020
|
+
});
|
|
3021
|
+
var SHAPE_TITLE = {
|
|
3022
|
+
web: "Web",
|
|
3023
|
+
server: "Server",
|
|
3024
|
+
mobile: "Mobile (publishable token only)"
|
|
3025
|
+
};
|
|
3026
|
+
function templateList() {
|
|
3027
|
+
const lines = [];
|
|
3028
|
+
for (const shape of ["web", "server", "mobile"]) {
|
|
3029
|
+
lines.push(` ${import_picocolors2.default.dim(SHAPE_TITLE[shape])}`);
|
|
3030
|
+
for (const framework of FRAMEWORKS.filter((f) => f.shape === shape)) {
|
|
3031
|
+
for (const t2 of framework.variants) {
|
|
3032
|
+
const label = framework.variants.length > 1 ? `${framework.display}: ${t2.display}` : t2.display;
|
|
3033
|
+
const aliases = t2.aliases?.length ? import_picocolors2.default.dim(` (also: ${t2.aliases.join(", ")})`) : "";
|
|
3034
|
+
lines.push(` ${framework.color(t2.id.padEnd(16))}${label}${aliases}`);
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
return lines.join("\n");
|
|
3039
|
+
}
|
|
3040
|
+
function helpText() {
|
|
3041
|
+
return `Usage: create-businessdash [OPTION]... [DIRECTORY]
|
|
3042
|
+
|
|
3043
|
+
Create a BusinessDash app from a starter, or several apps in one project.
|
|
3044
|
+
With no arguments, start the CLI in interactive mode.
|
|
3045
|
+
|
|
3046
|
+
Options:
|
|
3047
|
+
-t, --template NAME[,NAME\u2026] one starter, or several: each gets its own folder
|
|
3048
|
+
-i, --immediate install dependencies and start the dev server
|
|
3049
|
+
--pm NAME npm, pnpm, yarn or bun (default: the one that ran create)
|
|
3050
|
+
--overwrite remove existing files in DIRECTORY first
|
|
3051
|
+
--site-id UUID your site ID
|
|
3052
|
+
--pk TOKEN your publishable token (pk_\u2026)
|
|
3053
|
+
--sk KEY your secret key; the prompt keeps it out of shell history
|
|
3054
|
+
--sign-in get the keys by approving in your browser instead
|
|
3055
|
+
(optional; the keys prompt offers it too)
|
|
3056
|
+
--host URL BusinessDash address for --sign-in
|
|
3057
|
+
(default ${DEFAULT_HOST})
|
|
3058
|
+
--payments LIST what the app takes money for: store, donations,
|
|
3059
|
+
saas (comma-separated), or none. Payment code you
|
|
3060
|
+
don't pick is left out (default: none)
|
|
3061
|
+
--apple-team ID your Apple team, to sign an iPhone app (asked on a Mac
|
|
3062
|
+
when omitted; it stays on your machine)
|
|
3063
|
+
--interactive force interactive mode
|
|
3064
|
+
--no-interactive never prompt; fail instead
|
|
3065
|
+
-h, --help show this help
|
|
3066
|
+
-v, --version show the version
|
|
3067
|
+
|
|
3068
|
+
Available templates:
|
|
3069
|
+
${templateList()}
|
|
3070
|
+
|
|
3071
|
+
Examples:
|
|
3072
|
+
npm create businessdash@latest
|
|
3073
|
+
pnpm create businessdash my-site --template astro
|
|
3074
|
+
pnpm create businessdash acme --template astro,ios,android # acme/web, acme/ios, acme/android
|
|
3075
|
+
npm create businessdash@latest acme -- --template nuxt,flutter --pm pnpm`;
|
|
3076
|
+
}
|
|
3077
|
+
function fail(message) {
|
|
3078
|
+
console.error(`${import_picocolors2.default.red("\u2716")} ${message}`);
|
|
3079
|
+
process.exit(1);
|
|
3080
|
+
}
|
|
3081
|
+
function cancelled() {
|
|
3082
|
+
cancel("Operation cancelled");
|
|
3083
|
+
process.exit(0);
|
|
3084
|
+
}
|
|
3085
|
+
function hasCommand(name) {
|
|
3086
|
+
const result = spawnSync2(name, ["--version"], {
|
|
3087
|
+
stdio: "ignore",
|
|
3088
|
+
shell: process.platform === "win32"
|
|
3089
|
+
});
|
|
3090
|
+
return result.status === 0;
|
|
3091
|
+
}
|
|
3092
|
+
function run(command, cwd) {
|
|
3093
|
+
const [bin, ...args] = command;
|
|
3094
|
+
if (!bin) return false;
|
|
3095
|
+
const result = spawnSync2(bin, args, {
|
|
3096
|
+
cwd,
|
|
3097
|
+
stdio: "inherit",
|
|
3098
|
+
shell: process.platform === "win32"
|
|
3099
|
+
});
|
|
3100
|
+
return result.status === 0;
|
|
3101
|
+
}
|
|
3102
|
+
function colored(template) {
|
|
3103
|
+
return frameworkOf(template).color(template.display);
|
|
3104
|
+
}
|
|
3105
|
+
function keysFromFlags() {
|
|
3106
|
+
const keys = {};
|
|
3107
|
+
for (const slot of SLOT_ORDER) {
|
|
3108
|
+
const flag = KEY_FLAGS[slot];
|
|
3109
|
+
const value = argv[flag];
|
|
3110
|
+
if (value === void 0) continue;
|
|
3111
|
+
const problem = keyProblem(slot, value);
|
|
3112
|
+
if (problem) fail(`--${flag}: ${problem}`);
|
|
3113
|
+
keys[slot] = value.trim();
|
|
3114
|
+
}
|
|
3115
|
+
return keys;
|
|
3116
|
+
}
|
|
3117
|
+
async function pickFramework(message, shape) {
|
|
3118
|
+
const framework = await select({
|
|
3119
|
+
message,
|
|
3120
|
+
options: FRAMEWORKS.filter((f) => f.shape === shape).map((f) => ({
|
|
3121
|
+
value: f,
|
|
3122
|
+
label: f.color(f.display),
|
|
3123
|
+
hint: f.hint
|
|
3124
|
+
}))
|
|
3125
|
+
});
|
|
3126
|
+
if (isCancel(framework)) cancelled();
|
|
3127
|
+
const [only] = framework.variants;
|
|
3128
|
+
if (only && framework.variants.length === 1) return only;
|
|
3129
|
+
const variant = await select({
|
|
3130
|
+
message: "Select a variant:",
|
|
3131
|
+
options: framework.variants.map((t2) => ({
|
|
3132
|
+
value: t2,
|
|
3133
|
+
label: framework.color(t2.display),
|
|
3134
|
+
hint: t2.hint
|
|
3135
|
+
}))
|
|
3136
|
+
});
|
|
3137
|
+
if (isCancel(variant)) cancelled();
|
|
3138
|
+
return variant;
|
|
3139
|
+
}
|
|
3140
|
+
async function pickMobile(ios, android) {
|
|
3141
|
+
const swift = templateById("swift");
|
|
3142
|
+
const kotlin = templateById("kotlin");
|
|
3143
|
+
const flutter = templateById("flutter");
|
|
3144
|
+
const expo = templateById("react-native");
|
|
3145
|
+
const crossPlatform = [
|
|
3146
|
+
{ value: [flutter], label: colored(flutter), hint: "one app for both" },
|
|
3147
|
+
{ value: [expo], label: colored(expo), hint: "Expo, one app for both" }
|
|
3148
|
+
];
|
|
3149
|
+
const options = ios && android ? [
|
|
3150
|
+
...crossPlatform,
|
|
3151
|
+
{
|
|
3152
|
+
value: [swift, kotlin],
|
|
3153
|
+
label: `${colored(swift)} + ${colored(kotlin)}`,
|
|
3154
|
+
hint: "native, one app each"
|
|
3155
|
+
}
|
|
3156
|
+
] : ios ? [
|
|
3157
|
+
{ value: [swift], label: colored(swift), hint: "native SwiftUI" },
|
|
3158
|
+
...crossPlatform
|
|
3159
|
+
] : [
|
|
3160
|
+
{
|
|
3161
|
+
value: [kotlin],
|
|
3162
|
+
label: colored(kotlin),
|
|
3163
|
+
hint: "native Jetpack Compose"
|
|
3164
|
+
},
|
|
3165
|
+
...crossPlatform
|
|
3166
|
+
];
|
|
3167
|
+
const choice = await select({
|
|
3168
|
+
message: ios && android ? "How should the iOS and Android apps be built?" : ios ? "Select an iOS framework:" : "Select an Android framework:",
|
|
3169
|
+
options
|
|
3170
|
+
});
|
|
3171
|
+
if (isCancel(choice)) cancelled();
|
|
3172
|
+
return choice;
|
|
3173
|
+
}
|
|
3174
|
+
async function pickByPlatform() {
|
|
3175
|
+
const platforms = await multiselect({
|
|
3176
|
+
message: "Which platforms?",
|
|
3177
|
+
options: [
|
|
3178
|
+
{
|
|
3179
|
+
value: "web",
|
|
3180
|
+
label: "Web",
|
|
3181
|
+
hint: "React, Nuxt, SvelteKit, Astro, Angular, \u2026"
|
|
3182
|
+
},
|
|
3183
|
+
{
|
|
3184
|
+
value: "server",
|
|
3185
|
+
label: "Server-rendered",
|
|
3186
|
+
hint: "Laravel, Phoenix, Vapor"
|
|
3187
|
+
},
|
|
3188
|
+
{ value: "ios", label: "iOS" },
|
|
3189
|
+
{ value: "android", label: "Android" }
|
|
3190
|
+
],
|
|
3191
|
+
initialValues: ["web"],
|
|
3192
|
+
required: true
|
|
3193
|
+
});
|
|
3194
|
+
if (isCancel(platforms)) cancelled();
|
|
3195
|
+
const picked = [];
|
|
3196
|
+
if (platforms.includes("web"))
|
|
3197
|
+
picked.push(await pickFramework("Select a web framework:", "web"));
|
|
3198
|
+
if (platforms.includes("server")) {
|
|
3199
|
+
picked.push(await pickFramework("Select a server framework:", "server"));
|
|
3200
|
+
}
|
|
3201
|
+
const ios = platforms.includes("ios");
|
|
3202
|
+
const android = platforms.includes("android");
|
|
3203
|
+
if (ios || android) picked.push(...await pickMobile(ios, android));
|
|
3204
|
+
return picked;
|
|
3205
|
+
}
|
|
3206
|
+
async function chooseTemplates(interactive) {
|
|
3207
|
+
const names = templateNames(argv.template);
|
|
3208
|
+
if (names.length > 0) {
|
|
3209
|
+
const found = names.map((name) => ({ name, template: findTemplate(name) }));
|
|
3210
|
+
const unknown = found.filter((f) => !f.template).map((f) => `"${f.name}"`);
|
|
3211
|
+
if (unknown.length === 0) {
|
|
3212
|
+
return uniqueTemplates(
|
|
3213
|
+
found.flatMap((f) => f.template ? [f.template] : [])
|
|
3214
|
+
);
|
|
3215
|
+
}
|
|
3216
|
+
const what = `${unknown.join(", ")} ${unknown.length > 1 ? "aren't templates" : "isn't a template"}`;
|
|
3217
|
+
if (!interactive) fail(`${what}. Choose from:
|
|
3218
|
+
${templateList()}`);
|
|
3219
|
+
log.warn(`${what}. Choose below:`);
|
|
3220
|
+
} else if (!interactive) {
|
|
3221
|
+
fail(
|
|
3222
|
+
`Pass --template NAME (or several: --template astro,ios,android). Templates:
|
|
3223
|
+
${templateList()}`
|
|
3224
|
+
);
|
|
3225
|
+
}
|
|
3226
|
+
return pickByPlatform();
|
|
3227
|
+
}
|
|
3228
|
+
function paymentsFromFlag() {
|
|
3229
|
+
if (argv.payments === void 0) return void 0;
|
|
3230
|
+
const parsed = parsePayments(argv.payments);
|
|
3231
|
+
if ("error" in parsed) fail(parsed.error);
|
|
3232
|
+
return parsed.features;
|
|
3233
|
+
}
|
|
3234
|
+
async function choosePayments(fromFlag, interactive) {
|
|
3235
|
+
if (fromFlag) return fromFlag;
|
|
3236
|
+
if (!interactive) return [];
|
|
3237
|
+
const accept = await confirm({
|
|
3238
|
+
message: "Accept payments through Stripe?",
|
|
3239
|
+
initialValue: false
|
|
3240
|
+
});
|
|
3241
|
+
if (isCancel(accept)) cancelled();
|
|
3242
|
+
if (!accept) return [];
|
|
3243
|
+
const picked = await multiselect({
|
|
3244
|
+
message: "What will people pay for? (select all that apply)",
|
|
3245
|
+
options: PAYMENT_FEATURES.map((feature) => ({
|
|
3246
|
+
value: feature,
|
|
3247
|
+
label: PAYMENT_CHOICES[feature].label,
|
|
3248
|
+
hint: PAYMENT_CHOICES[feature].hint
|
|
3249
|
+
})),
|
|
3250
|
+
required: true
|
|
3251
|
+
});
|
|
3252
|
+
if (isCancel(picked)) cancelled();
|
|
3253
|
+
return PAYMENT_FEATURES.filter((feature) => picked.includes(feature));
|
|
3254
|
+
}
|
|
3255
|
+
function signInHost() {
|
|
3256
|
+
const raw = argv.host?.trim() || DEFAULT_HOST;
|
|
3257
|
+
let url;
|
|
3258
|
+
try {
|
|
3259
|
+
url = new URL(raw);
|
|
3260
|
+
} catch {
|
|
3261
|
+
fail(`--host: "${raw}" isn't a URL.`);
|
|
3262
|
+
}
|
|
3263
|
+
const local = url.hostname === "localhost" || url.hostname === "127.0.0.1";
|
|
3264
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && local)) {
|
|
3265
|
+
fail("--host must be https (plain http only for localhost).");
|
|
3266
|
+
}
|
|
3267
|
+
return url.origin;
|
|
3268
|
+
}
|
|
3269
|
+
function keyPressed() {
|
|
3270
|
+
if (!process.stdin.isTTY) {
|
|
3271
|
+
return { pressed: new Promise(() => void 0), stop: () => void 0 };
|
|
3272
|
+
}
|
|
3273
|
+
let onData = () => void 0;
|
|
3274
|
+
const pressed = new Promise((resolve2) => {
|
|
3275
|
+
onData = () => resolve2();
|
|
3276
|
+
});
|
|
3277
|
+
process.stdin.on("data", onData);
|
|
3278
|
+
process.stdin.resume();
|
|
3279
|
+
return {
|
|
3280
|
+
pressed,
|
|
3281
|
+
stop: () => {
|
|
3282
|
+
process.stdin.off("data", onData);
|
|
3283
|
+
process.stdin.pause();
|
|
3284
|
+
}
|
|
3285
|
+
};
|
|
3286
|
+
}
|
|
3287
|
+
async function signInForKeys(slots) {
|
|
3288
|
+
const host = signInHost();
|
|
3289
|
+
const key = keyPressed();
|
|
3290
|
+
try {
|
|
3291
|
+
const result = await signIn({
|
|
3292
|
+
host,
|
|
3293
|
+
withSecret: slots.includes("sk"),
|
|
3294
|
+
skip: key.pressed,
|
|
3295
|
+
onLink: (url) => log.step(
|
|
3296
|
+
`Approve in your browser. If it didn't open:
|
|
3297
|
+
${import_picocolors2.default.cyan(url)}
|
|
3298
|
+
${import_picocolors2.default.dim("Waiting\u2026 press Enter to skip and add the keys later.")}`
|
|
3299
|
+
)
|
|
3300
|
+
});
|
|
3301
|
+
if (!result.ok) {
|
|
3302
|
+
log.warn(`${result.message} Carrying on without keys.`);
|
|
3303
|
+
return { keys: {}, signedIn: false };
|
|
3304
|
+
}
|
|
3305
|
+
const keys = {};
|
|
3306
|
+
for (const slot of slots) {
|
|
3307
|
+
const value = result.keys[slot];
|
|
3308
|
+
if (value) keys[slot] = value;
|
|
3309
|
+
}
|
|
3310
|
+
log.success(`Signed in. Using ${result.siteName}'s keys.`);
|
|
3311
|
+
return { keys, signedIn: true };
|
|
3312
|
+
} finally {
|
|
3313
|
+
key.stop();
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
async function promptForKeys(slots, envFile) {
|
|
3317
|
+
const choice = await select({
|
|
3318
|
+
message: "Your BusinessDash keys:",
|
|
3319
|
+
initialValue: "skip",
|
|
3320
|
+
options: [
|
|
3321
|
+
{
|
|
3322
|
+
value: "skip",
|
|
3323
|
+
label: "Skip for now",
|
|
3324
|
+
hint: envFile ? `fill in ${envFile} later` : "add them later"
|
|
3325
|
+
},
|
|
3326
|
+
{
|
|
3327
|
+
value: "sign-in",
|
|
3328
|
+
label: "Sign in to BusinessDash",
|
|
3329
|
+
hint: "approve in your browser; they're filled in for you"
|
|
3330
|
+
},
|
|
3331
|
+
{ value: "paste", label: "Paste them" }
|
|
3332
|
+
]
|
|
3333
|
+
});
|
|
3334
|
+
if (isCancel(choice)) cancelled();
|
|
3335
|
+
if (choice === "skip") return { keys: {}, signedIn: false };
|
|
3336
|
+
if (choice === "sign-in") return signInForKeys(slots);
|
|
3337
|
+
log.info(
|
|
3338
|
+
`They're in your dashboard under Settings > Web Content SDK:
|
|
3339
|
+
${import_picocolors2.default.cyan(KEYS_URL)}`
|
|
3340
|
+
);
|
|
3341
|
+
const keys = {};
|
|
3342
|
+
for (const slot of slots) {
|
|
3343
|
+
const validate = (value2) => value2?.trim() ? keyProblem(slot, value2) : void 0;
|
|
3344
|
+
const value = slot === "sk" ? await password({
|
|
3345
|
+
message: `${SLOT_LABEL[slot]} (Enter to skip):`,
|
|
3346
|
+
validate
|
|
3347
|
+
}) : await text({
|
|
3348
|
+
message: `${SLOT_LABEL[slot]}:`,
|
|
3349
|
+
placeholder: "Enter to skip",
|
|
3350
|
+
validate
|
|
3351
|
+
});
|
|
3352
|
+
if (isCancel(value)) cancelled();
|
|
3353
|
+
if (value?.trim()) keys[slot] = value.trim();
|
|
3354
|
+
}
|
|
3355
|
+
return { keys, signedIn: false };
|
|
3356
|
+
}
|
|
3357
|
+
function unusedKeyWarning(slot, templates) {
|
|
3358
|
+
const flag = `--${KEY_FLAGS[slot]}`;
|
|
3359
|
+
if (slot === "sk" && templates.every((t2) => frameworkOf(t2).shape === "mobile")) {
|
|
3360
|
+
return `${flag} was not written anywhere: mobile starters ship inside an app binary, so they only take a publishable token.`;
|
|
3361
|
+
}
|
|
3362
|
+
const which = templates.length === 1 ? `the ${templates[0]?.display} starter has` : "none of these starters has";
|
|
3363
|
+
return `${flag} was not written anywhere: ${which} a place for a ${SLOT_LABEL[slot].toLowerCase()}.`;
|
|
3364
|
+
}
|
|
3365
|
+
function envNotes(env) {
|
|
3366
|
+
const notes = [];
|
|
3367
|
+
if (!env.written) {
|
|
3368
|
+
notes.push(`${env.file} already existed, so it was left as it was.`);
|
|
3369
|
+
} else {
|
|
3370
|
+
const missing = env.slots.filter((slot) => !env.placed.includes(slot));
|
|
3371
|
+
if (missing.length > 0) {
|
|
3372
|
+
const names = missing.map((slot) => SLOT_LABEL[slot].toLowerCase());
|
|
3373
|
+
notes.push(
|
|
3374
|
+
`Add your ${names.join(", ")} to ${env.file}. They're at ${import_picocolors2.default.cyan(KEYS_URL)}`
|
|
3375
|
+
);
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
if (env.addedToGitignore) {
|
|
3379
|
+
notes.push(`Added ${env.file} to .gitignore so your keys stay out of git.`);
|
|
3380
|
+
}
|
|
3381
|
+
return notes;
|
|
3382
|
+
}
|
|
3383
|
+
async function chooseAppleTeam(templates, interactive) {
|
|
3384
|
+
const signing = templates.filter((t2) => t2.appleTeam);
|
|
3385
|
+
const flag = argv["apple-team"]?.trim();
|
|
3386
|
+
if (flag) {
|
|
3387
|
+
if (signing.length > 0) return flag;
|
|
3388
|
+
log.warn(
|
|
3389
|
+
"--apple-team was not written anywhere: only the Swift and React Native starters take one (Flutter finds your team itself)."
|
|
3390
|
+
);
|
|
3391
|
+
return void 0;
|
|
3392
|
+
}
|
|
3393
|
+
if (signing.length === 0 || !interactive || process.platform !== "darwin")
|
|
3394
|
+
return void 0;
|
|
3395
|
+
const teams = detectAppleTeams();
|
|
3396
|
+
const [only] = teams;
|
|
3397
|
+
if (!only) return void 0;
|
|
3398
|
+
if (teams.length === 1) {
|
|
3399
|
+
const yes = await confirm({
|
|
3400
|
+
message: `Sign the iPhone app with ${only.name} (${only.id})?`,
|
|
3401
|
+
initialValue: true
|
|
3402
|
+
});
|
|
3403
|
+
if (isCancel(yes)) cancelled();
|
|
3404
|
+
return yes ? only.id : void 0;
|
|
3405
|
+
}
|
|
3406
|
+
const choice = await select({
|
|
3407
|
+
message: "Which Apple team should sign the iPhone app?",
|
|
3408
|
+
options: [
|
|
3409
|
+
...teams.map((team) => ({
|
|
3410
|
+
value: team.id,
|
|
3411
|
+
label: team.name,
|
|
3412
|
+
hint: team.id
|
|
3413
|
+
})),
|
|
3414
|
+
{ value: "", label: "None for now", hint: "pick one in Xcode later" }
|
|
3415
|
+
]
|
|
3416
|
+
});
|
|
3417
|
+
if (isCancel(choice)) cancelled();
|
|
3418
|
+
return choice || void 0;
|
|
3419
|
+
}
|
|
3420
|
+
function quote(path) {
|
|
3421
|
+
return /\s/.test(path) ? `"${path}"` : path;
|
|
3422
|
+
}
|
|
3423
|
+
function appSteps(template, dir, from, pm, keys) {
|
|
3424
|
+
const steps = [];
|
|
3425
|
+
const path = relative(from, dir);
|
|
3426
|
+
if (path) steps.push(`cd ${quote(path)}`);
|
|
3427
|
+
if (template.dev) {
|
|
3428
|
+
const workspace = pm === "pnpm" ? enclosingPnpmWorkspace(dir) : void 0;
|
|
3429
|
+
steps.push(
|
|
3430
|
+
installCommand(pm, { ignoreWorkspace: workspace !== void 0 }).join(
|
|
3431
|
+
" "
|
|
3432
|
+
),
|
|
3433
|
+
runCommand(pm, template.dev).join(" ")
|
|
3434
|
+
);
|
|
3435
|
+
} else if (template.steps) {
|
|
3436
|
+
steps.push(...template.steps({ keys }));
|
|
3437
|
+
}
|
|
3438
|
+
return steps;
|
|
3439
|
+
}
|
|
3440
|
+
async function main() {
|
|
3441
|
+
if (argv.help) {
|
|
3442
|
+
console.log(helpText());
|
|
3443
|
+
return;
|
|
3444
|
+
}
|
|
3445
|
+
if (argv.version) {
|
|
3446
|
+
console.log("0.1.0");
|
|
3447
|
+
return;
|
|
3448
|
+
}
|
|
3449
|
+
const interactive = argv.interactive ?? Boolean(process.stdin.isTTY);
|
|
3450
|
+
let pm = detectPackageManager(
|
|
3451
|
+
process.env.npm_config_user_agent
|
|
3452
|
+
);
|
|
3453
|
+
if (argv.pm !== void 0) {
|
|
3454
|
+
if (!isPackageManager(argv.pm))
|
|
3455
|
+
fail("--pm takes one of: npm, pnpm, yarn, bun.");
|
|
3456
|
+
pm = argv.pm;
|
|
3457
|
+
}
|
|
3458
|
+
const flagKeys = keysFromFlags();
|
|
3459
|
+
if (argv["sign-in"]) {
|
|
3460
|
+
if (Object.keys(flagKeys).length > 0) {
|
|
3461
|
+
fail(
|
|
3462
|
+
"--sign-in gets the keys for you; drop --site-id, --pk and --sk, or drop --sign-in."
|
|
3463
|
+
);
|
|
3464
|
+
}
|
|
3465
|
+
signInHost();
|
|
3466
|
+
}
|
|
3467
|
+
const paymentsFlag = paymentsFromFlag();
|
|
3468
|
+
const teamFlag = argv["apple-team"];
|
|
3469
|
+
if (teamFlag !== void 0 && !TEAM_ID.test(teamFlag.trim())) {
|
|
3470
|
+
fail(
|
|
3471
|
+
"--apple-team: an Apple team ID is 10 capital letters and digits (Xcode > Settings > Accounts, or developer.apple.com > Membership)."
|
|
3472
|
+
);
|
|
3473
|
+
}
|
|
3474
|
+
if (interactive) {
|
|
3475
|
+
await showLogo(process.stdout);
|
|
3476
|
+
intro(import_picocolors2.default.inverse(" create-businessdash "));
|
|
3477
|
+
}
|
|
3478
|
+
const positional = argv._[0];
|
|
3479
|
+
let targetDir = positional === void 0 ? "" : formatTargetDir(String(positional));
|
|
3480
|
+
if (!targetDir) {
|
|
3481
|
+
if (interactive) {
|
|
3482
|
+
const name = await text({
|
|
3483
|
+
message: "Project name:",
|
|
3484
|
+
placeholder: DEFAULT_PROJECT_NAME,
|
|
3485
|
+
defaultValue: DEFAULT_PROJECT_NAME,
|
|
3486
|
+
validate: (value) => value && !formatTargetDir(value) ? "That isn't a usable folder name." : void 0
|
|
3487
|
+
});
|
|
3488
|
+
if (isCancel(name)) cancelled();
|
|
3489
|
+
targetDir = formatTargetDir(name);
|
|
3490
|
+
} else {
|
|
3491
|
+
targetDir = DEFAULT_PROJECT_NAME;
|
|
3492
|
+
}
|
|
3493
|
+
}
|
|
3494
|
+
const root = resolve(targetDir);
|
|
3495
|
+
if (existsSync3(root) && !statSync2(root).isDirectory()) {
|
|
3496
|
+
fail(`"${targetDir}" is a file, not a folder.`);
|
|
3497
|
+
}
|
|
3498
|
+
if (!isEmptyDir(root)) {
|
|
3499
|
+
let action;
|
|
3500
|
+
if (argv.overwrite) {
|
|
3501
|
+
action = "remove";
|
|
3502
|
+
} else if (interactive) {
|
|
3503
|
+
const where = targetDir === "." ? "The current directory" : `Target directory "${targetDir}"`;
|
|
3504
|
+
const choice = await select({
|
|
3505
|
+
message: `${where} is not empty. Please choose how to proceed:`,
|
|
3506
|
+
options: [
|
|
3507
|
+
{ value: "cancel", label: "Cancel operation" },
|
|
3508
|
+
{ value: "remove", label: "Remove existing files and continue" },
|
|
3509
|
+
{ value: "keep", label: "Ignore files and continue" }
|
|
3510
|
+
]
|
|
3511
|
+
});
|
|
3512
|
+
if (isCancel(choice) || choice === "cancel") cancelled();
|
|
3513
|
+
action = choice;
|
|
3514
|
+
} else {
|
|
3515
|
+
fail(
|
|
3516
|
+
`"${targetDir}" is not empty. Pass --overwrite to replace what's there, or pick an empty folder.`
|
|
3517
|
+
);
|
|
3518
|
+
}
|
|
3519
|
+
if (action === "remove") emptyDir(root);
|
|
3520
|
+
}
|
|
3521
|
+
let packageName = basename(root);
|
|
3522
|
+
if (!isValidPackageName(packageName)) {
|
|
3523
|
+
const suggestion = toValidPackageName(packageName) || DEFAULT_PROJECT_NAME;
|
|
3524
|
+
if (interactive) {
|
|
3525
|
+
const name = await text({
|
|
3526
|
+
message: "Package name:",
|
|
3527
|
+
placeholder: suggestion,
|
|
3528
|
+
defaultValue: suggestion,
|
|
3529
|
+
validate: (value) => !value || isValidPackageName(value) ? void 0 : "Invalid package.json name"
|
|
3530
|
+
});
|
|
3531
|
+
if (isCancel(name)) cancelled();
|
|
3532
|
+
packageName = name;
|
|
3533
|
+
} else {
|
|
3534
|
+
packageName = suggestion;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
const templates = await chooseTemplates(interactive);
|
|
3538
|
+
const apps = planApps(templates);
|
|
3539
|
+
const multi = apps.length > 1;
|
|
3540
|
+
const payments = await choosePayments(paymentsFlag, interactive);
|
|
3541
|
+
const stores = new Set(templates.flatMap((t2) => t2.stores ?? []));
|
|
3542
|
+
const storeRules = appStoreNotice(payments, stores);
|
|
3543
|
+
if (storeRules.length > 0) {
|
|
3544
|
+
note(storeRules.join("\n\n"), appStoreTitle(stores));
|
|
3545
|
+
}
|
|
3546
|
+
const slots = SLOT_ORDER.filter(
|
|
3547
|
+
(slot) => templates.some((t2) => templateSlots(TEMPLATES_DIR, t2).includes(slot))
|
|
3548
|
+
);
|
|
3549
|
+
let keys = {};
|
|
3550
|
+
for (const slot of SLOT_ORDER) {
|
|
3551
|
+
const value = flagKeys[slot];
|
|
3552
|
+
if (!value) continue;
|
|
3553
|
+
if (slots.includes(slot)) keys[slot] = value;
|
|
3554
|
+
else log.warn(unusedKeyWarning(slot, templates));
|
|
3555
|
+
}
|
|
3556
|
+
let signedIn = false;
|
|
3557
|
+
if (slots.length > 0 && Object.keys(flagKeys).length === 0) {
|
|
3558
|
+
const choice = argv["sign-in"] ? await signInForKeys(slots) : interactive ? await promptForKeys(
|
|
3559
|
+
slots,
|
|
3560
|
+
multi ? void 0 : templates[0]?.env?.file
|
|
3561
|
+
) : void 0;
|
|
3562
|
+
if (choice) {
|
|
3563
|
+
keys = choice.keys;
|
|
3564
|
+
signedIn = choice.signedIn;
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
const appleTeam = await chooseAppleTeam(templates, interactive);
|
|
3568
|
+
const written = apps.map((app) => {
|
|
3569
|
+
const dir = app.folder ? join5(root, app.folder) : root;
|
|
3570
|
+
const name = app.folder ? toValidPackageName(`${packageName}-${app.folder}`) : packageName;
|
|
3571
|
+
const result = scaffold({
|
|
3572
|
+
templatesDir: TEMPLATES_DIR,
|
|
3573
|
+
template: app.template,
|
|
3574
|
+
targetDir: dir,
|
|
3575
|
+
packageName: name,
|
|
3576
|
+
pm,
|
|
3577
|
+
keys,
|
|
3578
|
+
appleTeam,
|
|
3579
|
+
payments: new Set(payments)
|
|
3580
|
+
});
|
|
3581
|
+
const framework = frameworkOf(app.template);
|
|
3582
|
+
const label = framework.variants.length > 1 ? `${framework.display} (${app.template.display})` : framework.display;
|
|
3583
|
+
log.success(`Scaffolded the ${framework.color(label)} starter in ${dir}`);
|
|
3584
|
+
return { ...app, dir, result };
|
|
3585
|
+
});
|
|
3586
|
+
if (multi) {
|
|
3587
|
+
const readme = join5(root, "README.md");
|
|
3588
|
+
if (!existsSync3(readme)) {
|
|
3589
|
+
const readmeApps = written.map((w) => ({
|
|
3590
|
+
...w,
|
|
3591
|
+
steps: appSteps(w.template, w.dir, root, pm, keys)
|
|
3592
|
+
}));
|
|
3593
|
+
writeFileSync3(readme, rootReadme(packageName, readmeApps, KEYS_URL));
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
const [single] = written;
|
|
3597
|
+
if (single && !multi && single.template.dev) {
|
|
3598
|
+
const { template, dir } = single;
|
|
3599
|
+
const dev = single.template.dev;
|
|
3600
|
+
let immediate = argv.immediate === true;
|
|
3601
|
+
if (!immediate && interactive) {
|
|
3602
|
+
const answer = await confirm({
|
|
3603
|
+
message: `Install with ${pm} and start now?`,
|
|
3604
|
+
initialValue: false
|
|
3605
|
+
});
|
|
3606
|
+
if (isCancel(answer)) cancelled();
|
|
3607
|
+
immediate = answer;
|
|
3608
|
+
}
|
|
3609
|
+
if (immediate) {
|
|
3610
|
+
const workspace = pm === "pnpm" ? enclosingPnpmWorkspace(dir) : void 0;
|
|
3611
|
+
const install = installCommand(pm, {
|
|
3612
|
+
ignoreWorkspace: workspace !== void 0
|
|
3613
|
+
});
|
|
3614
|
+
log.step(`Installing dependencies with ${pm}\u2026`);
|
|
3615
|
+
if (!run(install, dir)) fail(`${install.join(" ")} failed in ${dir}.`);
|
|
3616
|
+
if (template.needsBun && !hasCommand("bun")) {
|
|
3617
|
+
log.warn(
|
|
3618
|
+
"The dev server runs on Bun, which isn't installed. Get it at https://bun.sh, then start it from the project folder."
|
|
3619
|
+
);
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3622
|
+
log.step("Starting the dev server\u2026");
|
|
3623
|
+
run(runCommand(pm, dev), dir);
|
|
3624
|
+
return;
|
|
3625
|
+
}
|
|
3626
|
+
} else if (argv.immediate) {
|
|
3627
|
+
log.warn(
|
|
3628
|
+
multi ? "--immediate starts one app. With several, each one's steps are below." : "--immediate only runs JavaScript starters. This one uses its own toolchain; the steps are below."
|
|
3629
|
+
);
|
|
3630
|
+
}
|
|
3631
|
+
const cwd = process.cwd();
|
|
3632
|
+
const bunMissing = written.some((w) => w.template.needsBun) && !hasCommand("bun");
|
|
3633
|
+
const sections = [];
|
|
3634
|
+
const notes = [];
|
|
3635
|
+
for (const w of written) {
|
|
3636
|
+
const steps = appSteps(w.template, w.dir, cwd, pm, keys);
|
|
3637
|
+
sections.push(
|
|
3638
|
+
multi ? [
|
|
3639
|
+
import_picocolors2.default.bold(`${w.folder}: ${w.template.display}`),
|
|
3640
|
+
...steps.map((s) => ` ${s}`)
|
|
3641
|
+
].join("\n") : steps.join("\n")
|
|
3642
|
+
);
|
|
3643
|
+
const prefix = multi ? `${w.folder}/: ` : "";
|
|
3644
|
+
const own = [
|
|
3645
|
+
...w.result.env ? envNotes(w.result.env) : [],
|
|
3646
|
+
...w.template.needsBun && bunMissing ? ["The dev server runs on Bun: install it from https://bun.sh first."] : [],
|
|
3647
|
+
...w.template.dev && pm === "pnpm" && enclosingPnpmWorkspace(w.dir) ? [
|
|
3648
|
+
`This folder sits inside the pnpm workspace at ${enclosingPnpmWorkspace(w.dir)}; --ignore-workspace keeps the install to this project.`
|
|
3649
|
+
] : [],
|
|
3650
|
+
...w.template.appleTeam && !w.result.appleTeamFile ? [
|
|
3651
|
+
"No Apple team set for the iPhone app. Pick one in Xcode (Signing & Capabilities), or pass --apple-team."
|
|
3652
|
+
] : [],
|
|
3653
|
+
...w.result.appleTeamFile ? [
|
|
3654
|
+
`Your Apple team is in ${w.result.appleTeamFile}; it stays on this machine.`
|
|
3655
|
+
] : [],
|
|
3656
|
+
...w.template.notes ?? []
|
|
3657
|
+
];
|
|
3658
|
+
notes.push(...own.map((note2) => `${prefix}${note2}`));
|
|
3659
|
+
}
|
|
3660
|
+
if (multi) notes.push(`README.md lists every app and how to start it.`);
|
|
3661
|
+
if (signedIn && keys.pk) {
|
|
3662
|
+
notes.push(
|
|
3663
|
+
`The publishable token works from localhost. Before you deploy, make one for your domain at ${import_picocolors2.default.cyan(KEYS_URL)}`
|
|
3664
|
+
);
|
|
3665
|
+
}
|
|
3666
|
+
note(sections.join("\n\n"), "Next steps");
|
|
3667
|
+
for (const note2 of notes) log.info(note2);
|
|
3668
|
+
outro(`Docs: ${import_picocolors2.default.cyan(DOCS_URL)}`);
|
|
3669
|
+
}
|
|
3670
|
+
main().catch((error) => {
|
|
3671
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
3672
|
+
});
|