mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add workers support for tanstack start (#369)
This commit is contained in:
@@ -3,15 +3,6 @@ import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
import type { Backend, Frontend, Runtime, WebDeploy } from "../types";
|
||||
|
||||
const WORKERS_COMPATIBLE_FRONTENDS: Frontend[] = [
|
||||
"tanstack-router",
|
||||
"react-router",
|
||||
"solid",
|
||||
"next",
|
||||
"nuxt",
|
||||
"svelte",
|
||||
];
|
||||
|
||||
type DeploymentOption = {
|
||||
value: WebDeploy;
|
||||
label: string;
|
||||
@@ -38,18 +29,10 @@ export async function getDeploymentChoice(
|
||||
deployment?: WebDeploy,
|
||||
_runtime?: Runtime,
|
||||
_backend?: Backend,
|
||||
frontend: Frontend[] = [],
|
||||
_frontend: Frontend[] = [],
|
||||
): Promise<WebDeploy> {
|
||||
if (deployment !== undefined) return deployment;
|
||||
|
||||
const hasCompatibleFrontend = frontend.some((f) =>
|
||||
WORKERS_COMPATIBLE_FRONTENDS.includes(f),
|
||||
);
|
||||
|
||||
if (!hasCompatibleFrontend) {
|
||||
return "none";
|
||||
}
|
||||
|
||||
const options: DeploymentOption[] = [
|
||||
{
|
||||
value: "workers",
|
||||
@@ -74,15 +57,12 @@ export async function getDeploymentChoice(
|
||||
}
|
||||
|
||||
export async function getDeploymentToAdd(
|
||||
frontend: Frontend[],
|
||||
_frontend: Frontend[],
|
||||
existingDeployment?: WebDeploy,
|
||||
): Promise<WebDeploy> {
|
||||
const options: DeploymentOption[] = [];
|
||||
|
||||
if (
|
||||
frontend.some((f) => WORKERS_COMPATIBLE_FRONTENDS.includes(f)) &&
|
||||
existingDeployment !== "workers"
|
||||
) {
|
||||
if (existingDeployment !== "workers") {
|
||||
const { label, hint } = getDeploymentDisplay("workers");
|
||||
options.push({
|
||||
value: "workers",
|
||||
|
||||
Reference in New Issue
Block a user