mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 15:27:33 +00:00
rm prepare standalone entirely, update dockerfile to use pnpm
This commit is contained in:
@@ -1,28 +1,32 @@
|
||||
# Dockerfile for standalone ZITADEL Login UI
|
||||
FROM node:18-alpine AS base
|
||||
|
||||
# Install pnpm
|
||||
RUN npm install -g pnpm@9.1.2
|
||||
|
||||
# Install dependencies only when needed
|
||||
FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
# Prepare standalone and install dependencies
|
||||
COPY prepare-standalone.sh package*.json ./
|
||||
COPY *.standalone.* ./
|
||||
RUN ./prepare-standalone.sh
|
||||
# Install dependencies using pnpm
|
||||
COPY package*.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile --prod
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Prepare standalone configs
|
||||
RUN ./prepare-standalone.sh --no-install
|
||||
# Copy package files and install all dependencies (including dev dependencies)
|
||||
COPY package*.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build application
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
RUN npm run build:standalone
|
||||
RUN pnpm run build:login:standalone
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
FROM base AS runner
|
||||
|
@@ -1,65 +0,0 @@
|
||||
{
|
||||
"name": "@zitadel/login",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"test:unit": "vitest",
|
||||
"test:unit:watch": "vitest --watch",
|
||||
"lint": "next lint && prettier --check .",
|
||||
"lint:fix": "prettier --write .",
|
||||
"build": "next build",
|
||||
"build:standalone": "NEXT_PUBLIC_BASE_PATH=/ui/v2/login NEXT_OUTPUT_MODE=standalone next build",
|
||||
"start": "next start",
|
||||
"clean": "rm -rf node_modules && rm -rf .next"
|
||||
},
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^2.1.9",
|
||||
"@heroicons/react": "2.1.3",
|
||||
"@tailwindcss/forms": "0.5.7",
|
||||
"@vercel/analytics": "^1.2.2",
|
||||
"@zitadel/client": "latest",
|
||||
"@zitadel/proto": "latest",
|
||||
"clsx": "1.2.1",
|
||||
"copy-to-clipboard": "^3.3.3",
|
||||
"deepmerge": "^4.3.1",
|
||||
"lucide-react": "0.469.0",
|
||||
"moment": "^2.29.4",
|
||||
"next": "15.4.0-canary.86",
|
||||
"next-intl": "^3.25.1",
|
||||
"next-themes": "^0.2.1",
|
||||
"nice-grpc": "2.0.1",
|
||||
"qrcode.react": "^3.1.0",
|
||||
"react": "19.1.0",
|
||||
"react-dom": "19.1.0",
|
||||
"react-hook-form": "7.39.5",
|
||||
"tinycolor2": "1.4.2",
|
||||
"uuid": "^11.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.23.0",
|
||||
"@bufbuild/buf": "^1.53.0",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
"@types/node": "^22.14.1",
|
||||
"@types/react": "19.1.2",
|
||||
"@types/react-dom": "19.1.2",
|
||||
"@types/tinycolor2": "1.4.3",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"autoprefixer": "10.4.21",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-next": "15.4.0-canary.86",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"jsdom": "^26.1.0",
|
||||
"postcss": "8.5.3",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier-plugin-organize-imports": "^3.2.0",
|
||||
"prettier-plugin-tailwindcss": "0.6.11",
|
||||
"sass": "^1.87.0",
|
||||
"tailwindcss": "3.4.14",
|
||||
"typescript": "^5.8.3",
|
||||
"vitest": "^2.0.0"
|
||||
}
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to prepare standalone version of the login app
|
||||
set -e
|
||||
|
||||
echo "🔧 Preparing standalone version..."
|
||||
|
||||
# Parse arguments
|
||||
INSTALL_DEPS=true
|
||||
USE_LATEST=false
|
||||
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--no-install)
|
||||
INSTALL_DEPS=false
|
||||
shift
|
||||
;;
|
||||
--latest)
|
||||
USE_LATEST=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# Unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Build arguments for Node.js script
|
||||
NODE_ARGS=""
|
||||
if [ "$INSTALL_DEPS" = true ]; then
|
||||
NODE_ARGS="$NODE_ARGS --install"
|
||||
fi
|
||||
if [ "$USE_LATEST" = true ]; then
|
||||
NODE_ARGS="$NODE_ARGS --latest"
|
||||
fi
|
||||
|
||||
# Check if Node.js scripts exist
|
||||
if [ ! -f "scripts/prepare-standalone.js" ]; then
|
||||
echo "❌ scripts/prepare-standalone.js not found!"
|
||||
echo " Make sure you're in the correct directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run the enhanced Node.js prepare script
|
||||
node scripts/prepare-standalone.js $NODE_ARGS
|
||||
|
||||
echo ""
|
||||
echo "✅ Standalone version prepared successfully!"
|
||||
|
||||
if [ "$INSTALL_DEPS" = false ]; then
|
||||
echo ""
|
||||
echo "📝 Next steps:"
|
||||
echo " npm install - Install dependencies"
|
||||
echo " npm run dev - Start development server"
|
||||
echo " npm run build - Build for production"
|
||||
echo " npm run start - Start production server"
|
||||
fi
|
@@ -1,99 +0,0 @@
|
||||
# Standalone Build Scripts
|
||||
|
||||
This directory contains the simplified scripts needed for managing the ZITADEL Login UI standalone conversion.
|
||||
|
||||
## 📁 File Overview
|
||||
|
||||
### Required Files
|
||||
|
||||
- `package.json` - Main package file (monorepo mode with `workspace:*`)
|
||||
- `package.standalone.json` - Pre-configured standalone version (uses `latest`)
|
||||
- `scripts/prepare-standalone.js` - Conversion script
|
||||
|
||||
### Generated/Temporary Files
|
||||
|
||||
- `package.monorepo.backup.json` - Backup when switching to standalone mode
|
||||
|
||||
## 🛠️ Scripts Overview
|
||||
|
||||
### `prepare-standalone.js`
|
||||
|
||||
**The main script for converting monorepo to standalone mode.**
|
||||
|
||||
```bash
|
||||
node scripts/prepare-standalone.js [--install]
|
||||
```
|
||||
|
||||
- `--install` - Automatically install dependencies after preparation
|
||||
|
||||
**What it does:**
|
||||
|
||||
- Copies `package.standalone.json` → `package.json`
|
||||
- Confirms all configurations are unified and ready for standalone use
|
||||
- Optionally runs `pnpm install`
|
||||
|
||||
## 🚀 **Simplified Approach**
|
||||
|
||||
This setup now uses a **much simpler approach**:
|
||||
|
||||
1. **Unified Configuration**: All ESLint, Prettier, and Tailwind configs work for both monorepo and standalone modes
|
||||
2. **Static Configuration**: `package.standalone.json` is pre-configured with `latest` versions
|
||||
3. **No Duplicate Configs**: No separate `*.standalone.*` config files needed
|
||||
4. **Faster Setup**: Conversion is instant with just file copying
|
||||
|
||||
## 📋 **Usage for Customers**
|
||||
|
||||
```bash
|
||||
# 1. Clone the repository
|
||||
git clone <standalone-repo>
|
||||
|
||||
# 2. Prepare standalone mode
|
||||
node scripts/prepare-standalone.js --install
|
||||
|
||||
# 3. Start developing
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
## 🔧 **Usage for Maintainers**
|
||||
|
||||
```bash
|
||||
# Update to latest packages manually in package.standalone.json
|
||||
npm view @zitadel/client version
|
||||
npm view @zitadel/proto version
|
||||
|
||||
# Then update package.standalone.json with latest versions
|
||||
```
|
||||
|
||||
## ✨ **Key Benefits**
|
||||
|
||||
- **Single Config Files**: ESLint, Prettier, and Tailwind configs work for both modes
|
||||
- **No Duplication**: No need for separate `*.standalone.*` configuration files
|
||||
- **Faster Conversion**: Only 2 files need to be copied (package.json and tsconfig.json)
|
||||
- **Simpler Maintenance**: All configuration logic is in one place
|
||||
|
||||
# Switch back to monorepo mode
|
||||
|
||||
node scripts/config-manager.js switch monorepo
|
||||
|
||||
````
|
||||
|
||||
### `validate-standalone.js`
|
||||
|
||||
**Validates that standalone setup is working correctly.**
|
||||
|
||||
```bash
|
||||
node scripts/validate-standalone.js
|
||||
````
|
||||
|
||||
**Checks:**
|
||||
|
||||
- Required files exist
|
||||
- Package.json has required scripts and dependencies
|
||||
- Dependencies can be resolved
|
||||
- TypeScript compilation works
|
||||
|
||||
## Workflow Examples
|
||||
|
||||
### For Developers (Monorepo)
|
||||
|
||||
1. **Working in monorepo:**
|
@@ -1,93 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Prepare script for standalone version
|
||||
* This script converts the monorepo version to a standalone version
|
||||
*/
|
||||
|
||||
import { execSync } from "child_process";
|
||||
import fs from "fs/promises";
|
||||
|
||||
const FILES_TO_REMOVE = [
|
||||
// Turbo is not needed for standalone builds since there are no workspace dependencies
|
||||
{ file: "turbo.json", backup: "turbo.monorepo.backup.json" },
|
||||
];
|
||||
|
||||
async function prepareStandalone() {
|
||||
console.log("🔧 Preparing standalone version...\n");
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const shouldInstall = args.includes("--install");
|
||||
|
||||
try {
|
||||
// Step 1: Copy package.standalone.json to package.json
|
||||
console.log("📦 Setting up package.json...");
|
||||
const packageStandaloneExists = await fs
|
||||
.access("package.standalone.json")
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
|
||||
if (packageStandaloneExists) {
|
||||
// Backup current package.json
|
||||
await fs.copyFile("package.json", "package.monorepo.backup.json");
|
||||
console.log(
|
||||
" 💾 Backed up package.json → package.monorepo.backup.json",
|
||||
);
|
||||
|
||||
// Copy standalone version
|
||||
await fs.copyFile("package.standalone.json", "package.json");
|
||||
console.log(" ✅ package.standalone.json → package.json");
|
||||
} else {
|
||||
throw new Error("package.standalone.json not found!");
|
||||
}
|
||||
|
||||
// Step 2: Remove unnecessary files for standalone
|
||||
console.log("🗑️ Removing monorepo-specific files...");
|
||||
for (const item of FILES_TO_REMOVE) {
|
||||
const fileExists = await fs
|
||||
.access(item.file)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
|
||||
if (fileExists) {
|
||||
// Backup current file
|
||||
await fs.copyFile(item.file, item.backup);
|
||||
console.log(` 💾 Backed up ${item.file} → ${item.backup}`);
|
||||
|
||||
// Remove the file
|
||||
await fs.unlink(item.file);
|
||||
console.log(` 🗑️ Removed ${item.file} (not needed in standalone)`);
|
||||
} else {
|
||||
console.log(` ℹ️ ${item.file} not found, skipping`);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3: Install dependencies if requested
|
||||
if (shouldInstall) {
|
||||
console.log("\n📥 Installing dependencies...");
|
||||
try {
|
||||
execSync("pnpm install", { stdio: "inherit" });
|
||||
console.log(" ✅ Dependencies installed successfully");
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
" ⚠️ pnpm install failed, you may need to run it manually",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("\n🎉 Standalone preparation complete!");
|
||||
console.log(" ✨ Turbo removed - using standard npm scripts");
|
||||
console.log("\n📋 Next steps:");
|
||||
if (!shouldInstall) {
|
||||
console.log(" 1. Run: pnpm install");
|
||||
}
|
||||
console.log(" 2. Run: pnpm run dev");
|
||||
console.log(" 3. Start developing!\n");
|
||||
} catch (error) {
|
||||
console.error("\n❌ Failed to prepare standalone version:", error.message);
|
||||
console.error("Please check the error above and try again.\n");
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
prepareStandalone();
|
Reference in New Issue
Block a user