create-lego-one 2.0.15 → 2.0.17

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/dist/index.cjs CHANGED
@@ -384,7 +384,7 @@ async function updateProject(projectDir, options) {
384
384
  }
385
385
  } else if (item.strategy === "merge-gitignore") {
386
386
  if (targetExists) {
387
- await mergeGitignoreFile(sourcePath, targetPath, updates, options.dryRun);
387
+ await mergeGitignoreFile(sourcePath, targetPath, updates, options.dryRun, item.target);
388
388
  } else {
389
389
  updates.push({ file: item.target, action: "created" });
390
390
  if (!options.dryRun) {
@@ -449,7 +449,20 @@ async function mergeDirectory(sourceDir, targetDir, updates, dryRun = false) {
449
449
  await mergeDirectory(sourcePath, targetPath, updates, dryRun);
450
450
  } else {
451
451
  const targetExists = await import_fs_extra.default.pathExists(targetPath);
452
- if (!targetExists) {
452
+ if (entry.name === ".gitignore" && targetExists) {
453
+ const relativePath = import_path.default.relative(targetDir, targetPath).replace(/\\/g, "/");
454
+ await mergeGitignoreFile(sourcePath, targetPath, updates, dryRun, relativePath);
455
+ } else if (targetExists) {
456
+ const sourceContent = await import_fs_extra.default.readFile(sourcePath, "utf-8");
457
+ const targetContent = await import_fs_extra.default.readFile(targetPath, "utf-8");
458
+ if (sourceContent !== targetContent) {
459
+ const relativePath = import_path.default.relative(targetDir, targetPath).replace(/\\/g, "/");
460
+ updates.push({ file: relativePath, action: "updated" });
461
+ if (!dryRun) {
462
+ await import_fs_extra.default.copy(sourcePath, targetPath, { overwrite: true });
463
+ }
464
+ }
465
+ } else {
453
466
  const relativePath = import_path.default.relative(targetDir, targetPath);
454
467
  updates.push({ file: relativePath, action: "created" });
455
468
  if (!dryRun) {
@@ -472,11 +485,27 @@ async function mergeHostDirectory(sourceDir, targetDir, updates, dryRun = false,
472
485
  if (relativeToHostRoot === "modern.config.ts" || relativeToHostRoot === "src/saas.config.ts") {
473
486
  continue;
474
487
  }
488
+ if (relativeToHostRoot.startsWith("src/routes/")) {
489
+ continue;
490
+ }
475
491
  if (entry.isDirectory()) {
476
492
  await mergeHostDirectory(sourcePath, targetPath, updates, dryRun, hostRootDir);
477
493
  } else {
478
494
  const targetExists = await import_fs_extra.default.pathExists(targetPath);
479
- if (!targetExists) {
495
+ if (entry.name === ".gitignore" && targetExists) {
496
+ const relativePath = import_path.default.relative(targetDir, targetPath).replace(/\\/g, "/");
497
+ await mergeGitignoreFile(sourcePath, targetPath, updates, dryRun, relativePath);
498
+ } else if (targetExists) {
499
+ const relativeTargetPath = import_path.default.relative(targetDir, targetPath).replace(/\\/g, "/");
500
+ const sourceContent = await import_fs_extra.default.readFile(sourcePath, "utf-8");
501
+ const targetContent = await import_fs_extra.default.readFile(targetPath, "utf-8");
502
+ if (sourceContent !== targetContent) {
503
+ updates.push({ file: relativeTargetPath, action: "updated" });
504
+ if (!dryRun) {
505
+ await import_fs_extra.default.copy(sourcePath, targetPath, { overwrite: true });
506
+ }
507
+ }
508
+ } else {
480
509
  const relativeTargetPath = import_path.default.relative(targetDir, targetPath).replace(/\\/g, "/");
481
510
  updates.push({ file: relativeTargetPath, action: "created" });
482
511
  if (!dryRun) {
@@ -505,7 +534,10 @@ async function mergePocketBaseDirectory(sourceDir, targetDir, updates, dryRun =
505
534
  await mergePocketBaseDirectory(sourcePath, targetPath, updates, dryRun);
506
535
  } else {
507
536
  const targetExists = await import_fs_extra.default.pathExists(targetPath);
508
- if (!targetExists) {
537
+ if (entry.name === ".gitignore" && targetExists) {
538
+ const relativePath = import_path.default.relative(targetDir, targetPath).replace(/\\/g, "/");
539
+ await mergeGitignoreFile(sourcePath, targetPath, updates, dryRun, relativePath);
540
+ } else if (!targetExists) {
509
541
  const relativePath = import_path.default.relative(targetDir, targetPath);
510
542
  updates.push({ file: relativePath, action: "created" });
511
543
  if (!dryRun) {
@@ -518,6 +550,22 @@ async function mergePocketBaseDirectory(sourceDir, targetDir, updates, dryRun =
518
550
  async function mergeJsonFile(sourcePath, targetPath, updates, dryRun = false) {
519
551
  const sourceJson = JSON.parse(await import_fs_extra.default.readFile(sourcePath, "utf-8"));
520
552
  const targetJson = JSON.parse(await import_fs_extra.default.readFile(targetPath, "utf-8"));
553
+ const frameworkScripts = [
554
+ "dev",
555
+ "dev:host",
556
+ "dev:plugins",
557
+ "dev:all",
558
+ "build",
559
+ "lint",
560
+ "lint:fix",
561
+ "format",
562
+ "format:check",
563
+ "typecheck",
564
+ "test",
565
+ "test:e2e",
566
+ "clean",
567
+ "create-plugin"
568
+ ];
521
569
  const merged = { ...targetJson };
522
570
  if (sourceJson.dependencies) {
523
571
  merged.dependencies = { ...targetJson.dependencies, ...sourceJson.dependencies };
@@ -526,7 +574,23 @@ async function mergeJsonFile(sourcePath, targetPath, updates, dryRun = false) {
526
574
  merged.devDependencies = { ...targetJson.devDependencies, ...sourceJson.devDependencies };
527
575
  }
528
576
  if (sourceJson.scripts) {
529
- merged.scripts = { ...sourceJson.scripts, ...targetJson.scripts };
577
+ merged.scripts = { ...targetJson.scripts };
578
+ for (const scriptName of frameworkScripts) {
579
+ if (sourceJson.scripts[scriptName]) {
580
+ merged.scripts[scriptName] = sourceJson.scripts[scriptName];
581
+ }
582
+ }
583
+ for (const [scriptName, scriptValue] of Object.entries(sourceJson.scripts)) {
584
+ if (!merged.scripts[scriptName]) {
585
+ merged.scripts[scriptName] = scriptValue;
586
+ }
587
+ }
588
+ }
589
+ if (sourceJson.engines) {
590
+ merged.engines = sourceJson.engines;
591
+ }
592
+ if (sourceJson.type) {
593
+ merged.type = sourceJson.type;
530
594
  }
531
595
  const hasChanges = JSON.stringify(merged) !== JSON.stringify(targetJson);
532
596
  if (hasChanges) {
@@ -536,7 +600,7 @@ async function mergeJsonFile(sourcePath, targetPath, updates, dryRun = false) {
536
600
  }
537
601
  }
538
602
  }
539
- async function mergeGitignoreFile(sourcePath, targetPath, updates, dryRun = false) {
603
+ async function mergeGitignoreFile(sourcePath, targetPath, updates, dryRun = false, relativePath) {
540
604
  const sourceContent = await import_fs_extra.default.readFile(sourcePath, "utf-8");
541
605
  const targetContent = await import_fs_extra.default.readFile(targetPath, "utf-8");
542
606
  const sourceLines = sourceContent.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
@@ -544,7 +608,8 @@ async function mergeGitignoreFile(sourcePath, targetPath, updates, dryRun = fals
544
608
  const existingEntries = new Set(targetLines);
545
609
  const newEntries = sourceLines.filter((line) => !existingEntries.has(line));
546
610
  if (newEntries.length > 0) {
547
- updates.push({ file: import_path.default.basename(targetPath), action: "updated" });
611
+ const displayPath = relativePath || import_path.default.basename(targetPath);
612
+ updates.push({ file: displayPath, action: "updated" });
548
613
  if (!dryRun) {
549
614
  const updatedContent = targetContent + (targetContent.endsWith("\n") ? "" : "\n") + (newEntries.length > 0 ? "\n# Added by framework update\n" + newEntries.join("\n") + "\n" : "");
550
615
  await import_fs_extra.default.writeFile(targetPath, updatedContent, "utf-8");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.8_4981d554a2757e4ed25c3ad5a773b01f/node_modules/tsup/assets/cjs_shims.js","../src/index.ts"],"sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","#!/usr/bin/env node\n\n/**\n * create-lego-one CLI\n * Create a new Lego-One SaaS application from template\n */\n\nimport path from 'path';\nimport fs from 'fs';\nimport { fileURLToPath } from 'url';\nimport { program } from 'commander';\nimport * as kleur from 'kleur';\nimport fsExtra from 'fs-extra';\nimport validateProjectName from 'validate-npm-package-name';\nimport prompts from 'prompts';\nimport { execSync } from 'child_process';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\ninterface CreateOptions {\n appName?: string;\n interactive: boolean;\n git: boolean;\n branch?: string;\n template?: string;\n description?: string;\n author?: string;\n}\n\ninterface ProjectConfig {\n appName: string;\n description: string;\n author: string;\n git: boolean;\n}\n\n// ASCII art banner\nconst banner = `\n${kleur.cyan('┌─────────────────────────────────────────────────────────┐')}\n${kleur.cyan('│')} ${kleur.bold().white('Lego-One')} SaaS Boilerplate ${kleur.cyan('│')}\n${kleur.cyan('│')} ${kleur.gray('Microkernel architecture with Modern.js + Garfish')} ${kleur.cyan('│')}\n${kleur.cyan('└─────────────────────────────────────────────────────────┘')}\n`;\n\nasync function init() {\n console.log(banner);\n\n const version = getVersion();\n console.log(kleur.gray(`create-lego-one v${version}\\n`));\n\n program\n .name('create-lego-one')\n .description('Create a new Lego-One SaaS application')\n .version(version)\n .argument('[app-name]', 'Name of your application')\n .option('-i, --interactive', 'Use interactive prompts (default when no app name provided)')\n .option('--no-interactive', 'Skip interactive prompts')\n .option('--git', 'Initialize git repository', true)\n .option('--no-git', 'Skip git initialization')\n .option('--description <description>', 'Project description')\n .option('--author <author>', 'Author name')\n .option('--branch <branch>', 'Use specific branch')\n .option('--template <template>', 'Use specific template')\n .action(async (appName: string | undefined, options) => {\n // Default to interactive mode if no app name provided\n const isInteractive = options.interactive !== false && (!appName || options.interactive === true);\n \n const opts: CreateOptions = {\n appName,\n interactive: isInteractive,\n git: options.git !== false,\n branch: options.branch,\n template: options.template,\n description: options.description,\n author: options.author,\n };\n await createApp(opts);\n });\n\n // Add update command\n program\n .command('update')\n .description('Update existing Lego-One project with latest framework changes')\n .option('--dry-run', 'Show what would be updated without making changes')\n .option('--force', 'Force update even if conflicts detected')\n .action(async (options) => {\n await updateProject(process.cwd(), options);\n });\n\n await program.parseAsync(process.argv);\n}\n\nfunction getVersion(): string {\n const pkgPath = path.join(__dirname, '../package.json');\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));\n return pkg.version || '1.0.0';\n } catch {\n return '1.0.0';\n }\n}\n\nasync function createApp(options: CreateOptions) {\n try {\n let projectConfig: ProjectConfig;\n\n // Interactive mode - collect all project information\n if (options.interactive) {\n const responses = await prompts([\n {\n type: 'text',\n name: 'appName',\n message: 'What is your app named?',\n initial: options.appName || 'my-saas-app',\n validate: (value: string) => {\n if (!value) return 'App name is required';\n const validation = validateProjectName(value);\n if (validation.validForNewPackages) return true;\n const errorMsg = validation.errors?.join(', ') || validation.warnings?.join(', ') || 'unknown error';\n return 'Invalid app name: ' + errorMsg;\n },\n },\n {\n type: 'text',\n name: 'description',\n message: 'Project description (optional)',\n initial: options.description || 'A SaaS application built with Lego-One',\n },\n {\n type: 'text',\n name: 'author',\n message: 'Author name (optional)',\n initial: options.author || '',\n },\n {\n type: 'confirm',\n name: 'git',\n message: 'Initialize git repository?',\n initial: options.git !== false,\n },\n ]);\n\n projectConfig = {\n appName: responses.appName || options.appName || 'my-saas-app',\n description: responses.description || options.description || 'A SaaS application built with Lego-One',\n author: responses.author || options.author || '',\n git: responses.git !== false,\n };\n } else {\n // Non-interactive mode - use provided values or defaults\n if (!options.appName) {\n console.error(kleur.red('Please specify an app name or use interactive mode (default)'));\n process.exit(1);\n }\n\n projectConfig = {\n appName: options.appName,\n description: options.description || 'A SaaS application built with Lego-One',\n author: options.author || '',\n git: options.git !== false,\n };\n }\n\n // Validate app name\n const validation = validateProjectName(projectConfig.appName);\n if (!validation.validForNewPackages) {\n const errorMsg = validation.errors?.join(', ') || validation.warnings?.join(', ') || 'unknown error';\n console.error(kleur.red(`Invalid app name: ${errorMsg}`));\n if (validation.warnings && validation.warnings.length > 0) {\n console.error(kleur.yellow(`Warnings: ${validation.warnings.join(', ')}`));\n }\n process.exit(1);\n }\n\n const appName = projectConfig.appName;\n\n const targetDir = path.resolve(process.cwd(), appName);\n\n // Check if directory exists\n if (await fsExtra.pathExists(targetDir)) {\n const files = await fsExtra.readdir(targetDir);\n if (files.length > 0) {\n console.error(kleur.red(`Directory \"${appName}\" already exists and is not empty`));\n process.exit(1);\n }\n }\n\n console.log(kleur.cyan('Creating your Lego-One application...'));\n\n // Create target directory\n await fsExtra.ensureDir(targetDir);\n\n // Copy template files\n console.log(kleur.gray('Copying template files...'));\n const templateDir = path.join(__dirname, '../template');\n if (await fsExtra.pathExists(templateDir)) {\n await fsExtra.copy(templateDir, targetDir);\n } else {\n // Fallback: copy from root (development mode)\n const rootDir = path.join(__dirname, '../../..');\n await copyTemplateFiles(rootDir, targetDir);\n }\n\n // Update package.json with project configuration\n console.log(kleur.gray('Configuring project...'));\n await updatePackageJson(targetDir, projectConfig);\n\n // Update README.md with project-specific information\n await updateReadme(targetDir, projectConfig);\n\n // Ensure PocketBase directory structure exists\n await ensurePocketBaseStructure(targetDir);\n\n // Initialize git if requested\n if (projectConfig.git) {\n console.log(kleur.gray('Initializing git repository...'));\n try {\n execSync('git init', { cwd: targetDir });\n execSync('git add .', { cwd: targetDir });\n execSync('git commit -m \"Initial commit from Lego-One\"', {\n cwd: targetDir,\n });\n } catch (error) {\n console.warn(kleur.yellow('Could not initialize git repository'));\n }\n }\n\n console.log(kleur.green('Application created successfully!'));\n\n // Print success message\n console.log('\\n' + kleur.bold('Next steps:'));\n console.log(` ${kleur.cyan('cd')} ${appName}`);\n console.log(` ${kleur.cyan('pnpm install')}`);\n console.log(` ${kleur.cyan('pnpm run dev')}`);\n console.log('\\n' + kleur.gray('To start developing:'));\n console.log(` ${kleur.cyan('pnpm run dev')} - Start development server`);\n console.log(` ${kleur.cyan('pnpm run dev:all')} - Start all services`);\n console.log('\\n' + kleur.gray('To build for production:'));\n console.log(` ${kleur.cyan('pnpm run build')} - Build application`);\n console.log(` ${kleur.cyan('pnpm run start')} - Start production server`);\n console.log('\\n' + kleur.gray('Documentation:'));\n console.log(` ${kleur.cyan('https://lego-one.dev/docs')} - Full documentation`);\n console.log('\\n' + kleur.yellow('Happy coding! 🚀\\n'));\n } catch (error) {\n console.error(kleur.red('Failed to create application'));\n if (error instanceof Error) {\n console.error(kleur.red(error.message));\n }\n process.exit(1);\n }\n}\n\nasync function updatePackageJson(targetDir: string, config: ProjectConfig) {\n const packageJsonPath = path.join(targetDir, 'package.json');\n \n if (await fsExtra.pathExists(packageJsonPath)) {\n const packageJson = JSON.parse(await fsExtra.readFile(packageJsonPath, 'utf-8'));\n \n // Update package name\n packageJson.name = config.appName;\n \n // Update description if provided\n if (config.description) {\n packageJson.description = config.description;\n }\n \n // Update author if provided\n if (config.author) {\n packageJson.author = config.author;\n }\n \n // Write updated package.json\n await fsExtra.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\\n', 'utf-8');\n }\n}\n\nasync function updateReadme(targetDir: string, config: ProjectConfig) {\n const readmePath = path.join(targetDir, 'README.md');\n \n if (await fsExtra.pathExists(readmePath)) {\n let readmeContent = await fsExtra.readFile(readmePath, 'utf-8');\n \n // Replace placeholders\n readmeContent = readmeContent.replace(/{APP_NAME}/g, config.appName);\n readmeContent = readmeContent.replace(/{DESCRIPTION}/g, config.description);\n \n // Write updated README\n await fsExtra.writeFile(readmePath, readmeContent, 'utf-8');\n }\n}\n\nasync function ensurePocketBaseStructure(targetDir: string) {\n const pocketbaseDir = path.join(targetDir, 'pocketbase');\n \n // Ensure directory exists\n await fsExtra.ensureDir(pocketbaseDir);\n \n // Create .gitignore for PocketBase data\n const gitignorePath = path.join(pocketbaseDir, '.gitignore');\n const gitignoreContent = `# PocketBase data files (do not commit)\npb_data/\n*.db\n*.db-shm\n*.db-wal\nlogs.db\nlogs.db-shm\nlogs.db-wal\n\n# PocketBase executable (users download separately)\npocketbase\npocketbase.exe\npocketbase.exe.gz\n*.zip\n`;\n \n if (!(await fsExtra.pathExists(gitignorePath))) {\n await fsExtra.writeFile(gitignorePath, gitignoreContent, 'utf-8');\n }\n}\n\nasync function copyTemplateFiles(sourceDir: string, targetDir: string) {\n // Files to copy\n const filesToCopy = [\n 'host',\n 'packages/plugins',\n 'package.json',\n 'pnpm-lock.yaml',\n 'pnpm-workspace.yaml',\n '.gitignore',\n 'tsconfig.json',\n ];\n\n // Files to exclude\n const excludePatterns = [\n 'node_modules',\n 'dist',\n '.next',\n 'coverage',\n '.cache',\n '*.log',\n ];\n\n for (const file of filesToCopy) {\n const srcPath = path.join(sourceDir, file);\n const destPath = path.join(targetDir, file);\n\n if (await fsExtra.pathExists(srcPath)) {\n await fsExtra.copy(srcPath, destPath, {\n filter: (src) => {\n const relativePath = path.relative(sourceDir, src);\n return !excludePatterns.some((pattern) =>\n relativePath.includes(pattern)\n );\n },\n });\n }\n }\n}\n\nasync function updateProject(projectDir: string, options: { dryRun?: boolean; force?: boolean }) {\n try {\n console.log(kleur.cyan('🔄 Updating Lego-One project...\\n'));\n\n // Check if this is a lego-one project\n const packageJsonPath = path.join(projectDir, 'package.json');\n if (!(await fsExtra.pathExists(packageJsonPath))) {\n console.error(kleur.red('❌ This does not appear to be a Lego-One project (package.json not found)'));\n process.exit(1);\n }\n\n const packageJson = JSON.parse(await fsExtra.readFile(packageJsonPath, 'utf-8'));\n const isLegoOneProject = \n packageJson.name === 'lego-one' || \n packageJson.description?.includes('Lego-One') ||\n await fsExtra.pathExists(path.join(projectDir, 'host')) ||\n await fsExtra.pathExists(path.join(projectDir, 'packages/plugins/@lego'));\n\n if (!isLegoOneProject) {\n console.error(kleur.red('❌ This does not appear to be a Lego-One project'));\n process.exit(1);\n }\n\n // Get template directory from installed package\n const templateDir = path.join(__dirname, '../template');\n \n if (!(await fsExtra.pathExists(templateDir))) {\n console.error(kleur.red('❌ Template directory not found. Please reinstall create-lego-one.'));\n process.exit(1);\n }\n\n if (options.dryRun) {\n console.log(kleur.yellow('🔍 Dry run mode - no changes will be made\\n'));\n }\n\n // Files/directories to update (must match sync-template.js filesToSync)\n const updateItems = [\n // Core application structure\n { source: 'host', target: 'host', strategy: 'merge-host' }, // Merge host updates (skip user configs)\n { source: 'packages/plugins/@lego', target: 'packages/plugins/@lego', strategy: 'merge' }, // Add new plugins only\n \n // Root files\n { source: 'README.md', target: 'README.md', strategy: 'add-if-missing' }, // Add if doesn't exist (user-specific)\n \n // Configuration files\n { source: 'package.json', target: 'package.json', strategy: 'merge-json' }, // Merge package.json\n { source: 'pnpm-workspace.yaml', target: 'pnpm-workspace.yaml', strategy: 'replace' }, // Replace workspace config\n { source: '.gitignore', target: '.gitignore', strategy: 'merge-gitignore' }, // Merge gitignore intelligently\n { source: 'tsconfig.json', target: 'tsconfig.json', strategy: 'merge-json' }, // Merge tsconfig\n { source: 'tsconfig.base.json', target: 'tsconfig.base.json', strategy: 'replace' }, // Replace base config\n { source: '.eslintrc.js', target: '.eslintrc.js', strategy: 'replace' }, // Replace ESLint config\n { source: '.eslintignore', target: '.eslintignore', strategy: 'replace' }, // Replace ESLint ignore\n { source: '.prettierrc', target: '.prettierrc', strategy: 'replace' }, // Replace Prettier config\n { source: '.prettierignore', target: '.prettierignore', strategy: 'replace' }, // Replace Prettier ignore\n \n // Environment files (examples - users create their own from these)\n { source: '.env.example', target: '.env.example', strategy: 'replace' }, // Replace example file\n { source: '.env.development', target: '.env.development', strategy: 'add-if-missing' }, // Add if doesn't exist\n { source: '.env.production', target: '.env.production', strategy: 'add-if-missing' }, // Add if doesn't exist\n \n // Deployment files\n { source: 'Dockerfile', target: 'Dockerfile', strategy: 'replace' }, // Replace Dockerfile\n { source: 'docker-compose.yml', target: 'docker-compose.yml', strategy: 'replace' }, // Replace docker-compose\n { source: 'docker-entrypoint.sh', target: 'docker-entrypoint.sh', strategy: 'replace' }, // Replace entrypoint\n { source: 'nginx.conf', target: 'nginx.conf', strategy: 'replace' }, // Replace nginx config\n { source: '.dockerignore', target: '.dockerignore', strategy: 'replace' }, // Replace dockerignore\n \n // Documentation (for AI-assisted development)\n { source: 'docs', target: 'docs', strategy: 'merge' }, // Merge docs (add new, don't overwrite user docs)\n { source: 'CLAUDE.md', target: 'CLAUDE.md', strategy: 'add-if-missing' }, // Add if doesn't exist\n { source: 'PROMPT.md', target: 'PROMPT.md', strategy: 'add-if-missing' }, // Add if doesn't exist\n { source: '.cursor', target: '.cursor', strategy: 'merge' }, // Merge cursor rules\n \n // Scripts (for users to create plugins)\n { source: 'scripts', target: 'scripts', strategy: 'merge' }, // Merge scripts (add new, don't overwrite user scripts)\n \n // PocketBase structure\n { source: 'pocketbase', target: 'pocketbase', strategy: 'merge-pocketbase' }, // Merge PocketBase (skip executable)\n ];\n\n const updates: Array<{ file: string; action: string }> = [];\n\n for (const item of updateItems) {\n const sourcePath = path.join(templateDir, item.source);\n const targetPath = path.join(projectDir, item.target);\n\n if (!(await fsExtra.pathExists(sourcePath))) {\n continue;\n }\n\n const sourceStat = await fsExtra.stat(sourcePath);\n const targetExists = await fsExtra.pathExists(targetPath);\n\n if (item.strategy === 'skip') {\n continue;\n }\n\n if (item.strategy === 'merge' || item.strategy === 'merge-host' || item.strategy === 'merge-pocketbase') {\n // For directories, add new files only (don't overwrite existing)\n if (sourceStat.isDirectory()) {\n if (item.strategy === 'merge-host') {\n await mergeHostDirectory(sourcePath, targetPath, updates, options.dryRun);\n } else if (item.strategy === 'merge-pocketbase') {\n await mergePocketBaseDirectory(sourcePath, targetPath, updates, options.dryRun);\n } else {\n await mergeDirectory(sourcePath, targetPath, updates, options.dryRun);\n }\n }\n } else if (item.strategy === 'merge-gitignore') {\n // Merge .gitignore intelligently (combine entries, avoid duplicates)\n if (targetExists) {\n await mergeGitignoreFile(sourcePath, targetPath, updates, options.dryRun);\n } else {\n updates.push({ file: item.target, action: 'created' });\n if (!options.dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n } else if (item.strategy === 'add-if-missing') {\n // Only add if file doesn't exist\n if (!targetExists) {\n updates.push({ file: item.target, action: 'created' });\n if (!options.dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n } else if (item.strategy === 'merge-json') {\n if (targetExists) {\n await mergeJsonFile(sourcePath, targetPath, updates, options.dryRun);\n } else {\n updates.push({ file: item.target, action: 'created' });\n if (!options.dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n } else if (item.strategy === 'replace') {\n updates.push({ file: item.target, action: 'updated' });\n if (!options.dryRun) {\n await fsExtra.copy(sourcePath, targetPath, { overwrite: true });\n }\n }\n }\n\n // Summary\n console.log('\\n' + kleur.bold('Update Summary:'));\n if (updates.length === 0) {\n console.log(kleur.gray(' No updates needed'));\n } else {\n updates.forEach(({ file, action }) => {\n const icon = action === 'created' ? '➕' : action === 'updated' ? '🔄' : '✨';\n console.log(` ${icon} ${file} (${action})`);\n });\n }\n\n if (options.dryRun) {\n console.log('\\n' + kleur.yellow('💡 Run without --dry-run to apply updates'));\n } else {\n console.log('\\n' + kleur.green('✅ Project updated successfully!'));\n console.log(kleur.gray('\\nNext steps:'));\n console.log(` ${kleur.cyan('pnpm install')} - Install/update dependencies`);\n console.log(` ${kleur.cyan('pnpm run dev')} - Start development server`);\n }\n } catch (error) {\n console.error(kleur.red('❌ Failed to update project'));\n if (error instanceof Error) {\n console.error(kleur.red(error.message));\n }\n process.exit(1);\n }\n}\n\nasync function mergeDirectory(\n sourceDir: string,\n targetDir: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false\n) {\n await fsExtra.ensureDir(targetDir);\n const entries = await fsExtra.readdir(sourceDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const sourcePath = path.join(sourceDir, entry.name);\n const targetPath = path.join(targetDir, entry.name);\n\n if (entry.isDirectory()) {\n await mergeDirectory(sourcePath, targetPath, updates, dryRun);\n } else {\n // Only add files that don't exist (new plugins, new kernel files)\n const targetExists = await fsExtra.pathExists(targetPath);\n if (!targetExists) {\n const relativePath = path.relative(targetDir, targetPath);\n updates.push({ file: relativePath, action: 'created' });\n if (!dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n }\n }\n}\n\nasync function mergeHostDirectory(\n sourceDir: string,\n targetDir: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false,\n hostRootDir?: string\n) {\n // Track the host root directory for relative path calculation\n if (!hostRootDir) {\n hostRootDir = sourceDir;\n }\n\n await fsExtra.ensureDir(targetDir);\n const entries = await fsExtra.readdir(sourceDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const sourcePath = path.join(sourceDir, entry.name);\n const targetPath = path.join(targetDir, entry.name);\n const relativeToHostRoot = path.relative(hostRootDir, sourcePath).replace(/\\\\/g, '/');\n\n // Skip user-specific config files\n // modern.config.ts is at host root\n // saas.config.ts is at host/src/\n if (relativeToHostRoot === 'modern.config.ts' || relativeToHostRoot === 'src/saas.config.ts') {\n continue;\n }\n\n if (entry.isDirectory()) {\n await mergeHostDirectory(sourcePath, targetPath, updates, dryRun, hostRootDir);\n } else {\n // Only add files that don't exist\n const targetExists = await fsExtra.pathExists(targetPath);\n if (!targetExists) {\n const relativeTargetPath = path.relative(targetDir, targetPath).replace(/\\\\/g, '/');\n updates.push({ file: relativeTargetPath, action: 'created' });\n if (!dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n }\n }\n}\n\nasync function mergePocketBaseDirectory(\n sourceDir: string,\n targetDir: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false\n) {\n // Files to skip (executable and data)\n const skipFiles = [\n 'pocketbase.exe',\n 'pocketbase',\n 'pocketbase.exe.gz',\n 'pb_data',\n ];\n\n await fsExtra.ensureDir(targetDir);\n const entries = await fsExtra.readdir(sourceDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const sourcePath = path.join(sourceDir, entry.name);\n const targetPath = path.join(targetDir, entry.name);\n\n // Skip executable and data files\n if (skipFiles.includes(entry.name)) {\n continue;\n }\n\n if (entry.isDirectory()) {\n await mergePocketBaseDirectory(sourcePath, targetPath, updates, dryRun);\n } else {\n // Only add files that don't exist\n const targetExists = await fsExtra.pathExists(targetPath);\n if (!targetExists) {\n const relativePath = path.relative(targetDir, targetPath);\n updates.push({ file: relativePath, action: 'created' });\n if (!dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n }\n }\n}\n\nasync function mergeJsonFile(\n sourcePath: string,\n targetPath: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false\n) {\n const sourceJson = JSON.parse(await fsExtra.readFile(sourcePath, 'utf-8'));\n const targetJson = JSON.parse(await fsExtra.readFile(targetPath, 'utf-8'));\n\n // Merge dependencies and devDependencies\n const merged = { ...targetJson };\n \n if (sourceJson.dependencies) {\n merged.dependencies = { ...targetJson.dependencies, ...sourceJson.dependencies };\n }\n if (sourceJson.devDependencies) {\n merged.devDependencies = { ...targetJson.devDependencies, ...sourceJson.devDependencies };\n }\n if (sourceJson.scripts) {\n // Merge scripts, but keep user's custom scripts\n merged.scripts = { ...sourceJson.scripts, ...targetJson.scripts };\n }\n\n // Check if there are actual changes\n const hasChanges = JSON.stringify(merged) !== JSON.stringify(targetJson);\n \n if (hasChanges) {\n updates.push({ file: path.basename(targetPath), action: 'updated' });\n if (!dryRun) {\n await fsExtra.writeFile(targetPath, JSON.stringify(merged, null, 2) + '\\n', 'utf-8');\n }\n }\n}\n\nasync function mergeGitignoreFile(\n sourcePath: string,\n targetPath: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false\n) {\n const sourceContent = await fsExtra.readFile(sourcePath, 'utf-8');\n const targetContent = await fsExtra.readFile(targetPath, 'utf-8');\n\n // Split into lines and normalize\n const sourceLines = sourceContent.split('\\n').map(line => line.trim()).filter(line => line && !line.startsWith('#'));\n const targetLines = targetContent.split('\\n').map(line => line.trim()).filter(line => line && !line.startsWith('#'));\n\n // Get existing entries as a set\n const existingEntries = new Set(targetLines);\n\n // Find new entries from source\n const newEntries = sourceLines.filter(line => !existingEntries.has(line));\n\n if (newEntries.length > 0) {\n updates.push({ file: path.basename(targetPath), action: 'updated' });\n if (!dryRun) {\n // Append new entries to target file\n const updatedContent = targetContent + (targetContent.endsWith('\\n') ? '' : '\\n') + \n (newEntries.length > 0 ? '\\n# Added by framework update\\n' + newEntries.join('\\n') + '\\n' : '');\n await fsExtra.writeFile(targetPath, updatedContent, 'utf-8');\n }\n }\n}\n\n// Run the CLI\ninit().catch((error) => {\n console.error(kleur.red('Unexpected error:'));\n console.error(error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ACL9D,kBAAiB;AACjB,gBAAe;AACf,iBAA8B;AAC9B,uBAAwB;AACxB,YAAuB;AACvB,sBAAoB;AACpB,uCAAgC;AAChC,qBAAoB;AACpB,2BAAyB;AAEzB,IAAM,YAAY,YAAAA,QAAK,YAAQ,0BAAc,aAAe,CAAC;AAoB7D,IAAM,SAAS;AAAA,EACP,WAAK,oWAA6D,CAAC;AAAA,EACnE,WAAK,QAAG,CAAC,IAAU,WAAK,EAAE,MAAM,UAAU,CAAC,8CAAoD,WAAK,QAAG,CAAC;AAAA,EACxG,WAAK,QAAG,CAAC,IAAU,WAAK,mDAAmD,CAAC,SAAe,WAAK,QAAG,CAAC;AAAA,EACpG,WAAK,oWAA6D,CAAC;AAAA;AAG3E,eAAe,OAAO;AACpB,UAAQ,IAAI,MAAM;AAElB,QAAM,UAAU,WAAW;AAC3B,UAAQ,IAAU,WAAK,oBAAoB,OAAO;AAAA,CAAI,CAAC;AAEvD,2BACG,KAAK,iBAAiB,EACtB,YAAY,wCAAwC,EACpD,QAAQ,OAAO,EACf,SAAS,cAAc,0BAA0B,EACjD,OAAO,qBAAqB,6DAA6D,EACzF,OAAO,oBAAoB,0BAA0B,EACrD,OAAO,SAAS,6BAA6B,IAAI,EACjD,OAAO,YAAY,yBAAyB,EAC5C,OAAO,+BAA+B,qBAAqB,EAC3D,OAAO,qBAAqB,aAAa,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D;AAAA,EACF;AACF;AAGA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAY,UAAI,mBAAmB,CAAC;AAC5C,UAAQ,MAAM,KAAK;AACnB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["path","fs","prompts","validation","validateProjectName","fsExtra"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.8_4981d554a2757e4ed25c3ad5a773b01f/node_modules/tsup/assets/cjs_shims.js","../src/index.ts"],"sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","#!/usr/bin/env node\n\n/**\n * create-lego-one CLI\n * Create a new Lego-One SaaS application from template\n */\n\nimport path from 'path';\nimport fs from 'fs';\nimport { fileURLToPath } from 'url';\nimport { program } from 'commander';\nimport * as kleur from 'kleur';\nimport fsExtra from 'fs-extra';\nimport validateProjectName from 'validate-npm-package-name';\nimport prompts from 'prompts';\nimport { execSync } from 'child_process';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\ninterface CreateOptions {\n appName?: string;\n interactive: boolean;\n git: boolean;\n branch?: string;\n template?: string;\n description?: string;\n author?: string;\n}\n\ninterface ProjectConfig {\n appName: string;\n description: string;\n author: string;\n git: boolean;\n}\n\n// ASCII art banner\nconst banner = `\n${kleur.cyan('┌─────────────────────────────────────────────────────────┐')}\n${kleur.cyan('│')} ${kleur.bold().white('Lego-One')} SaaS Boilerplate ${kleur.cyan('│')}\n${kleur.cyan('│')} ${kleur.gray('Microkernel architecture with Modern.js + Garfish')} ${kleur.cyan('│')}\n${kleur.cyan('└─────────────────────────────────────────────────────────┘')}\n`;\n\nasync function init() {\n console.log(banner);\n\n const version = getVersion();\n console.log(kleur.gray(`create-lego-one v${version}\\n`));\n\n program\n .name('create-lego-one')\n .description('Create a new Lego-One SaaS application')\n .version(version)\n .argument('[app-name]', 'Name of your application')\n .option('-i, --interactive', 'Use interactive prompts (default when no app name provided)')\n .option('--no-interactive', 'Skip interactive prompts')\n .option('--git', 'Initialize git repository', true)\n .option('--no-git', 'Skip git initialization')\n .option('--description <description>', 'Project description')\n .option('--author <author>', 'Author name')\n .option('--branch <branch>', 'Use specific branch')\n .option('--template <template>', 'Use specific template')\n .action(async (appName: string | undefined, options) => {\n // Default to interactive mode if no app name provided\n const isInteractive = options.interactive !== false && (!appName || options.interactive === true);\n \n const opts: CreateOptions = {\n appName,\n interactive: isInteractive,\n git: options.git !== false,\n branch: options.branch,\n template: options.template,\n description: options.description,\n author: options.author,\n };\n await createApp(opts);\n });\n\n // Add update command\n program\n .command('update')\n .description('Update existing Lego-One project with latest framework changes')\n .option('--dry-run', 'Show what would be updated without making changes')\n .option('--force', 'Force update even if conflicts detected')\n .action(async (options) => {\n await updateProject(process.cwd(), options);\n });\n\n await program.parseAsync(process.argv);\n}\n\nfunction getVersion(): string {\n const pkgPath = path.join(__dirname, '../package.json');\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));\n return pkg.version || '1.0.0';\n } catch {\n return '1.0.0';\n }\n}\n\nasync function createApp(options: CreateOptions) {\n try {\n let projectConfig: ProjectConfig;\n\n // Interactive mode - collect all project information\n if (options.interactive) {\n const responses = await prompts([\n {\n type: 'text',\n name: 'appName',\n message: 'What is your app named?',\n initial: options.appName || 'my-saas-app',\n validate: (value: string) => {\n if (!value) return 'App name is required';\n const validation = validateProjectName(value);\n if (validation.validForNewPackages) return true;\n const errorMsg = validation.errors?.join(', ') || validation.warnings?.join(', ') || 'unknown error';\n return 'Invalid app name: ' + errorMsg;\n },\n },\n {\n type: 'text',\n name: 'description',\n message: 'Project description (optional)',\n initial: options.description || 'A SaaS application built with Lego-One',\n },\n {\n type: 'text',\n name: 'author',\n message: 'Author name (optional)',\n initial: options.author || '',\n },\n {\n type: 'confirm',\n name: 'git',\n message: 'Initialize git repository?',\n initial: options.git !== false,\n },\n ]);\n\n projectConfig = {\n appName: responses.appName || options.appName || 'my-saas-app',\n description: responses.description || options.description || 'A SaaS application built with Lego-One',\n author: responses.author || options.author || '',\n git: responses.git !== false,\n };\n } else {\n // Non-interactive mode - use provided values or defaults\n if (!options.appName) {\n console.error(kleur.red('Please specify an app name or use interactive mode (default)'));\n process.exit(1);\n }\n\n projectConfig = {\n appName: options.appName,\n description: options.description || 'A SaaS application built with Lego-One',\n author: options.author || '',\n git: options.git !== false,\n };\n }\n\n // Validate app name\n const validation = validateProjectName(projectConfig.appName);\n if (!validation.validForNewPackages) {\n const errorMsg = validation.errors?.join(', ') || validation.warnings?.join(', ') || 'unknown error';\n console.error(kleur.red(`Invalid app name: ${errorMsg}`));\n if (validation.warnings && validation.warnings.length > 0) {\n console.error(kleur.yellow(`Warnings: ${validation.warnings.join(', ')}`));\n }\n process.exit(1);\n }\n\n const appName = projectConfig.appName;\n\n const targetDir = path.resolve(process.cwd(), appName);\n\n // Check if directory exists\n if (await fsExtra.pathExists(targetDir)) {\n const files = await fsExtra.readdir(targetDir);\n if (files.length > 0) {\n console.error(kleur.red(`Directory \"${appName}\" already exists and is not empty`));\n process.exit(1);\n }\n }\n\n console.log(kleur.cyan('Creating your Lego-One application...'));\n\n // Create target directory\n await fsExtra.ensureDir(targetDir);\n\n // Copy template files\n console.log(kleur.gray('Copying template files...'));\n const templateDir = path.join(__dirname, '../template');\n if (await fsExtra.pathExists(templateDir)) {\n await fsExtra.copy(templateDir, targetDir);\n } else {\n // Fallback: copy from root (development mode)\n const rootDir = path.join(__dirname, '../../..');\n await copyTemplateFiles(rootDir, targetDir);\n }\n\n // Update package.json with project configuration\n console.log(kleur.gray('Configuring project...'));\n await updatePackageJson(targetDir, projectConfig);\n\n // Update README.md with project-specific information\n await updateReadme(targetDir, projectConfig);\n\n // Ensure PocketBase directory structure exists\n await ensurePocketBaseStructure(targetDir);\n\n // Initialize git if requested\n if (projectConfig.git) {\n console.log(kleur.gray('Initializing git repository...'));\n try {\n execSync('git init', { cwd: targetDir });\n execSync('git add .', { cwd: targetDir });\n execSync('git commit -m \"Initial commit from Lego-One\"', {\n cwd: targetDir,\n });\n } catch (error) {\n console.warn(kleur.yellow('Could not initialize git repository'));\n }\n }\n\n console.log(kleur.green('Application created successfully!'));\n\n // Print success message\n console.log('\\n' + kleur.bold('Next steps:'));\n console.log(` ${kleur.cyan('cd')} ${appName}`);\n console.log(` ${kleur.cyan('pnpm install')}`);\n console.log(` ${kleur.cyan('pnpm run dev')}`);\n console.log('\\n' + kleur.gray('To start developing:'));\n console.log(` ${kleur.cyan('pnpm run dev')} - Start development server`);\n console.log(` ${kleur.cyan('pnpm run dev:all')} - Start all services`);\n console.log('\\n' + kleur.gray('To build for production:'));\n console.log(` ${kleur.cyan('pnpm run build')} - Build application`);\n console.log(` ${kleur.cyan('pnpm run start')} - Start production server`);\n console.log('\\n' + kleur.gray('Documentation:'));\n console.log(` ${kleur.cyan('https://lego-one.dev/docs')} - Full documentation`);\n console.log('\\n' + kleur.yellow('Happy coding! 🚀\\n'));\n } catch (error) {\n console.error(kleur.red('Failed to create application'));\n if (error instanceof Error) {\n console.error(kleur.red(error.message));\n }\n process.exit(1);\n }\n}\n\nasync function updatePackageJson(targetDir: string, config: ProjectConfig) {\n const packageJsonPath = path.join(targetDir, 'package.json');\n \n if (await fsExtra.pathExists(packageJsonPath)) {\n const packageJson = JSON.parse(await fsExtra.readFile(packageJsonPath, 'utf-8'));\n \n // Update package name\n packageJson.name = config.appName;\n \n // Update description if provided\n if (config.description) {\n packageJson.description = config.description;\n }\n \n // Update author if provided\n if (config.author) {\n packageJson.author = config.author;\n }\n \n // Write updated package.json\n await fsExtra.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\\n', 'utf-8');\n }\n}\n\nasync function updateReadme(targetDir: string, config: ProjectConfig) {\n const readmePath = path.join(targetDir, 'README.md');\n \n if (await fsExtra.pathExists(readmePath)) {\n let readmeContent = await fsExtra.readFile(readmePath, 'utf-8');\n \n // Replace placeholders\n readmeContent = readmeContent.replace(/{APP_NAME}/g, config.appName);\n readmeContent = readmeContent.replace(/{DESCRIPTION}/g, config.description);\n \n // Write updated README\n await fsExtra.writeFile(readmePath, readmeContent, 'utf-8');\n }\n}\n\nasync function ensurePocketBaseStructure(targetDir: string) {\n const pocketbaseDir = path.join(targetDir, 'pocketbase');\n \n // Ensure directory exists\n await fsExtra.ensureDir(pocketbaseDir);\n \n // Create .gitignore for PocketBase data\n const gitignorePath = path.join(pocketbaseDir, '.gitignore');\n const gitignoreContent = `# PocketBase data files (do not commit)\npb_data/\n*.db\n*.db-shm\n*.db-wal\nlogs.db\nlogs.db-shm\nlogs.db-wal\n\n# PocketBase executable (users download separately)\npocketbase\npocketbase.exe\npocketbase.exe.gz\n*.zip\n`;\n \n if (!(await fsExtra.pathExists(gitignorePath))) {\n await fsExtra.writeFile(gitignorePath, gitignoreContent, 'utf-8');\n }\n}\n\nasync function copyTemplateFiles(sourceDir: string, targetDir: string) {\n // Files to copy\n const filesToCopy = [\n 'host',\n 'packages/plugins',\n 'package.json',\n 'pnpm-lock.yaml',\n 'pnpm-workspace.yaml',\n '.gitignore',\n 'tsconfig.json',\n ];\n\n // Files to exclude\n const excludePatterns = [\n 'node_modules',\n 'dist',\n '.next',\n 'coverage',\n '.cache',\n '*.log',\n ];\n\n for (const file of filesToCopy) {\n const srcPath = path.join(sourceDir, file);\n const destPath = path.join(targetDir, file);\n\n if (await fsExtra.pathExists(srcPath)) {\n await fsExtra.copy(srcPath, destPath, {\n filter: (src) => {\n const relativePath = path.relative(sourceDir, src);\n return !excludePatterns.some((pattern) =>\n relativePath.includes(pattern)\n );\n },\n });\n }\n }\n}\n\nasync function updateProject(projectDir: string, options: { dryRun?: boolean; force?: boolean }) {\n try {\n console.log(kleur.cyan('🔄 Updating Lego-One project...\\n'));\n\n // Check if this is a lego-one project\n const packageJsonPath = path.join(projectDir, 'package.json');\n if (!(await fsExtra.pathExists(packageJsonPath))) {\n console.error(kleur.red('❌ This does not appear to be a Lego-One project (package.json not found)'));\n process.exit(1);\n }\n\n const packageJson = JSON.parse(await fsExtra.readFile(packageJsonPath, 'utf-8'));\n const isLegoOneProject = \n packageJson.name === 'lego-one' || \n packageJson.description?.includes('Lego-One') ||\n await fsExtra.pathExists(path.join(projectDir, 'host')) ||\n await fsExtra.pathExists(path.join(projectDir, 'packages/plugins/@lego'));\n\n if (!isLegoOneProject) {\n console.error(kleur.red('❌ This does not appear to be a Lego-One project'));\n process.exit(1);\n }\n\n // Get template directory from installed package\n const templateDir = path.join(__dirname, '../template');\n \n if (!(await fsExtra.pathExists(templateDir))) {\n console.error(kleur.red('❌ Template directory not found. Please reinstall create-lego-one.'));\n process.exit(1);\n }\n\n if (options.dryRun) {\n console.log(kleur.yellow('🔍 Dry run mode - no changes will be made\\n'));\n }\n\n // Files/directories to update (must match sync-template.js filesToSync)\n const updateItems = [\n // Core application structure\n { source: 'host', target: 'host', strategy: 'merge-host' }, // Merge host updates (skip user configs)\n { source: 'packages/plugins/@lego', target: 'packages/plugins/@lego', strategy: 'merge' }, // Add new plugins only\n \n // Root files\n { source: 'README.md', target: 'README.md', strategy: 'add-if-missing' }, // Add if doesn't exist (user-specific)\n \n // Configuration files\n { source: 'package.json', target: 'package.json', strategy: 'merge-json' }, // Merge package.json\n { source: 'pnpm-workspace.yaml', target: 'pnpm-workspace.yaml', strategy: 'replace' }, // Replace workspace config\n { source: '.gitignore', target: '.gitignore', strategy: 'merge-gitignore' }, // Merge gitignore intelligently\n { source: 'tsconfig.json', target: 'tsconfig.json', strategy: 'merge-json' }, // Merge tsconfig\n { source: 'tsconfig.base.json', target: 'tsconfig.base.json', strategy: 'replace' }, // Replace base config\n { source: '.eslintrc.js', target: '.eslintrc.js', strategy: 'replace' }, // Replace ESLint config\n { source: '.eslintignore', target: '.eslintignore', strategy: 'replace' }, // Replace ESLint ignore\n { source: '.prettierrc', target: '.prettierrc', strategy: 'replace' }, // Replace Prettier config\n { source: '.prettierignore', target: '.prettierignore', strategy: 'replace' }, // Replace Prettier ignore\n \n // Environment files (examples - users create their own from these)\n { source: '.env.example', target: '.env.example', strategy: 'replace' }, // Replace example file\n { source: '.env.development', target: '.env.development', strategy: 'add-if-missing' }, // Add if doesn't exist\n { source: '.env.production', target: '.env.production', strategy: 'add-if-missing' }, // Add if doesn't exist\n \n // Deployment files\n { source: 'Dockerfile', target: 'Dockerfile', strategy: 'replace' }, // Replace Dockerfile\n { source: 'docker-compose.yml', target: 'docker-compose.yml', strategy: 'replace' }, // Replace docker-compose\n { source: 'docker-entrypoint.sh', target: 'docker-entrypoint.sh', strategy: 'replace' }, // Replace entrypoint\n { source: 'nginx.conf', target: 'nginx.conf', strategy: 'replace' }, // Replace nginx config\n { source: '.dockerignore', target: '.dockerignore', strategy: 'replace' }, // Replace dockerignore\n \n // Documentation (for AI-assisted development)\n { source: 'docs', target: 'docs', strategy: 'merge' }, // Merge docs (add new, don't overwrite user docs)\n { source: 'CLAUDE.md', target: 'CLAUDE.md', strategy: 'add-if-missing' }, // Add if doesn't exist\n { source: 'PROMPT.md', target: 'PROMPT.md', strategy: 'add-if-missing' }, // Add if doesn't exist\n { source: '.cursor', target: '.cursor', strategy: 'merge' }, // Merge cursor rules\n \n // Scripts (for users to create plugins)\n { source: 'scripts', target: 'scripts', strategy: 'merge' }, // Merge scripts (add new, don't overwrite user scripts)\n \n // PocketBase structure\n { source: 'pocketbase', target: 'pocketbase', strategy: 'merge-pocketbase' }, // Merge PocketBase (skip executable)\n ];\n\n const updates: Array<{ file: string; action: string }> = [];\n\n for (const item of updateItems) {\n const sourcePath = path.join(templateDir, item.source);\n const targetPath = path.join(projectDir, item.target);\n\n if (!(await fsExtra.pathExists(sourcePath))) {\n continue;\n }\n\n const sourceStat = await fsExtra.stat(sourcePath);\n const targetExists = await fsExtra.pathExists(targetPath);\n\n if (item.strategy === 'skip') {\n continue;\n }\n\n if (item.strategy === 'merge' || item.strategy === 'merge-host' || item.strategy === 'merge-pocketbase') {\n // For directories, add new files only (don't overwrite existing)\n if (sourceStat.isDirectory()) {\n if (item.strategy === 'merge-host') {\n await mergeHostDirectory(sourcePath, targetPath, updates, options.dryRun);\n } else if (item.strategy === 'merge-pocketbase') {\n await mergePocketBaseDirectory(sourcePath, targetPath, updates, options.dryRun);\n } else {\n await mergeDirectory(sourcePath, targetPath, updates, options.dryRun);\n }\n }\n } else if (item.strategy === 'merge-gitignore') {\n // Merge .gitignore intelligently (combine entries, avoid duplicates)\n if (targetExists) {\n await mergeGitignoreFile(sourcePath, targetPath, updates, options.dryRun, item.target);\n } else {\n updates.push({ file: item.target, action: 'created' });\n if (!options.dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n } else if (item.strategy === 'add-if-missing') {\n // Only add if file doesn't exist\n if (!targetExists) {\n updates.push({ file: item.target, action: 'created' });\n if (!options.dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n } else if (item.strategy === 'merge-json') {\n if (targetExists) {\n await mergeJsonFile(sourcePath, targetPath, updates, options.dryRun);\n } else {\n updates.push({ file: item.target, action: 'created' });\n if (!options.dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n } else if (item.strategy === 'replace') {\n updates.push({ file: item.target, action: 'updated' });\n if (!options.dryRun) {\n await fsExtra.copy(sourcePath, targetPath, { overwrite: true });\n }\n }\n }\n\n // Summary\n console.log('\\n' + kleur.bold('Update Summary:'));\n if (updates.length === 0) {\n console.log(kleur.gray(' No updates needed'));\n } else {\n updates.forEach(({ file, action }) => {\n const icon = action === 'created' ? '➕' : action === 'updated' ? '🔄' : '✨';\n console.log(` ${icon} ${file} (${action})`);\n });\n }\n\n if (options.dryRun) {\n console.log('\\n' + kleur.yellow('💡 Run without --dry-run to apply updates'));\n } else {\n console.log('\\n' + kleur.green('✅ Project updated successfully!'));\n console.log(kleur.gray('\\nNext steps:'));\n console.log(` ${kleur.cyan('pnpm install')} - Install/update dependencies`);\n console.log(` ${kleur.cyan('pnpm run dev')} - Start development server`);\n }\n } catch (error) {\n console.error(kleur.red('❌ Failed to update project'));\n if (error instanceof Error) {\n console.error(kleur.red(error.message));\n }\n process.exit(1);\n }\n}\n\nasync function mergeDirectory(\n sourceDir: string,\n targetDir: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false\n) {\n await fsExtra.ensureDir(targetDir);\n const entries = await fsExtra.readdir(sourceDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const sourcePath = path.join(sourceDir, entry.name);\n const targetPath = path.join(targetDir, entry.name);\n\n if (entry.isDirectory()) {\n await mergeDirectory(sourcePath, targetPath, updates, dryRun);\n } else {\n const targetExists = await fsExtra.pathExists(targetPath);\n \n // Special handling for .gitignore files - merge them even if they exist\n if (entry.name === '.gitignore' && targetExists) {\n const relativePath = path.relative(targetDir, targetPath).replace(/\\\\/g, '/');\n await mergeGitignoreFile(sourcePath, targetPath, updates, dryRun, relativePath);\n } else if (targetExists) {\n // For built-in plugins, update existing files to get framework updates\n // Check if file has changed by comparing content\n const sourceContent = await fsExtra.readFile(sourcePath, 'utf-8');\n const targetContent = await fsExtra.readFile(targetPath, 'utf-8');\n \n if (sourceContent !== targetContent) {\n const relativePath = path.relative(targetDir, targetPath).replace(/\\\\/g, '/');\n updates.push({ file: relativePath, action: 'updated' });\n if (!dryRun) {\n await fsExtra.copy(sourcePath, targetPath, { overwrite: true });\n }\n }\n } else {\n // Only add files that don't exist (new plugins, new kernel files)\n const relativePath = path.relative(targetDir, targetPath);\n updates.push({ file: relativePath, action: 'created' });\n if (!dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n }\n }\n}\n\nasync function mergeHostDirectory(\n sourceDir: string,\n targetDir: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false,\n hostRootDir?: string\n) {\n // Track the host root directory for relative path calculation\n if (!hostRootDir) {\n hostRootDir = sourceDir;\n }\n\n await fsExtra.ensureDir(targetDir);\n const entries = await fsExtra.readdir(sourceDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const sourcePath = path.join(sourceDir, entry.name);\n const targetPath = path.join(targetDir, entry.name);\n const relativeToHostRoot = path.relative(hostRootDir, sourcePath).replace(/\\\\/g, '/');\n\n // Skip user-specific config files\n // modern.config.ts is at host root\n // saas.config.ts is at host/src/\n if (relativeToHostRoot === 'modern.config.ts' || relativeToHostRoot === 'src/saas.config.ts') {\n continue;\n }\n\n // Skip user routes - these are user-customizable\n if (relativeToHostRoot.startsWith('src/routes/')) {\n continue;\n }\n\n if (entry.isDirectory()) {\n await mergeHostDirectory(sourcePath, targetPath, updates, dryRun, hostRootDir);\n } else {\n const targetExists = await fsExtra.pathExists(targetPath);\n \n // Special handling for .gitignore files - merge them even if they exist\n if (entry.name === '.gitignore' && targetExists) {\n const relativePath = path.relative(targetDir, targetPath).replace(/\\\\/g, '/');\n await mergeGitignoreFile(sourcePath, targetPath, updates, dryRun, relativePath);\n } else if (targetExists) {\n // For existing kernel files, update them from framework\n // This ensures users get bug fixes and improvements to kernel files\n const relativeTargetPath = path.relative(targetDir, targetPath).replace(/\\\\/g, '/');\n \n // Check if file has changed by comparing content\n const sourceContent = await fsExtra.readFile(sourcePath, 'utf-8');\n const targetContent = await fsExtra.readFile(targetPath, 'utf-8');\n \n if (sourceContent !== targetContent) {\n updates.push({ file: relativeTargetPath, action: 'updated' });\n if (!dryRun) {\n await fsExtra.copy(sourcePath, targetPath, { overwrite: true });\n }\n }\n } else {\n // Only add files that don't exist\n const relativeTargetPath = path.relative(targetDir, targetPath).replace(/\\\\/g, '/');\n updates.push({ file: relativeTargetPath, action: 'created' });\n if (!dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n }\n }\n}\n\nasync function mergePocketBaseDirectory(\n sourceDir: string,\n targetDir: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false\n) {\n // Files to skip (executable and data)\n const skipFiles = [\n 'pocketbase.exe',\n 'pocketbase',\n 'pocketbase.exe.gz',\n 'pb_data',\n ];\n\n await fsExtra.ensureDir(targetDir);\n const entries = await fsExtra.readdir(sourceDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const sourcePath = path.join(sourceDir, entry.name);\n const targetPath = path.join(targetDir, entry.name);\n\n // Skip executable and data files\n if (skipFiles.includes(entry.name)) {\n continue;\n }\n\n if (entry.isDirectory()) {\n await mergePocketBaseDirectory(sourcePath, targetPath, updates, dryRun);\n } else {\n const targetExists = await fsExtra.pathExists(targetPath);\n \n // Special handling for .gitignore files - merge them even if they exist\n if (entry.name === '.gitignore' && targetExists) {\n const relativePath = path.relative(targetDir, targetPath).replace(/\\\\/g, '/');\n await mergeGitignoreFile(sourcePath, targetPath, updates, dryRun, relativePath);\n } else if (!targetExists) {\n // Only add files that don't exist\n const relativePath = path.relative(targetDir, targetPath);\n updates.push({ file: relativePath, action: 'created' });\n if (!dryRun) {\n await fsExtra.copy(sourcePath, targetPath);\n }\n }\n }\n }\n}\n\nasync function mergeJsonFile(\n sourcePath: string,\n targetPath: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false\n) {\n const sourceJson = JSON.parse(await fsExtra.readFile(sourcePath, 'utf-8'));\n const targetJson = JSON.parse(await fsExtra.readFile(targetPath, 'utf-8'));\n\n // Framework script names that should always be updated from framework\n const frameworkScripts = [\n 'dev',\n 'dev:host',\n 'dev:plugins',\n 'dev:all',\n 'build',\n 'lint',\n 'lint:fix',\n 'format',\n 'format:check',\n 'typecheck',\n 'test',\n 'test:e2e',\n 'clean',\n 'create-plugin',\n ];\n\n // Merge dependencies and devDependencies\n const merged = { ...targetJson };\n \n if (sourceJson.dependencies) {\n merged.dependencies = { ...targetJson.dependencies, ...sourceJson.dependencies };\n }\n if (sourceJson.devDependencies) {\n merged.devDependencies = { ...targetJson.devDependencies, ...sourceJson.devDependencies };\n }\n \n if (sourceJson.scripts) {\n // Start with user's scripts (preserves custom scripts)\n merged.scripts = { ...targetJson.scripts };\n \n // Update framework scripts from source (framework takes precedence for these)\n for (const scriptName of frameworkScripts) {\n if (sourceJson.scripts[scriptName]) {\n merged.scripts[scriptName] = sourceJson.scripts[scriptName];\n }\n }\n \n // Add any new scripts from framework that don't exist in user's scripts\n for (const [scriptName, scriptValue] of Object.entries(sourceJson.scripts)) {\n if (!merged.scripts[scriptName]) {\n merged.scripts[scriptName] = scriptValue;\n }\n }\n }\n\n // Merge other top-level fields that should be updated from framework\n if (sourceJson.engines) {\n merged.engines = sourceJson.engines;\n }\n if (sourceJson.type) {\n merged.type = sourceJson.type;\n }\n\n // Check if there are actual changes\n const hasChanges = JSON.stringify(merged) !== JSON.stringify(targetJson);\n \n if (hasChanges) {\n updates.push({ file: path.basename(targetPath), action: 'updated' });\n if (!dryRun) {\n await fsExtra.writeFile(targetPath, JSON.stringify(merged, null, 2) + '\\n', 'utf-8');\n }\n }\n}\n\nasync function mergeGitignoreFile(\n sourcePath: string,\n targetPath: string,\n updates: Array<{ file: string; action: string }>,\n dryRun: boolean = false,\n relativePath?: string\n) {\n const sourceContent = await fsExtra.readFile(sourcePath, 'utf-8');\n const targetContent = await fsExtra.readFile(targetPath, 'utf-8');\n\n // Split into lines and normalize\n const sourceLines = sourceContent.split('\\n').map(line => line.trim()).filter(line => line && !line.startsWith('#'));\n const targetLines = targetContent.split('\\n').map(line => line.trim()).filter(line => line && !line.startsWith('#'));\n\n // Get existing entries as a set\n const existingEntries = new Set(targetLines);\n\n // Find new entries from source\n const newEntries = sourceLines.filter(line => !existingEntries.has(line));\n\n if (newEntries.length > 0) {\n const displayPath = relativePath || path.basename(targetPath);\n updates.push({ file: displayPath, action: 'updated' });\n if (!dryRun) {\n // Append new entries to target file\n const updatedContent = targetContent + (targetContent.endsWith('\\n') ? '' : '\\n') + \n (newEntries.length > 0 ? '\\n# Added by framework update\\n' + newEntries.join('\\n') + '\\n' : '');\n await fsExtra.writeFile(targetPath, updatedContent, 'utf-8');\n }\n }\n}\n\n// Run the CLI\ninit().catch((error) => {\n console.error(kleur.red('Unexpected error:'));\n console.error(error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ACL9D,kBAAiB;AACjB,gBAAe;AACf,iBAA8B;AAC9B,uBAAwB;AACxB,YAAuB;AACvB,sBAAoB;AACpB,uCAAgC;AAChC,qBAAoB;AACpB,2BAAyB;AAEzB,IAAM,YAAY,YAAAA,QAAK,YAAQ,0BAAc,aAAe,CAAC;AAoB7D,IAAM,SAAS;AAAA,EACP,WAAK,oWAA6D,CAAC;AAAA,EACnE,WAAK,QAAG,CAAC,IAAU,WAAK,EAAE,MAAM,UAAU,CAAC,8CAAoD,WAAK,QAAG,CAAC;AAAA,EACxG,WAAK,QAAG,CAAC,IAAU,WAAK,mDAAmD,CAAC,SAAe,WAAK,QAAG,CAAC;AAAA,EACpG,WAAK,oWAA6D,CAAC;AAAA;AAG3E,eAAe,OAAO;AACpB,UAAQ,IAAI,MAAM;AAElB,QAAM,UAAU,WAAW;AAC3B,UAAQ,IAAU,WAAK,oBAAoB,OAAO;AAAA,CAAI,CAAC;AAEvD,2BACG,KAAK,iBAAiB,EACtB,YAAY,wCAAwC,EACpD,QAAQ,OAAO,EACf,SAAS,cAAc,0BAA0B,EACjD,OAAO,qBAAqB,6DAA6D,EACzF,OAAO,oBAAoB,0BAA0B,EACrD,OAAO,SAAS,6BAA6B,IAAI,EACjD,OAAO,YAAY,yBAAy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A,YACA,SACA,SAAkB,OAClB,cACA;AACA,QAAM,gBAAgB,MAAM,gBAAAA,QAAQ,SAAS,YAAY,OAAO;AAChE,QAAM,gBAAgB,MAAM,gBAAAA,QAAQ,SAAS,YAAY,OAAO;AAGhE,QAAM,cAAc,cAAc,MAAM,IAAI,EAAE,IAAI,UAAQ,KAAK,KAAK,CAAC,EAAE,OAAO,UAAQ,QAAQ,CAAC,KAAK,WAAW,GAAG,CAAC;AACnH,QAAM,cAAc,cAAc,MAAM,IAAI,EAAE,IAAI,UAAQ,KAAK,KAAK,CAAC,EAAE,OAAO,UAAQ,QAAQ,CAAC,KAAK,WAAW,GAAG,CAAC;AAGnH,QAAM,kBAAkB,IAAI,IAAI,WAAW;AAG3C,QAAM,aAAa,YAAY,OAAO,UAAQ,CAAC,gBAAgB,IAAI,IAAI,CAAC;AAExE,MAAI,WAAW,SAAS,GAAG;AACzB,UAAM,cAAc,gBAAgB,YAAAL,QAAK,SAAS,UAAU;AAC5D,YAAQ,KAAK,EAAE,MAAM,aAAa,QAAQ,UAAU,CAAC;AACrD,QAAI,CAAC,QAAQ;AAEX,YAAM,iBAAiB,iBAAiB,cAAc,SAAS,IAAI,IAAI,KAAK,SACzE,WAAW,SAAS,IAAI,oCAAoC,WAAW,KAAK,IAAI,IAAI,OAAO;AAC9F,YAAM,gBAAAK,QAAQ,UAAU,YAAY,gBAAgB,OAAO;AAAA,IAC7D;AAAA,EACF;AACF;AAGA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAY,UAAI,mBAAmB,CAAC;AAC5C,UAAQ,MAAM,KAAK;AACnB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["path","fs","prompts","validation","validateProjectName","fsExtra"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-lego-one",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "description": "Create a new Lego-One SaaS application",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.cjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "host",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -48,27 +48,32 @@ async function initializePlugins() {
48
48
 
49
49
  // Create root
50
50
  const container = document.getElementById('root');
51
- if (container) {
52
- const root = createRoot(container);
51
+ if (!container) {
52
+ console.error('[Bootstrap] Root element not found! Make sure Modern.js generated the HTML file.');
53
+ throw new Error('Root element (#root) not found in DOM');
54
+ }
53
55
 
54
- // Initialize plugins
55
- initializePlugins();
56
+ const root = createRoot(container);
56
57
 
57
- root.render(
58
- <StrictMode>
59
- <BrowserRouter>
60
- <ThemeProvider>
61
- <QueryProvider>
62
- <PocketBaseProvider>
63
- <SlotProvider>
64
- <ChannelProvider />
65
- <App />
66
- <Toaster />
67
- </SlotProvider>
68
- </PocketBaseProvider>
69
- </QueryProvider>
70
- </ThemeProvider>
71
- </BrowserRouter>
72
- </StrictMode>
73
- );
74
- }
58
+ // Initialize plugins
59
+ initializePlugins();
60
+
61
+ console.log('[Bootstrap] ✅ Starting app render...');
62
+
63
+ root.render(
64
+ <StrictMode>
65
+ <BrowserRouter>
66
+ <ThemeProvider>
67
+ <QueryProvider>
68
+ <PocketBaseProvider>
69
+ <SlotProvider>
70
+ <ChannelProvider />
71
+ <App />
72
+ <Toaster />
73
+ </SlotProvider>
74
+ </PocketBaseProvider>
75
+ </QueryProvider>
76
+ </ThemeProvider>
77
+ </BrowserRouter>
78
+ </StrictMode>
79
+ );
@@ -7,38 +7,79 @@ const PocketBaseContext = createContext<PocketBase | null>(null);
7
7
 
8
8
  export function PocketBaseProvider({ children }: { children: React.ReactNode }) {
9
9
  const [pb, setPb] = useState<PocketBase | null>(null);
10
+ const [error, setError] = useState<string | null>(null);
11
+ const [isChecking, setIsChecking] = useState(true);
10
12
  const { token, clearAuth, setOrganization } = useGlobalKernelState();
11
13
 
12
14
  useEffect(() => {
13
- // Initialize PocketBase client
14
- const client = new PocketBase(import.meta.env.VITE_POCKETBASE_URL || 'http://127.0.0.1:8090');
15
+ async function initializePocketBase() {
16
+ try {
17
+ // Initialize PocketBase client
18
+ const pbUrl = import.meta.env.VITE_POCKETBASE_URL || 'http://127.0.0.1:8090';
19
+ console.log('[PocketBaseProvider] Initializing with URL:', pbUrl);
20
+
21
+ const client = new PocketBase(pbUrl);
15
22
 
16
- // Load stored token
17
- const storedToken = localStorage.getItem('pocketbase_auth');
18
- if (storedToken) {
19
- client.authStore.save(storedToken, null);
20
- }
21
-
22
- setPb(client);
23
-
24
- // Set up auth cleanup on token invalidation
25
- client.authStore.onChange(async (token, model) => {
26
- if (!token) {
27
- clearAuth();
28
- localStorage.removeItem('pocketbase_auth');
29
- setOrganization(null);
30
- } else {
31
- localStorage.setItem('pocketbase_auth', token);
32
-
33
- // Initialize organization on login
34
- if (model && !model.organizationId) {
35
- const org = await initializeFirstOrganization(client, model.id);
36
- if (org) {
37
- setOrganization(org);
23
+ // Test connection by attempting to fetch API info
24
+ setIsChecking(true);
25
+ try {
26
+ // Try to fetch the API root to verify connection
27
+ const response = await fetch(`${pbUrl}/api/health`, {
28
+ method: 'GET',
29
+ signal: AbortSignal.timeout(5000) // 5 second timeout
30
+ });
31
+
32
+ if (!response.ok && response.status !== 404) {
33
+ throw new Error(`PocketBase returned status ${response.status}`);
38
34
  }
35
+
36
+ console.log('[PocketBaseProvider] ✅ PocketBase connection successful');
37
+ } catch (healthError) {
38
+ // If health check fails, PocketBase is likely not running
39
+ const errorMsg = 'PocketBase is not running or not accessible. Please start PocketBase first.';
40
+ console.error('[PocketBaseProvider] ❌ Connection check failed:', healthError);
41
+ setError(errorMsg);
42
+ setIsChecking(false);
43
+ return;
44
+ }
45
+
46
+ // Load stored token
47
+ const storedToken = localStorage.getItem('pocketbase_auth');
48
+ if (storedToken) {
49
+ client.authStore.save(storedToken, null);
39
50
  }
51
+
52
+ setPb(client);
53
+ setIsChecking(false);
54
+ console.log('[PocketBaseProvider] ✅ PocketBase client initialized');
55
+
56
+ // Set up auth cleanup on token invalidation
57
+ client.authStore.onChange(async (token, model) => {
58
+ if (!token) {
59
+ clearAuth();
60
+ localStorage.removeItem('pocketbase_auth');
61
+ setOrganization(null);
62
+ } else {
63
+ localStorage.setItem('pocketbase_auth', token);
64
+
65
+ // Initialize organization on login
66
+ if (model && !model.organizationId) {
67
+ const org = await initializeFirstOrganization(client, model.id);
68
+ if (org) {
69
+ setOrganization(org);
70
+ }
71
+ }
72
+ }
73
+ });
74
+ } catch (err) {
75
+ const errorMessage = err instanceof Error ? err.message : 'Unknown error';
76
+ console.error('[PocketBaseProvider] ❌ Failed to initialize:', errorMessage);
77
+ setError(errorMessage);
78
+ setIsChecking(false);
40
79
  }
41
- });
80
+ }
81
+
82
+ initializePocketBase();
42
83
 
43
84
  return () => {
44
85
  // Cleanup on unmount
@@ -52,8 +93,129 @@ export function PocketBaseProvider({ children }: { children: React.ReactNode })
52
93
  }
53
94
  }, [pb, token]);
54
95
 
55
- if (!pb) {
56
- return null; // or a loading spinner
96
+ if (error) {
97
+ const pbUrl = import.meta.env.VITE_POCKETBASE_URL || 'http://127.0.0.1:8090';
98
+
99
+ return (
100
+ <div className="flex min-h-screen items-center justify-center bg-background p-6">
101
+ <div className="max-w-2xl rounded-lg border border-destructive bg-card p-8 shadow-lg">
102
+ <div className="mb-6">
103
+ <h2 className="text-2xl font-bold text-destructive">⚠️ PocketBase Connection Failed</h2>
104
+ <p className="mt-2 text-sm text-muted-foreground">
105
+ The application cannot connect to PocketBase. Please follow the setup steps below.
106
+ </p>
107
+ </div>
108
+
109
+ <div className="mb-6 space-y-4 rounded-lg bg-muted/50 p-4">
110
+ <div>
111
+ <h3 className="font-semibold text-foreground">Error Details:</h3>
112
+ <p className="mt-1 text-sm text-muted-foreground font-mono">{error}</p>
113
+ </div>
114
+ <div>
115
+ <h3 className="font-semibold text-foreground">Expected PocketBase URL:</h3>
116
+ <code className="mt-1 block rounded bg-background px-3 py-2 text-sm text-foreground">
117
+ {pbUrl}
118
+ </code>
119
+ </div>
120
+ </div>
121
+
122
+ <div className="mb-6">
123
+ <h3 className="mb-3 font-semibold text-foreground">📋 Setup Checklist:</h3>
124
+ <ol className="ml-6 list-decimal space-y-2 text-sm text-muted-foreground">
125
+ <li>
126
+ <strong className="text-foreground">Download PocketBase</strong>
127
+ <ul className="ml-4 mt-1 list-disc">
128
+ <li>Visit: <a href="https://pocketbase.io/docs" target="_blank" rel="noopener noreferrer" className="text-primary hover:underline">https://pocketbase.io/docs</a></li>
129
+ <li>Download the executable for your platform</li>
130
+ <li>Extract it to the <code className="rounded bg-background px-1.5 py-0.5 text-xs">pocketbase/</code> directory</li>
131
+ </ul>
132
+ </li>
133
+ <li>
134
+ <strong className="text-foreground">Start PocketBase</strong>
135
+ <ul className="ml-4 mt-1 list-disc">
136
+ <li>Open a terminal and navigate to: <code className="rounded bg-background px-1.5 py-0.5 text-xs">cd pocketbase</code></li>
137
+ <li>Run: <code className="rounded bg-background px-1.5 py-0.5 text-xs">./pocketbase serve</code> (or <code className="rounded bg-background px-1.5 py-0.5 text-xs">pocketbase.exe serve</code> on Windows)</li>
138
+ <li>PocketBase should start on port 8090</li>
139
+ </ul>
140
+ </li>
141
+ <li>
142
+ <strong className="text-foreground">Configure Environment Variables</strong>
143
+ <ul className="ml-4 mt-1 list-disc">
144
+ <li>Copy <code className="rounded bg-background px-1.5 py-0.5 text-xs">.env.development</code> to <code className="rounded bg-background px-1.5 py-0.5 text-xs">.env</code></li>
145
+ <li>Verify <code className="rounded bg-background px-1.5 py-0.5 text-xs">VITE_POCKETBASE_URL</code> matches your PocketBase URL</li>
146
+ </ul>
147
+ </li>
148
+ <li>
149
+ <strong className="text-foreground">Restart Development Server</strong>
150
+ <ul className="ml-4 mt-1 list-disc">
151
+ <li>Stop the current dev server (Ctrl+C)</li>
152
+ <li>Run <code className="rounded bg-background px-1.5 py-0.5 text-xs">pnpm run dev</code> again</li>
153
+ </ul>
154
+ </li>
155
+ </ol>
156
+ </div>
157
+
158
+ <div className="mb-6 rounded-lg border border-blue-500/50 bg-blue-500/10 p-4">
159
+ <h3 className="mb-2 font-semibold text-blue-600 dark:text-blue-400">💡 Quick Start Commands:</h3>
160
+ <div className="space-y-2 font-mono text-sm">
161
+ <div>
162
+ <span className="text-muted-foreground"># Terminal 1 - Start PocketBase</span>
163
+ <div className="mt-1 rounded bg-background px-3 py-2 text-foreground">
164
+ cd pocketbase<br />
165
+ ./pocketbase serve
166
+ </div>
167
+ </div>
168
+ <div>
169
+ <span className="text-muted-foreground"># Terminal 2 - Start Host</span>
170
+ <div className="mt-1 rounded bg-background px-3 py-2 text-foreground">
171
+ pnpm run dev:host
172
+ </div>
173
+ </div>
174
+ <div>
175
+ <span className="text-muted-foreground"># Terminal 3 - Start Plugins (optional)</span>
176
+ <div className="mt-1 rounded bg-background px-3 py-2 text-foreground">
177
+ pnpm run dev:all
178
+ </div>
179
+ </div>
180
+ </div>
181
+ </div>
182
+
183
+ <div className="flex gap-3">
184
+ <button
185
+ onClick={() => window.location.reload()}
186
+ className="flex-1 rounded-lg bg-primary px-4 py-2 font-medium text-primary-foreground hover:bg-primary/90"
187
+ >
188
+ 🔄 Retry Connection
189
+ </button>
190
+ <a
191
+ href="https://pocketbase.io/docs"
192
+ target="_blank"
193
+ rel="noopener noreferrer"
194
+ className="flex-1 rounded-lg border border-border bg-background px-4 py-2 text-center font-medium text-foreground hover:bg-accent"
195
+ >
196
+ 📚 PocketBase Docs
197
+ </a>
198
+ </div>
199
+ </div>
200
+ </div>
201
+ );
202
+ }
203
+
204
+ if (!pb && !error && isChecking) {
205
+ return (
206
+ <div className="flex min-h-screen items-center justify-center bg-background">
207
+ <div className="text-center">
208
+ <div className="mb-4 inline-block h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"></div>
209
+ <p className="text-sm text-muted-foreground">Connecting to PocketBase...</p>
210
+ <p className="mt-2 text-xs text-muted-foreground">
211
+ Make sure PocketBase is running at{' '}
212
+ <code className="rounded bg-muted px-1.5 py-0.5">
213
+ {import.meta.env.VITE_POCKETBASE_URL || 'http://127.0.0.1:8090'}
214
+ </code>
215
+ </p>
216
+ </div>
217
+ </div>
218
+ );
57
219
  }
58
220
 
59
221
  return (
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lego-one",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "private": true,
5
5
  "description": "Microkernel SaaS OS with Modern.js + Garfish + PocketBase",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lego/plugin-dashboard",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lego/plugin-todo",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {