diff --git a/gdf.js b/gdf.js index e02405e..4f6eb87 100755 --- a/gdf.js +++ b/gdf.js @@ -141,7 +141,7 @@ export class GDF { } get vite() { - return !!(this.#pj.scripts?.dev === 'vite') + return !!(this.#pj.scripts?.dev === 'vite') && !this.tanstackStart } // Does this application use remix.run? @@ -238,6 +238,17 @@ export class GDF { return !!this.#pj.dependencies?.nuxt } + // Does this application use TanStack Start? + get tanstackStart() { + return !!(this.#pj.dependencies?.['@tanstack/react-start'] || + this.#pj.dependencies?.['@tanstack/solid-start']) + } + + // Does this application build with the nitro vite plugin? + get nitro() { + return !!(this.#pj.dependencies?.nitro || this.#pj.devDependencies?.nitro) + } + // Does this application use gatsby? get gatsby() { return !!this.#pj.dependencies?.gatsby @@ -802,6 +813,7 @@ export class GDF { if (this.meteor) runtime = 'Meteor' if (this.nextjs) runtime = 'Next.js' if (this.nuxtjs) runtime = 'Nuxt' + if (this.tanstackStart) runtime = 'TanStack' if (this.nestjs) runtime = 'NestJS' if (this.gatsby) runtime = 'Gatsby' if (this.svelte) runtime = 'SvelteKit' @@ -846,6 +858,11 @@ export class GDF { return ['node', '/app/build/server.js'] } else if (this.nuxtjs) { return ['node', '.output/server/index.mjs'] + } else if (this.tanstackStart && this.nitro) { + return [this.bun ? 'bun' : 'node', '.output/server/index.mjs'] + } else if (this.tanstackStart) { + // srvx is a dependency of TanStack Start itself + return [this.npx, 'srvx', '--prod', '-s', '../client', 'dist/server/server.js'] } else if (this.meteor) { return ['node', 'main.js'] } else if (this.gatsby) { diff --git a/test/frameworks/tanstack-start-nitro/.dockerignore b/test/frameworks/tanstack-start-nitro/.dockerignore new file mode 100644 index 0000000..74340d4 --- /dev/null +++ b/test/frameworks/tanstack-start-nitro/.dockerignore @@ -0,0 +1,6 @@ +/.git +/node_modules +.dockerignore +.env +Dockerfile +fly.toml diff --git a/test/frameworks/tanstack-start-nitro/Dockerfile b/test/frameworks/tanstack-start-nitro/Dockerfile new file mode 100644 index 0000000..75f0c32 --- /dev/null +++ b/test/frameworks/tanstack-start-nitro/Dockerfile @@ -0,0 +1,45 @@ +# syntax = docker/dockerfile:1 + +# Adjust NODE_VERSION as desired +ARG NODE_VERSION=xxx +FROM node:${NODE_VERSION}-slim AS base + +LABEL fly_launch_runtime="TanStack" + +# TanStack app lives here +WORKDIR /app + +# Set production environment +ENV NODE_ENV="production" + + +# Throw-away build stage to reduce size of final image +FROM base AS build + +# Install packages needed to build node modules +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3 + +# Install node modules +COPY package-lock.json package.json ./ +RUN npm ci --include=dev + +# Copy application code +COPY . . + +# Build application +RUN npm run build + +# Remove development dependencies +RUN npm prune --omit=dev + + +# Final stage for app image +FROM base + +# Copy built application +COPY --from=build /app /app + +# Start the server by default, this can be overwritten at runtime +EXPOSE 3000 +CMD [ "node", ".output/server/index.mjs" ] diff --git a/test/frameworks/tanstack-start-nitro/package-lock.json b/test/frameworks/tanstack-start-nitro/package-lock.json new file mode 100644 index 0000000..5bf52e0 --- /dev/null +++ b/test/frameworks/tanstack-start-nitro/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "tanstack-start-nitro", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/test/frameworks/tanstack-start-nitro/package.json b/test/frameworks/tanstack-start-nitro/package.json new file mode 100644 index 0000000..f6ed3af --- /dev/null +++ b/test/frameworks/tanstack-start-nitro/package.json @@ -0,0 +1,22 @@ +{ + "name": "tanstack-start-nitro", + "private": true, + "type": "module", + "scripts": { + "dev": "vite dev --port 3000", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "@tanstack/react-router": "1.170.45", + "@tanstack/react-start": "1.169.3", + "react": "^19.2.0", + "react-dom": "^19.2.0" + }, + "devDependencies": { + "@vitejs/plugin-react": "^6.0.1", + "nitro": "^3.0.0", + "typescript": "^6.0.2", + "vite": "^8.0.0" + } +} diff --git a/test/frameworks/tanstack-start/.dockerignore b/test/frameworks/tanstack-start/.dockerignore new file mode 100644 index 0000000..74340d4 --- /dev/null +++ b/test/frameworks/tanstack-start/.dockerignore @@ -0,0 +1,6 @@ +/.git +/node_modules +.dockerignore +.env +Dockerfile +fly.toml diff --git a/test/frameworks/tanstack-start/Dockerfile b/test/frameworks/tanstack-start/Dockerfile new file mode 100644 index 0000000..9697c88 --- /dev/null +++ b/test/frameworks/tanstack-start/Dockerfile @@ -0,0 +1,45 @@ +# syntax = docker/dockerfile:1 + +# Adjust NODE_VERSION as desired +ARG NODE_VERSION=xxx +FROM node:${NODE_VERSION}-slim AS base + +LABEL fly_launch_runtime="TanStack" + +# TanStack app lives here +WORKDIR /app + +# Set production environment +ENV NODE_ENV="production" + + +# Throw-away build stage to reduce size of final image +FROM base AS build + +# Install packages needed to build node modules +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3 + +# Install node modules +COPY package-lock.json package.json ./ +RUN npm ci --include=dev + +# Copy application code +COPY . . + +# Build application +RUN npm run build + +# Remove development dependencies +RUN npm prune --omit=dev + + +# Final stage for app image +FROM base + +# Copy built application +COPY --from=build /app /app + +# Start the server by default, this can be overwritten at runtime +EXPOSE 3000 +CMD [ "npx", "srvx", "--prod", "-s", "../client", "dist/server/server.js" ] diff --git a/test/frameworks/tanstack-start/package-lock.json b/test/frameworks/tanstack-start/package-lock.json new file mode 100644 index 0000000..247563a --- /dev/null +++ b/test/frameworks/tanstack-start/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "tanstack-start", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/test/frameworks/tanstack-start/package.json b/test/frameworks/tanstack-start/package.json new file mode 100644 index 0000000..35f95e7 --- /dev/null +++ b/test/frameworks/tanstack-start/package.json @@ -0,0 +1,21 @@ +{ + "name": "tanstack-start", + "private": true, + "type": "module", + "scripts": { + "dev": "vite dev --port 3000", + "build": "vite build", + "start": "node .output/server/index.mjs", + "preview": "vite preview" + }, + "dependencies": { + "@tanstack/solid-router": "1.169.3", + "@tanstack/solid-start": "1.169.3", + "solid-js": "^1.9.9" + }, + "devDependencies": { + "typescript": "^6.0.2", + "vite": "^8.0.0", + "vite-plugin-solid": "^2.11.10" + } +}