refactor: remove core-realtime from main (scaffoldable via gen core-package realtime)

This commit is contained in:
2026-05-09 13:45:52 +02:00
parent e28fe847fd
commit 57b2ff5191
55 changed files with 80 additions and 1777 deletions

View File

@@ -1,10 +1,6 @@
import { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from "node:fs";
import { join, relative, dirname } from "node:path";
import { join, relative } from "node:path";
import type { PlopTypes } from "@turbo/gen";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
/**
* Throws if a core package directory already exists. Used as the first action
@@ -116,8 +112,18 @@ export function emitTemplateTree(
destPrefix: string,
opts: { templatesRoot?: string } = {},
): PlopTypes.AddActionConfig[] {
const root =
opts.templatesRoot ?? join(__dirname, "..", "templates");
// The templates directory is resolved in priority order:
// 1. opts.templatesRoot — test injection (temp directory)
// 2. cwd/turbo/generators/templates — turbo gen context (cwd = repo root)
// 3. cwd/templates — vitest context (cwd = turbo/generators)
let root: string;
if (opts.templatesRoot) {
root = opts.templatesRoot;
} else {
const fromRepoRoot = join(process.cwd(), "turbo", "generators", "templates");
const fromGeneratorsDir = join(process.cwd(), "templates");
root = existsSync(fromRepoRoot) ? fromRepoRoot : fromGeneratorsDir;
}
const srcRoot = join(root, srcPrefix);
const out: PlopTypes.AddActionConfig[] = [];
walkHbs(srcRoot, srcRoot, srcPrefix, destPrefix, out);